Model/Owns.ps1

#
# Identity Security Cloud V3 API
# Use these APIs to interact with the Identity Security Cloud 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 Sources
No description available.
.PARAMETER Entitlements
No description available.
.PARAMETER AccessProfiles
No description available.
.PARAMETER Roles
No description available.
.PARAMETER Apps
No description available.
.PARAMETER GovernanceGroups
No description available.
.PARAMETER FallbackApprover
No description available.
.OUTPUTS

Owns<PSCustomObject>
#>


function Initialize-Owns {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Sources},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Entitlements},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${AccessProfiles},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Roles},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Apps},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${GovernanceGroups},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${FallbackApprover}
    )

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


        $PSO = [PSCustomObject]@{
            "sources" = ${Sources}
            "entitlements" = ${Entitlements}
            "accessProfiles" = ${AccessProfiles}
            "roles" = ${Roles}
            "apps" = ${Apps}
            "governanceGroups" = ${GovernanceGroups}
            "fallbackApprover" = ${FallbackApprover}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Owns<PSCustomObject>

.DESCRIPTION

Convert from JSON to Owns<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Owns<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Owns
        $AllProperties = ("sources", "entitlements", "accessProfiles", "roles", "apps", "governanceGroups", "fallbackApprover")
        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 "sources"))) { #optional property not found
            $Sources = $null
        } else {
            $Sources = $JsonParameters.PSobject.Properties["sources"].value
        }

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "sources" = ${Sources}
            "entitlements" = ${Entitlements}
            "accessProfiles" = ${AccessProfiles}
            "roles" = ${Roles}
            "apps" = ${Apps}
            "governanceGroups" = ${GovernanceGroups}
            "fallbackApprover" = ${FallbackApprover}
        }

        return $PSO
    }

}