Model/ChangeContactValidationParameter.ps1

#
# Cloud Governance Api
# Contact: support@avepoint.com
#

<#
ChangeContactValidationParameter<PSCustomObject>
#>


function New-ChangeContactValidationParameter {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ContactActivityId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ScopeActivityId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TenantId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ObjectId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${DisplayName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Email},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Type} = "Site"
    )

    Process {
        'Creating PSCustomObject: Cloud.Governance.Client => ChangeContactValidationParameter' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        
        $PSO = [PSCustomObject]@{
            "ContactActivityId" = ${ContactActivityId}
            "ScopeActivityId" = ${ScopeActivityId}
            "TenantId" = ${TenantId}
            "ObjectId" = ${ObjectId}
            "DisplayName" = ${DisplayName}
            "Email" = ${Email}
            "Type" = ${Type}
        }

        return $PSO
    }
}

<#
ChangeContactValidationParameter<PSCustomObject>
#>

function ConvertFrom-JsonToChangeContactValidationParameter {
    Param(
        [AllowEmptyString()]
        [string]$Json
    )

    Process {
        'Converting JSON to PSCustomObject: Cloud.Governance.Client => ChangeContactValidationParameter' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ChangeContactValidationParameter
        $AllProperties = $("ContactActivityId", "ScopeActivityId", "TenantId", "ObjectId", "DisplayName", "Email", "Type")
        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 "ContactActivityId"))) { #optional property not found
            $ContactActivityId = $null
        } else {
            $ContactActivityId = $JsonParameters.PSobject.Properties["ContactActivityId"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "ScopeActivityId"))) { #optional property not found
            $ScopeActivityId = $null
        } else {
            $ScopeActivityId = $JsonParameters.PSobject.Properties["ScopeActivityId"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "TenantId"))) { #optional property not found
            $TenantId = $null
        } else {
            $TenantId = $JsonParameters.PSobject.Properties["TenantId"].value
        }

        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 "DisplayName"))) { #optional property not found
            $DisplayName = $null
        } else {
            $DisplayName = $JsonParameters.PSobject.Properties["DisplayName"].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 "Type"))) { #optional property not found
            $Type = $null
        } else {
            $Type = $JsonParameters.PSobject.Properties["Type"].value
        }

        $PSO = [PSCustomObject]@{
            "ContactActivityId" = ${ContactActivityId}
            "ScopeActivityId" = ${ScopeActivityId}
            "TenantId" = ${TenantId}
            "ObjectId" = ${ObjectId}
            "DisplayName" = ${DisplayName}
            "Email" = ${Email}
            "Type" = ${Type}
        }

        return $PSO
    }

}