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