Model/HTTPSecConfig.ps1

#
# SMServer V6
# Syncplify Server! REST API
# Version: 1.0.0
# Generated by OpenAPI Generator: https://openapi-generator.tech
#

<#
.SYNOPSIS

No summary available.

.DESCRIPTION

No description available.

.PARAMETER Enable
Is enabled?
.PARAMETER AllowedHosts
No description available.
.PARAMETER SslRedirect
No description available.
.PARAMETER SslTemporaryRedirect
No description available.
.PARAMETER SslHost
No description available.
.PARAMETER StsSeconds
No description available.
.PARAMETER StsIncludeSubdomains
No description available.
.PARAMETER FrameDeny
No description available.
.PARAMETER CustomFrameOptions
No description available.
.PARAMETER ContentTypeNoSniff
No description available.
.PARAMETER BrowserXssFilter
No description available.
.PARAMETER ContentSecurityPolicy
No description available.
.PARAMETER ReferrerPolicy
No description available.
.PARAMETER FeaturePolicy
No description available.
.PARAMETER DontRedirectIPv4HostNames
No description available.
.PARAMETER SslProxyHeaders
No description available.
.OUTPUTS

HTTPSecConfig<PSCustomObject>
#>


function Initialize-SS6HTTPSecConfig {
    [CmdletBinding()]
    Param (
        [Parameter(Position = 0, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${Enable},
        [Parameter(Position = 1, ValueFromPipelineByPropertyName = $true)]
        [String[]]
        ${AllowedHosts},
        [Parameter(Position = 2, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${SslRedirect},
        [Parameter(Position = 3, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${SslTemporaryRedirect},
        [Parameter(Position = 4, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${SslHost},
        [Parameter(Position = 5, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Int32]]
        ${StsSeconds},
        [Parameter(Position = 6, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${StsIncludeSubdomains},
        [Parameter(Position = 7, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${FrameDeny},
        [Parameter(Position = 8, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${CustomFrameOptions},
        [Parameter(Position = 9, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${ContentTypeNoSniff},
        [Parameter(Position = 10, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${BrowserXssFilter},
        [Parameter(Position = 11, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ContentSecurityPolicy},
        [Parameter(Position = 12, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${ReferrerPolicy},
        [Parameter(Position = 13, ValueFromPipelineByPropertyName = $true)]
        [String]
        ${FeaturePolicy},
        [Parameter(Position = 14, ValueFromPipelineByPropertyName = $true)]
        [System.Nullable[Boolean]]
        ${DontRedirectIPv4HostNames},
        [Parameter(Position = 15, ValueFromPipelineByPropertyName = $true)]
        [System.Collections.Hashtable]
        ${SslProxyHeaders}
    )

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


        $PSO = [PSCustomObject]@{
            "enable" = ${Enable}
            "allowedHosts" = ${AllowedHosts}
            "sslRedirect" = ${SslRedirect}
            "sslTemporaryRedirect" = ${SslTemporaryRedirect}
            "sslHost" = ${SslHost}
            "stsSeconds" = ${StsSeconds}
            "stsIncludeSubdomains" = ${StsIncludeSubdomains}
            "frameDeny" = ${FrameDeny}
            "customFrameOptions" = ${CustomFrameOptions}
            "contentTypeNoSniff" = ${ContentTypeNoSniff}
            "browserXssFilter" = ${BrowserXssFilter}
            "contentSecurityPolicy" = ${ContentSecurityPolicy}
            "referrerPolicy" = ${ReferrerPolicy}
            "featurePolicy" = ${FeaturePolicy}
            "dontRedirectIPv4HostNames" = ${DontRedirectIPv4HostNames}
            "sslProxyHeaders" = ${SslProxyHeaders}
        }


        return $PSO
    }
}

<#
.SYNOPSIS

Convert from JSON to HTTPSecConfig<PSCustomObject>

.DESCRIPTION

Convert from JSON to HTTPSecConfig<PSCustomObject>

.PARAMETER Json

Json object

.OUTPUTS

HTTPSecConfig<PSCustomObject>
#>

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

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

        $JsonParameters = ConvertFrom-Json -InputObject $Json

        # check if Json contains properties not defined in SS6HTTPSecConfig
        $AllProperties = ("enable", "allowedHosts", "sslRedirect", "sslTemporaryRedirect", "sslHost", "stsSeconds", "stsIncludeSubdomains", "frameDeny", "customFrameOptions", "contentTypeNoSniff", "browserXssFilter", "contentSecurityPolicy", "referrerPolicy", "featurePolicy", "dontRedirectIPv4HostNames", "sslProxyHeaders")
        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 "enable"))) { #optional property not found
            $Enable = $null
        } else {
            $Enable = $JsonParameters.PSobject.Properties["enable"].value
        }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        $PSO = [PSCustomObject]@{
            "enable" = ${Enable}
            "allowedHosts" = ${AllowedHosts}
            "sslRedirect" = ${SslRedirect}
            "sslTemporaryRedirect" = ${SslTemporaryRedirect}
            "sslHost" = ${SslHost}
            "stsSeconds" = ${StsSeconds}
            "stsIncludeSubdomains" = ${StsIncludeSubdomains}
            "frameDeny" = ${FrameDeny}
            "customFrameOptions" = ${CustomFrameOptions}
            "contentTypeNoSniff" = ${ContentTypeNoSniff}
            "browserXssFilter" = ${BrowserXssFilter}
            "contentSecurityPolicy" = ${ContentSecurityPolicy}
            "referrerPolicy" = ${ReferrerPolicy}
            "featurePolicy" = ${FeaturePolicy}
            "dontRedirectIPv4HostNames" = ${DontRedirectIPv4HostNames}
            "sslProxyHeaders" = ${SslProxyHeaders}
        }

        return $PSO
    }

}