Model/Appliedcontrol.ps1

#
# Identity Security Cloud API - SOD Violations
# 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

A compensating control that has been applied to a policy violation.

.PARAMETER Id
The system-generated unique identifier of the applied control record.
.PARAMETER Violation
The unique identifier of the policy violation the control was applied to.
.PARAMETER Control
No description available.
.PARAMETER Applier
No description available.
.PARAMETER Comments
Optional comments captured when the control was applied.
.PARAMETER Status
No description available.
.PARAMETER WorkflowId
The identifier of the workflow triggered when the control was applied.
.OUTPUTS

Appliedcontrol<PSCustomObject>
#>


function Initialize-Appliedcontrol {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Violation},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Control},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Applier},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Comments},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("Pending", "Active", "Completed", "Canceled", "Failed")]
        [PSCustomObject]
        ${Status},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${WorkflowId}
    )

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

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

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

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

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "violation" = ${Violation}
            "control" = ${Control}
            "applier" = ${Applier}
            "comments" = ${Comments}
            "status" = ${Status}
            "workflowId" = ${WorkflowId}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to Appliedcontrol<PSCustomObject>

.DESCRIPTION

Convert from JSON to Appliedcontrol<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

Appliedcontrol<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in Appliedcontrol
        $AllProperties = ("id", "violation", "control", "applier", "appliedDate", "expiration", "comments", "status", "workflowId")
        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 'id' missing."
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "id"))) {
            throw "Error! JSON cannot be serialized due to the required property 'id' missing."
        } else {
            $Id = $JsonParameters.PSobject.Properties["id"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "violation"))) {
            throw "Error! JSON cannot be serialized due to the required property 'violation' missing."
        } else {
            $Violation = $JsonParameters.PSobject.Properties["violation"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "control"))) {
            throw "Error! JSON cannot be serialized due to the required property 'control' missing."
        } else {
            $Control = $JsonParameters.PSobject.Properties["control"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "applier"))) {
            throw "Error! JSON cannot be serialized due to the required property 'applier' missing."
        } else {
            $Applier = $JsonParameters.PSobject.Properties["applier"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "appliedDate"))) {
            throw "Error! JSON cannot be serialized due to the required property 'appliedDate' missing."
        } else {
            $AppliedDate = $JsonParameters.PSobject.Properties["appliedDate"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "expiration"))) {
            throw "Error! JSON cannot be serialized due to the required property 'expiration' missing."
        } else {
            $Expiration = $JsonParameters.PSobject.Properties["expiration"].value
        }

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "violation" = ${Violation}
            "control" = ${Control}
            "applier" = ${Applier}
            "appliedDate" = ${AppliedDate}
            "expiration" = ${Expiration}
            "comments" = ${Comments}
            "status" = ${Status}
            "workflowId" = ${WorkflowId}
        }

        return $PSO
    }

}