Model/CampaignGet.ps1

#
# Identity Security Cloud API - Next Generation Certification Campaigns
# 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

No description available.

.PARAMETER Name
The campaign name.
.PARAMETER Description
The campaign description.
.PARAMETER Deadline
The campaign's completion deadline date. While creating campaign, If deadline is passed as empty then automatically it will be set for two weeks later from current time.
.PARAMETER DeadlineTimezone
The timezone must be in a valid ISO 8601 format. Timezones in ISO 8601 are represented as UTC (represented as 'Z') or as an offset from UTC. The offset format can be +/-hh:mm, +/-hhmm, or +/-hh.
.PARAMETER DeadlineTime
Calculated deadline time in UTC timezone of the campaign calculated from the deadline and the deadlineTimezone
.PARAMETER EmailNotificationEnabled
Enables email notification for this campaign
.PARAMETER AutoRevokeAllowed
Allows auto revoke for this campaign
.PARAMETER AutoActivate
If true, the campaign is set to activate automatically after generation completes. Campaigns stored without this attribute default to false.
.PARAMETER RecommendationsEnabled
Enables IAI for this campaign. Accepts true even if the IAI product feature is off. If IAI is turned off then campaigns generated from this template will indicate false. The real value will then be returned if IAI is ever enabled for the org in the future.
.PARAMETER SunsetCommentsRequired
Determines if comments on sunset date changes are required.
.PARAMETER Type
No description available.
.PARAMETER Reviewer
No description available.
.PARAMETER FilterRef
No description available.
.PARAMETER InlineFilter
No description available.
.PARAMETER SearchBasedParams
No description available.
.PARAMETER RemediatorRef
No description available.
.PARAMETER OwnerId
The campaign owner is the Identity that created the campaign.
.PARAMETER MandatoryCommentRequirement
No description available.
.PARAMETER LatestReports
A map of the latest report for each report type
.PARAMETER SourceIds
A direct list of sourceIds to include in this campaign.
.OUTPUTS

CampaignGet<PSCustomObject>
#>


function Initialize-CampaignGet {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${Deadline},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${DeadlineTimezone},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[System.DateTime]]
        ${DeadlineTime},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${EmailNotificationEnabled} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AutoRevokeAllowed} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AutoActivate} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${RecommendationsEnabled} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${SunsetCommentsRequired} = $true,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("IDENTITY", "UNCORRELATED_ACCOUNT", "MACHINE_ACCOUNT")]
        [PSCustomObject]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Reviewer},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${FilterRef},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${InlineFilter},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${SearchBasedParams},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${RemediatorRef},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${OwnerId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("ALL_DECISIONS", "REVOKE_ONLY_DECISIONS", "NO_DECISIONS")]
        [PSCustomObject]
        ${MandatoryCommentRequirement},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${LatestReports},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${SourceIds}
    )

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

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

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

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

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


        $PSO = [PSCustomObject]@{
            "name" = ${Name}
            "description" = ${Description}
            "deadline" = ${Deadline}
            "deadlineTimezone" = ${DeadlineTimezone}
            "deadlineTime" = ${DeadlineTime}
            "emailNotificationEnabled" = ${EmailNotificationEnabled}
            "autoRevokeAllowed" = ${AutoRevokeAllowed}
            "autoActivate" = ${AutoActivate}
            "recommendationsEnabled" = ${RecommendationsEnabled}
            "sunsetCommentsRequired" = ${SunsetCommentsRequired}
            "type" = ${Type}
            "reviewer" = ${Reviewer}
            "filterRef" = ${FilterRef}
            "inlineFilter" = ${InlineFilter}
            "searchBasedParams" = ${SearchBasedParams}
            "remediatorRef" = ${RemediatorRef}
            "ownerId" = ${OwnerId}
            "mandatoryCommentRequirement" = ${MandatoryCommentRequirement}
            "latestReports" = ${LatestReports}
            "sourceIds" = ${SourceIds}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to CampaignGet<PSCustomObject>

.DESCRIPTION

Convert from JSON to CampaignGet<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

CampaignGet<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in CampaignGet
        $AllProperties = ("id", "name", "description", "deadline", "deadlineTimezone", "deadlineTime", "emailNotificationEnabled", "autoRevokeAllowed", "autoActivate", "recommendationsEnabled", "sunsetCommentsRequired", "type", "reviewer", "alerts", "filterRef", "inlineFilter", "searchBasedParams", "remediatorRef", "ownerId", "created", "modified", "totalCertifications", "completedCertifications", "mandatoryCommentRequirement", "status", "latestReports", "sourceIds", "sourcesWithOrphanEntitlements")
        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 'name' missing."
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "name" = ${Name}
            "description" = ${Description}
            "deadline" = ${Deadline}
            "deadlineTimezone" = ${DeadlineTimezone}
            "deadlineTime" = ${DeadlineTime}
            "emailNotificationEnabled" = ${EmailNotificationEnabled}
            "autoRevokeAllowed" = ${AutoRevokeAllowed}
            "autoActivate" = ${AutoActivate}
            "recommendationsEnabled" = ${RecommendationsEnabled}
            "sunsetCommentsRequired" = ${SunsetCommentsRequired}
            "type" = ${Type}
            "reviewer" = ${Reviewer}
            "alerts" = ${Alerts}
            "filterRef" = ${FilterRef}
            "inlineFilter" = ${InlineFilter}
            "searchBasedParams" = ${SearchBasedParams}
            "remediatorRef" = ${RemediatorRef}
            "ownerId" = ${OwnerId}
            "created" = ${Created}
            "modified" = ${Modified}
            "totalCertifications" = ${TotalCertifications}
            "completedCertifications" = ${CompletedCertifications}
            "mandatoryCommentRequirement" = ${MandatoryCommentRequirement}
            "status" = ${Status}
            "latestReports" = ${LatestReports}
            "sourceIds" = ${SourceIds}
            "sourcesWithOrphanEntitlements" = ${SourcesWithOrphanEntitlements}
        }

        return $PSO
    }

}