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