Model/M365GroupMappingCreationModel.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 SourceType
The data type of source identity, no need to specify.
.PARAMETER DestinationType
The data type of destination identity, no need to specify.
.PARAMETER SourceName
The display name of source identity
.PARAMETER SourceIdentity
The source identity of migration
.PARAMETER DestinationName
The display name of destination identity
.PARAMETER DestinationIdentity
The destination identity of migration
.OUTPUTS
 
M365GroupMappingCreationModel<PSCustomObject>
#>


function Initialize-FlyM365GroupMappingCreationModel {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${SourceType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${DestinationType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SourceName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SourceIdentity},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${DestinationName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${DestinationIdentity}
    )

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

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

        if ($SourceIdentity.length -lt 1) {
            throw "invalid value for 'SourceIdentity', the character length must be great than or equal to 1."
        }

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

        if ($DestinationIdentity.length -lt 1) {
            throw "invalid value for 'DestinationIdentity', the character length must be great than or equal to 1."
        }


        $PSO = [PSCustomObject]@{
            "sourceType" = ${SourceType}
            "destinationType" = ${DestinationType}
            "sourceName" = ${SourceName}
            "sourceIdentity" = ${SourceIdentity}
            "destinationName" = ${DestinationName}
            "destinationIdentity" = ${DestinationIdentity}
        }

        return $PSO
    }
}

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

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in FlyM365GroupMappingCreationModel
        $AllProperties = ("sourceType", "destinationType", "sourceName", "sourceIdentity", "destinationName", "destinationIdentity")
        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 'sourceIdentity' missing."
        }

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "sourceType" = ${SourceType}
            "destinationType" = ${DestinationType}
            "sourceName" = ${SourceName}
            "sourceIdentity" = ${SourceIdentity}
            "destinationName" = ${DestinationName}
            "destinationIdentity" = ${DestinationIdentity}
        }

        return $PSO
    }

}