Model/LifecycleScopeSetting.ps1

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

<#
LifecycleScopeSetting<PSCustomObject>
#>


function New-LifecycleScopeSetting {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsLimitGroup} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${PeoplePickerFilterProfileId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ScopeType} = "SelectTenant",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Office365Tenant},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${TenantId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Containers},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Gallery},
        [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 => LifecycleScopeSetting' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        
        $PSO = [PSCustomObject]@{
            "IsLimitGroup" = ${IsLimitGroup}
            "PeoplePickerFilterProfileId" = ${PeoplePickerFilterProfileId}
            "ScopeType" = ${ScopeType}
            "Office365Tenant" = ${Office365Tenant}
            "TenantId" = ${TenantId}
            "Containers" = ${Containers}
            "Gallery" = ${Gallery}
            "ActivityType" = ${ActivityType}
            "Type" = ${Type}
            "Title" = ${Title}
            "Description" = ${Description}
            "RunAfter" = ${RunAfter}
        }

        return $PSO
    }
}

<#
LifecycleScopeSetting<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in LifecycleScopeSetting
        $AllProperties = $("IsLimitGroup", "PeoplePickerFilterProfileId", "ScopeType", "Office365Tenant", "TenantId", "Containers", "Gallery", "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 "IsLimitGroup"))) { #optional property not found
            $IsLimitGroup = $null
        } else {
            $IsLimitGroup = $JsonParameters.PSobject.Properties["IsLimitGroup"].value
        }

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

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

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "Office365Tenant"))) { #optional property not found
            $Office365Tenant = $null
        } else {
            $Office365Tenant = $JsonParameters.PSobject.Properties["Office365Tenant"].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 "Containers"))) { #optional property not found
            $Containers = $null
        } else {
            $Containers = $JsonParameters.PSobject.Properties["Containers"].value
        }

        if (!([bool]($JsonParameters.PSobject.Properties.name -match "Gallery"))) { #optional property not found
            $Gallery = $null
        } else {
            $Gallery = $JsonParameters.PSobject.Properties["Gallery"].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]@{
            "IsLimitGroup" = ${IsLimitGroup}
            "PeoplePickerFilterProfileId" = ${PeoplePickerFilterProfileId}
            "ScopeType" = ${ScopeType}
            "Office365Tenant" = ${Office365Tenant}
            "TenantId" = ${TenantId}
            "Containers" = ${Containers}
            "Gallery" = ${Gallery}
            "ActivityType" = ${ActivityType}
            "Type" = ${Type}
            "Title" = ${Title}
            "Description" = ${Description}
            "RunAfter" = ${RunAfter}
        }

        return $PSO
    }

}