Model/ScheduledAttributes.ps1

#
# Identity Security Cloud Beta API
# Use these APIs to interact with the Identity Security Cloud platform to achieve repeatable, automated processes with greater scalability. These APIs are in beta and are subject to change. 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: 3.1.0-beta
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

Attributes related to a scheduled trigger

.PARAMETER Frequency
Frequency of execution
.PARAMETER TimeZone
Time zone identifier
.PARAMETER CronString
No description available.
.PARAMETER WeeklyDays
Scheduled days of the week for execution
.PARAMETER WeeklyTimes
Scheduled execution times
.OUTPUTS

ScheduledAttributes<PSCustomObject>
#>


function Initialize-BetaScheduledAttributes {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("daily", "weekly", "monthly", "yearly", "cronSchedule")]
        [String]
        ${Frequency},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TimeZone},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${CronString},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${WeeklyDays},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${WeeklyTimes}
    )

    Process {
        'Creating PSCustomObject: Tm.Beta => BetaScheduledAttributes' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

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


        $PSO = [PSCustomObject]@{
            "frequency" = ${Frequency}
            "timeZone" = ${TimeZone}
            "cronString" = ${CronString}
            "weeklyDays" = ${WeeklyDays}
            "weeklyTimes" = ${WeeklyTimes}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to ScheduledAttributes<PSCustomObject>

.DESCRIPTION

Convert from JSON to ScheduledAttributes<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

ScheduledAttributes<PSCustomObject>
#>

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

    Process {
        'Converting JSON to PSCustomObject: Tm.Beta => BetaScheduledAttributes' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in BetaScheduledAttributes
        $AllProperties = ("frequency", "timeZone", "cronString", "weeklyDays", "weeklyTimes")
        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 'frequency' missing."
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "frequency"))) {
            throw "Error! JSON cannot be serialized due to the required property 'frequency' missing."
        } else {
            $Frequency = $JsonParameters.PSobject.Properties["frequency"].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 "cronString"))) { #optional property not found
            $CronString = $null
        } else {
            $CronString = $JsonParameters.PSobject.Properties["cronString"].value
        }

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

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

        $PSO = [PSCustomObject]@{
            "frequency" = ${Frequency}
            "timeZone" = ${TimeZone}
            "cronString" = ${CronString}
            "weeklyDays" = ${WeeklyDays}
            "weeklyTimes" = ${WeeklyTimes}
        }

        return $PSO
    }

}