Model/MachineIdentityUserEntitlements.ps1

#
# Identity Security Cloud V2025 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: v2025
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

Reference to a user entitlement.

.PARAMETER EntitlementId
Entitlement identifier.
.PARAMETER DisplayName
Display name of the entitlement.
.PARAMETER Source
No description available.
.OUTPUTS

MachineIdentityUserEntitlements<PSCustomObject>
#>


function Initialize-V2025MachineIdentityUserEntitlements {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${EntitlementId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${DisplayName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Source}
    )

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

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

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

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


        $PSO = [PSCustomObject]@{
            "entitlementId" = ${EntitlementId}
            "displayName" = ${DisplayName}
            "source" = ${Source}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to MachineIdentityUserEntitlements<PSCustomObject>

.DESCRIPTION

Convert from JSON to MachineIdentityUserEntitlements<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

MachineIdentityUserEntitlements<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json
        $V2025MachineIdentityUserEntitlementsAdditionalProperties = @{}

        # check if Json contains properties not defined in V2025MachineIdentityUserEntitlements
        $AllProperties = ("entitlementId", "displayName", "source")
        foreach ($name in $JsonParameters.PsObject.Properties.Name) {
            # store undefined properties in additionalProperties
            if (!($AllProperties.Contains($name))) {
                $V2025MachineIdentityUserEntitlementsAdditionalProperties[$name] = $JsonParameters.PSobject.Properties[$name].value
            }
        }

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

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

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

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

        $PSO = [PSCustomObject]@{
            "entitlementId" = ${EntitlementId}
            "displayName" = ${DisplayName}
            "source" = ${Source}
            "AdditionalProperties" = $V2025MachineIdentityUserEntitlementsAdditionalProperties
        }

        return $PSO
    }

}