machine-account-subtypes/src/PSSailpoint.MachineAccountSubtypes/Model/SubtypeProvisioningPolicyField.ps1

#
# SailPoint Identity Security API - Machine Account Subtypes
# 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

One field of a subtype provisioning policy.

.PARAMETER Name
Name of the attribute.
.PARAMETER Transform
Transform to apply to the field.
.PARAMETER Attributes
Attributes required for the transform.
.PARAMETER IsRequired
Indicates whether the attribute is required.
.PARAMETER Type
Type of the attribute.
.PARAMETER IsMultiValued
Indicates whether the attribute is multi-valued.
.OUTPUTS

SubtypeProvisioningPolicyField<PSCustomObject>
#>


function Initialize-SubtypeProvisioningPolicyField {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${Transform},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${Attributes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsRequired} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsMultiValued} = $false
    )

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

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


        $PSO = [PSCustomObject]@{
            "name" = ${Name}
            "transform" = ${Transform}
            "attributes" = ${Attributes}
            "isRequired" = ${IsRequired}
            "type" = ${Type}
            "isMultiValued" = ${IsMultiValued}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to SubtypeProvisioningPolicyField<PSCustomObject>

.DESCRIPTION

Convert from JSON to SubtypeProvisioningPolicyField<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

SubtypeProvisioningPolicyField<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in SubtypeProvisioningPolicyField
        $AllProperties = ("name", "transform", "attributes", "isRequired", "type", "isMultiValued")
        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 "transform"))) { #optional property not found
            $Transform = $null
        } else {
            $Transform = $JsonParameters.PSobject.Properties["transform"].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 "isRequired"))) { #optional property not found
            $IsRequired = $null
        } else {
            $IsRequired = $JsonParameters.PSobject.Properties["isRequired"].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 "isMultiValued"))) { #optional property not found
            $IsMultiValued = $null
        } else {
            $IsMultiValued = $JsonParameters.PSobject.Properties["isMultiValued"].value
        }

        $PSO = [PSCustomObject]@{
            "name" = ${Name}
            "transform" = ${Transform}
            "attributes" = ${Attributes}
            "isRequired" = ${IsRequired}
            "type" = ${Type}
            "isMultiValued" = ${IsMultiValued}
        }

        return $PSO
    }

}