Model/ChangeSiteObjectModel.ps1
# # Cloud Governance Api # Contact: support@avepoint.com # <# ChangeSiteObjectModel<PSCustomObject> #> function New-ChangeSiteObjectModel { [CmdletBinding()] Param ( [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Id}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${GroupId}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${TenantId}, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${Url}, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Boolean]] ${IsManagedByGAO} = $false, [Parameter(ValueFromPipelineByPropertyName = $true)] [System.Nullable[Boolean]] ${IsGroupSite} = $false, [Parameter(ValueFromPipelineByPropertyName = $true)] [String] ${ActivityId} ) Process { 'Creating PSCustomObject: Cloud.Governance.Client => ChangeSiteObjectModel' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $PSO = [PSCustomObject]@{ "Id" = ${Id} "GroupId" = ${GroupId} "TenantId" = ${TenantId} "Url" = ${Url} "IsManagedByGAO" = ${IsManagedByGAO} "IsGroupSite" = ${IsGroupSite} "ActivityId" = ${ActivityId} } return $PSO } } <# ChangeSiteObjectModel<PSCustomObject> #> function ConvertFrom-JsonToChangeSiteObjectModel { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: Cloud.Governance.Client => ChangeSiteObjectModel' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in ChangeSiteObjectModel $AllProperties = $("Id", "GroupId", "TenantId", "Url", "IsManagedByGAO", "IsGroupSite", "ActivityId") 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 "Id"))) { #optional property not found $Id = $null } else { $Id = $JsonParameters.PSobject.Properties["Id"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "GroupId"))) { #optional property not found $GroupId = $null } else { $GroupId = $JsonParameters.PSobject.Properties["GroupId"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "TenantId"))) { #optional property not found $TenantId = $null } else { $TenantId = $JsonParameters.PSobject.Properties["TenantId"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "Url"))) { #optional property not found $Url = $null } else { $Url = $JsonParameters.PSobject.Properties["Url"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "IsManagedByGAO"))) { #optional property not found $IsManagedByGAO = $null } else { $IsManagedByGAO = $JsonParameters.PSobject.Properties["IsManagedByGAO"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "IsGroupSite"))) { #optional property not found $IsGroupSite = $null } else { $IsGroupSite = $JsonParameters.PSobject.Properties["IsGroupSite"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "ActivityId"))) { #optional property not found $ActivityId = $null } else { $ActivityId = $JsonParameters.PSobject.Properties["ActivityId"].value } $PSO = [PSCustomObject]@{ "Id" = ${Id} "GroupId" = ${GroupId} "TenantId" = ${TenantId} "Url" = ${Url} "IsManagedByGAO" = ${IsManagedByGAO} "IsGroupSite" = ${IsGroupSite} "ActivityId" = ${ActivityId} } return $PSO } } |