v2024/src/PSSailpoint.V2024/Model/MachineIdentity.ps1

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

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER Name
Name of the Object
.PARAMETER BusinessApplication
The business application that the identity represents
.PARAMETER Description
Description of machine identity
.PARAMETER ManuallyEdited
Indicates if the machine identity has been manually edited
.PARAMETER Attributes
A map of custom machine identity attributes
.OUTPUTS

MachineIdentity<PSCustomObject>
#>


function Initialize-V2024MachineIdentity {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${BusinessApplication},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${ManuallyEdited} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Attributes}
    )

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

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


        $PSO = [PSCustomObject]@{
            "name" = ${Name}
            "businessApplication" = ${BusinessApplication}
            "description" = ${Description}
            "manuallyEdited" = ${ManuallyEdited}
            "attributes" = ${Attributes}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to MachineIdentity<PSCustomObject>

.DESCRIPTION

Convert from JSON to MachineIdentity<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

MachineIdentity<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in V2024MachineIdentity
        $AllProperties = ("id", "name", "created", "modified", "businessApplication", "description", "manuallyEdited", "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 'name' missing."
        }

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "name" = ${Name}
            "created" = ${Created}
            "modified" = ${Modified}
            "businessApplication" = ${BusinessApplication}
            "description" = ${Description}
            "manuallyEdited" = ${ManuallyEdited}
            "attributes" = ${Attributes}
        }

        return $PSO
    }

}