Model/ScheduledActionPayload.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

No description available.

.PARAMETER JobType
Type of the scheduled job.
.PARAMETER StartTime
The time when this scheduled action should start. Optional.
.PARAMETER CronString
Cron expression defining the schedule for this action. Optional for repeated events.
.PARAMETER TimeZoneId
Time zone ID for interpreting the cron expression. Optional, will default to current time zone.
.PARAMETER Content
No description available.
.OUTPUTS

ScheduledActionPayload<PSCustomObject>
#>


function Initialize-V2024ScheduledActionPayload {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("BACKUP", "CREATE_DRAFT", "CONFIG_DEPLOY_DRAFT")]
        [String]
        ${JobType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${StartTime},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${CronString},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TimeZoneId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Content}
    )

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

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

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


        $PSO = [PSCustomObject]@{
            "jobType" = ${JobType}
            "startTime" = ${StartTime}
            "cronString" = ${CronString}
            "timeZoneId" = ${TimeZoneId}
            "content" = ${Content}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to ScheduledActionPayload<PSCustomObject>

.DESCRIPTION

Convert from JSON to ScheduledActionPayload<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

ScheduledActionPayload<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in V2024ScheduledActionPayload
        $AllProperties = ("jobType", "startTime", "cronString", "timeZoneId", "content")
        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 'jobType' missing."
        }

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "jobType" = ${JobType}
            "startTime" = ${StartTime}
            "cronString" = ${CronString}
            "timeZoneId" = ${TimeZoneId}
            "content" = ${Content}
        }

        return $PSO
    }

}