v3/src/PSSailpoint/Model/DateCompare.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

No description available.

.PARAMETER FirstDate
No description available.
.PARAMETER SecondDate
No description available.
.PARAMETER Operator
This is the comparison to perform. | Operation | Description | | --------- | ------- | | LT | Strictly less than: firstDate < secondDate | | LTE | Less than or equal to: firstDate <= secondDate | | GT | Strictly greater than: firstDate > secondDate | | GTE | Greater than or equal to: firstDate >= secondDate |
.PARAMETER PositiveCondition
The output of the transform if the expression evalutes to true
.PARAMETER NegativeCondition
The output of the transform if the expression evalutes to false
.PARAMETER RequiresPeriodicRefresh
A value that indicates whether the transform logic should be re-evaluated every evening as part of the identity refresh process
.PARAMETER VarInput
This is an optional attribute that can explicitly define the input data which will be fed into the transform logic. If input is not provided, the transform will take its input from the source and attribute combination configured via the UI.
.OUTPUTS

DateCompare<PSCustomObject>
#>


function Initialize-DateCompare {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${FirstDate},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${SecondDate},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("LT", "LTE", "GT", "GTE")]
        [String]
        ${Operator},
        [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${PositiveCondition},
        [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${NegativeCondition},
        [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${RequiresPeriodicRefresh} = $false,
        [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${VarInput}
    )

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

        if ($null -eq $FirstDate) {
            throw "invalid value for 'FirstDate', 'FirstDate' cannot be null."
        }

        if ($null -eq $SecondDate) {
            throw "invalid value for 'SecondDate', 'SecondDate' cannot be null."
        }

        if ($null -eq $Operator) {
            throw "invalid value for 'Operator', 'Operator' cannot be null."
        }

        if ($null -eq $PositiveCondition) {
            throw "invalid value for 'PositiveCondition', 'PositiveCondition' cannot be null."
        }

        if ($null -eq $NegativeCondition) {
            throw "invalid value for 'NegativeCondition', 'NegativeCondition' cannot be null."
        }


        $PSO = [PSCustomObject]@{
            "firstDate" = ${FirstDate}
            "secondDate" = ${SecondDate}
            "operator" = ${Operator}
            "positiveCondition" = ${PositiveCondition}
            "negativeCondition" = ${NegativeCondition}
            "requiresPeriodicRefresh" = ${RequiresPeriodicRefresh}
            "input" = ${VarInput}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to DateCompare<PSCustomObject>

.DESCRIPTION

Convert from JSON to DateCompare<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

DateCompare<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in DateCompare
        $AllProperties = ("firstDate", "secondDate", "operator", "positiveCondition", "negativeCondition", "requiresPeriodicRefresh", "input")
        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 'firstDate' missing."
        }

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "firstDate" = ${FirstDate}
            "secondDate" = ${SecondDate}
            "operator" = ${Operator}
            "positiveCondition" = ${PositiveCondition}
            "negativeCondition" = ${NegativeCondition}
            "requiresPeriodicRefresh" = ${RequiresPeriodicRefresh}
            "input" = ${VarInput}
        }

        return $PSO
    }

}