Model/MoveMappingSettingsModel.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
 
No description available.
 
.PARAMETER ProjectId
No description available.
.PARAMETER MultipleProjectsMappings
No description available.
.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 search conditions to filter mappings.
.PARAMETER StageStatuses
A list of Stage Status which will be used together with other search conditions to filter mappings.
.PARAMETER Statuses
A list of Mapping Status which will be used together with other search conditions to filter mappings.
.PARAMETER DestinationStatuses
A list of DestinationStatuses which will be used together with other search conditions to filter project mappings. Only used for Teams workspace
.PARAMETER ColorCodes
A list of ColorCodes which will be used together with other search conditions to filter project mappings.
.PARAMETER SourceTypes
A list of SourceType which will be used together with other search conditions to filter project mappings.
.PARAMETER DestinationTypes
A list of DestinationType which will be used together with other search conditions to filter project mappings.
.PARAMETER LastMigrationStatus
No description available.
.PARAMETER LastMigrationStartTimeRangeStart
No description available.
.PARAMETER LastMigrationStartTimeRangeEnd
No description available.
.OUTPUTS
 
MoveMappingSettingsModel<PSCustomObject>
#>


function Initialize-FlyMoveMappingSettingsModel {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ProjectId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${MultipleProjectsMappings},
        [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},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${DestinationStatuses},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${ColorCodes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [Int32[]]
        ${SourceTypes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [Int32[]]
        ${DestinationTypes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${LastMigrationStatus},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${LastMigrationStartTimeRangeStart},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${LastMigrationStartTimeRangeEnd}
    )

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

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


        $PSO = [PSCustomObject]@{
            "projectId" = ${ProjectId}
            "multipleProjectsMappings" = ${MultipleProjectsMappings}
            "isSelectAll" = ${IsSelectAll}
            "search" = ${Search}
            "mappingIds" = ${MappingIds}
            "stages" = ${Stages}
            "stageStatuses" = ${StageStatuses}
            "statuses" = ${Statuses}
            "destinationStatuses" = ${DestinationStatuses}
            "colorCodes" = ${ColorCodes}
            "sourceTypes" = ${SourceTypes}
            "destinationTypes" = ${DestinationTypes}
            "lastMigrationStatus" = ${LastMigrationStatus}
            "lastMigrationStartTimeRangeStart" = ${LastMigrationStartTimeRangeStart}
            "lastMigrationStartTimeRangeEnd" = ${LastMigrationStartTimeRangeEnd}
        }

        return $PSO
    }
}

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

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in FlyMoveMappingSettingsModel
        $AllProperties = ("projectId", "multipleProjectsMappings", "isSelectAll", "search", "mappingIds", "stages", "stageStatuses", "statuses", "destinationStatuses", "colorCodes", "sourceTypes", "destinationTypes", "lastMigrationStatus", "lastMigrationStartTimeRangeStart", "lastMigrationStartTimeRangeEnd")
        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 'isSelectAll' missing."
        }

        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 "projectId"))) { #optional property not found
            $ProjectId = $null
        } else {
            $ProjectId = $JsonParameters.PSobject.Properties["projectId"].value
        }

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "projectId" = ${ProjectId}
            "multipleProjectsMappings" = ${MultipleProjectsMappings}
            "isSelectAll" = ${IsSelectAll}
            "search" = ${Search}
            "mappingIds" = ${MappingIds}
            "stages" = ${Stages}
            "stageStatuses" = ${StageStatuses}
            "statuses" = ${Statuses}
            "destinationStatuses" = ${DestinationStatuses}
            "colorCodes" = ${ColorCodes}
            "sourceTypes" = ${SourceTypes}
            "destinationTypes" = ${DestinationTypes}
            "lastMigrationStatus" = ${LastMigrationStatus}
            "lastMigrationStartTimeRangeStart" = ${LastMigrationStartTimeRangeStart}
            "lastMigrationStartTimeRangeEnd" = ${LastMigrationStartTimeRangeEnd}
        }

        return $PSO
    }

}