Model/ManualImportSiteJobModel.ps1

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

<#
ManualImportSiteJobModel<PSCustomObject>
#>


function New-ManualImportSiteJobModel {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${ObjectType} = "None",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${InactiveJobTimeBaseType} = "LastModifiedTime",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject[]]
        ${Workspaces},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${FileName}
    )

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

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

        return $PSO
    }
}

<#
ManualImportSiteJobModel<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

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

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

        return $PSO
    }

}