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