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