Model/ChangeDistributionGroupSettingsCheckResult.ps1

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

<#
ChangeDistributionGroupSettingsCheckResult<PSCustomObject>
#>


function New-ChangeDistributionGroupSettingsCheckResult {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${ValidDomains},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${GroupObjectId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${OfficeTenantId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${GroupDisplayName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${GroupDescription},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${PrimarySmtpAddress},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${EmailAddresses},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${HiddenFromAddressListsEnabled} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${RequireSenderAuthenticationEnabled} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${SendAsPermissions},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${SendOnBehalfPermissions},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${SpecifiedSenders},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Metadatas},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsValid} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ErrorMessage},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${MessageCode} = "None"
    )

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

        
        $PSO = [PSCustomObject]@{
            "ValidDomains" = ${ValidDomains}
            "GroupObjectId" = ${GroupObjectId}
            "OfficeTenantId" = ${OfficeTenantId}
            "GroupDisplayName" = ${GroupDisplayName}
            "GroupDescription" = ${GroupDescription}
            "PrimarySmtpAddress" = ${PrimarySmtpAddress}
            "EmailAddresses" = ${EmailAddresses}
            "HiddenFromAddressListsEnabled" = ${HiddenFromAddressListsEnabled}
            "RequireSenderAuthenticationEnabled" = ${RequireSenderAuthenticationEnabled}
            "SendAsPermissions" = ${SendAsPermissions}
            "SendOnBehalfPermissions" = ${SendOnBehalfPermissions}
            "SpecifiedSenders" = ${SpecifiedSenders}
            "Metadatas" = ${Metadatas}
            "IsValid" = ${IsValid}
            "ErrorMessage" = ${ErrorMessage}
            "MessageCode" = ${MessageCode}
        }

        return $PSO
    }
}

<#
ChangeDistributionGroupSettingsCheckResult<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ChangeDistributionGroupSettingsCheckResult
        $AllProperties = $("ValidDomains", "GroupObjectId", "OfficeTenantId", "GroupDisplayName", "GroupDescription", "PrimarySmtpAddress", "EmailAddresses", "HiddenFromAddressListsEnabled", "RequireSenderAuthenticationEnabled", "SendAsPermissions", "SendOnBehalfPermissions", "SpecifiedSenders", "Metadatas", "IsValid", "ErrorMessage", "MessageCode")
        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 "ValidDomains"))) { #optional property not found
            $ValidDomains = $null
        } else {
            $ValidDomains = $JsonParameters.PSobject.Properties["ValidDomains"].value
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "ValidDomains" = ${ValidDomains}
            "GroupObjectId" = ${GroupObjectId}
            "OfficeTenantId" = ${OfficeTenantId}
            "GroupDisplayName" = ${GroupDisplayName}
            "GroupDescription" = ${GroupDescription}
            "PrimarySmtpAddress" = ${PrimarySmtpAddress}
            "EmailAddresses" = ${EmailAddresses}
            "HiddenFromAddressListsEnabled" = ${HiddenFromAddressListsEnabled}
            "RequireSenderAuthenticationEnabled" = ${RequireSenderAuthenticationEnabled}
            "SendAsPermissions" = ${SendAsPermissions}
            "SendOnBehalfPermissions" = ${SendOnBehalfPermissions}
            "SpecifiedSenders" = ${SpecifiedSenders}
            "Metadatas" = ${Metadatas}
            "IsValid" = ${IsValid}
            "ErrorMessage" = ${ErrorMessage}
            "MessageCode" = ${MessageCode}
        }

        return $PSO
    }

}