Model/MigrationJobSettingsModel.ps1

#
# Fly SDK API
# No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
# Version: 1.0
# Contact: support@avepoint.com
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS
 
No summary available.
 
.DESCRIPTION
 
Job configration information.
 
.PARAMETER Type
Specify the type of the job to run against the selected projects or mappings.
.PARAMETER IsDeleteSource
Whether the source data will be deleted after migration job completes. This option is currently not supported and will always has the value of False.
.PARAMETER ScheduledTime
Specify the time when you want the job to be scheduled. By default the job will be scheduled as soon as possible.
.PARAMETER IsSelectAll
A boolean value indicates whether the Select All option is checked. Default to False which means only mappings with ids in MappingIds properties are selected.
.PARAMETER Search
A search criteria. If specified it will be used to filter the mappings in the current project. Default empty.
.PARAMETER MappingIds
Specify a list of mapping ids against which the operation or job will be run. If IsSelectAll is set to True, these mappings will be filtered out instead.
.PARAMETER Stages
A list of Stages which will be used together with other serach conditions to filter mappings.
.PARAMETER StageStatuses
A list of Stage Status which will be used together with other serach conditions to filter mappings.
.PARAMETER Statuses
A list of Mapping Status which will be used together with other serach conditions to filter mappings.
.OUTPUTS
 
MigrationJobSettingsModel<PSCustomObject>
#>


function Initialize-FlyMigrationJobSettingsModel {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Type},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsDeleteSource},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${ScheduledTime},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [Boolean]
        ${IsSelectAll},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Search},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${MappingIds},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Stages},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${StageStatuses},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Statuses}
    )

    Process {
        'Creating PSCustomObject: Fly.Client => FlyMigrationJobSettingsModel' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

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

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


        $PSO = [PSCustomObject]@{
            "type" = ${Type}
            "isDeleteSource" = ${IsDeleteSource}
            "scheduledTime" = ${ScheduledTime}
            "isSelectAll" = ${IsSelectAll}
            "search" = ${Search}
            "mappingIds" = ${MappingIds}
            "stages" = ${Stages}
            "stageStatuses" = ${StageStatuses}
            "statuses" = ${Statuses}
        }

        return $PSO
    }
}

<#
.SYNOPSIS
 
Convert from JSON to MigrationJobSettingsModel<PSCustomObject>
 
.DESCRIPTION
 
Convert from JSON to MigrationJobSettingsModel<PSCustomObject>
 
.PARAMETER Json
 
Json object
 
.OUTPUTS
 
MigrationJobSettingsModel<PSCustomObject>
#>

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

    Process {
        'Converting JSON to PSCustomObject: Fly.Client => FlyMigrationJobSettingsModel' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in FlyMigrationJobSettingsModel
        $AllProperties = ("type", "isDeleteSource", "scheduledTime", "isSelectAll", "search", "mappingIds", "stages", "stageStatuses", "statuses")
        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 'type' missing."
        }

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "type" = ${Type}
            "isDeleteSource" = ${IsDeleteSource}
            "scheduledTime" = ${ScheduledTime}
            "isSelectAll" = ${IsSelectAll}
            "search" = ${Search}
            "mappingIds" = ${MappingIds}
            "stages" = ${Stages}
            "stageStatuses" = ${StageStatuses}
            "statuses" = ${Statuses}
        }

        return $PSO
    }

}