Model/PolicySummaryModel.ps1

#
# Fly SDK API
# No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
# Version: 1.0
# Contact: support@avepoint.com
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS
 
No summary available.
 
.DESCRIPTION
 
No description available.
 
.PARAMETER Platform
The platform type of policy
.PARAMETER IsDefault
A boolean value indicates whether the policy is default one
.PARAMETER IsInUse
A boolean value indicates whether this policy is being used
.PARAMETER Name
The name of the object
.PARAMETER Description
The description of the object
.PARAMETER CreateTime
The creation time of the object
.PARAMETER CreateBy
The user who create this object
.PARAMETER LastModifyTime
The last modified time of the object
.PARAMETER LastModifyBy
The user who last modified the object
.PARAMETER Id
The GUID of the object
.OUTPUTS
 
PolicySummaryModel<PSCustomObject>
#>


function Initialize-FlyPolicySummaryModel {
    [CmdletBinding()]
    Param (
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [PSCustomObject]
        ${Platform},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsDefault},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${IsInUse},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Description},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${CreateTime},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${CreateBy},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int64]]
        ${LastModifyTime},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${LastModifyBy},
        [Parameter(ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Id}
    )

    Process {
        'Creating PSCustomObject: Fly.Client => FlyPolicySummaryModel' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug


        $PSO = [PSCustomObject]@{
            "platform" = ${Platform}
            "isDefault" = ${IsDefault}
            "isInUse" = ${IsInUse}
            "name" = ${Name}
            "description" = ${Description}
            "createTime" = ${CreateTime}
            "createBy" = ${CreateBy}
            "lastModifyTime" = ${LastModifyTime}
            "lastModifyBy" = ${LastModifyBy}
            "id" = ${Id}
        }

        return $PSO
    }
}

<#
.SYNOPSIS
 
Convert from JSON to PolicySummaryModel<PSCustomObject>
 
.DESCRIPTION
 
Convert from JSON to PolicySummaryModel<PSCustomObject>
 
.PARAMETER Json
 
Json object
 
.OUTPUTS
 
PolicySummaryModel<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in FlyPolicySummaryModel
        $AllProperties = ("platform", "isDefault", "isInUse", "name", "description", "createTime", "createBy", "lastModifyTime", "lastModifyBy", "id")
        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 "platform"))) { #optional property not found
            $Platform = $null
        } else {
            $Platform = $JsonParameters.PSobject.Properties["platform"].value
        }

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "platform" = ${Platform}
            "isDefault" = ${IsDefault}
            "isInUse" = ${IsInUse}
            "name" = ${Name}
            "description" = ${Description}
            "createTime" = ${CreateTime}
            "createBy" = ${CreateBy}
            "lastModifyTime" = ${LastModifyTime}
            "lastModifyBy" = ${LastModifyBy}
            "id" = ${Id}
        }

        return $PSO
    }

}