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