Model/Snapshot.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 Reverse No description available. .PARAMETER Count No description available. .PARAMETER After No description available. .PARAMETER Before No description available. .OUTPUTS Snapshot<PSCustomObject> #> function Initialize-Snapshot { [CmdletBinding()] Param ( [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)] [String] ${Reverse} = "false", [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)] [String] ${Count} = "10", [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)] [String] ${After} = "1577836861", [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)] [String] ${Before} = "1640995261" ) Process { 'Creating PSCustomObject: AiRE => Snapshot' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $PSO = [PSCustomObject]@{ "reverse" = ${Reverse} "count" = ${Count} "after" = ${After} "before" = ${Before} } return $PSO } } <# .SYNOPSIS Convert from JSON to Snapshot<PSCustomObject> .DESCRIPTION Convert from JSON to Snapshot<PSCustomObject> .PARAMETER Json Json object .OUTPUTS Snapshot<PSCustomObject> #> function ConvertFrom-JsonToSnapshot { Param( [AllowEmptyString()] [string]$Json ) Process { 'Converting JSON to PSCustomObject: AiRE => Snapshot' | Write-Debug $PSBoundParameters | Out-DebugParameter | Write-Debug $JsonParameters = ConvertFrom-Json -InputObject $Json # check if Json contains properties not defined in Snapshot $AllProperties = ("reverse", "count", "after", "before") 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 "reverse"))) { #optional property not found $Reverse = $null } else { $Reverse = $JsonParameters.PSobject.Properties["reverse"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "count"))) { #optional property not found $Count = $null } else { $Count = $JsonParameters.PSobject.Properties["count"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "after"))) { #optional property not found $After = $null } else { $After = $JsonParameters.PSobject.Properties["after"].value } if (!([bool]($JsonParameters.PSobject.Properties.name -match "before"))) { #optional property not found $Before = $null } else { $Before = $JsonParameters.PSobject.Properties["before"].value } $PSO = [PSCustomObject]@{ "reverse" = ${Reverse} "count" = ${Count} "after" = ${After} "before" = ${Before} } return $PSO } } |