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