Model/SetNfsDataset.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 Hostby
No description available.
.PARAMETER Name
No description available.
.PARAMETER Accesstype
No description available.
.PARAMETER Root
No description available.
.PARAMETER Hypervisor
No description available.
.OUTPUTS

SetNfsDataset<PSCustomObject>
#>


function Initialize-SetNfsDataset {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Action} = "activatenfs",
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Hostby} = "N",
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Name} = "192.168.10.202/24",
        [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Accesstype} = "rw",
        [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Root} = "true",
        [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Hypervisor} = "true"
    )

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


        $PSO = [PSCustomObject]@{
            "action" = ${Action}
            "hostby" = ${Hostby}
            "name" = ${Name}
            "accesstype" = ${Accesstype}
            "root" = ${Root}
            "hypervisor" = ${Hypervisor}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to SetNfsDataset<PSCustomObject>

.DESCRIPTION

Convert from JSON to SetNfsDataset<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

SetNfsDataset<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in SetNfsDataset
        $AllProperties = ("action", "hostby", "name", "accesstype", "root", "hypervisor")
        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 "hostby"))) { #optional property not found
            $Hostby = $null
        } else {
            $Hostby = $JsonParameters.PSobject.Properties["hostby"].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 "accesstype"))) { #optional property not found
            $Accesstype = $null
        } else {
            $Accesstype = $JsonParameters.PSobject.Properties["accesstype"].value
        }

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

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

        $PSO = [PSCustomObject]@{
            "action" = ${Action}
            "hostby" = ${Hostby}
            "name" = ${Name}
            "accesstype" = ${Accesstype}
            "root" = ${Root}
            "hypervisor" = ${Hypervisor}
        }

        return $PSO
    }

}