Model/TeamMemberPermissionSetting.ps1

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

<#
TeamMemberPermissionSetting<PSCustomObject>
#>


function New-TeamMemberPermissionSetting {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AllowCreateUpdateChannels} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AllowCreatePrivateChannels} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AllowDeleteChannels} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AllowAddRemoveApps} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AllowCreateUpdateRemoveTabs} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AllowCreateUpdateRemoveConnectors} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AllowEditMessages} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${AllowDeleteMessages} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ActivityId}
    )

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

        
        $PSO = [PSCustomObject]@{
            "AllowCreateUpdateChannels" = ${AllowCreateUpdateChannels}
            "AllowCreatePrivateChannels" = ${AllowCreatePrivateChannels}
            "AllowDeleteChannels" = ${AllowDeleteChannels}
            "AllowAddRemoveApps" = ${AllowAddRemoveApps}
            "AllowCreateUpdateRemoveTabs" = ${AllowCreateUpdateRemoveTabs}
            "AllowCreateUpdateRemoveConnectors" = ${AllowCreateUpdateRemoveConnectors}
            "AllowEditMessages" = ${AllowEditMessages}
            "AllowDeleteMessages" = ${AllowDeleteMessages}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }
}

<#
TeamMemberPermissionSetting<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in TeamMemberPermissionSetting
        $AllProperties = $("AllowCreateUpdateChannels", "AllowCreatePrivateChannels", "AllowDeleteChannels", "AllowAddRemoveApps", "AllowCreateUpdateRemoveTabs", "AllowCreateUpdateRemoveConnectors", "AllowEditMessages", "AllowDeleteMessages", "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 "AllowCreateUpdateChannels"))) { #optional property not found
            $AllowCreateUpdateChannels = $null
        } else {
            $AllowCreateUpdateChannels = $JsonParameters.PSobject.Properties["AllowCreateUpdateChannels"].value
        }

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "AllowCreateUpdateChannels" = ${AllowCreateUpdateChannels}
            "AllowCreatePrivateChannels" = ${AllowCreatePrivateChannels}
            "AllowDeleteChannels" = ${AllowDeleteChannels}
            "AllowAddRemoveApps" = ${AllowAddRemoveApps}
            "AllowCreateUpdateRemoveTabs" = ${AllowCreateUpdateRemoveTabs}
            "AllowCreateUpdateRemoveConnectors" = ${AllowCreateUpdateRemoveConnectors}
            "AllowEditMessages" = ${AllowEditMessages}
            "AllowDeleteMessages" = ${AllowDeleteMessages}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }

}