Model/RollbackSnapshot.ps1

#
# Storvix APIs
# List of all APIs accessible with the AiRE filer
# Version: 3.0.0
# Contact: support@storvix.eu
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER Action
No description available.
.PARAMETER Snapname
No description available.
.OUTPUTS

RollbackSnapshot<PSCustomObject>
#>


function Initialize-RollbackSnapshot {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Action} = "rollbacksnapshot",
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Snapname} = "20210430071021"
    )

    Process {
        'Creating PSCustomObject: AiRE => RollbackSnapshot' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug


        $PSO = [PSCustomObject]@{
            "action" = ${Action}
            "snapname" = ${Snapname}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to RollbackSnapshot<PSCustomObject>

.DESCRIPTION

Convert from JSON to RollbackSnapshot<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

RollbackSnapshot<PSCustomObject>
#>

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

    Process {
        'Converting JSON to PSCustomObject: AiRE => RollbackSnapshot' | Write-Debug
        $PSBoundParameters | Out-DebugParameter | Write-Debug

        $JsonParameters = ConvertFrom-Json -InputObject $Json

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

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

        $PSO = [PSCustomObject]@{
            "action" = ${Action}
            "snapname" = ${Snapname}
        }

        return $PSO
    }

}