Model/SCLifecycleActionModel.ps1

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

<#
SCLifecycleActionModel<PSCustomObject>
#>


function New-SCLifecycleActionModel {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${LifecycleActionType} = "Lock",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${LockType} = "None",
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsPermanentlyDelete} = $false,
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ActivityId}
    )

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

        
        $PSO = [PSCustomObject]@{
            "LifecycleActionType" = ${LifecycleActionType}
            "LockType" = ${LockType}
            "IsPermanentlyDelete" = ${IsPermanentlyDelete}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }
}

<#
SCLifecycleActionModel<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

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

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

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

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

        $PSO = [PSCustomObject]@{
            "LifecycleActionType" = ${LifecycleActionType}
            "LockType" = ${LockType}
            "IsPermanentlyDelete" = ${IsPermanentlyDelete}
            "ActivityId" = ${ActivityId}
        }

        return $PSO
    }

}