Model/Compensatingcontrolupdate.ps1

#
# Identity Security Cloud API - SOD Controls
# 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
The display name of the compensating control.
.PARAMETER Description
A human-readable description of the compensating control.
.PARAMETER Owner
No description available.
.PARAMETER SecondaryOwners
References to additional identities or governance groups that share ownership of the compensating control (maximum 10).
.PARAMETER Type
The type of compensating control that determines how a violation is addressed.
.PARAMETER Action
The action performed when the compensating control is applied.
.PARAMETER Expiration
The duration after which the applied control expires, expressed as a duration string.
.PARAMETER JustificationRequired
Indicates whether a justification is required when applying this control.
.PARAMETER WorkflowID
Workflow definition ID used when the control action is a workflow.
.OUTPUTS

Compensatingcontrolupdate<PSCustomObject>
#>


function Initialize-Compensatingcontrolupdate {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Owner},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${SecondaryOwners},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("Mitigation", "Remediation")]
        [String]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("Workflow", "Certification")]
        [String]
        ${Action},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Expiration},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${JustificationRequired} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${WorkflowID}
    )

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

        if (!$Name -and $Name.length -gt 128) {
            throw "invalid value for 'Name', the character length must be smaller than or equal to 128."
        }

        if (!$Description -and $Description.length -gt 1024) {
            throw "invalid value for 'Description', the character length must be smaller than or equal to 1024."
        }

        if (!$SecondaryOwners -and $SecondaryOwners.length -gt 10) {
            throw "invalid value for 'SecondaryOwners', number of items must be less than or equal to 10."
        }


        $PSO = [PSCustomObject]@{
            "name" = ${Name}
            "description" = ${Description}
            "owner" = ${Owner}
            "secondaryOwners" = ${SecondaryOwners}
            "type" = ${Type}
            "action" = ${Action}
            "expiration" = ${Expiration}
            "justificationRequired" = ${JustificationRequired}
            "workflowID" = ${WorkflowID}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Compensatingcontrolupdate<PSCustomObject>

.DESCRIPTION

Convert from JSON to Compensatingcontrolupdate<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Compensatingcontrolupdate<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Compensatingcontrolupdate
        $AllProperties = ("name", "description", "owner", "secondaryOwners", "type", "action", "expiration", "justificationRequired", "workflowID")
        foreach ($name in $JsonParameters.PsObject.Properties.Name) {
            if (!($AllProperties.Contains($name))) {
                throw "Error! JSON key '$name' not found in the properties: $($AllProperties)"
            }
        }

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "name" = ${Name}
            "description" = ${Description}
            "owner" = ${Owner}
            "secondaryOwners" = ${SecondaryOwners}
            "type" = ${Type}
            "action" = ${Action}
            "expiration" = ${Expiration}
            "justificationRequired" = ${JustificationRequired}
            "workflowID" = ${WorkflowID}
        }

        return $PSO
    }

}