Model/Machineidentityv2.ps1

#
# Identity Security Cloud API - Machine Identities
# 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: v1
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER Name
Name of the Object
.PARAMETER Description
Description of the machine identity.
.PARAMETER Attributes
A map of custom machine identity attributes.
.PARAMETER ConnectorAttributes
A map of attributes sourced from the connector during aggregation.
.PARAMETER ManuallyEdited
Indicates if the machine identity has been manually edited.
.PARAMETER ManuallyCreated
Indicates if the machine identity has been manually created.
.PARAMETER Owners
No description available.
.PARAMETER Subtype
The subtype value associated to the machine identity.
.PARAMETER SourceId
The source id associated to the machine identity.
.PARAMETER Uuid
The UUID associated to the machine identity directly aggregated from a source.
.PARAMETER NativeIdentity
The native identity associated to the machine identity directly aggregated from a source.
.PARAMETER DatasetId
The dataset id associated to the source from which the identity was retrieved.
.PARAMETER Environment
The environment the machine identity belongs to.
.PARAMETER ExistsOnSource
Indicates whether the machine identity still exists on the source.
.PARAMETER Status
Operational status read from stored attributes.status; null when absent.
.PARAMETER Resource
No description available.
.PARAMETER Source
No description available.
.PARAMETER UserEntitlements
The user entitlements associated to the machine identity.
.PARAMETER BusinessApplicationRefs
Optional Business Application references associated with this machine identity.
.PARAMETER EffectiveSanctionedStatus
No description available.
.PARAMETER Risk
No description available.
.OUTPUTS

Machineidentityv2<PSCustomObject>
#>


function Initialize-Machineidentityv2 {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${Attributes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${ConnectorAttributes},
        [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)]
        [String]
        ${Environment},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ExistsOnSource},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Status},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Resource},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Source},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${UserEntitlements},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${BusinessApplicationRefs},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("SANCTIONED", "UNSANCTIONED", "UNKNOWN")]
        [PSCustomObject]
        ${EffectiveSanctionedStatus},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Risk}
    )

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


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

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Machineidentityv2<PSCustomObject>

.DESCRIPTION

Convert from JSON to Machineidentityv2<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Machineidentityv2<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "resource"))) { #optional property not found
            $Resource = $null
        } else {
            $Resource = $JsonParameters.PSobject.Properties["resource"].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 "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
        }

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

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

        return $PSO
    }

}