Model/ProjectCreationModel.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 Name Specify the name of project .PARAMETER SourcePlatform Specify the platform type of source connection .PARAMETER SourceConnectionId Specify the GUID of source connection .PARAMETER DestinationPlatform Specify the platform type of destination connection .PARAMETER DestinationConnectionId Specify the GUID of destination connection .PARAMETER PolicyId Specify the GUID of policy which applied to the project .PARAMETER TagIds Specify a list of tag ids to the project .OUTPUTS ProjectCreationModel<PSCustomObject> #> function Initialize-FlyProjectCreationModel { [CmdletBinding()] Param ( [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Name}, [Parameter(ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${SourcePlatform}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${SourceConnectionId}, [Parameter(ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${DestinationPlatform}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${DestinationConnectionId}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${PolicyId}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String[]] ${TagIds} ) Process { 'Creating PSCustomObject: Fly.Client => FlyProjectCreationModel' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug if (!$Name) { throw "invalid value for 'Name', 'Name' cannot be null." } if ($Name.length -lt 1) { throw "invalid value for 'Name', the character length must be great than or equal to 1." } if (!$SourcePlatform) { throw "invalid value for 'SourcePlatform', 'SourcePlatform' cannot be null." } if (!$SourceConnectionId) { throw "invalid value for 'SourceConnectionId', 'SourceConnectionId' cannot be null." } if (!$DestinationPlatform) { throw "invalid value for 'DestinationPlatform', 'DestinationPlatform' cannot be null." } if (!$DestinationConnectionId) { throw "invalid value for 'DestinationConnectionId', 'DestinationConnectionId' cannot be null." } if (!$PolicyId) { throw "invalid value for 'PolicyId', 'PolicyId' cannot be null." } if (!$TagIds) { throw "invalid value for 'TagIds', 'TagIds' cannot be null." } $PSO = [PSCustomObject]@{ "name" = ${Name} "sourcePlatform" = ${SourcePlatform} "sourceConnectionId" = ${SourceConnectionId} "destinationPlatform" = ${DestinationPlatform} "destinationConnectionId" = ${DestinationConnectionId} "policyId" = ${PolicyId} "tagIds" = ${TagIds} } return $PSO } } <# .SYNOPSIS Convert from JSON to ProjectCreationModel<PSCustomObject> .DESCRIPTION Convert from JSON to ProjectCreationModel<PSCustomObject> .PARAMETER Json Json object .OUTPUTS ProjectCreationModel<PSCustomObject> #> function ConvertFrom-FlyJsonToProjectCreationModel { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: Fly.Client => FlyProjectCreationModel' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in FlyProjectCreationModel $AllProperties = ("name", "sourcePlatform", "sourceConnectionId", "destinationPlatform", "destinationConnectionId", "policyId", "tagIds") 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 "sourcePlatform"))) { throw "Error! JSON cannot be serialized due to the required property 'sourcePlatform' missing." } else { $SourcePlatform = $JsonParameters.PSobject.Properties["sourcePlatform"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "sourceConnectionId"))) { throw "Error! JSON cannot be serialized due to the required property 'sourceConnectionId' missing." } else { $SourceConnectionId = $JsonParameters.PSobject.Properties["sourceConnectionId"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "destinationPlatform"))) { throw "Error! JSON cannot be serialized due to the required property 'destinationPlatform' missing." } else { $DestinationPlatform = $JsonParameters.PSobject.Properties["destinationPlatform"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "destinationConnectionId"))) { throw "Error! JSON cannot be serialized due to the required property 'destinationConnectionId' missing." } else { $DestinationConnectionId = $JsonParameters.PSobject.Properties["destinationConnectionId"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "policyId"))) { throw "Error! JSON cannot be serialized due to the required property 'policyId' missing." } else { $PolicyId = $JsonParameters.PSobject.Properties["policyId"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "tagIds"))) { throw "Error! JSON cannot be serialized due to the required property 'tagIds' missing." } else { $TagIds = $JsonParameters.PSobject.Properties["tagIds"].value } $PSO = [PSCustomObject]@{ "name" = ${Name} "sourcePlatform" = ${SourcePlatform} "sourceConnectionId" = ${SourceConnectionId} "destinationPlatform" = ${DestinationPlatform} "destinationConnectionId" = ${DestinationConnectionId} "policyId" = ${PolicyId} "tagIds" = ${TagIds} } return $PSO } } |