Model/CreateDataset.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 Path
No description available.
.PARAMETER Type
No description available.
.PARAMETER Casesensitivity
No description available.
.PARAMETER Quota
No description available.
.PARAMETER Reservation
No description available.
.PARAMETER Aclinherit
No description available.
.PARAMETER Compression
No description available.
.PARAMETER VarProfile
No description available.
.PARAMETER Policy
No description available.
.OUTPUTS

CreateDataset<PSCustomObject>
#>


function Initialize-CreateDataset {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Path} = "{masterpool}/{datasetname}",
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Type} = "filesystem",
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Casesensitivity} = "mixed",
        [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Quota} = "",
        [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Reservation} = "",
        [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Aclinherit} = "restricted",
        [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Compression} = "lz4",
        [Parameter(Position = 7, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${VarProfile} = "none",
        [Parameter(Position = 8, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Policy} = "none"
    )

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


        $PSO = [PSCustomObject]@{
            "path" = ${Path}
            "type" = ${Type}
            "casesensitivity" = ${Casesensitivity}
            "quota" = ${Quota}
            "reservation" = ${Reservation}
            "aclinherit" = ${Aclinherit}
            "compression" = ${Compression}
            "profile" = ${VarProfile}
            "policy" = ${Policy}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to CreateDataset<PSCustomObject>

.DESCRIPTION

Convert from JSON to CreateDataset<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

CreateDataset<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in CreateDataset
        $AllProperties = ("path", "type", "casesensitivity", "quota", "reservation", "aclinherit", "compression", "profile", "policy")
        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 "path"))) { #optional property not found
            $Path = $null
        } else {
            $Path = $JsonParameters.PSobject.Properties["path"].value
        }

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "path" = ${Path}
            "type" = ${Type}
            "casesensitivity" = ${Casesensitivity}
            "quota" = ${Quota}
            "reservation" = ${Reservation}
            "aclinherit" = ${Aclinherit}
            "compression" = ${Compression}
            "profile" = ${VarProfile}
            "policy" = ${Policy}
        }

        return $PSO
    }

}