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