Model/SpConfigRule.ps1

#
# Identity Security Cloud V2024 API
# 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: v2024
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

Format of Config Hub Object Rules

.PARAMETER Path
JSONPath expression denoting the path within the object where a value substitution should be applied
.PARAMETER Value
Value to be assigned at the jsonPath location within the object
.PARAMETER Mode
Draft modes to which this rule will apply
.OUTPUTS

SpConfigRule<PSCustomObject>
#>


function Initialize-V2024SpConfigRule {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Path},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Value},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("RESTORE", "PROMOTE", "UPLOAD")]
        [String[]]
        ${Mode}
    )

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


        $PSO = [PSCustomObject]@{
            "path" = ${Path}
            "value" = ${Value}
            "mode" = ${Mode}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to SpConfigRule<PSCustomObject>

.DESCRIPTION

Convert from JSON to SpConfigRule<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

SpConfigRule<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in V2024SpConfigRule
        $AllProperties = ("path", "value", "mode")
        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 "path"))) { #optional property not found
            $Path = $null
        } else {
            $Path = $JsonParameters.PSobject.Properties["path"].value
        }

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

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

        $PSO = [PSCustomObject]@{
            "path" = ${Path}
            "value" = ${Value}
            "mode" = ${Mode}
        }

        return $PSO
    }

}