Model/SetIscsiDataset.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 Remotei
No description available.
.PARAMETER LocalTarget
No description available.
.OUTPUTS

SetIscsiDataset<PSCustomObject>
#>


function Initialize-SetIscsiDataset {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Action} = "activateiscsi",
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${Remotei} = "",
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${LocalTarget} = ""
    )

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


        $PSO = [PSCustomObject]@{
            "action" = ${Action}
            "remotei" = ${Remotei}
            "local_target" = ${LocalTarget}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to SetIscsiDataset<PSCustomObject>

.DESCRIPTION

Convert from JSON to SetIscsiDataset<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

SetIscsiDataset<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

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

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

        $PSO = [PSCustomObject]@{
            "action" = ${Action}
            "remotei" = ${Remotei}
            "local_target" = ${LocalTarget}
        }

        return $PSO
    }

}