Model/M365GroupLifecycleGallery.ps1

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

<#
M365GroupLifecycleGallery<PSCustomObject>
#>


function New-M365GroupLifecycleGallery {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Office365TenantId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${M365GroupInfo},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${M365GroupLifecycleScopeSetting},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${M365GroupLifecycleActions},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${GalleryType},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${GalleryInternalName},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${GalleryMetadata}
    )

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

        
        $PSO = [PSCustomObject]@{
            "Office365TenantId" = ${Office365TenantId}
            "M365GroupInfo" = ${M365GroupInfo}
            "M365GroupLifecycleScopeSetting" = ${M365GroupLifecycleScopeSetting}
            "M365GroupLifecycleActions" = ${M365GroupLifecycleActions}
            "GalleryType" = ${GalleryType}
            "GalleryInternalName" = ${GalleryInternalName}
            "GalleryMetadata" = ${GalleryMetadata}
        }

        return $PSO
    }
}

<#
M365GroupLifecycleGallery<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in M365GroupLifecycleGallery
        $AllProperties = $("Office365TenantId", "M365GroupInfo", "M365GroupLifecycleScopeSetting", "M365GroupLifecycleActions", "GalleryType", "GalleryInternalName", "GalleryMetadata")
        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 "Office365TenantId"))) { #optional property not found
            $Office365TenantId = $null
        } else {
            $Office365TenantId = $JsonParameters.PSobject.Properties["Office365TenantId"].value
        }

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "Office365TenantId" = ${Office365TenantId}
            "M365GroupInfo" = ${M365GroupInfo}
            "M365GroupLifecycleScopeSetting" = ${M365GroupLifecycleScopeSetting}
            "M365GroupLifecycleActions" = ${M365GroupLifecycleActions}
            "GalleryType" = ${GalleryType}
            "GalleryInternalName" = ${GalleryInternalName}
            "GalleryMetadata" = ${GalleryMetadata}
        }

        return $PSO
    }

}