beta/src/PSSailpoint.Beta/Model/SourceAccountCreated.ps1

#
# Identity Security Cloud Beta API
# Use these APIs to interact with the Identity Security Cloud platform to achieve repeatable, automated processes with greater scalability. These APIs are in beta and are subject to change. 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.1.0-beta
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER Uuid
Identity's universal unique identifier (UUID) on the source. The source system generates the UUID.
.PARAMETER Id
SailPoint generated unique identifier.
.PARAMETER NativeIdentifier
Account's unique ID on the source.
.PARAMETER SourceId
Source ID.
.PARAMETER SourceName
Source name.
.PARAMETER IdentityId
ID of the identity correlated with the account.
.PARAMETER IdentityName
Name of the identity correlated with the account.
.PARAMETER Attributes
Account attributes. The attributes' contents depend on the source's account schema.
.OUTPUTS

SourceAccountCreated<PSCustomObject>
#>


function Initialize-BetaSourceAccountCreated {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Uuid},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${NativeIdentifier},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SourceId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SourceName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${IdentityId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${IdentityName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${Attributes}
    )

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

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

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

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

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

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

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

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

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


        $PSO = [PSCustomObject]@{
            "uuid" = ${Uuid}
            "id" = ${Id}
            "nativeIdentifier" = ${NativeIdentifier}
            "sourceId" = ${SourceId}
            "sourceName" = ${SourceName}
            "identityId" = ${IdentityId}
            "identityName" = ${IdentityName}
            "attributes" = ${Attributes}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to SourceAccountCreated<PSCustomObject>

.DESCRIPTION

Convert from JSON to SourceAccountCreated<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

SourceAccountCreated<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in BetaSourceAccountCreated
        $AllProperties = ("uuid", "id", "nativeIdentifier", "sourceId", "sourceName", "identityId", "identityName", "attributes")
        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 'uuid' missing."
        }

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "uuid" = ${Uuid}
            "id" = ${Id}
            "nativeIdentifier" = ${NativeIdentifier}
            "sourceId" = ${SourceId}
            "sourceName" = ${SourceName}
            "identityId" = ${IdentityId}
            "identityName" = ${IdentityName}
            "attributes" = ${Attributes}
        }

        return $PSO
    }

}