Model/MachineAccountV2.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 account. Machine identities are returned as the `machineIdentities` list, which includes the machine identity the account is directly linked to and machine identities linked to the account through its source resource.

.PARAMETER Name
Name of the Object
.PARAMETER MachineIdentities
The machine identities linked to this machine account. The list is empty when there are none.
.PARAMETER Description
The description of the machine account.
.PARAMETER NativeIdentity
The unique ID of the machine account generated by the source system.
.PARAMETER Uuid
The unique ID of the account as determined by the account schema.
.PARAMETER OwnerIdentity
The identity that owns this machine account.
.PARAMETER Owners
No description available.
.PARAMETER Subtype
No description available.
.PARAMETER AccessType
The connection type of the source this account is from.
.PARAMETER Environment
The environment of the machine account.
.PARAMETER Attributes
Custom attributes specific to the machine account.
.PARAMETER ConnectorAttributes
The connector attributes for the account.
.PARAMETER ClassificationMethod
How the account was classified as a machine account.
.PARAMETER ManuallyEdited
Indicates whether the machine account has been manually edited.
.PARAMETER ManuallyCorrelated
Indicates whether the account has been manually correlated to an identity.
.PARAMETER Enabled
Indicates whether the account is enabled.
.PARAMETER Locked
Indicates whether the account is currently locked.
.PARAMETER HasEntitlements
Indicates whether the account has entitlements.
.PARAMETER Source
The source this machine account belongs to.
.PARAMETER Resource
No description available.
.PARAMETER DatasetId
ID of the dataset the machine account was aggregated from. Null for accounts that were not aggregated from a dataset.
.PARAMETER Type
The classification of the machine account.
.PARAMETER AccountType
Deprecated. Use `type`, which always has the same value.
.PARAMETER Risk
No description available.
.OUTPUTS

MachineAccountV2<PSCustomObject>
#>


function Initialize-MachineAccountV2 {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${MachineIdentities},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${NativeIdentity},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Uuid},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${OwnerIdentity},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Owners},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Subtype},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${AccessType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Environment},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${Attributes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${ConnectorAttributes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("CRITERIA", "SOURCE", "DISCOVERY", "MANUAL", "MANUALLY_UNCLASSIFIED")]
        [String]
        ${ClassificationMethod},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${ManuallyEdited} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${ManuallyCorrelated} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Enabled} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Locked} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${HasEntitlements} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Source},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Resource},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${DatasetId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("MACHINE", "MACHINE_DATASET", "CANDIDATE", "CANDIDATE_BY_SOURCE", "DISCOVERED", "AGENT")]
        [String]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("MACHINE", "MACHINE_DATASET", "CANDIDATE", "CANDIDATE_BY_SOURCE", "DISCOVERED", "AGENT")]
        [String]
        ${AccountType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Risk}
    )

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


        $PSO = [PSCustomObject]@{
            "name" = ${Name}
            "machineIdentities" = ${MachineIdentities}
            "description" = ${Description}
            "nativeIdentity" = ${NativeIdentity}
            "uuid" = ${Uuid}
            "ownerIdentity" = ${OwnerIdentity}
            "owners" = ${Owners}
            "subtype" = ${Subtype}
            "accessType" = ${AccessType}
            "environment" = ${Environment}
            "attributes" = ${Attributes}
            "connectorAttributes" = ${ConnectorAttributes}
            "classificationMethod" = ${ClassificationMethod}
            "manuallyEdited" = ${ManuallyEdited}
            "manuallyCorrelated" = ${ManuallyCorrelated}
            "enabled" = ${Enabled}
            "locked" = ${Locked}
            "hasEntitlements" = ${HasEntitlements}
            "source" = ${Source}
            "resource" = ${Resource}
            "datasetId" = ${DatasetId}
            "type" = ${Type}
            "accountType" = ${AccountType}
            "risk" = ${Risk}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to MachineAccountV2<PSCustomObject>

.DESCRIPTION

Convert from JSON to MachineAccountV2<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

MachineAccountV2<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in MachineAccountV2
        $AllProperties = ("id", "name", "created", "modified", "machineIdentities", "description", "nativeIdentity", "uuid", "ownerIdentity", "owners", "subtype", "accessType", "environment", "attributes", "connectorAttributes", "classificationMethod", "manuallyEdited", "manuallyCorrelated", "enabled", "locked", "hasEntitlements", "source", "resource", "datasetId", "type", "accountType", "risk", "permissionLevel", "compliance", "lastUsedAt")
        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 "machineIdentities"))) { #optional property not found
            $MachineIdentities = $null
        } else {
            $MachineIdentities = $JsonParameters.PSobject.Properties["machineIdentities"].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 "nativeIdentity"))) { #optional property not found
            $NativeIdentity = $null
        } else {
            $NativeIdentity = $JsonParameters.PSobject.Properties["nativeIdentity"].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 "ownerIdentity"))) { #optional property not found
            $OwnerIdentity = $null
        } else {
            $OwnerIdentity = $JsonParameters.PSobject.Properties["ownerIdentity"].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 "accessType"))) { #optional property not found
            $AccessType = $null
        } else {
            $AccessType = $JsonParameters.PSobject.Properties["accessType"].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 "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 "classificationMethod"))) { #optional property not found
            $ClassificationMethod = $null
        } else {
            $ClassificationMethod = $JsonParameters.PSobject.Properties["classificationMethod"].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 "manuallyCorrelated"))) { #optional property not found
            $ManuallyCorrelated = $null
        } else {
            $ManuallyCorrelated = $JsonParameters.PSobject.Properties["manuallyCorrelated"].value
        }

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "name" = ${Name}
            "created" = ${Created}
            "modified" = ${Modified}
            "machineIdentities" = ${MachineIdentities}
            "description" = ${Description}
            "nativeIdentity" = ${NativeIdentity}
            "uuid" = ${Uuid}
            "ownerIdentity" = ${OwnerIdentity}
            "owners" = ${Owners}
            "subtype" = ${Subtype}
            "accessType" = ${AccessType}
            "environment" = ${Environment}
            "attributes" = ${Attributes}
            "connectorAttributes" = ${ConnectorAttributes}
            "classificationMethod" = ${ClassificationMethod}
            "manuallyEdited" = ${ManuallyEdited}
            "manuallyCorrelated" = ${ManuallyCorrelated}
            "enabled" = ${Enabled}
            "locked" = ${Locked}
            "hasEntitlements" = ${HasEntitlements}
            "source" = ${Source}
            "resource" = ${Resource}
            "datasetId" = ${DatasetId}
            "type" = ${Type}
            "accountType" = ${AccountType}
            "risk" = ${Risk}
            "permissionLevel" = ${PermissionLevel}
            "compliance" = ${Compliance}
            "lastUsedAt" = ${LastUsedAt}
        }

        return $PSO
    }

}