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

Details about the campaign that was generated.

.PARAMETER Id
The unique ID of the campaign.
.PARAMETER Name
Human friendly name of the campaign.
.PARAMETER Description
Extended description of the campaign.
.PARAMETER Created
The date and time the campaign was created.
.PARAMETER Modified
The date and time the campaign was last modified.
.PARAMETER Deadline
The date and time when the campaign must be finished by.
.PARAMETER Type
The type of campaign that was generated.
.PARAMETER CampaignOwner
No description available.
.PARAMETER Status
The current status of the campaign.
.OUTPUTS

CampaignGeneratedCampaign<PSCustomObject>
#>


function Initialize-BetaCampaignGeneratedCampaign {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.DateTime]
        ${Created},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Modified},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Deadline},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("MANAGER", "SOURCE_OWNER", "SEARCH", "ROLE_COMPOSITION")]
        [PSCustomObject]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${CampaignOwner},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [ValidateSet("STAGED", "ACTIVATING", "ACTIVE")]
        [PSCustomObject]
        ${Status}
    )

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

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

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

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

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

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

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

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


        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "name" = ${Name}
            "description" = ${Description}
            "created" = ${Created}
            "modified" = ${Modified}
            "deadline" = ${Deadline}
            "type" = ${Type}
            "campaignOwner" = ${CampaignOwner}
            "status" = ${Status}
        }

        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to CampaignGeneratedCampaign<PSCustomObject>

.DESCRIPTION

Convert from JSON to CampaignGeneratedCampaign<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

CampaignGeneratedCampaign<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in BetaCampaignGeneratedCampaign
        $AllProperties = ("id", "name", "description", "created", "modified", "deadline", "type", "campaignOwner", "status")
        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 'id' missing."
        }

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

        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 "created"))) {
            throw "Error! JSON cannot be serialized due to the required property 'created' missing."
        } else {
            $Created = $JsonParameters.PSobject.Properties["created"].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 "campaignOwner"))) {
            throw "Error! JSON cannot be serialized due to the required property 'campaignOwner' missing."
        } else {
            $CampaignOwner = $JsonParameters.PSobject.Properties["campaignOwner"].value
        }

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

        $PSO = [PSCustomObject]@{
            "id" = ${Id}
            "name" = ${Name}
            "description" = ${Description}
            "created" = ${Created}
            "modified" = ${Modified}
            "deadline" = ${Deadline}
            "type" = ${Type}
            "campaignOwner" = ${CampaignOwner}
            "status" = ${Status}
        }

        return $PSO
    }

}