Model/CloneTeam.ps1

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

<#
CloneTeam<PSCustomObject>
#>


function New-CloneTeam {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${CloneTeamId},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${CloneTeamTitle},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${EnableCloneChannels} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${EnableCloneApps} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${EnableCloneTabs} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${EnableCloneMembers} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${EnableCloneTeamSetting} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ActivityId}
    )

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

        
        $PSO = [PSCustomObject]@{
            "CloneTeamId" = ${CloneTeamId}
            "CloneTeamTitle" = ${CloneTeamTitle}
            "EnableCloneChannels" = ${EnableCloneChannels}
            "EnableCloneApps" = ${EnableCloneApps}
            "EnableCloneTabs" = ${EnableCloneTabs}
            "EnableCloneMembers" = ${EnableCloneMembers}
            "EnableCloneTeamSetting" = ${EnableCloneTeamSetting}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }
}

<#
CloneTeam<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in CloneTeam
        $AllProperties = $("CloneTeamId", "CloneTeamTitle", "EnableCloneChannels", "EnableCloneApps", "EnableCloneTabs", "EnableCloneMembers", "EnableCloneTeamSetting", "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 "CloneTeamId"))) { #optional property not found
            $CloneTeamId = $null
        } else {
            $CloneTeamId = $JsonParameters.PSobject.Properties["CloneTeamId"].value
        }

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "CloneTeamId" = ${CloneTeamId}
            "CloneTeamTitle" = ${CloneTeamTitle}
            "EnableCloneChannels" = ${EnableCloneChannels}
            "EnableCloneApps" = ${EnableCloneApps}
            "EnableCloneTabs" = ${EnableCloneTabs}
            "EnableCloneMembers" = ${EnableCloneMembers}
            "EnableCloneTeamSetting" = ${EnableCloneTeamSetting}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }

}