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