Model/ManualImportTeamJobModel.ps1

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

<#
ManualImportTeamJobModel<PSCustomObject>
#>


function New-ManualImportTeamJobModel {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ObjectType} = "None",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsIncludeArchivedTeams} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${InactiveJobTimeBaseType} = "LastModifiedTime",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${FileName}
    )

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

        
        $PSO = [PSCustomObject]@{
            "ObjectType" = ${ObjectType}
            "IsIncludeArchivedTeams" = ${IsIncludeArchivedTeams}
            "InactiveJobTimeBaseType" = ${InactiveJobTimeBaseType}
            "Name" = ${Name}
            "Description" = ${Description}
            "FileName" = ${FileName}
        }

        return $PSO
    }
}

<#
ManualImportTeamJobModel<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in ManualImportTeamJobModel
        $AllProperties = $("ObjectType", "IsIncludeArchivedTeams", "InactiveJobTimeBaseType", "Name", "Description", "FileName")
        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 "ObjectType"))) { #optional property not found
            $ObjectType = $null
        } else {
            $ObjectType = $JsonParameters.PSobject.Properties["ObjectType"].value
        }

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

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

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

        $PSO = [PSCustomObject]@{
            "ObjectType" = ${ObjectType}
            "IsIncludeArchivedTeams" = ${IsIncludeArchivedTeams}
            "InactiveJobTimeBaseType" = ${InactiveJobTimeBaseType}
            "Name" = ${Name}
            "Description" = ${Description}
            "FileName" = ${FileName}
        }

        return $PSO
    }

}