org-config/src/PSSailpoint.OrgConfig/Model/OrgConfig.ps1

#
# SailPoint Identity Security API - Org Config
# 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

OrgConfig settings accessible to external customer org admins (`ORG_ADMIN`). ### Provisioning setting precedence 1. **Source value:** used first when set. When the request spans more than one source, the largest value among those sources wins. 2. **OrgConfig value:** used when no source value is set. 3. **Default:** used when neither is set. A value outside the allowed range is ignored, and the next level is used. ### Defaults * **Retries:** 3 * **Retry interval:** 60 minutes. The actual wait varies by up to 10 percent above or below the interval, so requests that fail together do not retry at the same time. * **Status check interval:** 240 minutes * **Status check limit:** 180 checks ### Scope * **Retry count and retry interval:** account enable, disable, unlock, or delete; lifecycle changes that provision accounts; access requests; and RSA token PIN resets. * **Not affected by these settings:** password changes, which use a fixed retry schedule. * **Status check interval and status check limit:** queued provisioning requests.

.PARAMETER OrgName
The name of the org.
.PARAMETER TimeZone
The selected time zone which is to be used for the org. This directly affects when scheduled tasks are executed. Valid options can be found at /beta/org-config/valid-time-zones
.PARAMETER LcsChangeHonorsSourceEnableFeature
Flag to determine whether the LCS_CHANGE_HONORS_SOURCE_ENABLE_FEATURE flag is enabled for the current org.
.PARAMETER ArmCustomerId
ARM Customer ID
.PARAMETER ArmSapSystemIdMappings
A list of IDN::sourceId to ARM::systemId mappings.
.PARAMETER ArmAuth
ARM authentication string
.PARAMETER ArmDb
ARM database name
.PARAMETER ArmSsoUrl
ARM SSO URL
.PARAMETER IaiEnableCertificationRecommendations
Flag to determine whether IAI Certification Recommendations are enabled for the current org
.PARAMETER AiAgentDeleteRequestEnabled
Org opt-in flag that enables AI Agent delete-at-source lifecycle requests for the current org.
.PARAMETER ProvisioningMaxRetries
The number of times a provisioning request is retried.
.PARAMETER ProvisioningRetryThreshold
The number of minutes between provisioning retries.
.PARAMETER ProvisioningStatusCheckInterval
The number of minutes between status checks of a queued provisioning request.
.PARAMETER ProvisioningMaxStatusChecks
The number of status checks that run before a queued provisioning request times out.
.PARAMETER SodReportConfigs
No description available.
.OUTPUTS

OrgConfig<PSCustomObject>
#>


