Model/MachineAccountLinkedMachineIdentity.ps1

#
# SailPoint Identity Security API - Machine Accounts
# Use these APIs to interact with the SailPoint Identity Security 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: v1
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

A machine identity that is linked to a machine account.

.PARAMETER Name
Name of the Object
.PARAMETER Description
The description of the machine identity.
.PARAMETER Attributes
The attributes of the machine identity, including the attributes read from the source.
.PARAMETER ManuallyEdited
Indicates whether the machine identity has been manually edited.
.PARAMETER ManuallyCreated
Indicates whether the machine identity was created manually rather than by aggregation.
.PARAMETER Owners
No description available.
.PARAMETER Subtype
The subtype of the machine identity.
.PARAMETER SourceId
ID of the source the machine identity comes from.
.PARAMETER Uuid
The UUID of the machine identity, as read from the source.
.PARAMETER NativeIdentity
The native identity of the machine identity, as read from the source.
.PARAMETER DatasetId
ID of the dataset the machine identity was aggregated from.
.PARAMETER Source
The source the machine identity comes from.
.PARAMETER UserEntitlements
The user entitlements associated with the machine identity.
.PARAMETER ExistsOnSource
Indicates whether the machine identity still exists on the source.
.PARAMETER BusinessApplicationRefs
The business applications linked to the machine identity. This field is omitted when business application links are not available for the machine identity.
.PARAMETER EffectiveSanctionedStatus
The sanctioned status derived from the linked business applications. This field is present only when `businessApplicationRefs` is present.
.OUTPUTS

MachineAccountLinkedMachineIdentity<PSCustomObject>
#>


function Initialize-MachineAccountLinkedMachineIdentity {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${Attributes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${ManuallyEdited} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${ManuallyCreated} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Owners},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Subtype},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SourceId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Uuid},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${NativeIdentity},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${DatasetId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Source},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${UserEntitlements},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("TRUE", "FALSE", "NOT_APPLICABLE")]
        [String]
        ${ExistsOnSource},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${BusinessApplicationRefs},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("SANCTIONED", "UNSANCTIONED", "UNKNOWN")]
        [String]
        ${EffectiveSanctionedStatus}
    )

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


        $PSO = [PSCustomObject]@{
            "name" = ${Name}
            "description" = ${Description}
            "attributes" = ${Attributes}
            "manuallyEdited" = ${ManuallyEdited}
            "manuallyCreated" = ${ManuallyCreated}
            "owners" = ${Owners}
            "subtype" = ${Subtype}
            "sourceId" = ${SourceId}
            "uuid" = ${Uuid}
            "nativeIdentity" = ${NativeIdentity}
            "datasetId" = ${DatasetId}
            "source" = ${Source}
            "userEntitlements" = ${UserEntitlements}
            "existsOnSource" = ${ExistsOnSource}
            "businessApplicationRefs" = ${BusinessApplicationRefs}
            "effectiveSanctionedStatus" = ${EffectiveSanctionedStatus}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to MachineAccountLinkedMachineIdentity<PSCustomObject>

.DESCRIPTION

Convert from JSON to MachineAccountLinkedMachineIdentity<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

MachineAccountLinkedMachineIdentity<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in MachineAccountLinkedMachineIdentity
        $AllProperties = ("id", "name", "created", "modified", "description", "attributes", "manuallyEdited", "manuallyCreated", "owners", "subtype", "sourceId", "uuid", "nativeIdentity", "datasetId", "source", "userEntitlements", "existsOnSource", "businessApplicationRefs", "effectiveSanctionedStatus")
        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 "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 "attributes"))) { #optional property not found
            $Attributes = $null
        } else {
            $Attributes = $JsonParameters.PSobject.Properties["attributes"].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 "manuallyCreated"))) { #optional property not found
            $ManuallyCreated = $null
        } else {
            $ManuallyCreated = $JsonParameters.PSobject.Properties["manuallyCreated"].value
        }

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "name" = ${Name}
            "created" = ${Created}
            "modified" = ${Modified}
            "description" = ${Description}
            "attributes" = ${Attributes}
            "manuallyEdited" = ${ManuallyEdited}
            "manuallyCreated" = ${ManuallyCreated}
            "owners" = ${Owners}
            "subtype" = ${Subtype}
            "sourceId" = ${SourceId}
            "uuid" = ${Uuid}
            "nativeIdentity" = ${NativeIdentity}
            "datasetId" = ${DatasetId}
            "source" = ${Source}
            "userEntitlements" = ${UserEntitlements}
            "existsOnSource" = ${ExistsOnSource}
            "businessApplicationRefs" = ${BusinessApplicationRefs}
            "effectiveSanctionedStatus" = ${EffectiveSanctionedStatus}
        }

        return $PSO
    }

}