Model/M365GroupLifecycleActions.ps1

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

<#
M365GroupLifecycleActions<PSCustomObject>
#>


function New-M365GroupLifecycleActions {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsSendCancellation} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SendCancellationEmailTemplateId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsNotifyEnabled} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${NotifyUsers},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${NotifyEmailTemplateId},
        [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 => M365GroupLifecycleActions' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        
        $PSO = [PSCustomObject]@{
            "IsSendCancellation" = ${IsSendCancellation}
            "SendCancellationEmailTemplateId" = ${SendCancellationEmailTemplateId}
            "IsNotifyEnabled" = ${IsNotifyEnabled}
            "NotifyUsers" = ${NotifyUsers}
            "NotifyEmailTemplateId" = ${NotifyEmailTemplateId}
            "ActivityType" = ${ActivityType}
            "Type" = ${Type}
            "Title" = ${Title}
            "Description" = ${Description}
            "RunAfter" = ${RunAfter}
        }

        return $PSO
    }
}

<#
M365GroupLifecycleActions<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in M365GroupLifecycleActions
        $AllProperties = $("IsSendCancellation", "SendCancellationEmailTemplateId", "IsNotifyEnabled", "NotifyUsers", "NotifyEmailTemplateId", "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 "IsSendCancellation"))) { #optional property not found
            $IsSendCancellation = $null
        } else {
            $IsSendCancellation = $JsonParameters.PSobject.Properties["IsSendCancellation"].value
        }

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

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

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "NotifyEmailTemplateId"))) { #optional property not found
            $NotifyEmailTemplateId = $null
        } else {
            $NotifyEmailTemplateId = $JsonParameters.PSobject.Properties["NotifyEmailTemplateId"].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]@{
            "IsSendCancellation" = ${IsSendCancellation}
            "SendCancellationEmailTemplateId" = ${SendCancellationEmailTemplateId}
            "IsNotifyEnabled" = ${IsNotifyEnabled}
            "NotifyUsers" = ${NotifyUsers}
            "NotifyEmailTemplateId" = ${NotifyEmailTemplateId}
            "ActivityType" = ${ActivityType}
            "Type" = ${Type}
            "Title" = ${Title}
            "Description" = ${Description}
            "RunAfter" = ${RunAfter}
        }

        return $PSO
    }

}