function Initialize-OrgConfig {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${OrgName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TimeZone},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${LcsChangeHonorsSourceEnableFeature} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ArmCustomerId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${ArmSapSystemIdMappings},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ArmAuth},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ArmDb},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ArmSsoUrl},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IaiEnableCertificationRecommendations} = $true,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AiAgentDeleteRequestEnabled} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${ProvisioningMaxRetries},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${ProvisioningRetryThreshold},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${ProvisioningStatusCheckInterval},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${ProvisioningMaxStatusChecks},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${SodReportConfigs}
    )

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

        if ($ProvisioningMaxRetries -and $ProvisioningMaxRetries -gt 24) {
          throw "invalid value for 'ProvisioningMaxRetries', must be smaller than or equal to 24."
        }

        if ($ProvisioningMaxRetries -and $ProvisioningMaxRetries -lt 0) {
          throw "invalid value for 'ProvisioningMaxRetries', must be greater than or equal to 0."
        }

        if ($ProvisioningRetryThreshold -and $ProvisioningRetryThreshold -gt 1440) {
          throw "invalid value for 'ProvisioningRetryThreshold', must be smaller than or equal to 1440."
        }

        if ($ProvisioningRetryThreshold -and $ProvisioningRetryThreshold -lt 1) {
          throw "invalid value for 'ProvisioningRetryThreshold', must be greater than or equal to 1."
        }

        if ($ProvisioningStatusCheckInterval -and $ProvisioningStatusCheckInterval -gt 1440) {
          throw "invalid value for 'ProvisioningStatusCheckInterval', must be smaller than or equal to 1440."
        }

        if ($ProvisioningStatusCheckInterval -and $ProvisioningStatusCheckInterval -lt 1) {
          throw "invalid value for 'ProvisioningStatusCheckInterval', must be greater than or equal to 1."
        }

        if ($ProvisioningMaxStatusChecks -and $ProvisioningMaxStatusChecks -gt 1000) {
          throw "invalid value for 'ProvisioningMaxStatusChecks', must be smaller than or equal to 1000."
        }

        if ($ProvisioningMaxStatusChecks -and $ProvisioningMaxStatusChecks -lt 1) {
          throw "invalid value for 'ProvisioningMaxStatusChecks', must be greater than or equal to 1."
        }


        $PSO = [PSCustomObject]@{
            "orgName" = ${OrgName}
            "timeZone" = ${TimeZone}
            "lcsChangeHonorsSourceEnableFeature" = ${LcsChangeHonorsSourceEnableFeature}
            "armCustomerId" = ${ArmCustomerId}
            "armSapSystemIdMappings" = ${ArmSapSystemIdMappings}
            "armAuth" = ${ArmAuth}
            "armDb" = ${ArmDb}
            "armSsoUrl" = ${ArmSsoUrl}
            "iaiEnableCertificationRecommendations" = ${IaiEnableCertificationRecommendations}
            "aiAgentDeleteRequestEnabled" = ${AiAgentDeleteRequestEnabled}
            "provisioningMaxRetries" = ${ProvisioningMaxRetries}
            "provisioningRetryThreshold" = ${ProvisioningRetryThreshold}
            "provisioningStatusCheckInterval" = ${ProvisioningStatusCheckInterval}
            "provisioningMaxStatusChecks" = ${ProvisioningMaxStatusChecks}
            "sodReportConfigs" = ${SodReportConfigs}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to OrgConfig<PSCustomObject>

.DESCRIPTION

Convert from JSON to OrgConfig<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

OrgConfig<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in OrgConfig
        $AllProperties = ("orgName", "timeZone", "lcsChangeHonorsSourceEnableFeature", "armCustomerId", "armSapSystemIdMappings", "armAuth", "armDb", "armSsoUrl", "iaiEnableCertificationRecommendations", "aiAgentDeleteRequestEnabled", "provisioningMaxRetries", "provisioningRetryThreshold", "provisioningStatusCheckInterval", "provisioningMaxStatusChecks", "sodReportConfigs")
        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 "orgName"))) { #optional property not found
            $OrgName = $null
        } else {
            $OrgName = $JsonParameters.PSobject.Properties["orgName"].value
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "orgName" = ${OrgName}
            "timeZone" = ${TimeZone}
            "lcsChangeHonorsSourceEnableFeature" = ${LcsChangeHonorsSourceEnableFeature}
            "armCustomerId" = ${ArmCustomerId}
            "armSapSystemIdMappings" = ${ArmSapSystemIdMappings}
            "armAuth" = ${ArmAuth}
            "armDb" = ${ArmDb}
            "armSsoUrl" = ${ArmSsoUrl}
            "iaiEnableCertificationRecommendations" = ${IaiEnableCertificationRecommendations}
            "aiAgentDeleteRequestEnabled" = ${AiAgentDeleteRequestEnabled}
            "provisioningMaxRetries" = ${ProvisioningMaxRetries}
            "provisioningRetryThreshold" = ${ProvisioningRetryThreshold}
            "provisioningStatusCheckInterval" = ${ProvisioningStatusCheckInterval}
            "provisioningMaxStatusChecks" = ${ProvisioningMaxStatusChecks}
            "sodReportConfigs" = ${SodReportConfigs}
        }

        return $PSO
    }

}