v3/src/PSSailpoint/Model/SearchExportReportArguments.ps1

#
# IdentityNow V3 API
# Use these APIs to interact with the IdentityNow platform to achieve repeatable, automated processes with greater scalability. We encourage you to join the SailPoint Developer Community forum at https://developer.sailpoint.com/discuss to connect with other developers using our APIs.
# Version: 3.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

Arguments for Search Export report (SEARCH_EXPORT)

.PARAMETER Indices
The names of the Elasticsearch indices in which to search. If none are provided, then all indices will be searched.
.PARAMETER Filters
The filters to be applied for each filtered field name.
.PARAMETER Query
No description available.
.PARAMETER IncludeNested
Indicates whether nested objects from returned search results should be included.
.PARAMETER Sort
The fields to be used to sort the search results. Use + or - to specify the sort direction.
.PARAMETER DefaultS3Bucket
Use it to set default s3 bucket where generated report will be saved. In case this argument is false and 's3Bucket' argument is null or absent there will be default s3Bucket assigned to the report.
.PARAMETER S3Bucket
If you want to be specific you could use this argument with defaultS3Bucket = false.
.OUTPUTS

SearchExportReportArguments<PSCustomObject>
#>


function Initialize-SearchExportReportArguments {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Indices},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${Filters},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Query},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IncludeNested} = $true,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${Sort},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [Boolean]
        ${DefaultS3Bucket},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${S3Bucket}
    )

    Process {
        'Creating PSCustomObject: PSSailpoint => SearchExportReportArguments' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        if (!$Query) {
            throw "invalid value for 'Query', 'Query' cannot be null."
        }

        if (!$DefaultS3Bucket) {
            throw "invalid value for 'DefaultS3Bucket', 'DefaultS3Bucket' cannot be null."
        }


        $PSO = [PSCustomObject]@{
            "indices" = ${Indices}
            "filters" = ${Filters}
            "query" = ${Query}
            "includeNested" = ${IncludeNested}
            "sort" = ${Sort}
            "defaultS3Bucket" = ${DefaultS3Bucket}
            "s3Bucket" = ${S3Bucket}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to SearchExportReportArguments<PSCustomObject>

.DESCRIPTION

Convert from JSON to SearchExportReportArguments<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

SearchExportReportArguments<PSCustomObject>
#>

function ConvertFrom-JsonToSearchExportReportArguments {
    Param(
        [AllowEmptyString()]
        [string]$Json
    )

    Process {
        'Converting JSON to PSCustomObject: PSSailpoint => SearchExportReportArguments' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in SearchExportReportArguments
        $AllProperties = ("indices", "filters", "query", "includeNested", "sort", "defaultS3Bucket", "s3Bucket")
        foreach ($name in $JsonParameters.PsObject.Properties.Name) {
            if (!($AllProperties.Contains($name))) {
                throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
            }
        }

        If ([string]::IsNullOrEmpty($Json) -or $Json -eq "{}") { # empty json
            throw "Error! Empty JSON cannot be serialized due to the required property 'query' missing."
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "query"))) {
            throw "Error! JSON cannot be serialized due to the required property 'query' missing."
        } else {
            $Query = $JsonParameters.PSobject.Properties["query"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "defaultS3Bucket"))) {
            throw "Error! JSON cannot be serialized due to the required property 'defaultS3Bucket' missing."
        } else {
            $DefaultS3Bucket = $JsonParameters.PSobject.Properties["defaultS3Bucket"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "indices"))) { #optional property not found
            $Indices = $null
        } else {
            $Indices = $JsonParameters.PSobject.Properties["indices"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "filters"))) { #optional property not found
            $Filters = $null
        } else {
            $Filters = $JsonParameters.PSobject.Properties["filters"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "includeNested"))) { #optional property not found
            $IncludeNested = $null
        } else {
            $IncludeNested = $JsonParameters.PSobject.Properties["includeNested"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "sort"))) { #optional property not found
            $Sort = $null
        } else {
            $Sort = $JsonParameters.PSobject.Properties["sort"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "s3Bucket"))) { #optional property not found
            $S3Bucket = $null
        } else {
            $S3Bucket = $JsonParameters.PSobject.Properties["s3Bucket"].value
        }

        $PSO = [PSCustomObject]@{
            "indices" = ${Indices}
            "filters" = ${Filters}
            "query" = ${Query}
            "includeNested" = ${IncludeNested}
            "sort" = ${Sort}
            "defaultS3Bucket" = ${DefaultS3Bucket}
            "s3Bucket" = ${S3Bucket}
        }

        return $PSO
    }

}