Model/SDKSchema.ps1
# # Cloud Governance Api # Contact: support@avepoint.com # <# SDKSchema<PSCustomObject> #> function New-SDKSchema { [CmdletBinding()] Param ( [Parameter(ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${CreateGroupGallery}, [Parameter(ValueFromPipelineByPropertyName = $true)] [PSCustomObject] ${CreateTeamGallery} ) Process { 'Creating PSCustomObject: Cloud.Governance.Client => SDKSchema' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $PSO = [PSCustomObject]@{ "CreateGroupGallery" = ${CreateGroupGallery} "CreateTeamGallery" = ${CreateTeamGallery} } return $PSO } } <# SDKSchema<PSCustomObject> #> function ConvertFrom-JsonToSDKSchema { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: Cloud.Governance.Client => SDKSchema' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in SDKSchema $AllProperties = $("CreateGroupGallery", "CreateTeamGallery") foreach ($name in $JsonParameters.PsObject.Properties.Name) { if (!($AllProperties.Contains($name))) { throw "Error! JSON key '$name' not found in the properties: $($AllProperties)" } } if (!([bool]($JsonParameters.PSobject.Properties.name -match "CreateGroupGallery"))) { #optional property not found $CreateGroupGallery = $null } else { $CreateGroupGallery = $JsonParameters.PSobject.Properties["CreateGroupGallery"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "CreateTeamGallery"))) { #optional property not found $CreateTeamGallery = $null } else { $CreateTeamGallery = $JsonParameters.PSobject.Properties["CreateTeamGallery"].value } $PSO = [PSCustomObject]@{ "CreateGroupGallery" = ${CreateGroupGallery} "CreateTeamGallery" = ${CreateTeamGallery} } return $PSO } } |