Model/Delegation2.ps1

#
# NERM API v2025
# The NERM API v2025 accesss and modifies resources in your environment.
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER DelegatorId
The id of the delegator
.PARAMETER DelegateId
The id of the delegate
.PARAMETER Expiration
The expiration date of the delegation
.OUTPUTS

Delegation2<PSCustomObject>
#>


function Initialize-NERMV2025Delegation2 {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${DelegatorId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${DelegateId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Expiration}
    )

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


        $PSO = [PSCustomObject]@{
            "delegator_id" = ${DelegatorId}
            "delegate_id" = ${DelegateId}
            "expiration" = ${Expiration}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Delegation2<PSCustomObject>

.DESCRIPTION

Convert from JSON to Delegation2<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Delegation2<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in NERMV2025Delegation2
        $AllProperties = ("delegator_id", "delegate_id", "expiration")
        foreach ($name in $JsonParameters.PsObject.Properties.Name) {
            if (!($AllProperties.Contains($name))) {
                throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
            }
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "delegator_id" = ${DelegatorId}
            "delegate_id" = ${DelegateId}
            "expiration" = ${Expiration}
        }

        return $PSO
    }

}