Model/CreateResourceMailboxContactInformationRequestModel.ps1

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

<#
CreateResourceMailboxContactInformationRequestModel<PSCustomObject>
#>


function New-CreateResourceMailboxContactInformationRequestModel {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Location},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Phone},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Street},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${City},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Zip},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Country},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Notes},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${State},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ActivityId}
    )

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

        
        $PSO = [PSCustomObject]@{
            "Location" = ${Location}
            "Phone" = ${Phone}
            "Street" = ${Street}
            "City" = ${City}
            "Zip" = ${Zip}
            "Country" = ${Country}
            "Notes" = ${Notes}
            "State" = ${State}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }
}

<#
CreateResourceMailboxContactInformationRequestModel<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in CreateResourceMailboxContactInformationRequestModel
        $AllProperties = $("Location", "Phone", "Street", "City", "Zip", "Country", "Notes", "State", "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 "Location"))) { #optional property not found
            $Location = $null
        } else {
            $Location = $JsonParameters.PSobject.Properties["Location"].value
        }

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "Location" = ${Location}
            "Phone" = ${Phone}
            "Street" = ${Street}
            "City" = ${City}
            "Zip" = ${Zip}
            "Country" = ${Country}
            "Notes" = ${Notes}
            "State" = ${State}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }

}