Public/adc-functions-conf-ns.ps1

function Invoke-ADCAddNsacl {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for ACL entry resource.
    .PARAMETER Aclname
        Name for the extended ACL rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER Aclaction
        Action to perform on incoming IPv4 packets that match the extended ACL rule.
        Available settings function as follows:
        * ALLOW - The Citrix ADC processes the packet.
        * BRIDGE - The Citrix ADC bridges the packet to the destination without processing it.
        * DENY - The Citrix ADC drops the packet.
        Possible values = BRIDGE, DENY, ALLOW
    .PARAMETER Td
        Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0.
    .PARAMETER Srcip
        IP address or range of IP addresses to match against the source IP address of an incoming IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 10.102.29.30-10.102.29.189.
    .PARAMETER Srcipop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Srcipval
        IP address or range of IP addresses to match against the source IP address of an incoming IPv4 packet. In the command line interface, separate the range with a hyphen. For example:10.102.29.30-10.102.29.189.
    .PARAMETER Srcipdataset
        Policy dataset which can have multiple IP ranges bound to it.
    .PARAMETER Srcport
        Port number or range of port numbers to match against the source port number of an incoming IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
    .PARAMETER Srcportop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Srcportval
        Port number or range of port numbers to match against the source port number of an incoming IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
    .PARAMETER Srcportdataset
        Policy dataset which can have multiple port ranges bound to it.
    .PARAMETER Destip
        IP address or range of IP addresses to match against the destination IP address of an incoming IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 10.102.29.30-10.102.29.189.
    .PARAMETER Destipop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Destipval
        IP address or range of IP addresses to match against the destination IP address of an incoming IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 10.102.29.30-10.102.29.189.
    .PARAMETER Destipdataset
        Policy dataset which can have multiple IP ranges bound to it.
    .PARAMETER Destport
        Port number or range of port numbers to match against the destination port number of an incoming IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Destportop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Destportval
        Port number or range of port numbers to match against the destination port number of an incoming IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Destportdataset
        Policy dataset which can have multiple port ranges bound to it.
    .PARAMETER Ttl
        Number of seconds, in multiples of four, after which the extended ACL rule expires. If you do not want the extended ACL rule to expire, do not specify a TTL value.
    .PARAMETER Srcmac
        MAC address to match against the source MAC address of an incoming IPv4 packet.
    .PARAMETER Srcmacmask
        Used to define range of Source MAC address. It takes string of 0 and 1, 0s are for exact match and 1s for wildcard. For matching first 3 bytes of MAC address, srcMacMask value "000000111111". .
    .PARAMETER Protocol
        Protocol to match against the protocol of an incoming IPv4 packet.
        Possible values = ICMP, IGMP, TCP, EGP, IGP, ARGUS, UDP, RDP, RSVP, EIGRP, L2TP, ISIS, GGP, IPoverIP, ST, CBT, BBN-RCC-M, NVP-II, PUP, EMCON, XNET, CHAOS, MUX, DCN-MEAS, HMP, PRM, XNS-IDP, TRUNK-1, TRUNK-2, LEAF-1, LEAF-2, IRTP, ISO-TP4, NETBLT, MFE-NSP, MERIT-INP, SEP, 3PC, IDPR, XTP, DDP, IDPR-CMTP, TP++, IL, IPv6, SDRP, IPv6-Route, IPv6-Frag, IDRP, GRE, MHRP, BNA, ESP, AH, I-NLSP, SWIPE, NARP, MOBILE, TLSP, SKIP, ICMPV6, IPv6-NoNx, IPv6-Opts, Any-Host-Internal-Protocol, CFTP, Any-Local-Network, SAT-EXPAK, KRYPTOLAN, RVD, IPPC, Any-Distributed-File-System, TFTP, VISA, IPCV, CPNX, CPHB, WSN, PVP, BR-SAT-MO, SUN-ND, WB-MON, WB-EXPAK, ISO-IP, VMTP, SECURE-VM, VINES, TTP, NSFNET-IG, DGP, TCF, OSPFIGP, Sprite-RP, LARP, MTP, AX.25, IPIP, MICP, SCC-SP, ETHERIP, Any-Private-Encryption-Scheme, GMTP, IFMP, PNNI, PIM, ARIS, SCPS, QNX, A/N, IPComp, SNP, Compaq-Pe, IPX-in-IP, VRRP, PGM, Any-0-Hop-Protocol, ENCAP, DDX, IATP, STP, SRP, UTI, SMP, SM, PTP, FIRE, CRTP, CRUDP, SSCOPMCE, IPLT, SPS, PIPE, SCTP, FC, RSVP-E2E-IGNORE, Mobility-Header, UDPLite
    .PARAMETER Protocolnumber
        Protocol to match against the protocol of an incoming IPv4 packet.
    .PARAMETER Vlan
        ID of the VLAN. The Citrix ADC applies the ACL rule only to the incoming packets of the specified VLAN. If you do not specify a VLAN ID, the appliance applies the ACL rule to the incoming packets on all VLANs.
    .PARAMETER Vxlan
        ID of the VXLAN. The Citrix ADC applies the ACL rule only to the incoming packets of the specified VXLAN. If you do not specify a VXLAN ID, the appliance applies the ACL rule to the incoming packets on all VXLANs.
    .PARAMETER Interface
        ID of an interface. The Citrix ADC applies the ACL rule only to the incoming packets from the specified interface. If you do not specify any value, the appliance applies the ACL rule to the incoming packets of all interfaces.
    .PARAMETER Established
        Allow only incoming TCP packets that have the ACK or RST bit set, if the action set for the ACL rule is ALLOW and these packets match the other conditions in the ACL rule.
    .PARAMETER Icmptype
        ICMP Message type to match against the message type of an incoming ICMP packet. For example, to block DESTINATION UNREACHABLE messages, you must specify 3 as the ICMP type.
        Note: This parameter can be specified only for the ICMP protocol.
    .PARAMETER Icmpcode
        Code of a particular ICMP message type to match against the ICMP code of an incoming ICMP packet. For example, to block DESTINATION HOST UNREACHABLE messages, specify 3 as the ICMP type and 1 as the ICMP code.
        If you set this parameter, you must set the ICMP Type parameter.
    .PARAMETER Priority
        Priority for the extended ACL rule that determines the order in which it is evaluated relative to the other extended ACL rules. If you do not specify priorities while creating extended ACL rules, the ACL rules are evaluated in the order in which they are created.
    .PARAMETER State
        Enable or disable the extended ACL rule. After you apply the extended ACL rules, the Citrix ADC compares incoming packets against the enabled extended ACL rules.
        Possible values = ENABLED, DISABLED
    .PARAMETER Logstate
        Enable or disable logging of events related to the extended ACL rule. The log messages are stored in the configured syslog or auditlog server.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ratelimit
        Maximum number of log messages to be generated per second. If you set this parameter, you must enable the Log State parameter.
    .PARAMETER Type
        Type of the acl,default will be CLASSIC.
        Available options as follows:
        * CLASSIC - specifies the regular extended acls.
        * DFD - cluster specific acls,specifies hashmethod for steering of the packet in cluster .
        Possible values = CLASSIC, DFD
    .PARAMETER Dfdhash
        Specifies the type hashmethod to be applied, to steer the packet to the FP of the packet.
        Possible values = SIP-SPORT-DIP-DPORT, SIP, DIP, SIP-DIP, SIP-SPORT, DIP-DPORT
    .PARAMETER Stateful
        If stateful option is enabled, transparent sessions are created for the traffic hitting this ACL and not hitting any other features like LB, INAT etc. .
        Possible values = YES, NO
    .PARAMETER PassThru
        Return details about the created nsacl item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNsacl -aclname <string> -aclaction <string>
        An example how to add nsacl configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNsacl
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacl/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Aclname,

        [Parameter(Mandatory)]
        [ValidateSet('BRIDGE', 'DENY', 'ALLOW')]
        [string]$Aclaction,

        [ValidateRange(0, 4094)]
        [double]$Td,

        [boolean]$Srcip,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Srcipop,

        [string]$Srcipval,

        [string]$Srcipdataset,

        [boolean]$Srcport,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Srcportop,

        [string]$Srcportval,

        [string]$Srcportdataset,

        [boolean]$Destip,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Destipop,

        [string]$Destipval,

        [string]$Destipdataset,

        [boolean]$Destport,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Destportop,

        [string]$Destportval,

        [string]$Destportdataset,

        [ValidateRange(1, 2147483647)]
        [double]$Ttl,

        [string]$Srcmac,

        [string]$Srcmacmask = '"000000000000"',

        [ValidateSet('ICMP', 'IGMP', 'TCP', 'EGP', 'IGP', 'ARGUS', 'UDP', 'RDP', 'RSVP', 'EIGRP', 'L2TP', 'ISIS', 'GGP', 'IPoverIP', 'ST', 'CBT', 'BBN-RCC-M', 'NVP-II', 'PUP', 'EMCON', 'XNET', 'CHAOS', 'MUX', 'DCN-MEAS', 'HMP', 'PRM', 'XNS-IDP', 'TRUNK-1', 'TRUNK-2', 'LEAF-1', 'LEAF-2', 'IRTP', 'ISO-TP4', 'NETBLT', 'MFE-NSP', 'MERIT-INP', 'SEP', '3PC', 'IDPR', 'XTP', 'DDP', 'IDPR-CMTP', 'TP++', 'IL', 'IPv6', 'SDRP', 'IPv6-Route', 'IPv6-Frag', 'IDRP', 'GRE', 'MHRP', 'BNA', 'ESP', 'AH', 'I-NLSP', 'SWIPE', 'NARP', 'MOBILE', 'TLSP', 'SKIP', 'ICMPV6', 'IPv6-NoNx', 'IPv6-Opts', 'Any-Host-Internal-Protocol', 'CFTP', 'Any-Local-Network', 'SAT-EXPAK', 'KRYPTOLAN', 'RVD', 'IPPC', 'Any-Distributed-File-System', 'TFTP', 'VISA', 'IPCV', 'CPNX', 'CPHB', 'WSN', 'PVP', 'BR-SAT-MO', 'SUN-ND', 'WB-MON', 'WB-EXPAK', 'ISO-IP', 'VMTP', 'SECURE-VM', 'VINES', 'TTP', 'NSFNET-IG', 'DGP', 'TCF', 'OSPFIGP', 'Sprite-RP', 'LARP', 'MTP', 'AX.25', 'IPIP', 'MICP', 'SCC-SP', 'ETHERIP', 'Any-Private-Encryption-Scheme', 'GMTP', 'IFMP', 'PNNI', 'PIM', 'ARIS', 'SCPS', 'QNX', 'A/N', 'IPComp', 'SNP', 'Compaq-Pe', 'IPX-in-IP', 'VRRP', 'PGM', 'Any-0-Hop-Protocol', 'ENCAP', 'DDX', 'IATP', 'STP', 'SRP', 'UTI', 'SMP', 'SM', 'PTP', 'FIRE', 'CRTP', 'CRUDP', 'SSCOPMCE', 'IPLT', 'SPS', 'PIPE', 'SCTP', 'FC', 'RSVP-E2E-IGNORE', 'Mobility-Header', 'UDPLite')]
        [string]$Protocol,

        [ValidateRange(1, 255)]
        [double]$Protocolnumber,

        [ValidateRange(1, 4094)]
        [double]$Vlan,

        [ValidateRange(1, 16777215)]
        [double]$Vxlan,

        [string]$Interface,

        [boolean]$Established,

        [ValidateRange(0, 65536)]
        [double]$Icmptype,

        [ValidateRange(0, 65536)]
        [double]$Icmpcode,

        [ValidateRange(1, 100000)]
        [double]$Priority,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$State = 'ENABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Logstate = 'DISABLED',

        [ValidateRange(1, 10000)]
        [double]$Ratelimit = '100',

        [ValidateSet('CLASSIC', 'DFD')]
        [string]$Type = 'CLASSIC',

        [ValidateSet('SIP-SPORT-DIP-DPORT', 'SIP', 'DIP', 'SIP-DIP', 'SIP-SPORT', 'DIP-DPORT')]
        [string]$Dfdhash,

        [ValidateSet('YES', 'NO')]
        [string]$Stateful = 'NO',

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNsacl: Starting"
    }
    process {
        try {
            $payload = @{ aclname = $aclname
                aclaction         = $aclaction
            }
            if ( $PSBoundParameters.ContainsKey('td') ) { $payload.Add('td', $td) }
            if ( $PSBoundParameters.ContainsKey('srcip') ) { $payload.Add('srcip', $srcip) }
            if ( $PSBoundParameters.ContainsKey('srcipop') ) { $payload.Add('srcipop', $srcipop) }
            if ( $PSBoundParameters.ContainsKey('srcipval') ) { $payload.Add('srcipval', $srcipval) }
            if ( $PSBoundParameters.ContainsKey('srcipdataset') ) { $payload.Add('srcipdataset', $srcipdataset) }
            if ( $PSBoundParameters.ContainsKey('srcport') ) { $payload.Add('srcport', $srcport) }
            if ( $PSBoundParameters.ContainsKey('srcportop') ) { $payload.Add('srcportop', $srcportop) }
            if ( $PSBoundParameters.ContainsKey('srcportval') ) { $payload.Add('srcportval', $srcportval) }
            if ( $PSBoundParameters.ContainsKey('srcportdataset') ) { $payload.Add('srcportdataset', $srcportdataset) }
            if ( $PSBoundParameters.ContainsKey('destip') ) { $payload.Add('destip', $destip) }
            if ( $PSBoundParameters.ContainsKey('destipop') ) { $payload.Add('destipop', $destipop) }
            if ( $PSBoundParameters.ContainsKey('destipval') ) { $payload.Add('destipval', $destipval) }
            if ( $PSBoundParameters.ContainsKey('destipdataset') ) { $payload.Add('destipdataset', $destipdataset) }
            if ( $PSBoundParameters.ContainsKey('destport') ) { $payload.Add('destport', $destport) }
            if ( $PSBoundParameters.ContainsKey('destportop') ) { $payload.Add('destportop', $destportop) }
            if ( $PSBoundParameters.ContainsKey('destportval') ) { $payload.Add('destportval', $destportval) }
            if ( $PSBoundParameters.ContainsKey('destportdataset') ) { $payload.Add('destportdataset', $destportdataset) }
            if ( $PSBoundParameters.ContainsKey('ttl') ) { $payload.Add('ttl', $ttl) }
            if ( $PSBoundParameters.ContainsKey('srcmac') ) { $payload.Add('srcmac', $srcmac) }
            if ( $PSBoundParameters.ContainsKey('srcmacmask') ) { $payload.Add('srcmacmask', $srcmacmask) }
            if ( $PSBoundParameters.ContainsKey('protocol') ) { $payload.Add('protocol', $protocol) }
            if ( $PSBoundParameters.ContainsKey('protocolnumber') ) { $payload.Add('protocolnumber', $protocolnumber) }
            if ( $PSBoundParameters.ContainsKey('vlan') ) { $payload.Add('vlan', $vlan) }
            if ( $PSBoundParameters.ContainsKey('vxlan') ) { $payload.Add('vxlan', $vxlan) }
            if ( $PSBoundParameters.ContainsKey('Interface') ) { $payload.Add('Interface', $Interface) }
            if ( $PSBoundParameters.ContainsKey('established') ) { $payload.Add('established', $established) }
            if ( $PSBoundParameters.ContainsKey('icmptype') ) { $payload.Add('icmptype', $icmptype) }
            if ( $PSBoundParameters.ContainsKey('icmpcode') ) { $payload.Add('icmpcode', $icmpcode) }
            if ( $PSBoundParameters.ContainsKey('priority') ) { $payload.Add('priority', $priority) }
            if ( $PSBoundParameters.ContainsKey('state') ) { $payload.Add('state', $state) }
            if ( $PSBoundParameters.ContainsKey('logstate') ) { $payload.Add('logstate', $logstate) }
            if ( $PSBoundParameters.ContainsKey('ratelimit') ) { $payload.Add('ratelimit', $ratelimit) }
            if ( $PSBoundParameters.ContainsKey('type') ) { $payload.Add('type', $type) }
            if ( $PSBoundParameters.ContainsKey('dfdhash') ) { $payload.Add('dfdhash', $dfdhash) }
            if ( $PSBoundParameters.ContainsKey('stateful') ) { $payload.Add('stateful', $stateful) }
            if ( $PSCmdlet.ShouldProcess("nsacl", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsacl -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsacl -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNsacl: Finished"
    }
}

function Invoke-ADCDeleteNsacl {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for ACL entry resource.
    .PARAMETER Aclname
        Name for the extended ACL rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNsacl -Aclname <string>
        An example how to delete nsacl configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNsacl
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacl/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Aclname 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNsacl: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$aclname", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nsacl -NitroPath nitro/v1/config -Resource $aclname -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNsacl: Finished"
    }
}

function Invoke-ADCUpdateNsacl {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for ACL entry resource.
    .PARAMETER Aclname
        Name for the extended ACL rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER Aclaction
        Action to perform on incoming IPv4 packets that match the extended ACL rule.
        Available settings function as follows:
        * ALLOW - The Citrix ADC processes the packet.
        * BRIDGE - The Citrix ADC bridges the packet to the destination without processing it.
        * DENY - The Citrix ADC drops the packet.
        Possible values = BRIDGE, DENY, ALLOW
    .PARAMETER Srcip
        IP address or range of IP addresses to match against the source IP address of an incoming IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 10.102.29.30-10.102.29.189.
    .PARAMETER Srcipop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Srcipval
        IP address or range of IP addresses to match against the source IP address of an incoming IPv4 packet. In the command line interface, separate the range with a hyphen. For example:10.102.29.30-10.102.29.189.
    .PARAMETER Srcport
        Port number or range of port numbers to match against the source port number of an incoming IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
    .PARAMETER Srcportop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Srcportval
        Port number or range of port numbers to match against the source port number of an incoming IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
    .PARAMETER Destip
        IP address or range of IP addresses to match against the destination IP address of an incoming IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 10.102.29.30-10.102.29.189.
    .PARAMETER Destipop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Destipval
        IP address or range of IP addresses to match against the destination IP address of an incoming IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 10.102.29.30-10.102.29.189.
    .PARAMETER Destport
        Port number or range of port numbers to match against the destination port number of an incoming IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Destportop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Destportval
        Port number or range of port numbers to match against the destination port number of an incoming IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Srcmac
        MAC address to match against the source MAC address of an incoming IPv4 packet.
    .PARAMETER Srcmacmask
        Used to define range of Source MAC address. It takes string of 0 and 1, 0s are for exact match and 1s for wildcard. For matching first 3 bytes of MAC address, srcMacMask value "000000111111". .
    .PARAMETER Protocol
        Protocol to match against the protocol of an incoming IPv4 packet.
        Possible values = ICMP, IGMP, TCP, EGP, IGP, ARGUS, UDP, RDP, RSVP, EIGRP, L2TP, ISIS, GGP, IPoverIP, ST, CBT, BBN-RCC-M, NVP-II, PUP, EMCON, XNET, CHAOS, MUX, DCN-MEAS, HMP, PRM, XNS-IDP, TRUNK-1, TRUNK-2, LEAF-1, LEAF-2, IRTP, ISO-TP4, NETBLT, MFE-NSP, MERIT-INP, SEP, 3PC, IDPR, XTP, DDP, IDPR-CMTP, TP++, IL, IPv6, SDRP, IPv6-Route, IPv6-Frag, IDRP, GRE, MHRP, BNA, ESP, AH, I-NLSP, SWIPE, NARP, MOBILE, TLSP, SKIP, ICMPV6, IPv6-NoNx, IPv6-Opts, Any-Host-Internal-Protocol, CFTP, Any-Local-Network, SAT-EXPAK, KRYPTOLAN, RVD, IPPC, Any-Distributed-File-System, TFTP, VISA, IPCV, CPNX, CPHB, WSN, PVP, BR-SAT-MO, SUN-ND, WB-MON, WB-EXPAK, ISO-IP, VMTP, SECURE-VM, VINES, TTP, NSFNET-IG, DGP, TCF, OSPFIGP, Sprite-RP, LARP, MTP, AX.25, IPIP, MICP, SCC-SP, ETHERIP, Any-Private-Encryption-Scheme, GMTP, IFMP, PNNI, PIM, ARIS, SCPS, QNX, A/N, IPComp, SNP, Compaq-Pe, IPX-in-IP, VRRP, PGM, Any-0-Hop-Protocol, ENCAP, DDX, IATP, STP, SRP, UTI, SMP, SM, PTP, FIRE, CRTP, CRUDP, SSCOPMCE, IPLT, SPS, PIPE, SCTP, FC, RSVP-E2E-IGNORE, Mobility-Header, UDPLite
    .PARAMETER Protocolnumber
        Protocol to match against the protocol of an incoming IPv4 packet.
    .PARAMETER Icmptype
        ICMP Message type to match against the message type of an incoming ICMP packet. For example, to block DESTINATION UNREACHABLE messages, you must specify 3 as the ICMP type.
        Note: This parameter can be specified only for the ICMP protocol.
    .PARAMETER Icmpcode
        Code of a particular ICMP message type to match against the ICMP code of an incoming ICMP packet. For example, to block DESTINATION HOST UNREACHABLE messages, specify 3 as the ICMP type and 1 as the ICMP code.
        If you set this parameter, you must set the ICMP Type parameter.
    .PARAMETER Vlan
        ID of the VLAN. The Citrix ADC applies the ACL rule only to the incoming packets of the specified VLAN. If you do not specify a VLAN ID, the appliance applies the ACL rule to the incoming packets on all VLANs.
    .PARAMETER Vxlan
        ID of the VXLAN. The Citrix ADC applies the ACL rule only to the incoming packets of the specified VXLAN. If you do not specify a VXLAN ID, the appliance applies the ACL rule to the incoming packets on all VXLANs.
    .PARAMETER Interface
        ID of an interface. The Citrix ADC applies the ACL rule only to the incoming packets from the specified interface. If you do not specify any value, the appliance applies the ACL rule to the incoming packets of all interfaces.
    .PARAMETER Priority
        Priority for the extended ACL rule that determines the order in which it is evaluated relative to the other extended ACL rules. If you do not specify priorities while creating extended ACL rules, the ACL rules are evaluated in the order in which they are created.
    .PARAMETER Logstate
        Enable or disable logging of events related to the extended ACL rule. The log messages are stored in the configured syslog or auditlog server.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ratelimit
        Maximum number of log messages to be generated per second. If you set this parameter, you must enable the Log State parameter.
    .PARAMETER Established
        Allow only incoming TCP packets that have the ACK or RST bit set, if the action set for the ACL rule is ALLOW and these packets match the other conditions in the ACL rule.
    .PARAMETER Dfdhash
        Specifies the type hashmethod to be applied, to steer the packet to the FP of the packet.
        Possible values = SIP-SPORT-DIP-DPORT, SIP, DIP, SIP-DIP, SIP-SPORT, DIP-DPORT
    .PARAMETER Stateful
        If stateful option is enabled, transparent sessions are created for the traffic hitting this ACL and not hitting any other features like LB, INAT etc. .
        Possible values = YES, NO
    .PARAMETER PassThru
        Return details about the created nsacl item.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsacl -aclname <string>
        An example how to update nsacl configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsacl
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacl/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Aclname,

        [ValidateSet('BRIDGE', 'DENY', 'ALLOW')]
        [string]$Aclaction,

        [boolean]$Srcip,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Srcipop,

        [string]$Srcipval,

        [boolean]$Srcport,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Srcportop,

        [string]$Srcportval,

        [boolean]$Destip,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Destipop,

        [string]$Destipval,

        [boolean]$Destport,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Destportop,

        [string]$Destportval,

        [string]$Srcmac,

        [string]$Srcmacmask,

        [ValidateSet('ICMP', 'IGMP', 'TCP', 'EGP', 'IGP', 'ARGUS', 'UDP', 'RDP', 'RSVP', 'EIGRP', 'L2TP', 'ISIS', 'GGP', 'IPoverIP', 'ST', 'CBT', 'BBN-RCC-M', 'NVP-II', 'PUP', 'EMCON', 'XNET', 'CHAOS', 'MUX', 'DCN-MEAS', 'HMP', 'PRM', 'XNS-IDP', 'TRUNK-1', 'TRUNK-2', 'LEAF-1', 'LEAF-2', 'IRTP', 'ISO-TP4', 'NETBLT', 'MFE-NSP', 'MERIT-INP', 'SEP', '3PC', 'IDPR', 'XTP', 'DDP', 'IDPR-CMTP', 'TP++', 'IL', 'IPv6', 'SDRP', 'IPv6-Route', 'IPv6-Frag', 'IDRP', 'GRE', 'MHRP', 'BNA', 'ESP', 'AH', 'I-NLSP', 'SWIPE', 'NARP', 'MOBILE', 'TLSP', 'SKIP', 'ICMPV6', 'IPv6-NoNx', 'IPv6-Opts', 'Any-Host-Internal-Protocol', 'CFTP', 'Any-Local-Network', 'SAT-EXPAK', 'KRYPTOLAN', 'RVD', 'IPPC', 'Any-Distributed-File-System', 'TFTP', 'VISA', 'IPCV', 'CPNX', 'CPHB', 'WSN', 'PVP', 'BR-SAT-MO', 'SUN-ND', 'WB-MON', 'WB-EXPAK', 'ISO-IP', 'VMTP', 'SECURE-VM', 'VINES', 'TTP', 'NSFNET-IG', 'DGP', 'TCF', 'OSPFIGP', 'Sprite-RP', 'LARP', 'MTP', 'AX.25', 'IPIP', 'MICP', 'SCC-SP', 'ETHERIP', 'Any-Private-Encryption-Scheme', 'GMTP', 'IFMP', 'PNNI', 'PIM', 'ARIS', 'SCPS', 'QNX', 'A/N', 'IPComp', 'SNP', 'Compaq-Pe', 'IPX-in-IP', 'VRRP', 'PGM', 'Any-0-Hop-Protocol', 'ENCAP', 'DDX', 'IATP', 'STP', 'SRP', 'UTI', 'SMP', 'SM', 'PTP', 'FIRE', 'CRTP', 'CRUDP', 'SSCOPMCE', 'IPLT', 'SPS', 'PIPE', 'SCTP', 'FC', 'RSVP-E2E-IGNORE', 'Mobility-Header', 'UDPLite')]
        [string]$Protocol,

        [ValidateRange(1, 255)]
        [double]$Protocolnumber,

        [ValidateRange(0, 65536)]
        [double]$Icmptype,

        [ValidateRange(0, 65536)]
        [double]$Icmpcode,

        [ValidateRange(1, 4094)]
        [double]$Vlan,

        [ValidateRange(1, 16777215)]
        [double]$Vxlan,

        [string]$Interface,

        [ValidateRange(1, 100000)]
        [double]$Priority,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Logstate,

        [ValidateRange(1, 10000)]
        [double]$Ratelimit,

        [boolean]$Established,

        [ValidateSet('SIP-SPORT-DIP-DPORT', 'SIP', 'DIP', 'SIP-DIP', 'SIP-SPORT', 'DIP-DPORT')]
        [string]$Dfdhash,

        [ValidateSet('YES', 'NO')]
        [string]$Stateful,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsacl: Starting"
    }
    process {
        try {
            $payload = @{ aclname = $aclname }
            if ( $PSBoundParameters.ContainsKey('aclaction') ) { $payload.Add('aclaction', $aclaction) }
            if ( $PSBoundParameters.ContainsKey('srcip') ) { $payload.Add('srcip', $srcip) }
            if ( $PSBoundParameters.ContainsKey('srcipop') ) { $payload.Add('srcipop', $srcipop) }
            if ( $PSBoundParameters.ContainsKey('srcipval') ) { $payload.Add('srcipval', $srcipval) }
            if ( $PSBoundParameters.ContainsKey('srcport') ) { $payload.Add('srcport', $srcport) }
            if ( $PSBoundParameters.ContainsKey('srcportop') ) { $payload.Add('srcportop', $srcportop) }
            if ( $PSBoundParameters.ContainsKey('srcportval') ) { $payload.Add('srcportval', $srcportval) }
            if ( $PSBoundParameters.ContainsKey('destip') ) { $payload.Add('destip', $destip) }
            if ( $PSBoundParameters.ContainsKey('destipop') ) { $payload.Add('destipop', $destipop) }
            if ( $PSBoundParameters.ContainsKey('destipval') ) { $payload.Add('destipval', $destipval) }
            if ( $PSBoundParameters.ContainsKey('destport') ) { $payload.Add('destport', $destport) }
            if ( $PSBoundParameters.ContainsKey('destportop') ) { $payload.Add('destportop', $destportop) }
            if ( $PSBoundParameters.ContainsKey('destportval') ) { $payload.Add('destportval', $destportval) }
            if ( $PSBoundParameters.ContainsKey('srcmac') ) { $payload.Add('srcmac', $srcmac) }
            if ( $PSBoundParameters.ContainsKey('srcmacmask') ) { $payload.Add('srcmacmask', $srcmacmask) }
            if ( $PSBoundParameters.ContainsKey('protocol') ) { $payload.Add('protocol', $protocol) }
            if ( $PSBoundParameters.ContainsKey('protocolnumber') ) { $payload.Add('protocolnumber', $protocolnumber) }
            if ( $PSBoundParameters.ContainsKey('icmptype') ) { $payload.Add('icmptype', $icmptype) }
            if ( $PSBoundParameters.ContainsKey('icmpcode') ) { $payload.Add('icmpcode', $icmpcode) }
            if ( $PSBoundParameters.ContainsKey('vlan') ) { $payload.Add('vlan', $vlan) }
            if ( $PSBoundParameters.ContainsKey('vxlan') ) { $payload.Add('vxlan', $vxlan) }
            if ( $PSBoundParameters.ContainsKey('Interface') ) { $payload.Add('Interface', $Interface) }
            if ( $PSBoundParameters.ContainsKey('priority') ) { $payload.Add('priority', $priority) }
            if ( $PSBoundParameters.ContainsKey('logstate') ) { $payload.Add('logstate', $logstate) }
            if ( $PSBoundParameters.ContainsKey('ratelimit') ) { $payload.Add('ratelimit', $ratelimit) }
            if ( $PSBoundParameters.ContainsKey('established') ) { $payload.Add('established', $established) }
            if ( $PSBoundParameters.ContainsKey('dfdhash') ) { $payload.Add('dfdhash', $dfdhash) }
            if ( $PSBoundParameters.ContainsKey('stateful') ) { $payload.Add('stateful', $stateful) }
            if ( $PSCmdlet.ShouldProcess("nsacl", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsacl -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsacl -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsacl: Finished"
    }
}

function Invoke-ADCUnsetNsacl {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for ACL entry resource.
    .PARAMETER Aclname
        Name for the extended ACL rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER Srcip
        IP address or range of IP addresses to match against the source IP address of an incoming IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 10.102.29.30-10.102.29.189.
    .PARAMETER Srcport
        Port number or range of port numbers to match against the source port number of an incoming IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
    .PARAMETER Destip
        IP address or range of IP addresses to match against the destination IP address of an incoming IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 10.102.29.30-10.102.29.189.
    .PARAMETER Destport
        Port number or range of port numbers to match against the destination port number of an incoming IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Srcmac
        MAC address to match against the source MAC address of an incoming IPv4 packet.
    .PARAMETER Srcmacmask
        Used to define range of Source MAC address. It takes string of 0 and 1, 0s are for exact match and 1s for wildcard. For matching first 3 bytes of MAC address, srcMacMask value "000000111111". .
    .PARAMETER Protocol
        Protocol to match against the protocol of an incoming IPv4 packet.
        Possible values = ICMP, IGMP, TCP, EGP, IGP, ARGUS, UDP, RDP, RSVP, EIGRP, L2TP, ISIS, GGP, IPoverIP, ST, CBT, BBN-RCC-M, NVP-II, PUP, EMCON, XNET, CHAOS, MUX, DCN-MEAS, HMP, PRM, XNS-IDP, TRUNK-1, TRUNK-2, LEAF-1, LEAF-2, IRTP, ISO-TP4, NETBLT, MFE-NSP, MERIT-INP, SEP, 3PC, IDPR, XTP, DDP, IDPR-CMTP, TP++, IL, IPv6, SDRP, IPv6-Route, IPv6-Frag, IDRP, GRE, MHRP, BNA, ESP, AH, I-NLSP, SWIPE, NARP, MOBILE, TLSP, SKIP, ICMPV6, IPv6-NoNx, IPv6-Opts, Any-Host-Internal-Protocol, CFTP, Any-Local-Network, SAT-EXPAK, KRYPTOLAN, RVD, IPPC, Any-Distributed-File-System, TFTP, VISA, IPCV, CPNX, CPHB, WSN, PVP, BR-SAT-MO, SUN-ND, WB-MON, WB-EXPAK, ISO-IP, VMTP, SECURE-VM, VINES, TTP, NSFNET-IG, DGP, TCF, OSPFIGP, Sprite-RP, LARP, MTP, AX.25, IPIP, MICP, SCC-SP, ETHERIP, Any-Private-Encryption-Scheme, GMTP, IFMP, PNNI, PIM, ARIS, SCPS, QNX, A/N, IPComp, SNP, Compaq-Pe, IPX-in-IP, VRRP, PGM, Any-0-Hop-Protocol, ENCAP, DDX, IATP, STP, SRP, UTI, SMP, SM, PTP, FIRE, CRTP, CRUDP, SSCOPMCE, IPLT, SPS, PIPE, SCTP, FC, RSVP-E2E-IGNORE, Mobility-Header, UDPLite
    .PARAMETER Icmptype
        ICMP Message type to match against the message type of an incoming ICMP packet. For example, to block DESTINATION UNREACHABLE messages, you must specify 3 as the ICMP type.
        Note: This parameter can be specified only for the ICMP protocol.
    .PARAMETER Icmpcode
        Code of a particular ICMP message type to match against the ICMP code of an incoming ICMP packet. For example, to block DESTINATION HOST UNREACHABLE messages, specify 3 as the ICMP type and 1 as the ICMP code.
        If you set this parameter, you must set the ICMP Type parameter.
    .PARAMETER Vlan
        ID of the VLAN. The Citrix ADC applies the ACL rule only to the incoming packets of the specified VLAN. If you do not specify a VLAN ID, the appliance applies the ACL rule to the incoming packets on all VLANs.
    .PARAMETER Vxlan
        ID of the VXLAN. The Citrix ADC applies the ACL rule only to the incoming packets of the specified VXLAN. If you do not specify a VXLAN ID, the appliance applies the ACL rule to the incoming packets on all VXLANs.
    .PARAMETER Interface
        ID of an interface. The Citrix ADC applies the ACL rule only to the incoming packets from the specified interface. If you do not specify any value, the appliance applies the ACL rule to the incoming packets of all interfaces.
    .PARAMETER Logstate
        Enable or disable logging of events related to the extended ACL rule. The log messages are stored in the configured syslog or auditlog server.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ratelimit
        Maximum number of log messages to be generated per second. If you set this parameter, you must enable the Log State parameter.
    .PARAMETER Established
        Allow only incoming TCP packets that have the ACK or RST bit set, if the action set for the ACL rule is ALLOW and these packets match the other conditions in the ACL rule.
    .PARAMETER Stateful
        If stateful option is enabled, transparent sessions are created for the traffic hitting this ACL and not hitting any other features like LB, INAT etc. .
        Possible values = YES, NO
    .PARAMETER Dfdhash
        Specifies the type hashmethod to be applied, to steer the packet to the FP of the packet.
        Possible values = SIP-SPORT-DIP-DPORT, SIP, DIP, SIP-DIP, SIP-SPORT, DIP-DPORT
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNsacl -aclname <string>
        An example how to unset nsacl configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNsacl
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacl
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Aclname,

        [Boolean]$srcip,

        [Boolean]$srcport,

        [Boolean]$destip,

        [Boolean]$destport,

        [Boolean]$srcmac,

        [Boolean]$srcmacmask,

        [Boolean]$protocol,

        [Boolean]$icmptype,

        [Boolean]$icmpcode,

        [Boolean]$vlan,

        [Boolean]$vxlan,

        [Boolean]$Interface,

        [Boolean]$logstate,

        [Boolean]$ratelimit,

        [Boolean]$established,

        [Boolean]$stateful,

        [Boolean]$dfdhash 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNsacl: Starting"
    }
    process {
        try {
            $payload = @{ aclname = $aclname }
            if ( $PSBoundParameters.ContainsKey('srcip') ) { $payload.Add('srcip', $srcip) }
            if ( $PSBoundParameters.ContainsKey('srcport') ) { $payload.Add('srcport', $srcport) }
            if ( $PSBoundParameters.ContainsKey('destip') ) { $payload.Add('destip', $destip) }
            if ( $PSBoundParameters.ContainsKey('destport') ) { $payload.Add('destport', $destport) }
            if ( $PSBoundParameters.ContainsKey('srcmac') ) { $payload.Add('srcmac', $srcmac) }
            if ( $PSBoundParameters.ContainsKey('srcmacmask') ) { $payload.Add('srcmacmask', $srcmacmask) }
            if ( $PSBoundParameters.ContainsKey('protocol') ) { $payload.Add('protocol', $protocol) }
            if ( $PSBoundParameters.ContainsKey('icmptype') ) { $payload.Add('icmptype', $icmptype) }
            if ( $PSBoundParameters.ContainsKey('icmpcode') ) { $payload.Add('icmpcode', $icmpcode) }
            if ( $PSBoundParameters.ContainsKey('vlan') ) { $payload.Add('vlan', $vlan) }
            if ( $PSBoundParameters.ContainsKey('vxlan') ) { $payload.Add('vxlan', $vxlan) }
            if ( $PSBoundParameters.ContainsKey('Interface') ) { $payload.Add('Interface', $Interface) }
            if ( $PSBoundParameters.ContainsKey('logstate') ) { $payload.Add('logstate', $logstate) }
            if ( $PSBoundParameters.ContainsKey('ratelimit') ) { $payload.Add('ratelimit', $ratelimit) }
            if ( $PSBoundParameters.ContainsKey('established') ) { $payload.Add('established', $established) }
            if ( $PSBoundParameters.ContainsKey('stateful') ) { $payload.Add('stateful', $stateful) }
            if ( $PSBoundParameters.ContainsKey('dfdhash') ) { $payload.Add('dfdhash', $dfdhash) }
            if ( $PSCmdlet.ShouldProcess("$aclname", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nsacl -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNsacl: Finished"
    }
}

function Invoke-ADCEnableNsacl {
    <#
    .SYNOPSIS
        Enable NS configuration Object.
    .DESCRIPTION
        Configuration for ACL entry resource.
    .PARAMETER Aclname
        Name for the extended ACL rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .EXAMPLE
        PS C:\>Invoke-ADCEnableNsacl -aclname <string>
        An example how to enable nsacl configuration Object(s).
    .NOTES
        File Name : Invoke-ADCEnableNsacl
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacl/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Aclname 

    )
    begin {
        Write-Verbose "Invoke-ADCEnableNsacl: Starting"
    }
    process {
        try {
            $payload = @{ aclname = $aclname }

            if ( $PSCmdlet.ShouldProcess($Name, "Enable NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsacl -Action enable -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCEnableNsacl: Finished"
    }
}

function Invoke-ADCDisableNsacl {
    <#
    .SYNOPSIS
        Disable NS configuration Object.
    .DESCRIPTION
        Configuration for ACL entry resource.
    .PARAMETER Aclname
        Name for the extended ACL rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .EXAMPLE
        PS C:\>Invoke-ADCDisableNsacl -aclname <string>
        An example how to disable nsacl configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDisableNsacl
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacl/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Aclname 

    )
    begin {
        Write-Verbose "Invoke-ADCDisableNsacl: Starting"
    }
    process {
        try {
            $payload = @{ aclname = $aclname }

            if ( $PSCmdlet.ShouldProcess($Name, "Disable NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsacl -Action disable -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDisableNsacl: Finished"
    }
}

function Invoke-ADCRenameNsacl {
    <#
    .SYNOPSIS
        Rename NS configuration Object.
    .DESCRIPTION
        Configuration for ACL entry resource.
    .PARAMETER Aclname
        Name for the extended ACL rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER Newname
        New name for the extended ACL rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER PassThru
        Return details about the created nsacl item.
    .EXAMPLE
        PS C:\>Invoke-ADCRenameNsacl -aclname <string> -newname <string>
        An example how to rename nsacl configuration Object(s).
    .NOTES
        File Name : Invoke-ADCRenameNsacl
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacl/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Aclname,

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Newname,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCRenameNsacl: Starting"
    }
    process {
        try {
            $payload = @{ aclname = $aclname
                newname           = $newname
            }

            if ( $PSCmdlet.ShouldProcess("nsacl", "Rename NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsacl -Action rename -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsacl -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCRenameNsacl: Finished"
    }
}

function Invoke-ADCGetNsacl {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for ACL entry resource.
    .PARAMETER Aclname
        Name for the extended ACL rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER GetAll
        Retrieve all nsacl object(s).
    .PARAMETER Count
        If specified, the count of the nsacl object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsacl
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsacl -GetAll
        Get all nsacl data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsacl -Count
        Get the number of nsacl objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsacl -name <string>
        Get nsacl object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsacl -Filter @{ 'name'='<value>' }
        Get nsacl data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsacl
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacl/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Aclname,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNsacl: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsacl objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsacl -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsacl objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsacl -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsacl objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsacl -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsacl configuration for property 'aclname'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsacl -NitroPath nitro/v1/config -Resource $aclname -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nsacl configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsacl -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsacl: Ended"
    }
}

function Invoke-ADCAddNsacl6 {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for ACL6 entry resource.
    .PARAMETER Acl6name
        Name for the ACL6 rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER Acl6action
        Action to perform on the incoming IPv6 packets that match the ACL6 rule.
        Available settings function as follows:
        * ALLOW - The Citrix ADC processes the packet.
        * BRIDGE - The Citrix ADC bridges the packet to the destination without processing it.
        * DENY - The Citrix ADC drops the packet.
        Possible values = BRIDGE, DENY, ALLOW
    .PARAMETER Td
        Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0.
    .PARAMETER Srcipv6
        IP address or range of IP addresses to match against the source IP address of an incoming IPv6 packet. In the command line interface, separate the range with a hyphen.
    .PARAMETER Srcipop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Srcipv6val
        Source IPv6 address (range).
    .PARAMETER Srcport
        Port number or range of port numbers to match against the source port number of an incoming IPv6 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Srcportop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Srcportval
        Source port (range).
    .PARAMETER Destipv6
        IP address or range of IP addresses to match against the destination IP address of an incoming IPv6 packet. In the command line interface, separate the range with a hyphen.
    .PARAMETER Destipop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Destipv6val
        Destination IPv6 address (range).
    .PARAMETER Destport
        Port number or range of port numbers to match against the destination port number of an incoming IPv6 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Destportop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Destportval
        Destination port (range).
    .PARAMETER Ttl
        Time to expire this ACL6 (in seconds).
    .PARAMETER Srcmac
        MAC address to match against the source MAC address of an incoming IPv6 packet.
    .PARAMETER Srcmacmask
        Used to define range of Source MAC address. It takes string of 0 and 1, 0s are for exact match and 1s for wildcard. For matching first 3 bytes of MAC address, srcMacMask value "000000111111". .
    .PARAMETER Protocol
        Protocol, identified by protocol name, to match against the protocol of an incoming IPv6 packet.
        Possible values = ICMPV6, TCP, UDP, ICMP, IGMP, EGP, IGP, ARGUS, RDP, RSVP, EIGRP, L2TP, ISIS, GGP, IPoverIP, ST, CBT, BBN-RCC-M, NVP-II, PUP, EMCON, XNET, CHAOS, MUX, DCN-MEAS, HMP, PRM, XNS-IDP, TRUNK-1, TRUNK-2, LEAF-1, LEAF-2, IRTP, ISO-TP4, NETBLT, MFE-NSP, MERIT-INP, SEP, 3PC, IDPR, XTP, DDP, IDPR-CMTP, TP++, IL, IPv6, SDRP, IPv6-Route, IPv6-Frag, IDRP, GRE, MHRP, BNA, ESP, AH, I-NLSP, SWIPE, NARP, MOBILE, TLSP, SKIP, IPv6-NoNx, IPv6-Opts, Any-Host-Internal-Protocol, CFTP, Any-Local-Network, SAT-EXPAK, KRYPTOLAN, RVD, IPPC, Any-Distributed-File-System, TFTP, VISA, IPCV, CPNX, CPHB, WSN, PVP, BR-SAT-MO, SUN-ND, WB-MON, WB-EXPAK, ISO-IP, VMTP, SECURE-VM, VINES, TTP, NSFNET-IG, DGP, TCF, OSPFIGP, Sprite-RP, LARP, MTP, AX.25, IPIP, MICP, SCC-SP, ETHERIP, Any-Private-Encryption-Scheme, GMTP, IFMP, PNNI, PIM, ARIS, SCPS, QNX, A/N, IPComp, SNP, Compaq-Pe, IPX-in-IP, VRRP, PGM, Any-0-Hop-Protocol, ENCAP, DDX, IATP, STP, SRP, UTI, SMP, SM, PTP, FIRE, CRTP, CRUDP, SSCOPMCE, IPLT, SPS, PIPE, SCTP, FC, RSVP-E2E-IGNORE, Mobility-Header, UDPLite
    .PARAMETER Protocolnumber
        Protocol, identified by protocol number, to match against the protocol of an incoming IPv6 packet.
    .PARAMETER Vlan
        ID of the VLAN. The Citrix ADC applies the ACL6 rule only to the incoming packets on the specified VLAN. If you do not specify a VLAN ID, the appliance applies the ACL6 rule to the incoming packets on all VLANs.
    .PARAMETER Vxlan
        ID of the VXLAN. The Citrix ADC applies the ACL6 rule only to the incoming packets on the specified VXLAN. If you do not specify a VXLAN ID, the appliance applies the ACL6 rule to the incoming packets on all VXLANs.
    .PARAMETER Interface
        ID of an interface. The Citrix ADC applies the ACL6 rule only to the incoming packets from the specified interface. If you do not specify any value, the appliance applies the ACL6 rule to the incoming packets from all interfaces.
    .PARAMETER Established
        Allow only incoming TCP packets that have the ACK or RST bit set if the action set for the ACL6 rule is ALLOW and these packets match the other conditions in the ACL6 rule.
    .PARAMETER Icmptype
        ICMP Message type to match against the message type of an incoming IPv6 ICMP packet. For example, to block DESTINATION UNREACHABLE messages, you must specify 3 as the ICMP type.
        Note: This parameter can be specified only for the ICMP protocol.
    .PARAMETER Icmpcode
        Code of a particular ICMP message type to match against the ICMP code of an incoming IPv6 ICMP packet. For example, to block DESTINATION HOST UNREACHABLE messages, specify 3 as the ICMP type and 1 as the ICMP code.
        If you set this parameter, you must set the ICMP Type parameter.
    .PARAMETER Priority
        Priority for the ACL6 rule, which determines the order in which it is evaluated relative to the other ACL6 rules. If you do not specify priorities while creating ACL6 rules, the ACL6 rules are evaluated in the order in which they are created.
    .PARAMETER State
        State of the ACL6.
        Possible values = ENABLED, DISABLED
    .PARAMETER Type
        Type of the acl6,default will be CLASSIC.
        Available options as follows:
        * CLASSIC - specifies the regular extended acls.
        * DFD - cluster specific acls,specifies hashmethod for steering of the packet in cluster .
        Possible values = CLASSIC, DFD
    .PARAMETER Dfdhash
        Specifies the type of hashmethod to be applied, to steer the packet to the FP of the packet.
        Possible values = SIP-SPORT-DIP-DPORT, SIP, DIP, SIP-DIP, SIP-SPORT, DIP-DPORT
    .PARAMETER Dfdprefix
        hashprefix to be applied to SIP/DIP to generate rsshash FP.eg 128 => hash calculated on the complete IP.
    .PARAMETER Stateful
        If stateful option is enabled, transparent sessions are created for the traffic hitting this ACL6 and not hitting any other features like LB, INAT etc. .
        Possible values = YES, NO
    .PARAMETER Logstate
        Enable or disable logging of events related to the ACL6 rule. The log messages are stored in the configured syslog or auditlog server.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ratelimit
        Maximum number of log messages to be generated per second. If you set this parameter, you must enable the Log State parameter.
    .PARAMETER PassThru
        Return details about the created nsacl6 item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNsacl6 -acl6name <string> -acl6action <string>
        An example how to add nsacl6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNsacl6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacl6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Acl6name,

        [Parameter(Mandatory)]
        [ValidateSet('BRIDGE', 'DENY', 'ALLOW')]
        [string]$Acl6action,

        [ValidateRange(0, 4094)]
        [double]$Td,

        [boolean]$Srcipv6,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Srcipop,

        [string]$Srcipv6val,

        [boolean]$Srcport,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Srcportop,

        [string]$Srcportval,

        [boolean]$Destipv6,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Destipop,

        [string]$Destipv6val,

        [boolean]$Destport,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Destportop,

        [string]$Destportval,

        [ValidateRange(1, 2147483647)]
        [double]$Ttl,

        [string]$Srcmac,

        [string]$Srcmacmask = '"000000000000"',

        [ValidateSet('ICMPV6', 'TCP', 'UDP', 'ICMP', 'IGMP', 'EGP', 'IGP', 'ARGUS', 'RDP', 'RSVP', 'EIGRP', 'L2TP', 'ISIS', 'GGP', 'IPoverIP', 'ST', 'CBT', 'BBN-RCC-M', 'NVP-II', 'PUP', 'EMCON', 'XNET', 'CHAOS', 'MUX', 'DCN-MEAS', 'HMP', 'PRM', 'XNS-IDP', 'TRUNK-1', 'TRUNK-2', 'LEAF-1', 'LEAF-2', 'IRTP', 'ISO-TP4', 'NETBLT', 'MFE-NSP', 'MERIT-INP', 'SEP', '3PC', 'IDPR', 'XTP', 'DDP', 'IDPR-CMTP', 'TP++', 'IL', 'IPv6', 'SDRP', 'IPv6-Route', 'IPv6-Frag', 'IDRP', 'GRE', 'MHRP', 'BNA', 'ESP', 'AH', 'I-NLSP', 'SWIPE', 'NARP', 'MOBILE', 'TLSP', 'SKIP', 'IPv6-NoNx', 'IPv6-Opts', 'Any-Host-Internal-Protocol', 'CFTP', 'Any-Local-Network', 'SAT-EXPAK', 'KRYPTOLAN', 'RVD', 'IPPC', 'Any-Distributed-File-System', 'TFTP', 'VISA', 'IPCV', 'CPNX', 'CPHB', 'WSN', 'PVP', 'BR-SAT-MO', 'SUN-ND', 'WB-MON', 'WB-EXPAK', 'ISO-IP', 'VMTP', 'SECURE-VM', 'VINES', 'TTP', 'NSFNET-IG', 'DGP', 'TCF', 'OSPFIGP', 'Sprite-RP', 'LARP', 'MTP', 'AX.25', 'IPIP', 'MICP', 'SCC-SP', 'ETHERIP', 'Any-Private-Encryption-Scheme', 'GMTP', 'IFMP', 'PNNI', 'PIM', 'ARIS', 'SCPS', 'QNX', 'A/N', 'IPComp', 'SNP', 'Compaq-Pe', 'IPX-in-IP', 'VRRP', 'PGM', 'Any-0-Hop-Protocol', 'ENCAP', 'DDX', 'IATP', 'STP', 'SRP', 'UTI', 'SMP', 'SM', 'PTP', 'FIRE', 'CRTP', 'CRUDP', 'SSCOPMCE', 'IPLT', 'SPS', 'PIPE', 'SCTP', 'FC', 'RSVP-E2E-IGNORE', 'Mobility-Header', 'UDPLite')]
        [string]$Protocol,

        [ValidateRange(1, 255)]
        [double]$Protocolnumber,

        [ValidateRange(1, 4094)]
        [double]$Vlan,

        [ValidateRange(1, 16777215)]
        [double]$Vxlan,

        [string]$Interface,

        [boolean]$Established,

        [ValidateRange(0, 65536)]
        [double]$Icmptype,

        [ValidateRange(0, 65536)]
        [double]$Icmpcode,

        [ValidateRange(1, 81920)]
        [double]$Priority,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$State = 'ENABLED',

        [ValidateSet('CLASSIC', 'DFD')]
        [string]$Type = 'CLASSIC',

        [ValidateSet('SIP-SPORT-DIP-DPORT', 'SIP', 'DIP', 'SIP-DIP', 'SIP-SPORT', 'DIP-DPORT')]
        [string]$Dfdhash,

        [ValidateRange(1, 128)]
        [double]$Dfdprefix = '128',

        [ValidateSet('YES', 'NO')]
        [string]$Stateful = 'NO',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Logstate = 'DISABLED',

        [ValidateRange(1, 10000)]
        [double]$Ratelimit = '100',

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNsacl6: Starting"
    }
    process {
        try {
            $payload = @{ acl6name = $acl6name
                acl6action         = $acl6action
            }
            if ( $PSBoundParameters.ContainsKey('td') ) { $payload.Add('td', $td) }
            if ( $PSBoundParameters.ContainsKey('srcipv6') ) { $payload.Add('srcipv6', $srcipv6) }
            if ( $PSBoundParameters.ContainsKey('srcipop') ) { $payload.Add('srcipop', $srcipop) }
            if ( $PSBoundParameters.ContainsKey('srcipv6val') ) { $payload.Add('srcipv6val', $srcipv6val) }
            if ( $PSBoundParameters.ContainsKey('srcport') ) { $payload.Add('srcport', $srcport) }
            if ( $PSBoundParameters.ContainsKey('srcportop') ) { $payload.Add('srcportop', $srcportop) }
            if ( $PSBoundParameters.ContainsKey('srcportval') ) { $payload.Add('srcportval', $srcportval) }
            if ( $PSBoundParameters.ContainsKey('destipv6') ) { $payload.Add('destipv6', $destipv6) }
            if ( $PSBoundParameters.ContainsKey('destipop') ) { $payload.Add('destipop', $destipop) }
            if ( $PSBoundParameters.ContainsKey('destipv6val') ) { $payload.Add('destipv6val', $destipv6val) }
            if ( $PSBoundParameters.ContainsKey('destport') ) { $payload.Add('destport', $destport) }
            if ( $PSBoundParameters.ContainsKey('destportop') ) { $payload.Add('destportop', $destportop) }
            if ( $PSBoundParameters.ContainsKey('destportval') ) { $payload.Add('destportval', $destportval) }
            if ( $PSBoundParameters.ContainsKey('ttl') ) { $payload.Add('ttl', $ttl) }
            if ( $PSBoundParameters.ContainsKey('srcmac') ) { $payload.Add('srcmac', $srcmac) }
            if ( $PSBoundParameters.ContainsKey('srcmacmask') ) { $payload.Add('srcmacmask', $srcmacmask) }
            if ( $PSBoundParameters.ContainsKey('protocol') ) { $payload.Add('protocol', $protocol) }
            if ( $PSBoundParameters.ContainsKey('protocolnumber') ) { $payload.Add('protocolnumber', $protocolnumber) }
            if ( $PSBoundParameters.ContainsKey('vlan') ) { $payload.Add('vlan', $vlan) }
            if ( $PSBoundParameters.ContainsKey('vxlan') ) { $payload.Add('vxlan', $vxlan) }
            if ( $PSBoundParameters.ContainsKey('Interface') ) { $payload.Add('Interface', $Interface) }
            if ( $PSBoundParameters.ContainsKey('established') ) { $payload.Add('established', $established) }
            if ( $PSBoundParameters.ContainsKey('icmptype') ) { $payload.Add('icmptype', $icmptype) }
            if ( $PSBoundParameters.ContainsKey('icmpcode') ) { $payload.Add('icmpcode', $icmpcode) }
            if ( $PSBoundParameters.ContainsKey('priority') ) { $payload.Add('priority', $priority) }
            if ( $PSBoundParameters.ContainsKey('state') ) { $payload.Add('state', $state) }
            if ( $PSBoundParameters.ContainsKey('type') ) { $payload.Add('type', $type) }
            if ( $PSBoundParameters.ContainsKey('dfdhash') ) { $payload.Add('dfdhash', $dfdhash) }
            if ( $PSBoundParameters.ContainsKey('dfdprefix') ) { $payload.Add('dfdprefix', $dfdprefix) }
            if ( $PSBoundParameters.ContainsKey('stateful') ) { $payload.Add('stateful', $stateful) }
            if ( $PSBoundParameters.ContainsKey('logstate') ) { $payload.Add('logstate', $logstate) }
            if ( $PSBoundParameters.ContainsKey('ratelimit') ) { $payload.Add('ratelimit', $ratelimit) }
            if ( $PSCmdlet.ShouldProcess("nsacl6", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsacl6 -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsacl6 -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNsacl6: Finished"
    }
}

function Invoke-ADCDeleteNsacl6 {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for ACL6 entry resource.
    .PARAMETER Acl6name
        Name for the ACL6 rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNsacl6 -Acl6name <string>
        An example how to delete nsacl6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNsacl6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacl6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Acl6name 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNsacl6: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$acl6name", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nsacl6 -NitroPath nitro/v1/config -Resource $acl6name -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNsacl6: Finished"
    }
}

function Invoke-ADCUpdateNsacl6 {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for ACL6 entry resource.
    .PARAMETER Acl6name
        Name for the ACL6 rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER Aclaction
        Action associated with the ACL6.
        Possible values = BRIDGE, DENY, ALLOW
    .PARAMETER Srcipv6
        IP address or range of IP addresses to match against the source IP address of an incoming IPv6 packet. In the command line interface, separate the range with a hyphen.
    .PARAMETER Srcipop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Srcipv6val
        Source IPv6 address (range).
    .PARAMETER Srcport
        Port number or range of port numbers to match against the source port number of an incoming IPv6 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Srcportop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Srcportval
        Source port (range).
    .PARAMETER Destipv6
        IP address or range of IP addresses to match against the destination IP address of an incoming IPv6 packet. In the command line interface, separate the range with a hyphen.
    .PARAMETER Destipop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Destipv6val
        Destination IPv6 address (range).
    .PARAMETER Destport
        Port number or range of port numbers to match against the destination port number of an incoming IPv6 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Destportop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Destportval
        Destination port (range).
    .PARAMETER Srcmac
        MAC address to match against the source MAC address of an incoming IPv6 packet.
    .PARAMETER Srcmacmask
        Used to define range of Source MAC address. It takes string of 0 and 1, 0s are for exact match and 1s for wildcard. For matching first 3 bytes of MAC address, srcMacMask value "000000111111". .
    .PARAMETER Protocol
        Protocol, identified by protocol name, to match against the protocol of an incoming IPv6 packet.
        Possible values = ICMPV6, TCP, UDP, ICMP, IGMP, EGP, IGP, ARGUS, RDP, RSVP, EIGRP, L2TP, ISIS, GGP, IPoverIP, ST, CBT, BBN-RCC-M, NVP-II, PUP, EMCON, XNET, CHAOS, MUX, DCN-MEAS, HMP, PRM, XNS-IDP, TRUNK-1, TRUNK-2, LEAF-1, LEAF-2, IRTP, ISO-TP4, NETBLT, MFE-NSP, MERIT-INP, SEP, 3PC, IDPR, XTP, DDP, IDPR-CMTP, TP++, IL, IPv6, SDRP, IPv6-Route, IPv6-Frag, IDRP, GRE, MHRP, BNA, ESP, AH, I-NLSP, SWIPE, NARP, MOBILE, TLSP, SKIP, IPv6-NoNx, IPv6-Opts, Any-Host-Internal-Protocol, CFTP, Any-Local-Network, SAT-EXPAK, KRYPTOLAN, RVD, IPPC, Any-Distributed-File-System, TFTP, VISA, IPCV, CPNX, CPHB, WSN, PVP, BR-SAT-MO, SUN-ND, WB-MON, WB-EXPAK, ISO-IP, VMTP, SECURE-VM, VINES, TTP, NSFNET-IG, DGP, TCF, OSPFIGP, Sprite-RP, LARP, MTP, AX.25, IPIP, MICP, SCC-SP, ETHERIP, Any-Private-Encryption-Scheme, GMTP, IFMP, PNNI, PIM, ARIS, SCPS, QNX, A/N, IPComp, SNP, Compaq-Pe, IPX-in-IP, VRRP, PGM, Any-0-Hop-Protocol, ENCAP, DDX, IATP, STP, SRP, UTI, SMP, SM, PTP, FIRE, CRTP, CRUDP, SSCOPMCE, IPLT, SPS, PIPE, SCTP, FC, RSVP-E2E-IGNORE, Mobility-Header, UDPLite
    .PARAMETER Protocolnumber
        Protocol, identified by protocol number, to match against the protocol of an incoming IPv6 packet.
    .PARAMETER Icmptype
        ICMP Message type to match against the message type of an incoming IPv6 ICMP packet. For example, to block DESTINATION UNREACHABLE messages, you must specify 3 as the ICMP type.
        Note: This parameter can be specified only for the ICMP protocol.
    .PARAMETER Icmpcode
        Code of a particular ICMP message type to match against the ICMP code of an incoming IPv6 ICMP packet. For example, to block DESTINATION HOST UNREACHABLE messages, specify 3 as the ICMP type and 1 as the ICMP code.
        If you set this parameter, you must set the ICMP Type parameter.
    .PARAMETER Vlan
        ID of the VLAN. The Citrix ADC applies the ACL6 rule only to the incoming packets on the specified VLAN. If you do not specify a VLAN ID, the appliance applies the ACL6 rule to the incoming packets on all VLANs.
    .PARAMETER Vxlan
        ID of the VXLAN. The Citrix ADC applies the ACL6 rule only to the incoming packets on the specified VXLAN. If you do not specify a VXLAN ID, the appliance applies the ACL6 rule to the incoming packets on all VXLANs.
    .PARAMETER Interface
        ID of an interface. The Citrix ADC applies the ACL6 rule only to the incoming packets from the specified interface. If you do not specify any value, the appliance applies the ACL6 rule to the incoming packets from all interfaces.
    .PARAMETER Priority
        Priority for the ACL6 rule, which determines the order in which it is evaluated relative to the other ACL6 rules. If you do not specify priorities while creating ACL6 rules, the ACL6 rules are evaluated in the order in which they are created.
    .PARAMETER Logstate
        Enable or disable logging of events related to the ACL6 rule. The log messages are stored in the configured syslog or auditlog server.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ratelimit
        Maximum number of log messages to be generated per second. If you set this parameter, you must enable the Log State parameter.
    .PARAMETER Established
        Allow only incoming TCP packets that have the ACK or RST bit set if the action set for the ACL6 rule is ALLOW and these packets match the other conditions in the ACL6 rule.
    .PARAMETER Dfdhash
        Specifies the type of hashmethod to be applied, to steer the packet to the FP of the packet.
        Possible values = SIP-SPORT-DIP-DPORT, SIP, DIP, SIP-DIP, SIP-SPORT, DIP-DPORT
    .PARAMETER Dfdprefix
        hashprefix to be applied to SIP/DIP to generate rsshash FP.eg 128 => hash calculated on the complete IP.
    .PARAMETER Stateful
        If stateful option is enabled, transparent sessions are created for the traffic hitting this ACL6 and not hitting any other features like LB, INAT etc. .
        Possible values = YES, NO
    .PARAMETER PassThru
        Return details about the created nsacl6 item.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsacl6 -acl6name <string>
        An example how to update nsacl6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsacl6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacl6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Acl6name,

        [ValidateSet('BRIDGE', 'DENY', 'ALLOW')]
        [string]$Aclaction,

        [boolean]$Srcipv6,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Srcipop,

        [string]$Srcipv6val,

        [boolean]$Srcport,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Srcportop,

        [string]$Srcportval,

        [boolean]$Destipv6,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Destipop,

        [string]$Destipv6val,

        [boolean]$Destport,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Destportop,

        [string]$Destportval,

        [string]$Srcmac,

        [string]$Srcmacmask,

        [ValidateSet('ICMPV6', 'TCP', 'UDP', 'ICMP', 'IGMP', 'EGP', 'IGP', 'ARGUS', 'RDP', 'RSVP', 'EIGRP', 'L2TP', 'ISIS', 'GGP', 'IPoverIP', 'ST', 'CBT', 'BBN-RCC-M', 'NVP-II', 'PUP', 'EMCON', 'XNET', 'CHAOS', 'MUX', 'DCN-MEAS', 'HMP', 'PRM', 'XNS-IDP', 'TRUNK-1', 'TRUNK-2', 'LEAF-1', 'LEAF-2', 'IRTP', 'ISO-TP4', 'NETBLT', 'MFE-NSP', 'MERIT-INP', 'SEP', '3PC', 'IDPR', 'XTP', 'DDP', 'IDPR-CMTP', 'TP++', 'IL', 'IPv6', 'SDRP', 'IPv6-Route', 'IPv6-Frag', 'IDRP', 'GRE', 'MHRP', 'BNA', 'ESP', 'AH', 'I-NLSP', 'SWIPE', 'NARP', 'MOBILE', 'TLSP', 'SKIP', 'IPv6-NoNx', 'IPv6-Opts', 'Any-Host-Internal-Protocol', 'CFTP', 'Any-Local-Network', 'SAT-EXPAK', 'KRYPTOLAN', 'RVD', 'IPPC', 'Any-Distributed-File-System', 'TFTP', 'VISA', 'IPCV', 'CPNX', 'CPHB', 'WSN', 'PVP', 'BR-SAT-MO', 'SUN-ND', 'WB-MON', 'WB-EXPAK', 'ISO-IP', 'VMTP', 'SECURE-VM', 'VINES', 'TTP', 'NSFNET-IG', 'DGP', 'TCF', 'OSPFIGP', 'Sprite-RP', 'LARP', 'MTP', 'AX.25', 'IPIP', 'MICP', 'SCC-SP', 'ETHERIP', 'Any-Private-Encryption-Scheme', 'GMTP', 'IFMP', 'PNNI', 'PIM', 'ARIS', 'SCPS', 'QNX', 'A/N', 'IPComp', 'SNP', 'Compaq-Pe', 'IPX-in-IP', 'VRRP', 'PGM', 'Any-0-Hop-Protocol', 'ENCAP', 'DDX', 'IATP', 'STP', 'SRP', 'UTI', 'SMP', 'SM', 'PTP', 'FIRE', 'CRTP', 'CRUDP', 'SSCOPMCE', 'IPLT', 'SPS', 'PIPE', 'SCTP', 'FC', 'RSVP-E2E-IGNORE', 'Mobility-Header', 'UDPLite')]
        [string]$Protocol,

        [ValidateRange(1, 255)]
        [double]$Protocolnumber,

        [ValidateRange(0, 65536)]
        [double]$Icmptype,

        [ValidateRange(0, 65536)]
        [double]$Icmpcode,

        [ValidateRange(1, 4094)]
        [double]$Vlan,

        [ValidateRange(1, 16777215)]
        [double]$Vxlan,

        [string]$Interface,

        [ValidateRange(1, 81920)]
        [double]$Priority,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Logstate,

        [ValidateRange(1, 10000)]
        [double]$Ratelimit,

        [boolean]$Established,

        [ValidateSet('SIP-SPORT-DIP-DPORT', 'SIP', 'DIP', 'SIP-DIP', 'SIP-SPORT', 'DIP-DPORT')]
        [string]$Dfdhash,

        [ValidateRange(1, 128)]
        [double]$Dfdprefix,

        [ValidateSet('YES', 'NO')]
        [string]$Stateful,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsacl6: Starting"
    }
    process {
        try {
            $payload = @{ acl6name = $acl6name }
            if ( $PSBoundParameters.ContainsKey('aclaction') ) { $payload.Add('aclaction', $aclaction) }
            if ( $PSBoundParameters.ContainsKey('srcipv6') ) { $payload.Add('srcipv6', $srcipv6) }
            if ( $PSBoundParameters.ContainsKey('srcipop') ) { $payload.Add('srcipop', $srcipop) }
            if ( $PSBoundParameters.ContainsKey('srcipv6val') ) { $payload.Add('srcipv6val', $srcipv6val) }
            if ( $PSBoundParameters.ContainsKey('srcport') ) { $payload.Add('srcport', $srcport) }
            if ( $PSBoundParameters.ContainsKey('srcportop') ) { $payload.Add('srcportop', $srcportop) }
            if ( $PSBoundParameters.ContainsKey('srcportval') ) { $payload.Add('srcportval', $srcportval) }
            if ( $PSBoundParameters.ContainsKey('destipv6') ) { $payload.Add('destipv6', $destipv6) }
            if ( $PSBoundParameters.ContainsKey('destipop') ) { $payload.Add('destipop', $destipop) }
            if ( $PSBoundParameters.ContainsKey('destipv6val') ) { $payload.Add('destipv6val', $destipv6val) }
            if ( $PSBoundParameters.ContainsKey('destport') ) { $payload.Add('destport', $destport) }
            if ( $PSBoundParameters.ContainsKey('destportop') ) { $payload.Add('destportop', $destportop) }
            if ( $PSBoundParameters.ContainsKey('destportval') ) { $payload.Add('destportval', $destportval) }
            if ( $PSBoundParameters.ContainsKey('srcmac') ) { $payload.Add('srcmac', $srcmac) }
            if ( $PSBoundParameters.ContainsKey('srcmacmask') ) { $payload.Add('srcmacmask', $srcmacmask) }
            if ( $PSBoundParameters.ContainsKey('protocol') ) { $payload.Add('protocol', $protocol) }
            if ( $PSBoundParameters.ContainsKey('protocolnumber') ) { $payload.Add('protocolnumber', $protocolnumber) }
            if ( $PSBoundParameters.ContainsKey('icmptype') ) { $payload.Add('icmptype', $icmptype) }
            if ( $PSBoundParameters.ContainsKey('icmpcode') ) { $payload.Add('icmpcode', $icmpcode) }
            if ( $PSBoundParameters.ContainsKey('vlan') ) { $payload.Add('vlan', $vlan) }
            if ( $PSBoundParameters.ContainsKey('vxlan') ) { $payload.Add('vxlan', $vxlan) }
            if ( $PSBoundParameters.ContainsKey('Interface') ) { $payload.Add('Interface', $Interface) }
            if ( $PSBoundParameters.ContainsKey('priority') ) { $payload.Add('priority', $priority) }
            if ( $PSBoundParameters.ContainsKey('logstate') ) { $payload.Add('logstate', $logstate) }
            if ( $PSBoundParameters.ContainsKey('ratelimit') ) { $payload.Add('ratelimit', $ratelimit) }
            if ( $PSBoundParameters.ContainsKey('established') ) { $payload.Add('established', $established) }
            if ( $PSBoundParameters.ContainsKey('dfdhash') ) { $payload.Add('dfdhash', $dfdhash) }
            if ( $PSBoundParameters.ContainsKey('dfdprefix') ) { $payload.Add('dfdprefix', $dfdprefix) }
            if ( $PSBoundParameters.ContainsKey('stateful') ) { $payload.Add('stateful', $stateful) }
            if ( $PSCmdlet.ShouldProcess("nsacl6", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsacl6 -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsacl6 -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsacl6: Finished"
    }
}

function Invoke-ADCUnsetNsacl6 {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for ACL6 entry resource.
    .PARAMETER Acl6name
        Name for the ACL6 rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER Srcipv6
        IP address or range of IP addresses to match against the source IP address of an incoming IPv6 packet. In the command line interface, separate the range with a hyphen.
    .PARAMETER Srcport
        Port number or range of port numbers to match against the source port number of an incoming IPv6 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Destipv6
        IP address or range of IP addresses to match against the destination IP address of an incoming IPv6 packet. In the command line interface, separate the range with a hyphen.
    .PARAMETER Destport
        Port number or range of port numbers to match against the destination port number of an incoming IPv6 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Srcmac
        MAC address to match against the source MAC address of an incoming IPv6 packet.
    .PARAMETER Srcmacmask
        Used to define range of Source MAC address. It takes string of 0 and 1, 0s are for exact match and 1s for wildcard. For matching first 3 bytes of MAC address, srcMacMask value "000000111111". .
    .PARAMETER Protocol
        Protocol, identified by protocol name, to match against the protocol of an incoming IPv6 packet.
        Possible values = ICMPV6, TCP, UDP, ICMP, IGMP, EGP, IGP, ARGUS, RDP, RSVP, EIGRP, L2TP, ISIS, GGP, IPoverIP, ST, CBT, BBN-RCC-M, NVP-II, PUP, EMCON, XNET, CHAOS, MUX, DCN-MEAS, HMP, PRM, XNS-IDP, TRUNK-1, TRUNK-2, LEAF-1, LEAF-2, IRTP, ISO-TP4, NETBLT, MFE-NSP, MERIT-INP, SEP, 3PC, IDPR, XTP, DDP, IDPR-CMTP, TP++, IL, IPv6, SDRP, IPv6-Route, IPv6-Frag, IDRP, GRE, MHRP, BNA, ESP, AH, I-NLSP, SWIPE, NARP, MOBILE, TLSP, SKIP, IPv6-NoNx, IPv6-Opts, Any-Host-Internal-Protocol, CFTP, Any-Local-Network, SAT-EXPAK, KRYPTOLAN, RVD, IPPC, Any-Distributed-File-System, TFTP, VISA, IPCV, CPNX, CPHB, WSN, PVP, BR-SAT-MO, SUN-ND, WB-MON, WB-EXPAK, ISO-IP, VMTP, SECURE-VM, VINES, TTP, NSFNET-IG, DGP, TCF, OSPFIGP, Sprite-RP, LARP, MTP, AX.25, IPIP, MICP, SCC-SP, ETHERIP, Any-Private-Encryption-Scheme, GMTP, IFMP, PNNI, PIM, ARIS, SCPS, QNX, A/N, IPComp, SNP, Compaq-Pe, IPX-in-IP, VRRP, PGM, Any-0-Hop-Protocol, ENCAP, DDX, IATP, STP, SRP, UTI, SMP, SM, PTP, FIRE, CRTP, CRUDP, SSCOPMCE, IPLT, SPS, PIPE, SCTP, FC, RSVP-E2E-IGNORE, Mobility-Header, UDPLite
    .PARAMETER Icmptype
        ICMP Message type to match against the message type of an incoming IPv6 ICMP packet. For example, to block DESTINATION UNREACHABLE messages, you must specify 3 as the ICMP type.
        Note: This parameter can be specified only for the ICMP protocol.
    .PARAMETER Icmpcode
        Code of a particular ICMP message type to match against the ICMP code of an incoming IPv6 ICMP packet. For example, to block DESTINATION HOST UNREACHABLE messages, specify 3 as the ICMP type and 1 as the ICMP code.
        If you set this parameter, you must set the ICMP Type parameter.
    .PARAMETER Vlan
        ID of the VLAN. The Citrix ADC applies the ACL6 rule only to the incoming packets on the specified VLAN. If you do not specify a VLAN ID, the appliance applies the ACL6 rule to the incoming packets on all VLANs.
    .PARAMETER Vxlan
        ID of the VXLAN. The Citrix ADC applies the ACL6 rule only to the incoming packets on the specified VXLAN. If you do not specify a VXLAN ID, the appliance applies the ACL6 rule to the incoming packets on all VXLANs.
    .PARAMETER Interface
        ID of an interface. The Citrix ADC applies the ACL6 rule only to the incoming packets from the specified interface. If you do not specify any value, the appliance applies the ACL6 rule to the incoming packets from all interfaces.
    .PARAMETER Logstate
        Enable or disable logging of events related to the ACL6 rule. The log messages are stored in the configured syslog or auditlog server.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ratelimit
        Maximum number of log messages to be generated per second. If you set this parameter, you must enable the Log State parameter.
    .PARAMETER Established
        Allow only incoming TCP packets that have the ACK or RST bit set if the action set for the ACL6 rule is ALLOW and these packets match the other conditions in the ACL6 rule.
    .PARAMETER Stateful
        If stateful option is enabled, transparent sessions are created for the traffic hitting this ACL6 and not hitting any other features like LB, INAT etc. .
        Possible values = YES, NO
    .PARAMETER Dfdhash
        Specifies the type of hashmethod to be applied, to steer the packet to the FP of the packet.
        Possible values = SIP-SPORT-DIP-DPORT, SIP, DIP, SIP-DIP, SIP-SPORT, DIP-DPORT
    .PARAMETER Dfdprefix
        hashprefix to be applied to SIP/DIP to generate rsshash FP.eg 128 => hash calculated on the complete IP.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNsacl6 -acl6name <string>
        An example how to unset nsacl6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNsacl6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacl6
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Acl6name,

        [Boolean]$srcipv6,

        [Boolean]$srcport,

        [Boolean]$destipv6,

        [Boolean]$destport,

        [Boolean]$srcmac,

        [Boolean]$srcmacmask,

        [Boolean]$protocol,

        [Boolean]$icmptype,

        [Boolean]$icmpcode,

        [Boolean]$vlan,

        [Boolean]$vxlan,

        [Boolean]$Interface,

        [Boolean]$logstate,

        [Boolean]$ratelimit,

        [Boolean]$established,

        [Boolean]$stateful,

        [Boolean]$dfdhash,

        [Boolean]$dfdprefix 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNsacl6: Starting"
    }
    process {
        try {
            $payload = @{ acl6name = $acl6name }
            if ( $PSBoundParameters.ContainsKey('srcipv6') ) { $payload.Add('srcipv6', $srcipv6) }
            if ( $PSBoundParameters.ContainsKey('srcport') ) { $payload.Add('srcport', $srcport) }
            if ( $PSBoundParameters.ContainsKey('destipv6') ) { $payload.Add('destipv6', $destipv6) }
            if ( $PSBoundParameters.ContainsKey('destport') ) { $payload.Add('destport', $destport) }
            if ( $PSBoundParameters.ContainsKey('srcmac') ) { $payload.Add('srcmac', $srcmac) }
            if ( $PSBoundParameters.ContainsKey('srcmacmask') ) { $payload.Add('srcmacmask', $srcmacmask) }
            if ( $PSBoundParameters.ContainsKey('protocol') ) { $payload.Add('protocol', $protocol) }
            if ( $PSBoundParameters.ContainsKey('icmptype') ) { $payload.Add('icmptype', $icmptype) }
            if ( $PSBoundParameters.ContainsKey('icmpcode') ) { $payload.Add('icmpcode', $icmpcode) }
            if ( $PSBoundParameters.ContainsKey('vlan') ) { $payload.Add('vlan', $vlan) }
            if ( $PSBoundParameters.ContainsKey('vxlan') ) { $payload.Add('vxlan', $vxlan) }
            if ( $PSBoundParameters.ContainsKey('Interface') ) { $payload.Add('Interface', $Interface) }
            if ( $PSBoundParameters.ContainsKey('logstate') ) { $payload.Add('logstate', $logstate) }
            if ( $PSBoundParameters.ContainsKey('ratelimit') ) { $payload.Add('ratelimit', $ratelimit) }
            if ( $PSBoundParameters.ContainsKey('established') ) { $payload.Add('established', $established) }
            if ( $PSBoundParameters.ContainsKey('stateful') ) { $payload.Add('stateful', $stateful) }
            if ( $PSBoundParameters.ContainsKey('dfdhash') ) { $payload.Add('dfdhash', $dfdhash) }
            if ( $PSBoundParameters.ContainsKey('dfdprefix') ) { $payload.Add('dfdprefix', $dfdprefix) }
            if ( $PSCmdlet.ShouldProcess("$acl6name", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nsacl6 -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNsacl6: Finished"
    }
}

function Invoke-ADCEnableNsacl6 {
    <#
    .SYNOPSIS
        Enable NS configuration Object.
    .DESCRIPTION
        Configuration for ACL6 entry resource.
    .PARAMETER Acl6name
        Name for the ACL6 rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .EXAMPLE
        PS C:\>Invoke-ADCEnableNsacl6 -acl6name <string>
        An example how to enable nsacl6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCEnableNsacl6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacl6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Acl6name 

    )
    begin {
        Write-Verbose "Invoke-ADCEnableNsacl6: Starting"
    }
    process {
        try {
            $payload = @{ acl6name = $acl6name }

            if ( $PSCmdlet.ShouldProcess($Name, "Enable NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsacl6 -Action enable -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCEnableNsacl6: Finished"
    }
}

function Invoke-ADCDisableNsacl6 {
    <#
    .SYNOPSIS
        Disable NS configuration Object.
    .DESCRIPTION
        Configuration for ACL6 entry resource.
    .PARAMETER Acl6name
        Name for the ACL6 rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .EXAMPLE
        PS C:\>Invoke-ADCDisableNsacl6 -acl6name <string>
        An example how to disable nsacl6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDisableNsacl6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacl6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Acl6name 

    )
    begin {
        Write-Verbose "Invoke-ADCDisableNsacl6: Starting"
    }
    process {
        try {
            $payload = @{ acl6name = $acl6name }

            if ( $PSCmdlet.ShouldProcess($Name, "Disable NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsacl6 -Action disable -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDisableNsacl6: Finished"
    }
}

function Invoke-ADCRenameNsacl6 {
    <#
    .SYNOPSIS
        Rename NS configuration Object.
    .DESCRIPTION
        Configuration for ACL6 entry resource.
    .PARAMETER Acl6name
        Name for the ACL6 rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER Newname
        New name for the ACL6 rule. Must begin with an ASCII alphabetic or underscore \(_\) character, and must contain only ASCII alphanumeric, underscore, hash \(\#\), period \(.\), space, colon \(:\), at \(@\), equals \(=\), and hyphen \(-\) characters.
    .PARAMETER PassThru
        Return details about the created nsacl6 item.
    .EXAMPLE
        PS C:\>Invoke-ADCRenameNsacl6 -acl6name <string> -newname <string>
        An example how to rename nsacl6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCRenameNsacl6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacl6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Acl6name,

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Newname,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCRenameNsacl6: Starting"
    }
    process {
        try {
            $payload = @{ acl6name = $acl6name
                newname            = $newname
            }

            if ( $PSCmdlet.ShouldProcess("nsacl6", "Rename NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsacl6 -Action rename -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsacl6 -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCRenameNsacl6: Finished"
    }
}

function Invoke-ADCGetNsacl6 {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for ACL6 entry resource.
    .PARAMETER Acl6name
        Name for the ACL6 rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER GetAll
        Retrieve all nsacl6 object(s).
    .PARAMETER Count
        If specified, the count of the nsacl6 object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsacl6
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsacl6 -GetAll
        Get all nsacl6 data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsacl6 -Count
        Get the number of nsacl6 objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsacl6 -name <string>
        Get nsacl6 object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsacl6 -Filter @{ 'name'='<value>' }
        Get nsacl6 data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsacl6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacl6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Acl6name,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNsacl6: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsacl6 objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsacl6 -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsacl6 objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsacl6 -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsacl6 objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsacl6 -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsacl6 configuration for property 'acl6name'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsacl6 -NitroPath nitro/v1/config -Resource $acl6name -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nsacl6 configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsacl6 -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsacl6: Ended"
    }
}

function Invoke-ADCRenumberNsacls {
    <#
    .SYNOPSIS
        Renumber NS configuration Object.
    .DESCRIPTION
        Configuration for ACL entry resource.
    .PARAMETER Type
        Type of the acl,default will be CLASSIC.
        Available options as follows:
        * CLASSIC - specifies the regular extended acls.
        * DFD - cluster specific acls,specifies hashmethod for steering of the packet in cluster .
        Possible values = CLASSIC, DFD
    .EXAMPLE
        PS C:\>Invoke-ADCRenumberNsacls
        An example how to renumber nsacls configuration Object(s).
    .NOTES
        File Name : Invoke-ADCRenumberNsacls
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacls/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateSet('CLASSIC', 'DFD')]
        [string]$Type 

    )
    begin {
        Write-Verbose "Invoke-ADCRenumberNsacls: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('type') ) { $payload.Add('type', $type) }
            if ( $PSCmdlet.ShouldProcess($Name, "Renumber NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsacls -Action renumber -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCRenumberNsacls: Finished"
    }
}

function Invoke-ADCClearNsacls {
    <#
    .SYNOPSIS
        Clear NS configuration Object.
    .DESCRIPTION
        Configuration for ACL entry resource.
    .PARAMETER Type
        Type of the acl,default will be CLASSIC.
        Available options as follows:
        * CLASSIC - specifies the regular extended acls.
        * DFD - cluster specific acls,specifies hashmethod for steering of the packet in cluster .
        Possible values = CLASSIC, DFD
    .EXAMPLE
        PS C:\>Invoke-ADCClearNsacls
        An example how to clear nsacls configuration Object(s).
    .NOTES
        File Name : Invoke-ADCClearNsacls
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacls/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateSet('CLASSIC', 'DFD')]
        [string]$Type 

    )
    begin {
        Write-Verbose "Invoke-ADCClearNsacls: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('type') ) { $payload.Add('type', $type) }
            if ( $PSCmdlet.ShouldProcess($Name, "Clear NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsacls -Action clear -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCClearNsacls: Finished"
    }
}

function Invoke-ADCApplyNsacls {
    <#
    .SYNOPSIS
        Apply NS configuration Object.
    .DESCRIPTION
        Configuration for ACL entry resource.
    .PARAMETER Type
        Type of the acl,default will be CLASSIC.
        Available options as follows:
        * CLASSIC - specifies the regular extended acls.
        * DFD - cluster specific acls,specifies hashmethod for steering of the packet in cluster .
        Possible values = CLASSIC, DFD
    .EXAMPLE
        PS C:\>Invoke-ADCApplyNsacls
        An example how to apply nsacls configuration Object(s).
    .NOTES
        File Name : Invoke-ADCApplyNsacls
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacls/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateSet('CLASSIC', 'DFD')]
        [string]$Type 

    )
    begin {
        Write-Verbose "Invoke-ADCApplyNsacls: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('type') ) { $payload.Add('type', $type) }
            if ( $PSCmdlet.ShouldProcess($Name, "Apply NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsacls -Action apply -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCApplyNsacls: Finished"
    }
}

function Invoke-ADCClearNsacls6 {
    <#
    .SYNOPSIS
        Clear NS configuration Object.
    .DESCRIPTION
        Configuration for ACL6 entry resource.
    .PARAMETER Type
        Type of the acl,default will be CLASSIC.
        Available options as follows:
        * CLASSIC - specifies the regular extended acls.
        * DFD - cluster specific acls,specifies hashmethod for steering of the packet in cluster .
        Possible values = CLASSIC, DFD
    .EXAMPLE
        PS C:\>Invoke-ADCClearNsacls6
        An example how to clear nsacls6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCClearNsacls6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacls6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateSet('CLASSIC', 'DFD')]
        [string]$Type 

    )
    begin {
        Write-Verbose "Invoke-ADCClearNsacls6: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('type') ) { $payload.Add('type', $type) }
            if ( $PSCmdlet.ShouldProcess($Name, "Clear NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsacls6 -Action clear -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCClearNsacls6: Finished"
    }
}

function Invoke-ADCApplyNsacls6 {
    <#
    .SYNOPSIS
        Apply NS configuration Object.
    .DESCRIPTION
        Configuration for ACL6 entry resource.
    .PARAMETER Type
        Type of the acl,default will be CLASSIC.
        Available options as follows:
        * CLASSIC - specifies the regular extended acls.
        * DFD - cluster specific acls,specifies hashmethod for steering of the packet in cluster .
        Possible values = CLASSIC, DFD
    .EXAMPLE
        PS C:\>Invoke-ADCApplyNsacls6
        An example how to apply nsacls6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCApplyNsacls6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacls6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateSet('CLASSIC', 'DFD')]
        [string]$Type 

    )
    begin {
        Write-Verbose "Invoke-ADCApplyNsacls6: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('type') ) { $payload.Add('type', $type) }
            if ( $PSCmdlet.ShouldProcess($Name, "Apply NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsacls6 -Action apply -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCApplyNsacls6: Finished"
    }
}

function Invoke-ADCRenumberNsacls6 {
    <#
    .SYNOPSIS
        Renumber NS configuration Object.
    .DESCRIPTION
        Configuration for ACL6 entry resource.
    .PARAMETER Type
        Type of the acl,default will be CLASSIC.
        Available options as follows:
        * CLASSIC - specifies the regular extended acls.
        * DFD - cluster specific acls,specifies hashmethod for steering of the packet in cluster .
        Possible values = CLASSIC, DFD
    .EXAMPLE
        PS C:\>Invoke-ADCRenumberNsacls6
        An example how to renumber nsacls6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCRenumberNsacls6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsacls6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateSet('CLASSIC', 'DFD')]
        [string]$Type 

    )
    begin {
        Write-Verbose "Invoke-ADCRenumberNsacls6: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('type') ) { $payload.Add('type', $type) }
            if ( $PSCmdlet.ShouldProcess($Name, "Renumber NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsacls6 -Action renumber -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCRenumberNsacls6: Finished"
    }
}

function Invoke-ADCAddNsappflowcollector {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for appflowCollector resource.
    .PARAMETER Name
        Name of the AppFlow collector.
    .PARAMETER Ipaddress
        The IPv4 address of the AppFlow collector.
    .PARAMETER Port
        The UDP port on which the AppFlow collector is listening.
    .PARAMETER PassThru
        Return details about the created nsappflowcollector item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNsappflowcollector -name <string> -ipaddress <string>
        An example how to add nsappflowcollector configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNsappflowcollector
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsappflowcollector/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateLength(1, 127)]
        [string]$Name,

        [Parameter(Mandatory)]
        [string]$Ipaddress,

        [int]$Port = '4739',

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNsappflowcollector: Starting"
    }
    process {
        try {
            $payload = @{ name = $name
                ipaddress      = $ipaddress
            }
            if ( $PSBoundParameters.ContainsKey('port') ) { $payload.Add('port', $port) }
            if ( $PSCmdlet.ShouldProcess("nsappflowcollector", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsappflowcollector -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsappflowcollector -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNsappflowcollector: Finished"
    }
}

function Invoke-ADCDeleteNsappflowcollector {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for appflowCollector resource.
    .PARAMETER Name
        Name of the AppFlow collector.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNsappflowcollector -Name <string>
        An example how to delete nsappflowcollector configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNsappflowcollector
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsappflowcollector/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Name 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNsappflowcollector: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$name", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nsappflowcollector -NitroPath nitro/v1/config -Resource $name -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNsappflowcollector: Finished"
    }
}

function Invoke-ADCGetNsappflowcollector {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for appflowCollector resource.
    .PARAMETER Name
        Name of the AppFlow collector.
    .PARAMETER GetAll
        Retrieve all nsappflowcollector object(s).
    .PARAMETER Count
        If specified, the count of the nsappflowcollector object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsappflowcollector
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsappflowcollector -GetAll
        Get all nsappflowcollector data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsappflowcollector -Count
        Get the number of nsappflowcollector objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsappflowcollector -name <string>
        Get nsappflowcollector object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsappflowcollector -Filter @{ 'name'='<value>' }
        Get nsappflowcollector data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsappflowcollector
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsappflowcollector/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateLength(1, 127)]
        [string]$Name,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNsappflowcollector: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsappflowcollector objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsappflowcollector -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsappflowcollector objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsappflowcollector -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsappflowcollector objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsappflowcollector -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsappflowcollector configuration for property 'name'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsappflowcollector -NitroPath nitro/v1/config -Resource $name -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nsappflowcollector configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsappflowcollector -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsappflowcollector: Ended"
    }
}

function Invoke-ADCUpdateNsappflowparam {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for appflowParam resource.
    .PARAMETER Templaterefresh
        IPFIX template refresh interval (in seconds).
    .PARAMETER Udppmtu
        MTU to be used for IPFIX UDP packets.
    .PARAMETER Httpurl
        Enable AppFlow HTTP URL logging.
        Possible values = ENABLED, DISABLED
    .PARAMETER Httpcookie
        Enable AppFlow HTTP cookie logging.
        Possible values = ENABLED, DISABLED
    .PARAMETER Httpreferer
        Enable AppFlow HTTP referer logging.
        Possible values = ENABLED, DISABLED
    .PARAMETER Httpmethod
        Enable AppFlow HTTP method logging.
        Possible values = ENABLED, DISABLED
    .PARAMETER Httphost
        Enable AppFlow HTTP host logging.
        Possible values = ENABLED, DISABLED
    .PARAMETER Httpuseragent
        Enable AppFlow HTTP user-agent logging.
        Possible values = ENABLED, DISABLED
    .PARAMETER Clienttrafficonly
        Control whether AppFlow records should be generated only for client-side traffic.
        Possible values = YES, NO
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsappflowparam
        An example how to update nsappflowparam configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsappflowparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsappflowparam/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateRange(60, 3600)]
        [double]$Templaterefresh,

        [ValidateRange(128, 1472)]
        [double]$Udppmtu,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Httpurl,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Httpcookie,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Httpreferer,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Httpmethod,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Httphost,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Httpuseragent,

        [ValidateSet('YES', 'NO')]
        [string]$Clienttrafficonly 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsappflowparam: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('templaterefresh') ) { $payload.Add('templaterefresh', $templaterefresh) }
            if ( $PSBoundParameters.ContainsKey('udppmtu') ) { $payload.Add('udppmtu', $udppmtu) }
            if ( $PSBoundParameters.ContainsKey('httpurl') ) { $payload.Add('httpurl', $httpurl) }
            if ( $PSBoundParameters.ContainsKey('httpcookie') ) { $payload.Add('httpcookie', $httpcookie) }
            if ( $PSBoundParameters.ContainsKey('httpreferer') ) { $payload.Add('httpreferer', $httpreferer) }
            if ( $PSBoundParameters.ContainsKey('httpmethod') ) { $payload.Add('httpmethod', $httpmethod) }
            if ( $PSBoundParameters.ContainsKey('httphost') ) { $payload.Add('httphost', $httphost) }
            if ( $PSBoundParameters.ContainsKey('httpuseragent') ) { $payload.Add('httpuseragent', $httpuseragent) }
            if ( $PSBoundParameters.ContainsKey('clienttrafficonly') ) { $payload.Add('clienttrafficonly', $clienttrafficonly) }
            if ( $PSCmdlet.ShouldProcess("nsappflowparam", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsappflowparam -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsappflowparam: Finished"
    }
}

function Invoke-ADCUnsetNsappflowparam {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for appflowParam resource.
    .PARAMETER Templaterefresh
        IPFIX template refresh interval (in seconds).
    .PARAMETER Udppmtu
        MTU to be used for IPFIX UDP packets.
    .PARAMETER Httpurl
        Enable AppFlow HTTP URL logging.
        Possible values = ENABLED, DISABLED
    .PARAMETER Httpcookie
        Enable AppFlow HTTP cookie logging.
        Possible values = ENABLED, DISABLED
    .PARAMETER Httpreferer
        Enable AppFlow HTTP referer logging.
        Possible values = ENABLED, DISABLED
    .PARAMETER Httpmethod
        Enable AppFlow HTTP method logging.
        Possible values = ENABLED, DISABLED
    .PARAMETER Httphost
        Enable AppFlow HTTP host logging.
        Possible values = ENABLED, DISABLED
    .PARAMETER Httpuseragent
        Enable AppFlow HTTP user-agent logging.
        Possible values = ENABLED, DISABLED
    .PARAMETER Clienttrafficonly
        Control whether AppFlow records should be generated only for client-side traffic.
        Possible values = YES, NO
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNsappflowparam
        An example how to unset nsappflowparam configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNsappflowparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsappflowparam
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Boolean]$templaterefresh,

        [Boolean]$udppmtu,

        [Boolean]$httpurl,

        [Boolean]$httpcookie,

        [Boolean]$httpreferer,

        [Boolean]$httpmethod,

        [Boolean]$httphost,

        [Boolean]$httpuseragent,

        [Boolean]$clienttrafficonly 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNsappflowparam: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('templaterefresh') ) { $payload.Add('templaterefresh', $templaterefresh) }
            if ( $PSBoundParameters.ContainsKey('udppmtu') ) { $payload.Add('udppmtu', $udppmtu) }
            if ( $PSBoundParameters.ContainsKey('httpurl') ) { $payload.Add('httpurl', $httpurl) }
            if ( $PSBoundParameters.ContainsKey('httpcookie') ) { $payload.Add('httpcookie', $httpcookie) }
            if ( $PSBoundParameters.ContainsKey('httpreferer') ) { $payload.Add('httpreferer', $httpreferer) }
            if ( $PSBoundParameters.ContainsKey('httpmethod') ) { $payload.Add('httpmethod', $httpmethod) }
            if ( $PSBoundParameters.ContainsKey('httphost') ) { $payload.Add('httphost', $httphost) }
            if ( $PSBoundParameters.ContainsKey('httpuseragent') ) { $payload.Add('httpuseragent', $httpuseragent) }
            if ( $PSBoundParameters.ContainsKey('clienttrafficonly') ) { $payload.Add('clienttrafficonly', $clienttrafficonly) }
            if ( $PSCmdlet.ShouldProcess("nsappflowparam", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nsappflowparam -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNsappflowparam: Finished"
    }
}

function Invoke-ADCGetNsappflowparam {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for appflowParam resource.
    .PARAMETER GetAll
        Retrieve all nsappflowparam object(s).
    .PARAMETER Count
        If specified, the count of the nsappflowparam object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsappflowparam
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsappflowparam -GetAll
        Get all nsappflowparam data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsappflowparam -name <string>
        Get nsappflowparam object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsappflowparam -Filter @{ 'name'='<value>' }
        Get nsappflowparam data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsappflowparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsappflowparam/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNsappflowparam: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsappflowparam objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsappflowparam -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsappflowparam objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsappflowparam -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsappflowparam objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsappflowparam -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsappflowparam configuration for property ''"

            } else {
                Write-Verbose "Retrieving nsappflowparam configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsappflowparam -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsappflowparam: Ended"
    }
}

function Invoke-ADCChangeNsaptlicense {
    <#
    .SYNOPSIS
        Change NS configuration Object.
    .DESCRIPTION
        Configuration for aptlicense resource.
    .PARAMETER Id
        License ID.
    .PARAMETER Sessionid
        Session ID.
    .PARAMETER Bindtype
        Bind type.
    .PARAMETER Countavailable
        The user can allocate one or more licenses. Ensure the value is less than (for partial allocation) or equal to the total number of available licenses.
    .PARAMETER Licensedir
        License Directory.
    .PARAMETER Useproxy
        Specifies whether to use the licenseproxyserver to reach the internet. Make sure to configure licenseproxyserver to use this option.
        Possible values = YES, NO
    .EXAMPLE
        PS C:\>Invoke-ADCChangeNsaptlicense -id <string> -sessionid <string> -bindtype <string> -countavailable <string>
        An example how to change nsaptlicense configuration Object(s).
    .NOTES
        File Name : Invoke-ADCChangeNsaptlicense
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsaptlicense/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Id,

        [Parameter(Mandatory)]
        [string]$Sessionid,

        [Parameter(Mandatory)]
        [string]$Bindtype,

        [Parameter(Mandatory)]
        [string]$Countavailable,

        [string]$Licensedir,

        [ValidateSet('YES', 'NO')]
        [string]$Useproxy 
    )
    begin {
        Write-Verbose "Invoke-ADCChangeNsaptlicense: Starting"
    }
    process {
        try {
            $payload = @{ id   = $id
                sessionid      = $sessionid
                bindtype       = $bindtype
                countavailable = $countavailable
            }
            if ( $PSBoundParameters.ContainsKey('licensedir') ) { $payload.Add('licensedir', $licensedir) }
            if ( $PSBoundParameters.ContainsKey('useproxy') ) { $payload.Add('useproxy', $useproxy) }
            if ( $PSCmdlet.ShouldProcess("nsaptlicense", "Change NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsaptlicense -Action update -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCChangeNsaptlicense: Finished"
    }
}

function Invoke-ADCGetNsaptlicense {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for aptlicense resource.
    .PARAMETER Serialno
        Hardware Serial Number/License Activation Code(LAC).
    .PARAMETER Useproxy
        Specifies whether to use the licenseproxyserver to reach the internet. Make sure to configure licenseproxyserver to use this option.
        Possible values = YES, NO
    .PARAMETER GetAll
        Retrieve all nsaptlicense object(s).
    .PARAMETER Count
        If specified, the count of the nsaptlicense object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsaptlicense
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsaptlicense -GetAll
        Get all nsaptlicense data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsaptlicense -Count
        Get the number of nsaptlicense objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsaptlicense -name <string>
        Get nsaptlicense object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsaptlicense -Filter @{ 'name'='<value>' }
        Get nsaptlicense data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsaptlicense
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsaptlicense/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByArgument')]
        [string]$Serialno,

        [Parameter(ParameterSetName = 'GetByArgument')]
        [ValidateSet('YES', 'NO')]
        [string]$Useproxy,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNsaptlicense: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsaptlicense objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsaptlicense -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsaptlicense objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsaptlicense -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsaptlicense objects by arguments"
                $arguments = @{ } 
                if ( $PSBoundParameters.ContainsKey('serialno') ) { $arguments.Add('serialno', $serialno) } 
                if ( $PSBoundParameters.ContainsKey('useproxy') ) { $arguments.Add('useproxy', $useproxy) }
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsaptlicense -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsaptlicense configuration for property ''"

            } else {
                Write-Verbose "Retrieving nsaptlicense configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsaptlicense -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsaptlicense: Ended"
    }
}

function Invoke-ADCAddNsassignment {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for assignment resource.
    .PARAMETER Name
        Name for the assignment. Must begin with a letter, number, or the underscore character (_), and must contain only letters, numbers, and the hyphen (-), period (.) hash (#), space ( ), at (@), equals (=), colon (:), and underscore characters. Can be changed after the assignment is added.
    .PARAMETER Variable
        Left hand side of the assigment, of the form $variable-name (for a singleton variabled) or $variable-name[key-expression], where key-expression is an expression that evaluates to a text string and provides the key to select a map entry.
    .PARAMETER Set
        Right hand side of the assignment. The expression is evaluated and assigned to the left hand variable.
    .PARAMETER Add
        Right hand side of the assignment. The expression is evaluated and added to the left hand variable.
    .PARAMETER Sub
        Right hand side of the assignment. The expression is evaluated and subtracted from the left hand variable.
    .PARAMETER Append
        Right hand side of the assignment. The expression is evaluated and appended to the left hand variable.
    .PARAMETER Clear
        Clear the variable value. Deallocates a text value, and for a map, the text key.
    .PARAMETER Comment
        Comment. Can be used to preserve information about this rewrite action.
    .PARAMETER PassThru
        Return details about the created nsassignment item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNsassignment -name <string> -variable <string>
        An example how to add nsassignment configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNsassignment
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsassignment/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Name,

        [Parameter(Mandatory)]
        [string]$Variable,

        [string]$Set,

        [string]$Add,

        [string]$Sub,

        [string]$Append,

        [boolean]$Clear,

        [string]$Comment,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNsassignment: Starting"
    }
    process {
        try {
            $payload = @{ name = $name
                variable       = $variable
            }
            if ( $PSBoundParameters.ContainsKey('set') ) { $payload.Add('set', $set) }
            if ( $PSBoundParameters.ContainsKey('Add') ) { $payload.Add('Add', $Add) }
            if ( $PSBoundParameters.ContainsKey('sub') ) { $payload.Add('sub', $sub) }
            if ( $PSBoundParameters.ContainsKey('append') ) { $payload.Add('append', $append) }
            if ( $PSBoundParameters.ContainsKey('clear') ) { $payload.Add('clear', $clear) }
            if ( $PSBoundParameters.ContainsKey('comment') ) { $payload.Add('comment', $comment) }
            if ( $PSCmdlet.ShouldProcess("nsassignment", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsassignment -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsassignment -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNsassignment: Finished"
    }
}

function Invoke-ADCUpdateNsassignment {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for assignment resource.
    .PARAMETER Name
        Name for the assignment. Must begin with a letter, number, or the underscore character (_), and must contain only letters, numbers, and the hyphen (-), period (.) hash (#), space ( ), at (@), equals (=), colon (:), and underscore characters. Can be changed after the assignment is added.
    .PARAMETER Variable
        Left hand side of the assigment, of the form $variable-name (for a singleton variabled) or $variable-name[key-expression], where key-expression is an expression that evaluates to a text string and provides the key to select a map entry.
    .PARAMETER Set
        Right hand side of the assignment. The expression is evaluated and assigned to the left hand variable.
    .PARAMETER Add
        Right hand side of the assignment. The expression is evaluated and added to the left hand variable.
    .PARAMETER Sub
        Right hand side of the assignment. The expression is evaluated and subtracted from the left hand variable.
    .PARAMETER Append
        Right hand side of the assignment. The expression is evaluated and appended to the left hand variable.
    .PARAMETER Clear
        Clear the variable value. Deallocates a text value, and for a map, the text key.
    .PARAMETER Comment
        Comment. Can be used to preserve information about this rewrite action.
    .PARAMETER PassThru
        Return details about the created nsassignment item.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsassignment -name <string>
        An example how to update nsassignment configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsassignment
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsassignment/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Name,

        [string]$Variable,

        [string]$Set,

        [string]$Add,

        [string]$Sub,

        [string]$Append,

        [boolean]$Clear,

        [string]$Comment,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsassignment: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('variable') ) { $payload.Add('variable', $variable) }
            if ( $PSBoundParameters.ContainsKey('set') ) { $payload.Add('set', $set) }
            if ( $PSBoundParameters.ContainsKey('Add') ) { $payload.Add('Add', $Add) }
            if ( $PSBoundParameters.ContainsKey('sub') ) { $payload.Add('sub', $sub) }
            if ( $PSBoundParameters.ContainsKey('append') ) { $payload.Add('append', $append) }
            if ( $PSBoundParameters.ContainsKey('clear') ) { $payload.Add('clear', $clear) }
            if ( $PSBoundParameters.ContainsKey('comment') ) { $payload.Add('comment', $comment) }
            if ( $PSCmdlet.ShouldProcess("nsassignment", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsassignment -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsassignment -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsassignment: Finished"
    }
}

function Invoke-ADCUnsetNsassignment {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for assignment resource.
    .PARAMETER Name
        Name for the assignment. Must begin with a letter, number, or the underscore character (_), and must contain only letters, numbers, and the hyphen (-), period (.) hash (#), space ( ), at (@), equals (=), colon (:), and underscore characters. Can be changed after the assignment is added.
    .PARAMETER Comment
        Comment. Can be used to preserve information about this rewrite action.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNsassignment -name <string>
        An example how to unset nsassignment configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNsassignment
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsassignment
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [string]$Name,

        [Boolean]$comment 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNsassignment: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('comment') ) { $payload.Add('comment', $comment) }
            if ( $PSCmdlet.ShouldProcess("$name", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nsassignment -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNsassignment: Finished"
    }
}

function Invoke-ADCDeleteNsassignment {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for assignment resource.
    .PARAMETER Name
        Name for the assignment. Must begin with a letter, number, or the underscore character (_), and must contain only letters, numbers, and the hyphen (-), period (.) hash (#), space ( ), at (@), equals (=), colon (:), and underscore characters. Can be changed after the assignment is added.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNsassignment -Name <string>
        An example how to delete nsassignment configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNsassignment
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsassignment/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Name 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNsassignment: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$name", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nsassignment -NitroPath nitro/v1/config -Resource $name -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNsassignment: Finished"
    }
}

function Invoke-ADCRenameNsassignment {
    <#
    .SYNOPSIS
        Rename NS configuration Object.
    .DESCRIPTION
        Configuration for assignment resource.
    .PARAMETER Name
        Name for the assignment. Must begin with a letter, number, or the underscore character (_), and must contain only letters, numbers, and the hyphen (-), period (.) hash (#), space ( ), at (@), equals (=), colon (:), and underscore characters. Can be changed after the assignment is added.
    .PARAMETER Newname
        New name for the assignment.
        Must begin with a letter, number, or the underscore character (_), and must contain only letters, numbers, and the hyphen (-), period (.) hash (#), space ( ), at (@), equals (=), colon (:), and underscore characters. Can be changed after the rewrite policy is added.
    .PARAMETER PassThru
        Return details about the created nsassignment item.
    .EXAMPLE
        PS C:\>Invoke-ADCRenameNsassignment -name <string> -newname <string>
        An example how to rename nsassignment configuration Object(s).
    .NOTES
        File Name : Invoke-ADCRenameNsassignment
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsassignment/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Name,

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Newname,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCRenameNsassignment: Starting"
    }
    process {
        try {
            $payload = @{ name = $name
                newname        = $newname
            }

            if ( $PSCmdlet.ShouldProcess("nsassignment", "Rename NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsassignment -Action rename -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsassignment -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCRenameNsassignment: Finished"
    }
}

function Invoke-ADCGetNsassignment {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for assignment resource.
    .PARAMETER Name
        Name for the assignment. Must begin with a letter, number, or the underscore character (_), and must contain only letters, numbers, and the hyphen (-), period (.) hash (#), space ( ), at (@), equals (=), colon (:), and underscore characters. Can be changed after the assignment is added.
    .PARAMETER GetAll
        Retrieve all nsassignment object(s).
    .PARAMETER Count
        If specified, the count of the nsassignment object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsassignment
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsassignment -GetAll
        Get all nsassignment data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsassignment -Count
        Get the number of nsassignment objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsassignment -name <string>
        Get nsassignment object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsassignment -Filter @{ 'name'='<value>' }
        Get nsassignment data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsassignment
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsassignment/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [string]$Name,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNsassignment: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsassignment objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsassignment -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsassignment objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsassignment -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsassignment objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsassignment -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsassignment configuration for property 'name'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsassignment -NitroPath nitro/v1/config -Resource $name -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nsassignment configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsassignment -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsassignment: Ended"
    }
}

function Invoke-ADCUpdateNscapacity {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for capacity resource.
    .PARAMETER Bandwidth
        System bandwidth limit.
    .PARAMETER Platform
        appliance platform type.
        Possible values = VS10, VE10, VP10, VS25, VE25, VP25, VS50, VE50, VP50, VS200, VE200, VP200, VS1000, VE1000, VP1000, VS3000, VE3000, VP3000, VS5000, VE5000, VP5000, VS8000, VE8000, VP8000, VS10000, VE10000, VP10000, VS15000, VE15000, VP15000, VS25000, VE25000, VP25000, VS40000, VE40000, VP40000, VS100000, VE100000, VP100000, CP1000
    .PARAMETER Vcpu
        licensed using vcpu pool.
    .PARAMETER Edition
        Product edition.
        Possible values = Standard, Enterprise, Platinum
    .PARAMETER Unit
        Bandwidth unit.
        Possible values = Gbps, Mbps
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNscapacity
        An example how to update nscapacity configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNscapacity
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nscapacity/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [double]$Bandwidth,

        [ValidateSet('VS10', 'VE10', 'VP10', 'VS25', 'VE25', 'VP25', 'VS50', 'VE50', 'VP50', 'VS200', 'VE200', 'VP200', 'VS1000', 'VE1000', 'VP1000', 'VS3000', 'VE3000', 'VP3000', 'VS5000', 'VE5000', 'VP5000', 'VS8000', 'VE8000', 'VP8000', 'VS10000', 'VE10000', 'VP10000', 'VS15000', 'VE15000', 'VP15000', 'VS25000', 'VE25000', 'VP25000', 'VS40000', 'VE40000', 'VP40000', 'VS100000', 'VE100000', 'VP100000', 'CP1000')]
        [string]$Platform,

        [boolean]$Vcpu,

        [ValidateSet('Standard', 'Enterprise', 'Platinum')]
        [string]$Edition,

        [ValidateSet('Gbps', 'Mbps')]
        [string]$Unit 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNscapacity: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('bandwidth') ) { $payload.Add('bandwidth', $bandwidth) }
            if ( $PSBoundParameters.ContainsKey('platform') ) { $payload.Add('platform', $platform) }
            if ( $PSBoundParameters.ContainsKey('vcpu') ) { $payload.Add('vcpu', $vcpu) }
            if ( $PSBoundParameters.ContainsKey('edition') ) { $payload.Add('edition', $edition) }
            if ( $PSBoundParameters.ContainsKey('unit') ) { $payload.Add('unit', $unit) }
            if ( $PSCmdlet.ShouldProcess("nscapacity", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nscapacity -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNscapacity: Finished"
    }
}

function Invoke-ADCUnsetNscapacity {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for capacity resource.
    .PARAMETER Bandwidth
        System bandwidth limit.
    .PARAMETER Platform
        appliance platform type.
        Possible values = VS10, VE10, VP10, VS25, VE25, VP25, VS50, VE50, VP50, VS200, VE200, VP200, VS1000, VE1000, VP1000, VS3000, VE3000, VP3000, VS5000, VE5000, VP5000, VS8000, VE8000, VP8000, VS10000, VE10000, VP10000, VS15000, VE15000, VP15000, VS25000, VE25000, VP25000, VS40000, VE40000, VP40000, VS100000, VE100000, VP100000, CP1000
    .PARAMETER Vcpu
        licensed using vcpu pool.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNscapacity
        An example how to unset nscapacity configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNscapacity
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nscapacity
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Boolean]$bandwidth,

        [Boolean]$platform,

        [Boolean]$vcpu 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNscapacity: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('bandwidth') ) { $payload.Add('bandwidth', $bandwidth) }
            if ( $PSBoundParameters.ContainsKey('platform') ) { $payload.Add('platform', $platform) }
            if ( $PSBoundParameters.ContainsKey('vcpu') ) { $payload.Add('vcpu', $vcpu) }
            if ( $PSCmdlet.ShouldProcess("nscapacity", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nscapacity -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNscapacity: Finished"
    }
}

function Invoke-ADCGetNscapacity {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for capacity resource.
    .PARAMETER Nodeid
        Unique number that identifies the cluster node.
    .PARAMETER GetAll
        Retrieve all nscapacity object(s).
    .PARAMETER Count
        If specified, the count of the nscapacity object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNscapacity
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNscapacity -GetAll
        Get all nscapacity data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNscapacity -name <string>
        Get nscapacity object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNscapacity -Filter @{ 'name'='<value>' }
        Get nscapacity data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNscapacity
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nscapacity/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByArgument')]
        [ValidateRange(0, 31)]
        [double]$Nodeid,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNscapacity: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nscapacity objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nscapacity -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nscapacity objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nscapacity -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nscapacity objects by arguments"
                $arguments = @{ } 
                if ( $PSBoundParameters.ContainsKey('nodeid') ) { $arguments.Add('nodeid', $nodeid) }
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nscapacity -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nscapacity configuration for property ''"

            } else {
                Write-Verbose "Retrieving nscapacity configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nscapacity -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNscapacity: Ended"
    }
}

function Invoke-ADCAddNscentralmanagementserver {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for centralmanagementserver resource.
    .PARAMETER Type
        Type of the central management server. Must be either CLOUD or ONPREM depending on whether the server is on the cloud or on premise.
        Possible values = CLOUD, ONPREM
    .PARAMETER Username
        Username for access to central management server. Must begin with a letter, number, or the underscore character (_), and must contain only letters, numbers, and the hyphen (-), period (.) pound (#), space ( ), at (@), equals (=), colon (:), and underscore characters.
    .PARAMETER Password
        Password for access to central management server. Required for any user account.
    .PARAMETER Activationcode
        Activation code is used to register to ADM service.
    .PARAMETER Ipaddress
        Ip Address of central management server.
    .PARAMETER Servername
        Fully qualified domain name of the central management server or service-url to locate ADM service.
    .PARAMETER Validatecert
        validate the server certificate for secure SSL connections.
        Possible values = YES, NO
    .PARAMETER Deviceprofilename
        Device profile is created on ADM and contains the user name and password of the instance(s).
    .PARAMETER Adcusername
        ADC username used to create device profile on ADM.
    .PARAMETER Adcpassword
        ADC password used to create device profile on ADM.
    .PARAMETER PassThru
        Return details about the created nscentralmanagementserver item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNscentralmanagementserver -type <string>
        An example how to add nscentralmanagementserver configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNscentralmanagementserver
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nscentralmanagementserver/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateSet('CLOUD', 'ONPREM')]
        [string]$Type,

        [ValidateLength(1, 127)]
        [string]$Username,

        [ValidateLength(1, 127)]
        [string]$Password,

        [ValidateLength(1, 127)]
        [string]$Activationcode,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Ipaddress,

        [string]$Servername,

        [ValidateSet('YES', 'NO')]
        [string]$Validatecert = 'YES',

        [ValidateLength(1, 255)]
        [string]$Deviceprofilename,

        [ValidateLength(1, 127)]
        [string]$Adcusername,

        [ValidateLength(1, 127)]
        [string]$Adcpassword,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNscentralmanagementserver: Starting"
    }
    process {
        try {
            $payload = @{ type = $type }
            if ( $PSBoundParameters.ContainsKey('username') ) { $payload.Add('username', $username) }
            if ( $PSBoundParameters.ContainsKey('password') ) { $payload.Add('password', $password) }
            if ( $PSBoundParameters.ContainsKey('activationcode') ) { $payload.Add('activationcode', $activationcode) }
            if ( $PSBoundParameters.ContainsKey('ipaddress') ) { $payload.Add('ipaddress', $ipaddress) }
            if ( $PSBoundParameters.ContainsKey('servername') ) { $payload.Add('servername', $servername) }
            if ( $PSBoundParameters.ContainsKey('validatecert') ) { $payload.Add('validatecert', $validatecert) }
            if ( $PSBoundParameters.ContainsKey('deviceprofilename') ) { $payload.Add('deviceprofilename', $deviceprofilename) }
            if ( $PSBoundParameters.ContainsKey('adcusername') ) { $payload.Add('adcusername', $adcusername) }
            if ( $PSBoundParameters.ContainsKey('adcpassword') ) { $payload.Add('adcpassword', $adcpassword) }
            if ( $PSCmdlet.ShouldProcess("nscentralmanagementserver", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nscentralmanagementserver -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNscentralmanagementserver -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNscentralmanagementserver: Finished"
    }
}

function Invoke-ADCDeleteNscentralmanagementserver {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for centralmanagementserver resource.
    .PARAMETER Type
        Type of the central management server. Must be either CLOUD or ONPREM depending on whether the server is on the cloud or on premise.
        Possible values = CLOUD, ONPREM
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNscentralmanagementserver -Type <string>
        An example how to delete nscentralmanagementserver configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNscentralmanagementserver
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nscentralmanagementserver/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Type 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNscentralmanagementserver: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$type", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nscentralmanagementserver -NitroPath nitro/v1/config -Resource $type -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNscentralmanagementserver: Finished"
    }
}

function Invoke-ADCGetNscentralmanagementserver {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for centralmanagementserver resource.
    .PARAMETER Type
        Type of the central management server. Must be either CLOUD or ONPREM depending on whether the server is on the cloud or on premise.
        Possible values = CLOUD, ONPREM
    .PARAMETER GetAll
        Retrieve all nscentralmanagementserver object(s).
    .PARAMETER Count
        If specified, the count of the nscentralmanagementserver object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNscentralmanagementserver
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNscentralmanagementserver -GetAll
        Get all nscentralmanagementserver data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNscentralmanagementserver -Count
        Get the number of nscentralmanagementserver objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNscentralmanagementserver -name <string>
        Get nscentralmanagementserver object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNscentralmanagementserver -Filter @{ 'name'='<value>' }
        Get nscentralmanagementserver data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNscentralmanagementserver
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nscentralmanagementserver/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateSet('CLOUD', 'ONPREM')]
        [string]$Type,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNscentralmanagementserver: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nscentralmanagementserver objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nscentralmanagementserver -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nscentralmanagementserver objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nscentralmanagementserver -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nscentralmanagementserver objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nscentralmanagementserver -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nscentralmanagementserver configuration for property 'type'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nscentralmanagementserver -NitroPath nitro/v1/config -Resource $type -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nscentralmanagementserver configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nscentralmanagementserver -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNscentralmanagementserver: Ended"
    }
}

function Invoke-ADCClearNsconfig {
    <#
    .SYNOPSIS
        Clear NS configuration Object.
    .DESCRIPTION
        Configuration for system config resource.
    .PARAMETER Force
        Configurations will be cleared without prompting for confirmation.
    .PARAMETER Level
        Types of configurations to be cleared.
        * basic: Clears all configurations except the following:
        - NSIP, default route (gateway), static routes, MIPs, and SNIPs
        - Network settings (DG, VLAN, RHI and DNS settings)
        - Cluster settings
        - HA node definitions
        - Feature and mode settings
        - nsroot password
        * extended: Clears the same configurations as the 'basic' option. In addition, it clears the feature and mode settings.
        * full: Clears all configurations except NSIP, default route, and interface settings.
        Note: When you clear the configurations through the cluster IP address, by specifying the level as 'full', the cluster is deleted and all cluster nodes become standalone appliances. The 'basic' and 'extended' levels are propagated to the cluster nodes.
        Possible values = basic, extended, full
    .PARAMETER Rbaconfig
        RBA configurations and TACACS policies bound to system global will not be cleared if RBA is set to NO.This option is applicable only for BASIC level of clear configuration.Default is YES, which will clear rba configurations.
        Possible values = YES, NO
    .EXAMPLE
        PS C:\>Invoke-ADCClearNsconfig -level <string>
        An example how to clear nsconfig configuration Object(s).
    .NOTES
        File Name : Invoke-ADCClearNsconfig
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsconfig/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [boolean]$Force,

        [Parameter(Mandatory)]
        [ValidateSet('basic', 'extended', 'full')]
        [string]$Level,

        [ValidateSet('YES', 'NO')]
        [string]$Rbaconfig 

    )
    begin {
        Write-Verbose "Invoke-ADCClearNsconfig: Starting"
    }
    process {
        try {
            $payload = @{ level = $level }
            if ( $PSBoundParameters.ContainsKey('force') ) { $payload.Add('force', $force) }
            if ( $PSBoundParameters.ContainsKey('rbaconfig') ) { $payload.Add('rbaconfig', $rbaconfig) }
            if ( $PSCmdlet.ShouldProcess($Name, "Clear NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsconfig -Action clear -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCClearNsconfig: Finished"
    }
}

function Invoke-ADCUpdateNsconfig {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for system config resource.
    .PARAMETER Ipaddress
        IP address of the Citrix ADC. Commonly referred to as NSIP address. This parameter is mandatory to bring up the appliance.
    .PARAMETER Netmask
        Netmask corresponding to the IP address. This parameter is mandatory to bring up the appliance.
    .PARAMETER Nsvlan
        VLAN (NSVLAN) for the subnet on which the IP address resides.
    .PARAMETER Ifnum
        Interfaces of the appliances that must be bound to the NSVLAN.
    .PARAMETER Tagged
        Specifies that the interfaces will be added as 802.1q tagged interfaces. Packets sent on these interface on this VLAN will have an additional 4-byte 802.1q tag which identifies the VLAN.
        To use 802.1q tagging, the switch connected to the appliance's interfaces must also be configured for tagging.
        Possible values = YES, NO
    .PARAMETER Httpport
        The HTTP ports on the Web server. This allows the system to perform connection off-load for any client request that has a destination port matching one of these configured ports.
    .PARAMETER Maxconn
        The maximum number of connections that will be made from the system to the web server(s) attached to it. The value entered here is applied globally to all attached servers.
    .PARAMETER Maxreq
        The maximum number of requests that the system can pass on a particular connection between the system and a server attached to it. Setting this value to 0 allows an unlimited number of requests to be passed.
    .PARAMETER Cip
        The option to control (enable or disable) the insertion of the actual client IP address into the HTTP header request passed from the client to one, some, or all servers attached to the system.
        The passed address can then be accessed through a minor modification to the server.
        l If cipHeader is specified, it will be used as the client IP header.
        l If it is not specified, then the value that has been set by the set ns config CLI command will be used as the client IP header.
        Possible values = ENABLED, DISABLED
    .PARAMETER Cipheader
        The text that will be used as the client IP header.
    .PARAMETER Cookieversion
        The version of the cookie inserted by system.
        Possible values = 0, 1
    .PARAMETER Securecookie
        enable/disable secure flag for persistence cookie.
        Possible values = ENABLED, DISABLED
    .PARAMETER Pmtumin
        The minimum Path MTU.
    .PARAMETER Pmtutimeout
        The timeout value in minutes.
    .PARAMETER Ftpportrange
        Port range configured for FTP services.
    .PARAMETER Crportrange
        Port range for cache redirection services.
    .PARAMETER Timezone
        Name of the timezone.
    .PARAMETER Grantquotamaxclient
        The percentage of shared quota to be granted at a time for maxClient.
    .PARAMETER Exclusivequotamaxclient
        The percentage of maxClient to be given to PEs.
    .PARAMETER Grantquotaspillover
        The percentage of shared quota to be granted at a time for spillover.
    .PARAMETER Exclusivequotaspillover
        The percentage of max limit to be given to PEs.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsconfig
        An example how to update nsconfig configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsconfig
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsconfig/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Ipaddress,

        [string]$Netmask,

        [ValidateRange(2, 4094)]
        [double]$Nsvlan,

        [ValidateScript({ $_.Length -gt 1 })]
        [string[]]$Ifnum,

        [ValidateSet('YES', 'NO')]
        [string]$Tagged,

        [int[]]$Httpport,

        [ValidateRange(0, 4294967294)]
        [double]$Maxconn,

        [ValidateRange(0, 65535)]
        [double]$Maxreq,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Cip,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Cipheader,

        [ValidateSet('0', '1')]
        [string]$Cookieversion,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Securecookie,

        [ValidateRange(168, 1500)]
        [double]$Pmtumin,

        [ValidateRange(1, 1440)]
        [double]$Pmtutimeout,

        [ValidateLength(1024, 64000)]
        [string]$Ftpportrange,

        [ValidateLength(1, 65535)]
        [string]$Crportrange,

        [ValidateLength(1, 64)]
        [string]$Timezone,

        [ValidateRange(0, 100)]
        [double]$Grantquotamaxclient,

        [ValidateRange(0, 100)]
        [double]$Exclusivequotamaxclient,

        [ValidateRange(0, 100)]
        [double]$Grantquotaspillover,

        [ValidateRange(0, 100)]
        [double]$Exclusivequotaspillover 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsconfig: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('ipaddress') ) { $payload.Add('ipaddress', $ipaddress) }
            if ( $PSBoundParameters.ContainsKey('netmask') ) { $payload.Add('netmask', $netmask) }
            if ( $PSBoundParameters.ContainsKey('nsvlan') ) { $payload.Add('nsvlan', $nsvlan) }
            if ( $PSBoundParameters.ContainsKey('ifnum') ) { $payload.Add('ifnum', $ifnum) }
            if ( $PSBoundParameters.ContainsKey('tagged') ) { $payload.Add('tagged', $tagged) }
            if ( $PSBoundParameters.ContainsKey('httpport') ) { $payload.Add('httpport', $httpport) }
            if ( $PSBoundParameters.ContainsKey('maxconn') ) { $payload.Add('maxconn', $maxconn) }
            if ( $PSBoundParameters.ContainsKey('maxreq') ) { $payload.Add('maxreq', $maxreq) }
            if ( $PSBoundParameters.ContainsKey('cip') ) { $payload.Add('cip', $cip) }
            if ( $PSBoundParameters.ContainsKey('cipheader') ) { $payload.Add('cipheader', $cipheader) }
            if ( $PSBoundParameters.ContainsKey('cookieversion') ) { $payload.Add('cookieversion', $cookieversion) }
            if ( $PSBoundParameters.ContainsKey('securecookie') ) { $payload.Add('securecookie', $securecookie) }
            if ( $PSBoundParameters.ContainsKey('pmtumin') ) { $payload.Add('pmtumin', $pmtumin) }
            if ( $PSBoundParameters.ContainsKey('pmtutimeout') ) { $payload.Add('pmtutimeout', $pmtutimeout) }
            if ( $PSBoundParameters.ContainsKey('ftpportrange') ) { $payload.Add('ftpportrange', $ftpportrange) }
            if ( $PSBoundParameters.ContainsKey('crportrange') ) { $payload.Add('crportrange', $crportrange) }
            if ( $PSBoundParameters.ContainsKey('timezone') ) { $payload.Add('timezone', $timezone) }
            if ( $PSBoundParameters.ContainsKey('grantquotamaxclient') ) { $payload.Add('grantquotamaxclient', $grantquotamaxclient) }
            if ( $PSBoundParameters.ContainsKey('exclusivequotamaxclient') ) { $payload.Add('exclusivequotamaxclient', $exclusivequotamaxclient) }
            if ( $PSBoundParameters.ContainsKey('grantquotaspillover') ) { $payload.Add('grantquotaspillover', $grantquotaspillover) }
            if ( $PSBoundParameters.ContainsKey('exclusivequotaspillover') ) { $payload.Add('exclusivequotaspillover', $exclusivequotaspillover) }
            if ( $PSCmdlet.ShouldProcess("nsconfig", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsconfig -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsconfig: Finished"
    }
}

function Invoke-ADCUnsetNsconfig {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for system config resource.
    .PARAMETER Nsvlan
        VLAN (NSVLAN) for the subnet on which the IP address resides.
    .PARAMETER Ftpportrange
        Port range configured for FTP services.
    .PARAMETER Crportrange
        Port range for cache redirection services.
    .PARAMETER Timezone
        Name of the timezone.
    .PARAMETER Ipaddress
        IP address of the Citrix ADC. Commonly referred to as NSIP address. This parameter is mandatory to bring up the appliance.
    .PARAMETER Netmask
        Netmask corresponding to the IP address. This parameter is mandatory to bring up the appliance.
    .PARAMETER Ifnum
        Interfaces of the appliances that must be bound to the NSVLAN.
    .PARAMETER Tagged
        Specifies that the interfaces will be added as 802.1q tagged interfaces. Packets sent on these interface on this VLAN will have an additional 4-byte 802.1q tag which identifies the VLAN.
        To use 802.1q tagging, the switch connected to the appliance's interfaces must also be configured for tagging.
        Possible values = YES, NO
    .PARAMETER Httpport
        The HTTP ports on the Web server. This allows the system to perform connection off-load for any client request that has a destination port matching one of these configured ports.
    .PARAMETER Maxconn
        The maximum number of connections that will be made from the system to the web server(s) attached to it. The value entered here is applied globally to all attached servers.
    .PARAMETER Maxreq
        The maximum number of requests that the system can pass on a particular connection between the system and a server attached to it. Setting this value to 0 allows an unlimited number of requests to be passed.
    .PARAMETER Cip
        The option to control (enable or disable) the insertion of the actual client IP address into the HTTP header request passed from the client to one, some, or all servers attached to the system.
        The passed address can then be accessed through a minor modification to the server.
        l If cipHeader is specified, it will be used as the client IP header.
        l If it is not specified, then the value that has been set by the set ns config CLI command will be used as the client IP header.
        Possible values = ENABLED, DISABLED
    .PARAMETER Cipheader
        The text that will be used as the client IP header.
    .PARAMETER Cookieversion
        The version of the cookie inserted by system.
        Possible values = 0, 1
    .PARAMETER Securecookie
        enable/disable secure flag for persistence cookie.
        Possible values = ENABLED, DISABLED
    .PARAMETER Pmtumin
        The minimum Path MTU.
    .PARAMETER Pmtutimeout
        The timeout value in minutes.
    .PARAMETER Grantquotamaxclient
        The percentage of shared quota to be granted at a time for maxClient.
    .PARAMETER Exclusivequotamaxclient
        The percentage of maxClient to be given to PEs.
    .PARAMETER Grantquotaspillover
        The percentage of shared quota to be granted at a time for spillover.
    .PARAMETER Exclusivequotaspillover
        The percentage of max limit to be given to PEs.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNsconfig
        An example how to unset nsconfig configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNsconfig
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsconfig
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Boolean]$nsvlan,

        [Boolean]$ftpportrange,

        [Boolean]$crportrange,

        [Boolean]$timezone,

        [Boolean]$ipaddress,

        [Boolean]$netmask,

        [Boolean]$ifnum,

        [Boolean]$tagged,

        [Boolean]$httpport,

        [Boolean]$maxconn,

        [Boolean]$maxreq,

        [Boolean]$cip,

        [Boolean]$cipheader,

        [Boolean]$cookieversion,

        [Boolean]$securecookie,

        [Boolean]$pmtumin,

        [Boolean]$pmtutimeout,

        [Boolean]$grantquotamaxclient,

        [Boolean]$exclusivequotamaxclient,

        [Boolean]$grantquotaspillover,

        [Boolean]$exclusivequotaspillover 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNsconfig: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('nsvlan') ) { $payload.Add('nsvlan', $nsvlan) }
            if ( $PSBoundParameters.ContainsKey('ftpportrange') ) { $payload.Add('ftpportrange', $ftpportrange) }
            if ( $PSBoundParameters.ContainsKey('crportrange') ) { $payload.Add('crportrange', $crportrange) }
            if ( $PSBoundParameters.ContainsKey('timezone') ) { $payload.Add('timezone', $timezone) }
            if ( $PSBoundParameters.ContainsKey('ipaddress') ) { $payload.Add('ipaddress', $ipaddress) }
            if ( $PSBoundParameters.ContainsKey('netmask') ) { $payload.Add('netmask', $netmask) }
            if ( $PSBoundParameters.ContainsKey('ifnum') ) { $payload.Add('ifnum', $ifnum) }
            if ( $PSBoundParameters.ContainsKey('tagged') ) { $payload.Add('tagged', $tagged) }
            if ( $PSBoundParameters.ContainsKey('httpport') ) { $payload.Add('httpport', $httpport) }
            if ( $PSBoundParameters.ContainsKey('maxconn') ) { $payload.Add('maxconn', $maxconn) }
            if ( $PSBoundParameters.ContainsKey('maxreq') ) { $payload.Add('maxreq', $maxreq) }
            if ( $PSBoundParameters.ContainsKey('cip') ) { $payload.Add('cip', $cip) }
            if ( $PSBoundParameters.ContainsKey('cipheader') ) { $payload.Add('cipheader', $cipheader) }
            if ( $PSBoundParameters.ContainsKey('cookieversion') ) { $payload.Add('cookieversion', $cookieversion) }
            if ( $PSBoundParameters.ContainsKey('securecookie') ) { $payload.Add('securecookie', $securecookie) }
            if ( $PSBoundParameters.ContainsKey('pmtumin') ) { $payload.Add('pmtumin', $pmtumin) }
            if ( $PSBoundParameters.ContainsKey('pmtutimeout') ) { $payload.Add('pmtutimeout', $pmtutimeout) }
            if ( $PSBoundParameters.ContainsKey('grantquotamaxclient') ) { $payload.Add('grantquotamaxclient', $grantquotamaxclient) }
            if ( $PSBoundParameters.ContainsKey('exclusivequotamaxclient') ) { $payload.Add('exclusivequotamaxclient', $exclusivequotamaxclient) }
            if ( $PSBoundParameters.ContainsKey('grantquotaspillover') ) { $payload.Add('grantquotaspillover', $grantquotaspillover) }
            if ( $PSBoundParameters.ContainsKey('exclusivequotaspillover') ) { $payload.Add('exclusivequotaspillover', $exclusivequotaspillover) }
            if ( $PSCmdlet.ShouldProcess("nsconfig", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nsconfig -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNsconfig: Finished"
    }
}

function Invoke-ADCSaveNsconfig {
    <#
    .SYNOPSIS
        Save NS configuration Object.
    .DESCRIPTION
        Configuration for system config resource.
    .PARAMETER All
        Use this option to do saveconfig for all partitions.
    .EXAMPLE
        PS C:\>Invoke-ADCSaveNsconfig
        An example how to save nsconfig configuration Object(s).
    .NOTES
        File Name : Invoke-ADCSaveNsconfig
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsconfig/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [boolean]$All 

    )
    begin {
        Write-Verbose "Invoke-ADCSaveNsconfig: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('all') ) { $payload.Add('all', $all) }
            if ( $PSCmdlet.ShouldProcess($Name, "Save NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsconfig -Action save -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCSaveNsconfig: Finished"
    }
}

function Invoke-ADCDiffNsconfig {
    <#
    .SYNOPSIS
        Diff NS configuration Object.
    .DESCRIPTION
        Configuration for system config resource.
    .PARAMETER Config1
        Location of the configurations.
    .PARAMETER Config2
        Location of the configurations.
    .PARAMETER Outtype
        Format to display the difference in configurations.
        Possible values = cli, xml
    .PARAMETER Template
        File that contains the commands to be compared.
    .PARAMETER Ignoredevicespecific
        Suppress device specific differences.
    .EXAMPLE
        PS C:\>Invoke-ADCDiffNsconfig
        An example how to diff nsconfig configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDiffNsconfig
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsconfig/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [string]$Config1,

        [string]$Config2,

        [ValidateSet('cli', 'xml')]
        [string]$Outtype,

        [boolean]$Template,

        [boolean]$Ignoredevicespecific 

    )
    begin {
        Write-Verbose "Invoke-ADCDiffNsconfig: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('config1') ) { $payload.Add('config1', $config1) }
            if ( $PSBoundParameters.ContainsKey('config2') ) { $payload.Add('config2', $config2) }
            if ( $PSBoundParameters.ContainsKey('outtype') ) { $payload.Add('outtype', $outtype) }
            if ( $PSBoundParameters.ContainsKey('template') ) { $payload.Add('template', $template) }
            if ( $PSBoundParameters.ContainsKey('ignoredevicespecific') ) { $payload.Add('ignoredevicespecific', $ignoredevicespecific) }
            if ( $PSCmdlet.ShouldProcess($Name, "Diff NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsconfig -Action diff -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDiffNsconfig: Finished"
    }
}

function Invoke-ADCGetNsconfig {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for system config resource.
    .PARAMETER GetAll
        Retrieve all nsconfig object(s).
    .PARAMETER Count
        If specified, the count of the nsconfig object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsconfig
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsconfig -GetAll
        Get all nsconfig data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsconfig -name <string>
        Get nsconfig object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsconfig -Filter @{ 'name'='<value>' }
        Get nsconfig data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsconfig
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsconfig/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNsconfig: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsconfig objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsconfig -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsconfig objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsconfig -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsconfig objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsconfig -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsconfig configuration for property ''"

            } else {
                Write-Verbose "Retrieving nsconfig configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsconfig -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsconfig: Ended"
    }
}

function Invoke-ADCGetNsconnectiontable {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for TCP/IP connection table resource.
    .PARAMETER Filterexpression
        The maximum length of filter expression is 255 and it can be of following format:
        <expression> [<relop> <expression>]
        <relop> = ( ;; | || )
        <expression> =:
        CONNECTION.<qualifier>.<qualifier-method>.(<qualifier-value>)
        <qualifier> = SRCIP
        <qualifier-method> = [ EQ | NE ]
        <qualifier-value> = A valid IPv4 address
        example = CONNECTION.SRCIP.EQ(127.0.0.1)
        <qualifier> = DSTIP
        <qualifier-method> = [ EQ | NE ]
        <qualifier-value> = A valid IPv4 address.
        example = CONNECTION.DSTIP.EQ(127.0.0.1)
        <qualifier> = IP
        <qualifier-method> = [ EQ | NE ]
        <qualifier-value> = A valid IPv4 address.
        example = CONNECTION.IP.EQ(127.0.0.1)
        <qualifier> = SRCIPv6
        <qualifier-method> = [ EQ | NE ]
        <qualifier-value> = A valid IPv6 address.
        example = CONNECTION.SRCIPv6.EQ(2001:db8:0:0:1::1)
        <qualifier> = DSTIPv6
        <qualifier-method> = [ EQ | NE ]
        <qualifier-value> = A valid IPv6 address.
        example = CONNECTION.DSTIPv6.EQ(2001:db8:0:0:1::1)
        <qualifier> = IPv6
        <qualifier-method> = [ EQ | NE ]
        <qualifier-value> = A valid IPv6 address.
        example = CONNECTION.IPv6.EQ(2001:db8:0:0:1::1)
        <qualifier> = SRCPORT
        <qualifier-method> = [ EQ | NE | GT | GE | LT | LE
        | BETWEEN ]
        <qualifier-value> = A valid port number.
        example = CONNECTION.SRCPORT.EQ(80)
        <qualifier> = DSTPORT
        <qualifier-method> = [ EQ | NE | GT | GE | LT | LE
        | BETWEEN ]
        <qualifier-value> = A valid port number.
        example = CONNECTION.DSTPORT.EQ(80)
        <qualifier> = PORT
        <qualifier-method> = [ EQ | NE | GT | GE | LT | LE
        | BETWEEN ]
        <qualifier-value> = A valid port number.
        example = CONNECTION.PORT.EQ(80)
        <qualifier> = SVCNAME
        <qualifier-method> = [ EQ | NE | CONTAINS | STARTSWITH
        | ENDSWITH ]
        <qualifier-value> = service name.
        example = CONNECTION.SVCNAME.EQ("name")
        <qualifier> = LB_VSERVER.NAME
        <qualifier-method> = [ EQ | NE | CONTAINS | STARTSWITH
        | ENDSWITH ]
        <qualifier-value> = LB vserver name.
        example = CONNECTION.LB_VSERVER.NAME.EQ("name")
        <qualifier> = CS_VSERVER.NAME
        <qualifier-method> = [ EQ | NE | CONTAINS | STARTSWITH
        | ENDSWITH ]
        <qualifier-value> = CS vserver name.
        example = CONNECTION.CS_VSERVER.NAME.EQ("name")
        <qualifier> = INTF
        <qualifier-method> = [ EQ | NE ]
        <qualifier-value> = A valid interface id in the form of
        x/y (n/x/y in case of cluster interface).
        examle = CONNECTION.INTF.EQ("0/1/1")
        <qualifier> = VLANID
        <qualifier-method> = [ EQ | NE | GT | GE | LT | LE
        | BETWEEN ]
        <qualifier-value> = A valid VLAN ID.
        example = CONNECTION.VLANID.EQ(0)
        <qualifier> = CONNID
        <qualifier-method> = [ EQ | NE | GT | GE | LT | LE
        | BETWEEN ]
        <qualifier-value> = A valid PCB dev number.
        example = CONNECTION.CONNID.EQ(0)
        <qualifier> = PPEID
        <qualifier-method> = [ EQ | NE | GT | GE | LT | LE
        | BETWEEN ]
        <qualifier-value> = A valid core ID.
        example = CONNECTION.PPEID.EQ(0)
        <qualifier> = IDLETIME
        <qualifier-method> = [ EQ | NE | GT | GE | LT | LE
        | BETWEEN ]
        <qualifier-value> = A positive integer indicating the
        idletime.
        example = CONNECTION.IDLETIME.LT(100)
        <qualifier> = TCPSTATE
        <qualifier-method> = [ EQ | NE ]
        <qualifier-value> = ( CLOSE_WAIT | CLOSED | CLOSING |
        ESTABLISHED | FIN_WAIT_1 | FIN_WAIT_2 | LAST_ACK |
        LISTEN | SYN_RECEIVED | SYN_SENT | TIME_WAIT |
        NOT_APPLICABLE)
        example = CONNECTION.TCPSTATE.EQ(LISTEN)
        <qualifier> = SERVICE_TYPE
        <qualifier-method> = [ EQ | NE ]
        <qualifier-value> = ( SVC_HTTP | FTP | TCP | UDP | SSL |
        SSL_BRIDGE | SSL_TCP | NNTP | RPCSVR | RPCSVRS |
        RPCCLNT | SVC_DNS | ADNS | SNMP | RTSP | DHCPRA | NAT | ANY |
        MONITOR | MONITOR_UDP | MONITOR_PING | SIP_UDP |
        SVC_MYSQL | SVC_MSSQL | SERVICE_UNKNOWN )
        example = CONNECTION.SERVICE_TYPE.EQ(ANY)
        <qualifier> = TRAFFIC_DOMAIN_ID
        <qualifier-method> = [ EQ | NE | GT | GE | LT | LE
        | BETWEEN ]
        <qualifier-value> = A valid traffic domain ID.
        example = CONNECTION.TRAFFIC_DOMAIN_ID.EQ(0)
        common usecases:
        Filtering out loopback connections and view present
        connections through netscaler
        show connectiontable "CONNECTION.IP.NE(127.0.0.1) ;;
        CONNECTION.TCPSTATE.EQ(ESTABLISHED)" -detail full
        show connections from a particular sourceip and targeted
        to port 80
        show connectiontable "CONNECTION.SRCIP.EQ(10.102.1.91) ;;
        CONNECTION.DSTPORT.EQ(80)"
        show connection particular to a service and its linked
        client connections
        show connectiontable CONNECTION.SVCNAME.EQ("S1")
        -detail link
        show connections for a particular servicetype(e.g.http)
        show connectiontable CONNECTION.SERVICE_TYPE.EQ(TCP)
        viewing connections that have been idle for a long time
        show connectiontable CONNECTION.IDLETIME.GT(100)
        show connections particular to a service and idle
        for a long time
        show connectiontable "CONNECTION.SVCNAME.EQ(\\"S1\\") ;;
        CONNECTION.IDLETIME.GT(100)"
        show connections for a particular interface
        show connectiontable CONNECTION.INTF.EQ("1/1")
        show connections for a particular interface and vlan
        show connectiontable "CONNECTION.INTF.EQ(\\"1/1\\") ;;
        CONNECTION.VLANID.EQ(1)"
        .
    .PARAMETER Link
        Display link information if available.
    .PARAMETER Filtername
        Display name instead of IP for local entities.
    .PARAMETER Detail
        Specify display options for the connection table.
        * LINK - Displays the linked PCB (Protocol Control Block).
        * NAME - Displays along with the service name.
        * CONNFAILOVER - Displays PCB with connection failover.
        * FULL - Displays all available details.
        Possible values = LINK, NAME, CONNFAILOVER, FULL, NNM, FULL+
    .PARAMETER Listen
        Display listening services only.
    .PARAMETER Nodeid
        Unique number that identifies the cluster node.
    .PARAMETER GetAll
        Retrieve all nsconnectiontable object(s).
    .PARAMETER Count
        If specified, the count of the nsconnectiontable object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsconnectiontable
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsconnectiontable -GetAll
        Get all nsconnectiontable data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsconnectiontable -Count
        Get the number of nsconnectiontable objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsconnectiontable -name <string>
        Get nsconnectiontable object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsconnectiontable -Filter @{ 'name'='<value>' }
        Get nsconnectiontable data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsconnectiontable
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsconnectiontable/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByArgument')]
        [string]$Filterexpression,

        [Parameter(ParameterSetName = 'GetByArgument')]
        [boolean]$Link,

        [Parameter(ParameterSetName = 'GetByArgument')]
        [boolean]$Filtername,

        [Parameter(ParameterSetName = 'GetByArgument')]
        [ValidateSet('LINK', 'NAME', 'CONNFAILOVER', 'FULL', 'NNM', 'FULL+')]
        [string[]]$Detail,

        [Parameter(ParameterSetName = 'GetByArgument')]
        [boolean]$Listen,

        [Parameter(ParameterSetName = 'GetByArgument')]
        [ValidateRange(0, 31)]
        [double]$Nodeid,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNsconnectiontable: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsconnectiontable objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsconnectiontable -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsconnectiontable objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsconnectiontable -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsconnectiontable objects by arguments"
                $arguments = @{ } 
                if ( $PSBoundParameters.ContainsKey('filterexpression') ) { $arguments.Add('filterexpression', $filterexpression) } 
                if ( $PSBoundParameters.ContainsKey('link') ) { $arguments.Add('link', $link) } 
                if ( $PSBoundParameters.ContainsKey('filtername') ) { $arguments.Add('filtername', $filtername) } 
                if ( $PSBoundParameters.ContainsKey('detail') ) { $arguments.Add('detail', $detail) } 
                if ( $PSBoundParameters.ContainsKey('listen') ) { $arguments.Add('listen', $listen) } 
                if ( $PSBoundParameters.ContainsKey('nodeid') ) { $arguments.Add('nodeid', $nodeid) }
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsconnectiontable -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsconnectiontable configuration for property ''"

            } else {
                Write-Verbose "Retrieving nsconnectiontable configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsconnectiontable -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsconnectiontable: Ended"
    }
}

function Invoke-ADCUpdateNsconsoleloginprompt {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for console prompt resource.
    .PARAMETER Promptstring
        Console login prompt string.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsconsoleloginprompt
        An example how to update nsconsoleloginprompt configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsconsoleloginprompt
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsconsoleloginprompt/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [string]$Promptstring 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsconsoleloginprompt: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('promptstring') ) { $payload.Add('promptstring', $promptstring) }
            if ( $PSCmdlet.ShouldProcess("nsconsoleloginprompt", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsconsoleloginprompt -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsconsoleloginprompt: Finished"
    }
}

function Invoke-ADCUnsetNsconsoleloginprompt {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for console prompt resource.
    .PARAMETER Promptstring
        Console login prompt string.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNsconsoleloginprompt
        An example how to unset nsconsoleloginprompt configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNsconsoleloginprompt
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsconsoleloginprompt
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Boolean]$promptstring 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNsconsoleloginprompt: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('promptstring') ) { $payload.Add('promptstring', $promptstring) }
            if ( $PSCmdlet.ShouldProcess("nsconsoleloginprompt", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nsconsoleloginprompt -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNsconsoleloginprompt: Finished"
    }
}

function Invoke-ADCGetNsconsoleloginprompt {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for console prompt resource.
    .PARAMETER GetAll
        Retrieve all nsconsoleloginprompt object(s).
    .PARAMETER Count
        If specified, the count of the nsconsoleloginprompt object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsconsoleloginprompt
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsconsoleloginprompt -GetAll
        Get all nsconsoleloginprompt data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsconsoleloginprompt -name <string>
        Get nsconsoleloginprompt object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsconsoleloginprompt -Filter @{ 'name'='<value>' }
        Get nsconsoleloginprompt data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsconsoleloginprompt
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsconsoleloginprompt/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNsconsoleloginprompt: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsconsoleloginprompt objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsconsoleloginprompt -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsconsoleloginprompt objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsconsoleloginprompt -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsconsoleloginprompt objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsconsoleloginprompt -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsconsoleloginprompt configuration for property ''"

            } else {
                Write-Verbose "Retrieving nsconsoleloginprompt configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsconsoleloginprompt -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsconsoleloginprompt: Ended"
    }
}

function Invoke-ADCUpdateNscqaparam {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for cqaparam resource.
    .PARAMETER Harqretxdelay
        HARQ retransmission delay (in ms).
    .PARAMETER Net1label
        Name of the network label.
    .PARAMETER Minrttnet1
        MIN RTT (in ms) for the first network.
    .PARAMETER Lr1coeflist
        coefficients values for Label1.
    .PARAMETER Lr1probthresh
        Probability threshold values for LR model to differentiate between NET1 and reset(NET2 and NET3).
    .PARAMETER Net1cclscale
        Three congestion level scores limits corresponding to None, Low, Medium.
    .PARAMETER Net1csqscale
        Three signal quality level scores limits corresponding to Excellent, Good, Fair.
    .PARAMETER Net1logcoef
        Connection quality ranking Log coefficients of network 1.
    .PARAMETER Net2label
        Name of the network label 2.
    .PARAMETER Minrttnet2
        MIN RTT (in ms) for the second network.
    .PARAMETER Lr2coeflist
        coefficients values for Label 2.
    .PARAMETER Lr2probthresh
        Probability threshold values for LR model to differentiate between NET2 and NET3.
    .PARAMETER Net2cclscale
        Three congestion level scores limits corresponding to None, Low, Medium.
    .PARAMETER Net2csqscale
        Three signal quality level scores limits corresponding to Excellent, Good, Fair.
    .PARAMETER Net2logcoef
        Connnection quality ranking Log coefficients of network 2.
    .PARAMETER Net3label
        Name of the network label 3.
    .PARAMETER Minrttnet3
        MIN RTT (in ms) for the third network.
    .PARAMETER Net3cclscale
        Three congestion level scores limits corresponding to None, Low, Medium.
    .PARAMETER Net3csqscale
        Three signal quality level scores limits corresponding to Excellent, Good, Fair.
    .PARAMETER Net3logcoef
        Connection quality ranking Log coefficients of network 3.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNscqaparam
        An example how to update nscqaparam configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNscqaparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nscqaparam/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateRange(1, 64000)]
        [double]$Harqretxdelay,

        [string]$Net1label,

        [ValidateRange(0, 6400)]
        [double]$Minrttnet1,

        [string]$Lr1coeflist,

        [ValidateRange(0, 1)]
        [double]$Lr1probthresh,

        [string]$Net1cclscale,

        [string]$Net1csqscale,

        [string]$Net1logcoef,

        [string]$Net2label,

        [ValidateRange(0, 6400)]
        [double]$Minrttnet2,

        [string]$Lr2coeflist,

        [ValidateRange(0, 1)]
        [double]$Lr2probthresh,

        [string]$Net2cclscale,

        [string]$Net2csqscale,

        [string]$Net2logcoef,

        [string]$Net3label,

        [ValidateRange(0, 6400)]
        [double]$Minrttnet3,

        [string]$Net3cclscale,

        [string]$Net3csqscale,

        [string]$Net3logcoef 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNscqaparam: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('harqretxdelay') ) { $payload.Add('harqretxdelay', $harqretxdelay) }
            if ( $PSBoundParameters.ContainsKey('net1label') ) { $payload.Add('net1label', $net1label) }
            if ( $PSBoundParameters.ContainsKey('minrttnet1') ) { $payload.Add('minrttnet1', $minrttnet1) }
            if ( $PSBoundParameters.ContainsKey('lr1coeflist') ) { $payload.Add('lr1coeflist', $lr1coeflist) }
            if ( $PSBoundParameters.ContainsKey('lr1probthresh') ) { $payload.Add('lr1probthresh', $lr1probthresh) }
            if ( $PSBoundParameters.ContainsKey('net1cclscale') ) { $payload.Add('net1cclscale', $net1cclscale) }
            if ( $PSBoundParameters.ContainsKey('net1csqscale') ) { $payload.Add('net1csqscale', $net1csqscale) }
            if ( $PSBoundParameters.ContainsKey('net1logcoef') ) { $payload.Add('net1logcoef', $net1logcoef) }
            if ( $PSBoundParameters.ContainsKey('net2label') ) { $payload.Add('net2label', $net2label) }
            if ( $PSBoundParameters.ContainsKey('minrttnet2') ) { $payload.Add('minrttnet2', $minrttnet2) }
            if ( $PSBoundParameters.ContainsKey('lr2coeflist') ) { $payload.Add('lr2coeflist', $lr2coeflist) }
            if ( $PSBoundParameters.ContainsKey('lr2probthresh') ) { $payload.Add('lr2probthresh', $lr2probthresh) }
            if ( $PSBoundParameters.ContainsKey('net2cclscale') ) { $payload.Add('net2cclscale', $net2cclscale) }
            if ( $PSBoundParameters.ContainsKey('net2csqscale') ) { $payload.Add('net2csqscale', $net2csqscale) }
            if ( $PSBoundParameters.ContainsKey('net2logcoef') ) { $payload.Add('net2logcoef', $net2logcoef) }
            if ( $PSBoundParameters.ContainsKey('net3label') ) { $payload.Add('net3label', $net3label) }
            if ( $PSBoundParameters.ContainsKey('minrttnet3') ) { $payload.Add('minrttnet3', $minrttnet3) }
            if ( $PSBoundParameters.ContainsKey('net3cclscale') ) { $payload.Add('net3cclscale', $net3cclscale) }
            if ( $PSBoundParameters.ContainsKey('net3csqscale') ) { $payload.Add('net3csqscale', $net3csqscale) }
            if ( $PSBoundParameters.ContainsKey('net3logcoef') ) { $payload.Add('net3logcoef', $net3logcoef) }
            if ( $PSCmdlet.ShouldProcess("nscqaparam", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nscqaparam -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNscqaparam: Finished"
    }
}

function Invoke-ADCUnsetNscqaparam {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for cqaparam resource.
    .PARAMETER Harqretxdelay
        HARQ retransmission delay (in ms).
    .PARAMETER Net1label
        Name of the network label.
    .PARAMETER Minrttnet1
        MIN RTT (in ms) for the first network.
    .PARAMETER Lr1coeflist
        coefficients values for Label1.
    .PARAMETER Lr1probthresh
        Probability threshold values for LR model to differentiate between NET1 and reset(NET2 and NET3).
    .PARAMETER Net1cclscale
        Three congestion level scores limits corresponding to None, Low, Medium.
    .PARAMETER Net1csqscale
        Three signal quality level scores limits corresponding to Excellent, Good, Fair.
    .PARAMETER Net1logcoef
        Connection quality ranking Log coefficients of network 1.
    .PARAMETER Net2label
        Name of the network label 2.
    .PARAMETER Minrttnet2
        MIN RTT (in ms) for the second network.
    .PARAMETER Net2cclscale
        Three congestion level scores limits corresponding to None, Low, Medium.
    .PARAMETER Net2csqscale
        Three signal quality level scores limits corresponding to Excellent, Good, Fair.
    .PARAMETER Net2logcoef
        Connnection quality ranking Log coefficients of network 2.
    .PARAMETER Net3label
        Name of the network label 3.
    .PARAMETER Minrttnet3
        MIN RTT (in ms) for the third network.
    .PARAMETER Net3cclscale
        Three congestion level scores limits corresponding to None, Low, Medium.
    .PARAMETER Net3csqscale
        Three signal quality level scores limits corresponding to Excellent, Good, Fair.
    .PARAMETER Net3logcoef
        Connection quality ranking Log coefficients of network 3.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNscqaparam
        An example how to unset nscqaparam configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNscqaparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nscqaparam
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Boolean]$harqretxdelay,

        [Boolean]$net1label,

        [Boolean]$minrttnet1,

        [Boolean]$lr1coeflist,

        [Boolean]$lr1probthresh,

        [Boolean]$net1cclscale,

        [Boolean]$net1csqscale,

        [Boolean]$net1logcoef,

        [Boolean]$net2label,

        [Boolean]$minrttnet2,

        [Boolean]$net2cclscale,

        [Boolean]$net2csqscale,

        [Boolean]$net2logcoef,

        [Boolean]$net3label,

        [Boolean]$minrttnet3,

        [Boolean]$net3cclscale,

        [Boolean]$net3csqscale,

        [Boolean]$net3logcoef 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNscqaparam: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('harqretxdelay') ) { $payload.Add('harqretxdelay', $harqretxdelay) }
            if ( $PSBoundParameters.ContainsKey('net1label') ) { $payload.Add('net1label', $net1label) }
            if ( $PSBoundParameters.ContainsKey('minrttnet1') ) { $payload.Add('minrttnet1', $minrttnet1) }
            if ( $PSBoundParameters.ContainsKey('lr1coeflist') ) { $payload.Add('lr1coeflist', $lr1coeflist) }
            if ( $PSBoundParameters.ContainsKey('lr1probthresh') ) { $payload.Add('lr1probthresh', $lr1probthresh) }
            if ( $PSBoundParameters.ContainsKey('net1cclscale') ) { $payload.Add('net1cclscale', $net1cclscale) }
            if ( $PSBoundParameters.ContainsKey('net1csqscale') ) { $payload.Add('net1csqscale', $net1csqscale) }
            if ( $PSBoundParameters.ContainsKey('net1logcoef') ) { $payload.Add('net1logcoef', $net1logcoef) }
            if ( $PSBoundParameters.ContainsKey('net2label') ) { $payload.Add('net2label', $net2label) }
            if ( $PSBoundParameters.ContainsKey('minrttnet2') ) { $payload.Add('minrttnet2', $minrttnet2) }
            if ( $PSBoundParameters.ContainsKey('net2cclscale') ) { $payload.Add('net2cclscale', $net2cclscale) }
            if ( $PSBoundParameters.ContainsKey('net2csqscale') ) { $payload.Add('net2csqscale', $net2csqscale) }
            if ( $PSBoundParameters.ContainsKey('net2logcoef') ) { $payload.Add('net2logcoef', $net2logcoef) }
            if ( $PSBoundParameters.ContainsKey('net3label') ) { $payload.Add('net3label', $net3label) }
            if ( $PSBoundParameters.ContainsKey('minrttnet3') ) { $payload.Add('minrttnet3', $minrttnet3) }
            if ( $PSBoundParameters.ContainsKey('net3cclscale') ) { $payload.Add('net3cclscale', $net3cclscale) }
            if ( $PSBoundParameters.ContainsKey('net3csqscale') ) { $payload.Add('net3csqscale', $net3csqscale) }
            if ( $PSBoundParameters.ContainsKey('net3logcoef') ) { $payload.Add('net3logcoef', $net3logcoef) }
            if ( $PSCmdlet.ShouldProcess("nscqaparam", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nscqaparam -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNscqaparam: Finished"
    }
}

function Invoke-ADCGetNscqaparam {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for cqaparam resource.
    .PARAMETER GetAll
        Retrieve all nscqaparam object(s).
    .PARAMETER Count
        If specified, the count of the nscqaparam object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNscqaparam
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNscqaparam -GetAll
        Get all nscqaparam data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNscqaparam -name <string>
        Get nscqaparam object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNscqaparam -Filter @{ 'name'='<value>' }
        Get nscqaparam data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNscqaparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nscqaparam/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNscqaparam: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nscqaparam objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nscqaparam -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nscqaparam objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nscqaparam -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nscqaparam objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nscqaparam -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nscqaparam configuration for property ''"

            } else {
                Write-Verbose "Retrieving nscqaparam configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nscqaparam -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNscqaparam: Ended"
    }
}

function Invoke-ADCUpdateNsdhcpparams {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for DHCP parameters resource.
    .PARAMETER Dhcpclient
        Enables DHCP client to acquire IP address from the DHCP server in the next boot. When set to OFF, disables the DHCP client in the next boot.
        Possible values = ON, OFF
    .PARAMETER Saveroute
        DHCP acquired routes are saved on the Citrix ADC.
        Possible values = ON, OFF
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsdhcpparams
        An example how to update nsdhcpparams configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsdhcpparams
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsdhcpparams/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateSet('ON', 'OFF')]
        [string]$Dhcpclient,

        [ValidateSet('ON', 'OFF')]
        [string]$Saveroute 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsdhcpparams: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('dhcpclient') ) { $payload.Add('dhcpclient', $dhcpclient) }
            if ( $PSBoundParameters.ContainsKey('saveroute') ) { $payload.Add('saveroute', $saveroute) }
            if ( $PSCmdlet.ShouldProcess("nsdhcpparams", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsdhcpparams -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsdhcpparams: Finished"
    }
}

function Invoke-ADCUnsetNsdhcpparams {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for DHCP parameters resource.
    .PARAMETER Dhcpclient
        Enables DHCP client to acquire IP address from the DHCP server in the next boot. When set to OFF, disables the DHCP client in the next boot.
        Possible values = ON, OFF
    .PARAMETER Saveroute
        DHCP acquired routes are saved on the Citrix ADC.
        Possible values = ON, OFF
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNsdhcpparams
        An example how to unset nsdhcpparams configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNsdhcpparams
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsdhcpparams
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Boolean]$dhcpclient,

        [Boolean]$saveroute 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNsdhcpparams: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('dhcpclient') ) { $payload.Add('dhcpclient', $dhcpclient) }
            if ( $PSBoundParameters.ContainsKey('saveroute') ) { $payload.Add('saveroute', $saveroute) }
            if ( $PSCmdlet.ShouldProcess("nsdhcpparams", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nsdhcpparams -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNsdhcpparams: Finished"
    }
}

function Invoke-ADCGetNsdhcpparams {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for DHCP parameters resource.
    .PARAMETER GetAll
        Retrieve all nsdhcpparams object(s).
    .PARAMETER Count
        If specified, the count of the nsdhcpparams object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsdhcpparams
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsdhcpparams -GetAll
        Get all nsdhcpparams data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsdhcpparams -name <string>
        Get nsdhcpparams object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsdhcpparams -Filter @{ 'name'='<value>' }
        Get nsdhcpparams data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsdhcpparams
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsdhcpparams/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNsdhcpparams: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsdhcpparams objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsdhcpparams -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsdhcpparams objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsdhcpparams -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsdhcpparams objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsdhcpparams -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsdhcpparams configuration for property ''"

            } else {
                Write-Verbose "Retrieving nsdhcpparams configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsdhcpparams -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsdhcpparams: Ended"
    }
}

function Invoke-ADCUpdateNsdiameter {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for Diameter Parameters resource.
    .PARAMETER Identity
        DiameterIdentity to be used by NS. DiameterIdentity is used to identify a Diameter node uniquely. Before setting up diameter configuration, Citrix ADC (as a Diameter node) MUST be assigned a unique DiameterIdentity.
        example =>
        set ns diameter -identity netscaler.com
        Now whenever Citrix ADC needs to use identity in diameter messages. It will use 'netscaler.com' as Origin-Host AVP as defined in RFC3588
        .
    .PARAMETER Realm
        Diameter Realm to be used by NS.
        example =>
        set ns diameter -realm com
        Now whenever Citrix ADC system needs to use realm in diameter messages. It will use 'com' as Origin-Realm AVP as defined in RFC3588
        .
    .PARAMETER Serverclosepropagation
        when a Server connection goes down, whether to close the corresponding client connection if there were requests pending on the server.
        Possible values = YES, NO
    .PARAMETER Ownernode
        ID of the cluster node for which the diameter id is set, can be configured only through CLIP.
    .PARAMETER PassThru
        Return details about the created nsdiameter item.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsdiameter
        An example how to update nsdiameter configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsdiameter
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsdiameter/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Identity,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Realm,

        [ValidateSet('YES', 'NO')]
        [string]$Serverclosepropagation,

        [ValidateRange(0, 31)]
        [double]$Ownernode,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsdiameter: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('identity') ) { $payload.Add('identity', $identity) }
            if ( $PSBoundParameters.ContainsKey('realm') ) { $payload.Add('realm', $realm) }
            if ( $PSBoundParameters.ContainsKey('serverclosepropagation') ) { $payload.Add('serverclosepropagation', $serverclosepropagation) }
            if ( $PSBoundParameters.ContainsKey('ownernode') ) { $payload.Add('ownernode', $ownernode) }
            if ( $PSCmdlet.ShouldProcess("nsdiameter", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsdiameter -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsdiameter -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsdiameter: Finished"
    }
}

function Invoke-ADCUnsetNsdiameter {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for Diameter Parameters resource.
    .PARAMETER Serverclosepropagation
        when a Server connection goes down, whether to close the corresponding client connection if there were requests pending on the server.
        Possible values = YES, NO
    .PARAMETER Ownernode
        ID of the cluster node for which the diameter id is set, can be configured only through CLIP.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNsdiameter
        An example how to unset nsdiameter configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNsdiameter
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsdiameter
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Boolean]$serverclosepropagation,

        [Boolean]$ownernode 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNsdiameter: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('serverclosepropagation') ) { $payload.Add('serverclosepropagation', $serverclosepropagation) }
            if ( $PSBoundParameters.ContainsKey('ownernode') ) { $payload.Add('ownernode', $ownernode) }
            if ( $PSCmdlet.ShouldProcess("nsdiameter", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nsdiameter -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNsdiameter: Finished"
    }
}

function Invoke-ADCGetNsdiameter {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for Diameter Parameters resource.
    .PARAMETER Ownernode
        ID of the cluster node for which the diameter id is set, can be configured only through CLIP.
    .PARAMETER GetAll
        Retrieve all nsdiameter object(s).
    .PARAMETER Count
        If specified, the count of the nsdiameter object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsdiameter
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsdiameter -GetAll
        Get all nsdiameter data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsdiameter -Count
        Get the number of nsdiameter objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsdiameter -name <string>
        Get nsdiameter object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsdiameter -Filter @{ 'name'='<value>' }
        Get nsdiameter data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsdiameter
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsdiameter/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateRange(0, 31)]
        [double]$Ownernode,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNsdiameter: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsdiameter objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsdiameter -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsdiameter objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsdiameter -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsdiameter objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsdiameter -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsdiameter configuration for property 'ownernode'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsdiameter -NitroPath nitro/v1/config -Resource $ownernode -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nsdiameter configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsdiameter -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsdiameter: Ended"
    }
}

function Invoke-ADCAddNsencryptionkey {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for encryption key resource.
    .PARAMETER Name
        Key name. This follows the same syntax rules as other expression entity names:
        It must begin with an alpha character (A-Z or a-z) or an underscore (_).
        The rest of the characters must be alpha, numeric (0-9) or underscores.
        It cannot be re or xp (reserved for regular and XPath expressions).
        It cannot be an expression reserved word (e.g. SYS or HTTP).
        It cannot be used for an existing expression object (HTTP callout, patset, dataset, stringmap, or named expression).
    .PARAMETER Method
        Cipher method to be used to encrypt and decrypt content.
        NONE - no encryption or decryption is performed The output of ENCRYPT() and DECRYPT() is the same as the input.
        RC4 - the RC4 stream cipher with a 128 bit (16 byte) key; RC4 is now considered insecure and should only be used if required by existing applciations.
        DES[-<mode>] - the Data Encryption Standard (DES) block cipher with a 64-bit (8 byte) key, with 56 data bits and 8 parity bits. DES is considered less secure than DES3 or AES so it should only be used if required by an existing applicastion. The optional mode is described below; DES without a mode is equivalent to DES-CBC.
        DES3[-<mode>] - the Triple Data Encryption Standard (DES) block cipher with a 192-bit (24 byte) key. The optional mode is described below; DES3 without a mode is equivalent to DES3-CBC.
        AES<keysize>[-<mode>] - the Advanced Encryption Standard block cipher, available with 128 bit (16 byte), 192 bit (24 byte), and 256 bit (32 byte) keys. The optional mode is described below; AES<keysize> without a mode is equivalent to AES<keysize>-CBC.
        For a block cipher, the <mode> specifies how multiple blocks of plaintext are encrypted and how the Initialization Vector (IV) is used. Choices are
        CBC (Cipher Block Chaining) - Each block of plaintext is XORed with the previous ciphertext block, or IV for the first block, before being encrypted. Padding is required if the plaintext is not a multiple of the cipher block size.
        CFB (Cipher Feedback) - The previous ciphertext block, or the IV for the first block, is encrypted and the output is XORed with the current plaintext block to create the current ciphertext block. The 128-bit version of CFB is provided. Padding is not required.
        OFB (Output Feedback) - A keystream is generated by applying the cipher successfully to the IV and XORing the keystream blocks with the plaintext. Padding is not required.
        ECB (Electronic Codebook) - Each block of plaintext is independently encrypted. An IV is not used. Padding is required. This mode is considered less secure than the other modes because the same plaintext always produces the same encrypted text and should only be used if required by an existing application.
        Possible values = NONE, RC4, DES3, AES128, AES192, AES256, DES, DES-CBC, DES-CFB, DES-OFB, DES-ECB, DES3-CBC, DES3-CFB, DES3-OFB, DES3-ECB, AES128-CBC, AES128-CFB, AES128-OFB, AES128-ECB, AES192-CBC, AES192-CFB, AES192-OFB, AES192-ECB, AES256-CBC, AES256-CFB, AES256-OFB, AES256-ECB
    .PARAMETER Keyvalue
        The hex-encoded key value. The length is determined by the cipher method:
        RC4 - 16 bytes
        DES - 8 bytes (all modes)
        DES3 - 24 bytes (all modes)
        AES128 - 16 bytes (all modes)
        AES192 - 24 bytes (all modes)
        AES256 - 32 bytes (all modes)
        Note that the keyValue will be encrypted when it it is saved.
        There is a special key value AUTO which generates a new random key for the specified method. This kind of key is
        intended for use cases where the NetScaler both encrypts and decrypts the same data, such an HTTP header.
    .PARAMETER Padding
        Enables or disables the padding of plaintext to meet the block size requirements of block ciphers:
        ON - For encryption, PKCS5/7 padding is used, which appends n bytes of value n on the end of the plaintext to bring it to the cipher block lnegth. If the plaintext length is alraady a multiple of the block length, an additional block with bytes of value block_length will be added. For decryption, ISO 10126 padding is accepted, which expects the last byte of the block to be the number of added pad bytes. Note that this accepts PKCS5/7 padding, as well as ANSI_X923 padding. Padding ON is the default for the ECB and CBD modes.
        OFF - No padding. An Undef error will occur with the ECB or CBC modes if the plaintext length is not a multitple of the cipher block size. This can be used with the CFB and OFB modes, and with the ECB and CBC modes if the plaintext will always be an integral number of blocks, or if custom padding is implemented using a policy extension function. Padding OFf is the default for CFB and OFB modes.
        Possible values = OFF, ON
    .PARAMETER Initalizationvector
        The initalization voector (IV) for a block cipher, one block of data used to initialize the encryption. The best practice is to not specify an IV, in which case a new random IV will be generated for each encryption. The format must be iv_data or keyid_iv_data to include the generated IV in the encrypted data. The IV should only be specified if it cannot be included in the encrypted data. The IV length is the cipher block size:
        RC4 - not used (error if IV is specified)
        DES - 8 bytes (all modes)
        DES3 - 8 bytes (all modes)
        AES128 - 16 bytes (all modes)
        AES192 - 16 bytes (all modes)
        AES256 - 16 bytes (all modes).
        NOTE: The Nitro parameter 'iv' cannot be used as a PowerShell parameter, therefore an alternative Parameter name was chosen.
    .PARAMETER Comment
        Comments associated with this encryption key.
    .PARAMETER PassThru
        Return details about the created nsencryptionkey item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNsencryptionkey -name <string> -method <string>
        An example how to add nsencryptionkey configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNsencryptionkey
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsencryptionkey/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [Parameter(Mandatory)]
        [ValidateSet('NONE', 'RC4', 'DES3', 'AES128', 'AES192', 'AES256', 'DES', 'DES-CBC', 'DES-CFB', 'DES-OFB', 'DES-ECB', 'DES3-CBC', 'DES3-CFB', 'DES3-OFB', 'DES3-ECB', 'AES128-CBC', 'AES128-CFB', 'AES128-OFB', 'AES128-ECB', 'AES192-CBC', 'AES192-CFB', 'AES192-OFB', 'AES192-ECB', 'AES256-CBC', 'AES256-CFB', 'AES256-OFB', 'AES256-ECB')]
        [string]$Method,

        [string]$Keyvalue,

        [ValidateSet('OFF', 'ON')]
        [string]$Padding = 'DEFAULT',

        [string]$Initalizationvector,

        [string]$Comment,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNsencryptionkey: Starting"
    }
    process {
        try {
            $payload = @{ name = $name
                method         = $method
            }
            if ( $PSBoundParameters.ContainsKey('keyvalue') ) { $payload.Add('keyvalue', $keyvalue) }
            if ( $PSBoundParameters.ContainsKey('padding') ) { $payload.Add('padding', $padding) }
            if ( $PSBoundParameters.ContainsKey('initalizationvector') ) { $payload.Add('iv', $initalizationvector) }
            if ( $PSBoundParameters.ContainsKey('comment') ) { $payload.Add('comment', $comment) }
            if ( $PSCmdlet.ShouldProcess("nsencryptionkey", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsencryptionkey -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsencryptionkey -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNsencryptionkey: Finished"
    }
}

function Invoke-ADCUpdateNsencryptionkey {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for encryption key resource.
    .PARAMETER Name
        Key name. This follows the same syntax rules as other expression entity names:
        It must begin with an alpha character (A-Z or a-z) or an underscore (_).
        The rest of the characters must be alpha, numeric (0-9) or underscores.
        It cannot be re or xp (reserved for regular and XPath expressions).
        It cannot be an expression reserved word (e.g. SYS or HTTP).
        It cannot be used for an existing expression object (HTTP callout, patset, dataset, stringmap, or named expression).
    .PARAMETER Method
        Cipher method to be used to encrypt and decrypt content.
        NONE - no encryption or decryption is performed The output of ENCRYPT() and DECRYPT() is the same as the input.
        RC4 - the RC4 stream cipher with a 128 bit (16 byte) key; RC4 is now considered insecure and should only be used if required by existing applciations.
        DES[-<mode>] - the Data Encryption Standard (DES) block cipher with a 64-bit (8 byte) key, with 56 data bits and 8 parity bits. DES is considered less secure than DES3 or AES so it should only be used if required by an existing applicastion. The optional mode is described below; DES without a mode is equivalent to DES-CBC.
        DES3[-<mode>] - the Triple Data Encryption Standard (DES) block cipher with a 192-bit (24 byte) key. The optional mode is described below; DES3 without a mode is equivalent to DES3-CBC.
        AES<keysize>[-<mode>] - the Advanced Encryption Standard block cipher, available with 128 bit (16 byte), 192 bit (24 byte), and 256 bit (32 byte) keys. The optional mode is described below; AES<keysize> without a mode is equivalent to AES<keysize>-CBC.
        For a block cipher, the <mode> specifies how multiple blocks of plaintext are encrypted and how the Initialization Vector (IV) is used. Choices are
        CBC (Cipher Block Chaining) - Each block of plaintext is XORed with the previous ciphertext block, or IV for the first block, before being encrypted. Padding is required if the plaintext is not a multiple of the cipher block size.
        CFB (Cipher Feedback) - The previous ciphertext block, or the IV for the first block, is encrypted and the output is XORed with the current plaintext block to create the current ciphertext block. The 128-bit version of CFB is provided. Padding is not required.
        OFB (Output Feedback) - A keystream is generated by applying the cipher successfully to the IV and XORing the keystream blocks with the plaintext. Padding is not required.
        ECB (Electronic Codebook) - Each block of plaintext is independently encrypted. An IV is not used. Padding is required. This mode is considered less secure than the other modes because the same plaintext always produces the same encrypted text and should only be used if required by an existing application.
        Possible values = NONE, RC4, DES3, AES128, AES192, AES256, DES, DES-CBC, DES-CFB, DES-OFB, DES-ECB, DES3-CBC, DES3-CFB, DES3-OFB, DES3-ECB, AES128-CBC, AES128-CFB, AES128-OFB, AES128-ECB, AES192-CBC, AES192-CFB, AES192-OFB, AES192-ECB, AES256-CBC, AES256-CFB, AES256-OFB, AES256-ECB
    .PARAMETER Keyvalue
        The hex-encoded key value. The length is determined by the cipher method:
        RC4 - 16 bytes
        DES - 8 bytes (all modes)
        DES3 - 24 bytes (all modes)
        AES128 - 16 bytes (all modes)
        AES192 - 24 bytes (all modes)
        AES256 - 32 bytes (all modes)
        Note that the keyValue will be encrypted when it it is saved.
        There is a special key value AUTO which generates a new random key for the specified method. This kind of key is
        intended for use cases where the NetScaler both encrypts and decrypts the same data, such an HTTP header.
    .PARAMETER Padding
        Enables or disables the padding of plaintext to meet the block size requirements of block ciphers:
        ON - For encryption, PKCS5/7 padding is used, which appends n bytes of value n on the end of the plaintext to bring it to the cipher block lnegth. If the plaintext length is alraady a multiple of the block length, an additional block with bytes of value block_length will be added. For decryption, ISO 10126 padding is accepted, which expects the last byte of the block to be the number of added pad bytes. Note that this accepts PKCS5/7 padding, as well as ANSI_X923 padding. Padding ON is the default for the ECB and CBD modes.
        OFF - No padding. An Undef error will occur with the ECB or CBC modes if the plaintext length is not a multitple of the cipher block size. This can be used with the CFB and OFB modes, and with the ECB and CBC modes if the plaintext will always be an integral number of blocks, or if custom padding is implemented using a policy extension function. Padding OFf is the default for CFB and OFB modes.
        Possible values = OFF, ON
    .PARAMETER Initalizationvector
        The initalization voector (IV) for a block cipher, one block of data used to initialize the encryption. The best practice is to not specify an IV, in which case a new random IV will be generated for each encryption. The format must be iv_data or keyid_iv_data to include the generated IV in the encrypted data. The IV should only be specified if it cannot be included in the encrypted data. The IV length is the cipher block size:
        RC4 - not used (error if IV is specified)
        DES - 8 bytes (all modes)
        DES3 - 8 bytes (all modes)
        AES128 - 16 bytes (all modes)
        AES192 - 16 bytes (all modes)
        AES256 - 16 bytes (all modes).
        NOTE: The Nitro parameter 'iv' cannot be used as a PowerShell parameter, therefore an alternative Parameter name was chosen.
    .PARAMETER Comment
        Comments associated with this encryption key.
    .PARAMETER PassThru
        Return details about the created nsencryptionkey item.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsencryptionkey -name <string>
        An example how to update nsencryptionkey configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsencryptionkey
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsencryptionkey/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [ValidateSet('NONE', 'RC4', 'DES3', 'AES128', 'AES192', 'AES256', 'DES', 'DES-CBC', 'DES-CFB', 'DES-OFB', 'DES-ECB', 'DES3-CBC', 'DES3-CFB', 'DES3-OFB', 'DES3-ECB', 'AES128-CBC', 'AES128-CFB', 'AES128-OFB', 'AES128-ECB', 'AES192-CBC', 'AES192-CFB', 'AES192-OFB', 'AES192-ECB', 'AES256-CBC', 'AES256-CFB', 'AES256-OFB', 'AES256-ECB')]
        [string]$Method,

        [string]$Keyvalue,

        [ValidateSet('OFF', 'ON')]
        [string]$Padding,

        [string]$Initalizationvector,

        [string]$Comment,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsencryptionkey: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('method') ) { $payload.Add('method', $method) }
            if ( $PSBoundParameters.ContainsKey('keyvalue') ) { $payload.Add('keyvalue', $keyvalue) }
            if ( $PSBoundParameters.ContainsKey('padding') ) { $payload.Add('padding', $padding) }
            if ( $PSBoundParameters.ContainsKey('initalizationvector') ) { $payload.Add('iv', $initalizationvector) }
            if ( $PSBoundParameters.ContainsKey('comment') ) { $payload.Add('comment', $comment) }
            if ( $PSCmdlet.ShouldProcess("nsencryptionkey", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsencryptionkey -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsencryptionkey -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsencryptionkey: Finished"
    }
}

function Invoke-ADCUnsetNsencryptionkey {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for encryption key resource.
    .PARAMETER Name
        Key name. This follows the same syntax rules as other expression entity names:
        It must begin with an alpha character (A-Z or a-z) or an underscore (_).
        The rest of the characters must be alpha, numeric (0-9) or underscores.
        It cannot be re or xp (reserved for regular and XPath expressions).
        It cannot be an expression reserved word (e.g. SYS or HTTP).
        It cannot be used for an existing expression object (HTTP callout, patset, dataset, stringmap, or named expression).
    .PARAMETER Padding
        Enables or disables the padding of plaintext to meet the block size requirements of block ciphers:
        ON - For encryption, PKCS5/7 padding is used, which appends n bytes of value n on the end of the plaintext to bring it to the cipher block lnegth. If the plaintext length is alraady a multiple of the block length, an additional block with bytes of value block_length will be added. For decryption, ISO 10126 padding is accepted, which expects the last byte of the block to be the number of added pad bytes. Note that this accepts PKCS5/7 padding, as well as ANSI_X923 padding. Padding ON is the default for the ECB and CBD modes.
        OFF - No padding. An Undef error will occur with the ECB or CBC modes if the plaintext length is not a multitple of the cipher block size. This can be used with the CFB and OFB modes, and with the ECB and CBC modes if the plaintext will always be an integral number of blocks, or if custom padding is implemented using a policy extension function. Padding OFf is the default for CFB and OFB modes.
        Possible values = OFF, ON
    .PARAMETER Initalizationvector
        The initalization voector (IV) for a block cipher, one block of data used to initialize the encryption. The best practice is to not specify an IV, in which case a new random IV will be generated for each encryption. The format must be iv_data or keyid_iv_data to include the generated IV in the encrypted data. The IV should only be specified if it cannot be included in the encrypted data. The IV length is the cipher block size:
        RC4 - not used (error if IV is specified)
        DES - 8 bytes (all modes)
        DES3 - 8 bytes (all modes)
        AES128 - 16 bytes (all modes)
        AES192 - 16 bytes (all modes)
        AES256 - 16 bytes (all modes).
        NOTE: The Nitro parameter 'iv' cannot be used as a PowerShell parameter, therefore an alternative Parameter name was chosen.
    .PARAMETER Comment
        Comments associated with this encryption key.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNsencryptionkey -name <string>
        An example how to unset nsencryptionkey configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNsencryptionkey
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsencryptionkey
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [Boolean]$padding,

        [Boolean]$initalizationvector,

        [Boolean]$comment 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNsencryptionkey: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('padding') ) { $payload.Add('padding', $padding) }
            if ( $PSBoundParameters.ContainsKey('initalizationvector') ) { $payload.Add('iv', $initalizationvector) }
            if ( $PSBoundParameters.ContainsKey('comment') ) { $payload.Add('comment', $comment) }
            if ( $PSCmdlet.ShouldProcess("$name", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nsencryptionkey -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNsencryptionkey: Finished"
    }
}

function Invoke-ADCDeleteNsencryptionkey {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for encryption key resource.
    .PARAMETER Name
        Key name. This follows the same syntax rules as other expression entity names:
        It must begin with an alpha character (A-Z or a-z) or an underscore (_).
        The rest of the characters must be alpha, numeric (0-9) or underscores.
        It cannot be re or xp (reserved for regular and XPath expressions).
        It cannot be an expression reserved word (e.g. SYS or HTTP).
        It cannot be used for an existing expression object (HTTP callout, patset, dataset, stringmap, or named expression).
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNsencryptionkey -Name <string>
        An example how to delete nsencryptionkey configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNsencryptionkey
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsencryptionkey/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Name 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNsencryptionkey: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$name", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nsencryptionkey -NitroPath nitro/v1/config -Resource $name -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNsencryptionkey: Finished"
    }
}

function Invoke-ADCGetNsencryptionkey {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for encryption key resource.
    .PARAMETER Name
        Key name. This follows the same syntax rules as other expression entity names:
        It must begin with an alpha character (A-Z or a-z) or an underscore (_).
        The rest of the characters must be alpha, numeric (0-9) or underscores.
        It cannot be re or xp (reserved for regular and XPath expressions).
        It cannot be an expression reserved word (e.g. SYS or HTTP).
        It cannot be used for an existing expression object (HTTP callout, patset, dataset, stringmap, or named expression).
    .PARAMETER GetAll
        Retrieve all nsencryptionkey object(s).
    .PARAMETER Count
        If specified, the count of the nsencryptionkey object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsencryptionkey
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsencryptionkey -GetAll
        Get all nsencryptionkey data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsencryptionkey -Count
        Get the number of nsencryptionkey objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsencryptionkey -name <string>
        Get nsencryptionkey object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsencryptionkey -Filter @{ 'name'='<value>' }
        Get nsencryptionkey data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsencryptionkey
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsencryptionkey/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNsencryptionkey: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsencryptionkey objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsencryptionkey -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsencryptionkey objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsencryptionkey -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsencryptionkey objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsencryptionkey -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsencryptionkey configuration for property 'name'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsencryptionkey -NitroPath nitro/v1/config -Resource $name -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nsencryptionkey configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsencryptionkey -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsencryptionkey: Ended"
    }
}

function Invoke-ADCUpdateNsencryptionparams {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for default encryption parameters resource.
    .PARAMETER Method
        Cipher method (and key length) to be used to encrypt and decrypt content. The default value is AES256.
        Possible values = NONE, RC4, DES3, AES128, AES192, AES256, DES, DES-CBC, DES-CFB, DES-OFB, DES-ECB, DES3-CBC, DES3-CFB, DES3-OFB, DES3-ECB, AES128-CBC, AES128-CFB, AES128-OFB, AES128-ECB, AES192-CBC, AES192-CFB, AES192-OFB, AES192-ECB, AES256-CBC, AES256-CFB, AES256-OFB, AES256-ECB
    .PARAMETER Keyvalue
        The base64-encoded key generation number, method, and key value.
        Note:
        * Do not include this argument if you are changing the encryption method.
        * To generate a new key value for the current encryption method, specify an empty string \(""\) as the value of this parameter. The parameter is passed implicitly, with its automatically generated value, to the Citrix ADC packet engines even when it is not included in the command. Passing the parameter to the packet engines enables the appliance to save the key value to the configuration file and to propagate the key value to the secondary appliance in a high availability setup.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsencryptionparams -method <string>
        An example how to update nsencryptionparams configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsencryptionparams
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsencryptionparams/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateSet('NONE', 'RC4', 'DES3', 'AES128', 'AES192', 'AES256', 'DES', 'DES-CBC', 'DES-CFB', 'DES-OFB', 'DES-ECB', 'DES3-CBC', 'DES3-CFB', 'DES3-OFB', 'DES3-ECB', 'AES128-CBC', 'AES128-CFB', 'AES128-OFB', 'AES128-ECB', 'AES192-CBC', 'AES192-CFB', 'AES192-OFB', 'AES192-ECB', 'AES256-CBC', 'AES256-CFB', 'AES256-OFB', 'AES256-ECB')]
        [string]$Method,

        [string]$Keyvalue 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsencryptionparams: Starting"
    }
    process {
        try {
            $payload = @{ method = $method }
            if ( $PSBoundParameters.ContainsKey('keyvalue') ) { $payload.Add('keyvalue', $keyvalue) }
            if ( $PSCmdlet.ShouldProcess("nsencryptionparams", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsencryptionparams -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsencryptionparams: Finished"
    }
}

function Invoke-ADCGetNsencryptionparams {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for default encryption parameters resource.
    .PARAMETER GetAll
        Retrieve all nsencryptionparams object(s).
    .PARAMETER Count
        If specified, the count of the nsencryptionparams object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsencryptionparams
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsencryptionparams -GetAll
        Get all nsencryptionparams data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsencryptionparams -name <string>
        Get nsencryptionparams object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsencryptionparams -Filter @{ 'name'='<value>' }
        Get nsencryptionparams data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsencryptionparams
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsencryptionparams/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNsencryptionparams: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsencryptionparams objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsencryptionparams -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsencryptionparams objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsencryptionparams -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsencryptionparams objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsencryptionparams -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsencryptionparams configuration for property ''"

            } else {
                Write-Verbose "Retrieving nsencryptionparams configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsencryptionparams -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsencryptionparams: Ended"
    }
}

function Invoke-ADCGetNsevents {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for events resource.
    .PARAMETER Eventno
        Event number starting from which events must be shown.
    .PARAMETER GetAll
        Retrieve all nsevents object(s).
    .PARAMETER Count
        If specified, the count of the nsevents object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsevents
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsevents -GetAll
        Get all nsevents data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsevents -Count
        Get the number of nsevents objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsevents -name <string>
        Get nsevents object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsevents -Filter @{ 'name'='<value>' }
        Get nsevents data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsevents
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsevents/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByArgument')]
        [double]$Eventno,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNsevents: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsevents objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsevents -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsevents objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsevents -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsevents objects by arguments"
                $arguments = @{ } 
                if ( $PSBoundParameters.ContainsKey('eventno') ) { $arguments.Add('eventno', $eventno) }
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsevents -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsevents configuration for property ''"

            } else {
                Write-Verbose "Retrieving nsevents configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsevents -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsevents: Ended"
    }
}

function Invoke-ADCImportNsextension {
    <#
    .SYNOPSIS
        Import NS configuration Object.
    .DESCRIPTION
        Configuration for Extension resource.
    .PARAMETER Src
        Local path to and name of, or URL (protocol, host, path, and file name) for, the file in which to store the imported extension.
        NOTE: The import fails if the object to be imported is on an HTTPS server that requires client certificate authentication for access.
    .PARAMETER Name
        Name to assign to the extension object on the Citrix ADC.
    .PARAMETER Comment
        Any comments to preserve information about the extension object.
    .PARAMETER Overwrite
        Overwrites the existing file.
    .EXAMPLE
        PS C:\>Invoke-ADCImportNsextension -src <string> -name <string>
        An example how to import nsextension configuration Object(s).
    .NOTES
        File Name : Invoke-ADCImportNsextension
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsextension/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateLength(1, 2047)]
        [string]$Src,

        [Parameter(Mandatory)]
        [ValidateLength(1, 31)]
        [string]$Name,

        [string]$Comment,

        [boolean]$Overwrite 

    )
    begin {
        Write-Verbose "Invoke-ADCImportNsextension: Starting"
    }
    process {
        try {
            $payload = @{ src = $src
                name          = $name
            }
            if ( $PSBoundParameters.ContainsKey('comment') ) { $payload.Add('comment', $comment) }
            if ( $PSBoundParameters.ContainsKey('overwrite') ) { $payload.Add('overwrite', $overwrite) }
            if ( $PSCmdlet.ShouldProcess($Name, "Import NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsextension -Action import -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCImportNsextension: Finished"
    }
}

function Invoke-ADCDeleteNsextension {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for Extension resource.
    .PARAMETER Name
        Name to assign to the extension object on the Citrix ADC.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNsextension -Name <string>
        An example how to delete nsextension configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNsextension
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsextension/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Name 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNsextension: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$name", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nsextension -NitroPath nitro/v1/config -Resource $name -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNsextension: Finished"
    }
}

function Invoke-ADCAddNsextension {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for Extension resource.
    .PARAMETER Name
        Name to assign to the extension object on the Citrix ADC.
    .PARAMETER Comment
        Any comments to preserve information about the extension object.
    .PARAMETER PassThru
        Return details about the created nsextension item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNsextension -name <string>
        An example how to add nsextension configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNsextension
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsextension/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateLength(1, 31)]
        [string]$Name,

        [string]$Comment,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNsextension: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('comment') ) { $payload.Add('comment', $comment) }
            if ( $PSCmdlet.ShouldProcess("nsextension", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsextension -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsextension -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNsextension: Finished"
    }
}

function Invoke-ADCChangeNsextension {
    <#
    .SYNOPSIS
        Change NS configuration Object.
    .DESCRIPTION
        Configuration for Extension resource.
    .PARAMETER PassThru
        Return details about the created nsextension item.
    .EXAMPLE
        PS C:\>Invoke-ADCChangeNsextension
        An example how to change nsextension configuration Object(s).
    .NOTES
        File Name : Invoke-ADCChangeNsextension
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsextension/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCChangeNsextension: Starting"
    }
    process {
        try {
            $payload = @{ }

            if ( $PSCmdlet.ShouldProcess("nsextension", "Change NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method -NitroPath nitro/v1/config -Type nsextension -Payload $payload -GetWarning
                #
                #
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsextension -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCChangeNsextension: Finished"
    }
}

function Invoke-ADCUpdateNsextension {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for Extension resource.
    .PARAMETER Name
        Name to assign to the extension object on the Citrix ADC.
    .PARAMETER Trace
        Enables tracing to the NS log file of extension execution:
        off - turns off tracing (equivalent to unset ns extension <extension-name> -trace)
        calls - traces extension function calls with arguments and function returns with the first return value
        lines - traces the above plus line numbers for executed extension lines
        all - traces the above plus local variables changed by executed extension lines
        Note that the DEBUG log level must be enabled to see extension tracing.
        This can be done by set audit syslogParams -loglevel ALL or -loglevel DEBUG.
        Possible values = off, calls, lines, all
    .PARAMETER Tracefunctions
        Comma-separated list of extension functions to trace. By default, all extension functions are traced.
    .PARAMETER Tracevariables
        Comma-separated list of variables (in traced extension functions) to trace. By default, all variables are traced.
    .PARAMETER Comment
        Any comments to preserve information about the extension object.
    .PARAMETER PassThru
        Return details about the created nsextension item.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsextension -name <string>
        An example how to update nsextension configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsextension
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsextension/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateLength(1, 31)]
        [string]$Name,

        [ValidateSet('off', 'calls', 'lines', 'all')]
        [string]$Trace,

        [string]$Tracefunctions,

        [string]$Tracevariables,

        [string]$Comment,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsextension: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('trace') ) { $payload.Add('trace', $trace) }
            if ( $PSBoundParameters.ContainsKey('tracefunctions') ) { $payload.Add('tracefunctions', $tracefunctions) }
            if ( $PSBoundParameters.ContainsKey('tracevariables') ) { $payload.Add('tracevariables', $tracevariables) }
            if ( $PSBoundParameters.ContainsKey('comment') ) { $payload.Add('comment', $comment) }
            if ( $PSCmdlet.ShouldProcess("nsextension", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsextension -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsextension -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsextension: Finished"
    }
}

function Invoke-ADCUnsetNsextension {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for Extension resource.
    .PARAMETER Name
        Name to assign to the extension object on the Citrix ADC.
    .PARAMETER Trace
        Enables tracing to the NS log file of extension execution:
        off - turns off tracing (equivalent to unset ns extension <extension-name> -trace)
        calls - traces extension function calls with arguments and function returns with the first return value
        lines - traces the above plus line numbers for executed extension lines
        all - traces the above plus local variables changed by executed extension lines
        Note that the DEBUG log level must be enabled to see extension tracing.
        This can be done by set audit syslogParams -loglevel ALL or -loglevel DEBUG.
        Possible values = off, calls, lines, all
    .PARAMETER Tracefunctions
        Comma-separated list of extension functions to trace. By default, all extension functions are traced.
    .PARAMETER Tracevariables
        Comma-separated list of variables (in traced extension functions) to trace. By default, all variables are traced.
    .PARAMETER Comment
        Any comments to preserve information about the extension object.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNsextension -name <string>
        An example how to unset nsextension configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNsextension
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsextension
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateLength(1, 31)]
        [string]$Name,

        [Boolean]$trace,

        [Boolean]$tracefunctions,

        [Boolean]$tracevariables,

        [Boolean]$comment 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNsextension: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('trace') ) { $payload.Add('trace', $trace) }
            if ( $PSBoundParameters.ContainsKey('tracefunctions') ) { $payload.Add('tracefunctions', $tracefunctions) }
            if ( $PSBoundParameters.ContainsKey('tracevariables') ) { $payload.Add('tracevariables', $tracevariables) }
            if ( $PSBoundParameters.ContainsKey('comment') ) { $payload.Add('comment', $comment) }
            if ( $PSCmdlet.ShouldProcess("$name", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nsextension -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNsextension: Finished"
    }
}

function Invoke-ADCGetNsextension {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for Extension resource.
    .PARAMETER Name
        Name to assign to the extension object on the Citrix ADC.
    .PARAMETER GetAll
        Retrieve all nsextension object(s).
    .PARAMETER Count
        If specified, the count of the nsextension object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsextension
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsextension -GetAll
        Get all nsextension data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsextension -Count
        Get the number of nsextension objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsextension -name <string>
        Get nsextension object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsextension -Filter @{ 'name'='<value>' }
        Get nsextension data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsextension
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsextension/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateLength(1, 31)]
        [string]$Name,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNsextension: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsextension objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsextension -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsextension objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsextension -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsextension objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsextension -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsextension configuration for property 'name'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsextension -NitroPath nitro/v1/config -Resource $name -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nsextension configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsextension -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsextension: Ended"
    }
}

function Invoke-ADCGetNsextensionbinding {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Binding object which returns the resources bound to nsextension.
    .PARAMETER Name
        Name of the extension object.
    .PARAMETER GetAll
        Retrieve all nsextension_binding object(s).
    .PARAMETER Count
        If specified, the count of the nsextension_binding object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsextensionbinding
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsextensionbinding -GetAll
        Get all nsextension_binding data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsextensionbinding -name <string>
        Get nsextension_binding object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsextensionbinding -Filter @{ 'name'='<value>' }
        Get nsextension_binding data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsextensionbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsextension_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateLength(1, 31)]
        [string]$Name,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNsextensionbinding: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{  bulkbindings = 'yes' }
                Write-Verbose "Retrieving all nsextension_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsextension_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsextension_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsextension_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsextension_binding objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsextension_binding -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsextension_binding configuration for property 'name'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsextension_binding -NitroPath nitro/v1/config -Resource $name -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nsextension_binding configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsextension_binding -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsextensionbinding: Ended"
    }
}

function Invoke-ADCGetNsextensionextensionfunctionbinding {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Binding object showing the extensionfunction that can be bound to nsextension.
    .PARAMETER Name
        Name of the extension object.
    .PARAMETER GetAll
        Retrieve all nsextension_extensionfunction_binding object(s).
    .PARAMETER Count
        If specified, the count of the nsextension_extensionfunction_binding object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsextensionextensionfunctionbinding
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsextensionextensionfunctionbinding -GetAll
        Get all nsextension_extensionfunction_binding data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsextensionextensionfunctionbinding -Count
        Get the number of nsextension_extensionfunction_binding objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsextensionextensionfunctionbinding -name <string>
        Get nsextension_extensionfunction_binding object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsextensionextensionfunctionbinding -Filter @{ 'name'='<value>' }
        Get nsextension_extensionfunction_binding data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsextensionextensionfunctionbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsextension_extensionfunction_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateLength(1, 31)]
        [string]$Name,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNsextensionextensionfunctionbinding: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{  bulkbindings = 'yes' }
                Write-Verbose "Retrieving all nsextension_extensionfunction_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsextension_extensionfunction_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsextension_extensionfunction_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsextension_extensionfunction_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsextension_extensionfunction_binding objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsextension_extensionfunction_binding -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsextension_extensionfunction_binding configuration for property 'name'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsextension_extensionfunction_binding -NitroPath nitro/v1/config -Resource $name -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nsextension_extensionfunction_binding configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsextension_extensionfunction_binding -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsextensionextensionfunctionbinding: Ended"
    }
}

function Invoke-ADCEnableNsfeature {
    <#
    .SYNOPSIS
        Enable NS configuration Object.
    .DESCRIPTION
        Configuration for feature resource.
    .PARAMETER Feature
        Feature to be enabled. Multiple features can be specified by providing a blank space between each feature.
    .EXAMPLE
        PS C:\>Invoke-ADCEnableNsfeature
        An example how to enable nsfeature configuration Object(s).
    .NOTES
        File Name : Invoke-ADCEnableNsfeature
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsfeature/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [string[]]$Feature 

    )
    begin {
        Write-Verbose "Invoke-ADCEnableNsfeature: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('feature') ) { $payload.Add('feature', $feature) }
            if ( $PSCmdlet.ShouldProcess($Name, "Enable NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsfeature -Action enable -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCEnableNsfeature: Finished"
    }
}

function Invoke-ADCDisableNsfeature {
    <#
    .SYNOPSIS
        Disable NS configuration Object.
    .DESCRIPTION
        Configuration for feature resource.
    .PARAMETER Feature
        Feature to be enabled. Multiple features can be specified by providing a blank space between each feature.
    .EXAMPLE
        PS C:\>Invoke-ADCDisableNsfeature
        An example how to disable nsfeature configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDisableNsfeature
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsfeature/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [string[]]$Feature 

    )
    begin {
        Write-Verbose "Invoke-ADCDisableNsfeature: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('feature') ) { $payload.Add('feature', $feature) }
            if ( $PSCmdlet.ShouldProcess($Name, "Disable NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsfeature -Action disable -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDisableNsfeature: Finished"
    }
}

function Invoke-ADCGetNsfeature {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for feature resource.
    .PARAMETER GetAll
        Retrieve all nsfeature object(s).
    .PARAMETER Count
        If specified, the count of the nsfeature object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsfeature
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsfeature -GetAll
        Get all nsfeature data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsfeature -name <string>
        Get nsfeature object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsfeature -Filter @{ 'name'='<value>' }
        Get nsfeature data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsfeature
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsfeature/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNsfeature: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsfeature objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsfeature -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsfeature objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsfeature -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsfeature objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsfeature -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsfeature configuration for property ''"

            } else {
                Write-Verbose "Retrieving nsfeature configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsfeature -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsfeature: Ended"
    }
}

function Invoke-ADCGetNshardware {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for hardware resource.
    .PARAMETER GetAll
        Retrieve all nshardware object(s).
    .PARAMETER Count
        If specified, the count of the nshardware object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshardware
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshardware -GetAll
        Get all nshardware data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshardware -name <string>
        Get nshardware object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshardware -Filter @{ 'name'='<value>' }
        Get nshardware data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNshardware
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nshardware/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNshardware: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nshardware objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshardware -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nshardware objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshardware -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nshardware objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshardware -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nshardware configuration for property ''"

            } else {
                Write-Verbose "Retrieving nshardware configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshardware -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNshardware: Ended"
    }
}

function Invoke-ADCAddNshmackey {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for HMAC key resource.
    .PARAMETER Name
        Key name. This follows the same syntax rules as other expression entity names:
        It must begin with an alpha character (A-Z or a-z) or an underscore (_).
        The rest of the characters must be alpha, numeric (0-9) or underscores.
        It cannot be re or xp (reserved for regular and XPath expressions).
        It cannot be an expression reserved word (e.g. SYS or HTTP).
        It cannot be used for an existing expression object (HTTP callout, patset, dataset, stringmap, or named expression).
    .PARAMETER Digest
        Digest (hash) function to be used in the HMAC computation.
        Possible values = MD2, MD4, MD5, SHA1, SHA224, SHA256, SHA384, SHA512
    .PARAMETER Keyvalue
        The hex-encoded key to be used in the HMAC computation. The key can be any length (up to a Citrix ADC-imposed maximum of 255 bytes). If the length is less than the digest block size, it will be zero padded up to the block size. If it is greater than the block size, it will be hashed using the digest function to the block size. The block size for each digest is:
        MD2 - 16 bytes
        MD4 - 16 bytes
        MD5 - 16 bytes
        SHA1 - 20 bytes
        SHA224 - 28 bytes
        SHA256 - 32 bytes
        SHA384 - 48 bytes
        SHA512 - 64 bytes
        Note that the key will be encrypted when it it is saved
        There is a special key value AUTO which generates a new random key for the specified digest. This kind of key is
        intended for use cases where the NetScaler both generates and verifies an HMAC on the same data.
    .PARAMETER Comment
        Comments associated with this encryption key.
    .PARAMETER PassThru
        Return details about the created nshmackey item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNshmackey -name <string> -digest <string>
        An example how to add nshmackey configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNshmackey
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nshmackey/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [Parameter(Mandatory)]
        [ValidateSet('MD2', 'MD4', 'MD5', 'SHA1', 'SHA224', 'SHA256', 'SHA384', 'SHA512')]
        [string]$Digest,

        [string]$Keyvalue,

        [string]$Comment,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNshmackey: Starting"
    }
    process {
        try {
            $payload = @{ name = $name
                digest         = $digest
            }
            if ( $PSBoundParameters.ContainsKey('keyvalue') ) { $payload.Add('keyvalue', $keyvalue) }
            if ( $PSBoundParameters.ContainsKey('comment') ) { $payload.Add('comment', $comment) }
            if ( $PSCmdlet.ShouldProcess("nshmackey", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nshmackey -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNshmackey -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNshmackey: Finished"
    }
}

function Invoke-ADCUpdateNshmackey {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for HMAC key resource.
    .PARAMETER Name
        Key name. This follows the same syntax rules as other expression entity names:
        It must begin with an alpha character (A-Z or a-z) or an underscore (_).
        The rest of the characters must be alpha, numeric (0-9) or underscores.
        It cannot be re or xp (reserved for regular and XPath expressions).
        It cannot be an expression reserved word (e.g. SYS or HTTP).
        It cannot be used for an existing expression object (HTTP callout, patset, dataset, stringmap, or named expression).
    .PARAMETER Digest
        Digest (hash) function to be used in the HMAC computation.
        Possible values = MD2, MD4, MD5, SHA1, SHA224, SHA256, SHA384, SHA512
    .PARAMETER Keyvalue
        The hex-encoded key to be used in the HMAC computation. The key can be any length (up to a Citrix ADC-imposed maximum of 255 bytes). If the length is less than the digest block size, it will be zero padded up to the block size. If it is greater than the block size, it will be hashed using the digest function to the block size. The block size for each digest is:
        MD2 - 16 bytes
        MD4 - 16 bytes
        MD5 - 16 bytes
        SHA1 - 20 bytes
        SHA224 - 28 bytes
        SHA256 - 32 bytes
        SHA384 - 48 bytes
        SHA512 - 64 bytes
        Note that the key will be encrypted when it it is saved
        There is a special key value AUTO which generates a new random key for the specified digest. This kind of key is
        intended for use cases where the NetScaler both generates and verifies an HMAC on the same data.
    .PARAMETER Comment
        Comments associated with this encryption key.
    .PARAMETER PassThru
        Return details about the created nshmackey item.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNshmackey -name <string>
        An example how to update nshmackey configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNshmackey
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nshmackey/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [ValidateSet('MD2', 'MD4', 'MD5', 'SHA1', 'SHA224', 'SHA256', 'SHA384', 'SHA512')]
        [string]$Digest,

        [string]$Keyvalue,

        [string]$Comment,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNshmackey: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('digest') ) { $payload.Add('digest', $digest) }
            if ( $PSBoundParameters.ContainsKey('keyvalue') ) { $payload.Add('keyvalue', $keyvalue) }
            if ( $PSBoundParameters.ContainsKey('comment') ) { $payload.Add('comment', $comment) }
            if ( $PSCmdlet.ShouldProcess("nshmackey", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nshmackey -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNshmackey -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNshmackey: Finished"
    }
}

function Invoke-ADCUnsetNshmackey {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for HMAC key resource.
    .PARAMETER Name
        Key name. This follows the same syntax rules as other expression entity names:
        It must begin with an alpha character (A-Z or a-z) or an underscore (_).
        The rest of the characters must be alpha, numeric (0-9) or underscores.
        It cannot be re or xp (reserved for regular and XPath expressions).
        It cannot be an expression reserved word (e.g. SYS or HTTP).
        It cannot be used for an existing expression object (HTTP callout, patset, dataset, stringmap, or named expression).
    .PARAMETER Comment
        Comments associated with this encryption key.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNshmackey -name <string>
        An example how to unset nshmackey configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNshmackey
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nshmackey
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [Boolean]$comment 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNshmackey: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('comment') ) { $payload.Add('comment', $comment) }
            if ( $PSCmdlet.ShouldProcess("$name", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nshmackey -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNshmackey: Finished"
    }
}

function Invoke-ADCDeleteNshmackey {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for HMAC key resource.
    .PARAMETER Name
        Key name. This follows the same syntax rules as other expression entity names:
        It must begin with an alpha character (A-Z or a-z) or an underscore (_).
        The rest of the characters must be alpha, numeric (0-9) or underscores.
        It cannot be re or xp (reserved for regular and XPath expressions).
        It cannot be an expression reserved word (e.g. SYS or HTTP).
        It cannot be used for an existing expression object (HTTP callout, patset, dataset, stringmap, or named expression).
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNshmackey -Name <string>
        An example how to delete nshmackey configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNshmackey
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nshmackey/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Name 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNshmackey: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$name", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nshmackey -NitroPath nitro/v1/config -Resource $name -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNshmackey: Finished"
    }
}

function Invoke-ADCGetNshmackey {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for HMAC key resource.
    .PARAMETER Name
        Key name. This follows the same syntax rules as other expression entity names:
        It must begin with an alpha character (A-Z or a-z) or an underscore (_).
        The rest of the characters must be alpha, numeric (0-9) or underscores.
        It cannot be re or xp (reserved for regular and XPath expressions).
        It cannot be an expression reserved word (e.g. SYS or HTTP).
        It cannot be used for an existing expression object (HTTP callout, patset, dataset, stringmap, or named expression).
    .PARAMETER GetAll
        Retrieve all nshmackey object(s).
    .PARAMETER Count
        If specified, the count of the nshmackey object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshmackey
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshmackey -GetAll
        Get all nshmackey data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshmackey -Count
        Get the number of nshmackey objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshmackey -name <string>
        Get nshmackey object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshmackey -Filter @{ 'name'='<value>' }
        Get nshmackey data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNshmackey
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nshmackey/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNshmackey: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nshmackey objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshmackey -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nshmackey objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshmackey -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nshmackey objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshmackey -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nshmackey configuration for property 'name'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshmackey -NitroPath nitro/v1/config -Resource $name -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nshmackey configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshmackey -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNshmackey: Ended"
    }
}

function Invoke-ADCUpdateNshostname {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for host name resource.
    .PARAMETER Hostname
        Host name for the Citrix ADC.
    .PARAMETER Ownernode
        ID of the cluster node for which you are setting the hostname. Can be configured only through the cluster IP address.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNshostname -hostname <string>
        An example how to update nshostname configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNshostname
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nshostname/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateLength(1, 255)]
        [string]$Hostname,

        [ValidateRange(0, 31)]
        [double]$Ownernode 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNshostname: Starting"
    }
    process {
        try {
            $payload = @{ hostname = $hostname }
            if ( $PSBoundParameters.ContainsKey('ownernode') ) { $payload.Add('ownernode', $ownernode) }
            if ( $PSCmdlet.ShouldProcess("nshostname", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nshostname -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNshostname: Finished"
    }
}

function Invoke-ADCGetNshostname {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for host name resource.
    .PARAMETER GetAll
        Retrieve all nshostname object(s).
    .PARAMETER Count
        If specified, the count of the nshostname object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshostname
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshostname -GetAll
        Get all nshostname data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshostname -Count
        Get the number of nshostname objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshostname -name <string>
        Get nshostname object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshostname -Filter @{ 'name'='<value>' }
        Get nshostname data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNshostname
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nshostname/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNshostname: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nshostname objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshostname -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nshostname objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshostname -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nshostname objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshostname -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nshostname configuration for property ''"

            } else {
                Write-Verbose "Retrieving nshostname configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshostname -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNshostname: Ended"
    }
}

function Invoke-ADCUpdateNshttpparam {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for HTTP parameter resource.
    .PARAMETER Dropinvalreqs
        Drop invalid HTTP requests or responses.
        Possible values = ON, OFF
    .PARAMETER Markhttp09inval
        Mark HTTP/0.9 requests as invalid.
        Possible values = ON, OFF
    .PARAMETER Markconnreqinval
        Mark CONNECT requests as invalid.
        Possible values = ON, OFF
    .PARAMETER Insnssrvrhdr
        Enable or disable Citrix ADC server header insertion for Citrix ADC generated HTTP responses.
        Possible values = ON, OFF
    .PARAMETER Nssrvrhdr
        The server header value to be inserted. If no explicit header is specified then NSBUILD.RELEASE is used as default server header.
    .PARAMETER Logerrresp
        Server header value to be inserted.
        Possible values = ON, OFF
    .PARAMETER Conmultiplex
        Reuse server connections for requests from more than one client connections.
        Possible values = ENABLED, DISABLED
    .PARAMETER Maxreusepool
        Maximum limit on the number of connections, from the Citrix ADC to a particular server that are kept in the reuse pool. This setting is helpful for optimal memory utilization and for reducing the idle connections to the server just after the peak time.
    .PARAMETER Http2serverside
        Enable/Disable HTTP/2 on server side.
        Possible values = ON, OFF
    .PARAMETER Ignoreconnectcodingscheme
        Ignore Coding scheme in CONNECT request.
        Possible values = ENABLED, DISABLED
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNshttpparam
        An example how to update nshttpparam configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNshttpparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nshttpparam/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateSet('ON', 'OFF')]
        [string]$Dropinvalreqs,

        [ValidateSet('ON', 'OFF')]
        [string]$Markhttp09inval,

        [ValidateSet('ON', 'OFF')]
        [string]$Markconnreqinval,

        [ValidateSet('ON', 'OFF')]
        [string]$Insnssrvrhdr,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Nssrvrhdr,

        [ValidateSet('ON', 'OFF')]
        [string]$Logerrresp,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Conmultiplex,

        [ValidateRange(0, 360000)]
        [double]$Maxreusepool,

        [ValidateSet('ON', 'OFF')]
        [string]$Http2serverside,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ignoreconnectcodingscheme 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNshttpparam: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('dropinvalreqs') ) { $payload.Add('dropinvalreqs', $dropinvalreqs) }
            if ( $PSBoundParameters.ContainsKey('markhttp09inval') ) { $payload.Add('markhttp09inval', $markhttp09inval) }
            if ( $PSBoundParameters.ContainsKey('markconnreqinval') ) { $payload.Add('markconnreqinval', $markconnreqinval) }
            if ( $PSBoundParameters.ContainsKey('insnssrvrhdr') ) { $payload.Add('insnssrvrhdr', $insnssrvrhdr) }
            if ( $PSBoundParameters.ContainsKey('nssrvrhdr') ) { $payload.Add('nssrvrhdr', $nssrvrhdr) }
            if ( $PSBoundParameters.ContainsKey('logerrresp') ) { $payload.Add('logerrresp', $logerrresp) }
            if ( $PSBoundParameters.ContainsKey('conmultiplex') ) { $payload.Add('conmultiplex', $conmultiplex) }
            if ( $PSBoundParameters.ContainsKey('maxreusepool') ) { $payload.Add('maxreusepool', $maxreusepool) }
            if ( $PSBoundParameters.ContainsKey('http2serverside') ) { $payload.Add('http2serverside', $http2serverside) }
            if ( $PSBoundParameters.ContainsKey('ignoreconnectcodingscheme') ) { $payload.Add('ignoreconnectcodingscheme', $ignoreconnectcodingscheme) }
            if ( $PSCmdlet.ShouldProcess("nshttpparam", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nshttpparam -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNshttpparam: Finished"
    }
}

function Invoke-ADCUnsetNshttpparam {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for HTTP parameter resource.
    .PARAMETER Dropinvalreqs
        Drop invalid HTTP requests or responses.
        Possible values = ON, OFF
    .PARAMETER Markhttp09inval
        Mark HTTP/0.9 requests as invalid.
        Possible values = ON, OFF
    .PARAMETER Markconnreqinval
        Mark CONNECT requests as invalid.
        Possible values = ON, OFF
    .PARAMETER Insnssrvrhdr
        Enable or disable Citrix ADC server header insertion for Citrix ADC generated HTTP responses.
        Possible values = ON, OFF
    .PARAMETER Nssrvrhdr
        The server header value to be inserted. If no explicit header is specified then NSBUILD.RELEASE is used as default server header.
    .PARAMETER Logerrresp
        Server header value to be inserted.
        Possible values = ON, OFF
    .PARAMETER Conmultiplex
        Reuse server connections for requests from more than one client connections.
        Possible values = ENABLED, DISABLED
    .PARAMETER Maxreusepool
        Maximum limit on the number of connections, from the Citrix ADC to a particular server that are kept in the reuse pool. This setting is helpful for optimal memory utilization and for reducing the idle connections to the server just after the peak time.
    .PARAMETER Http2serverside
        Enable/Disable HTTP/2 on server side.
        Possible values = ON, OFF
    .PARAMETER Ignoreconnectcodingscheme
        Ignore Coding scheme in CONNECT request.
        Possible values = ENABLED, DISABLED
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNshttpparam
        An example how to unset nshttpparam configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNshttpparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nshttpparam
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Boolean]$dropinvalreqs,

        [Boolean]$markhttp09inval,

        [Boolean]$markconnreqinval,

        [Boolean]$insnssrvrhdr,

        [Boolean]$nssrvrhdr,

        [Boolean]$logerrresp,

        [Boolean]$conmultiplex,

        [Boolean]$maxreusepool,

        [Boolean]$http2serverside,

        [Boolean]$ignoreconnectcodingscheme 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNshttpparam: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('dropinvalreqs') ) { $payload.Add('dropinvalreqs', $dropinvalreqs) }
            if ( $PSBoundParameters.ContainsKey('markhttp09inval') ) { $payload.Add('markhttp09inval', $markhttp09inval) }
            if ( $PSBoundParameters.ContainsKey('markconnreqinval') ) { $payload.Add('markconnreqinval', $markconnreqinval) }
            if ( $PSBoundParameters.ContainsKey('insnssrvrhdr') ) { $payload.Add('insnssrvrhdr', $insnssrvrhdr) }
            if ( $PSBoundParameters.ContainsKey('nssrvrhdr') ) { $payload.Add('nssrvrhdr', $nssrvrhdr) }
            if ( $PSBoundParameters.ContainsKey('logerrresp') ) { $payload.Add('logerrresp', $logerrresp) }
            if ( $PSBoundParameters.ContainsKey('conmultiplex') ) { $payload.Add('conmultiplex', $conmultiplex) }
            if ( $PSBoundParameters.ContainsKey('maxreusepool') ) { $payload.Add('maxreusepool', $maxreusepool) }
            if ( $PSBoundParameters.ContainsKey('http2serverside') ) { $payload.Add('http2serverside', $http2serverside) }
            if ( $PSBoundParameters.ContainsKey('ignoreconnectcodingscheme') ) { $payload.Add('ignoreconnectcodingscheme', $ignoreconnectcodingscheme) }
            if ( $PSCmdlet.ShouldProcess("nshttpparam", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nshttpparam -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNshttpparam: Finished"
    }
}

function Invoke-ADCGetNshttpparam {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for HTTP parameter resource.
    .PARAMETER GetAll
        Retrieve all nshttpparam object(s).
    .PARAMETER Count
        If specified, the count of the nshttpparam object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshttpparam
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshttpparam -GetAll
        Get all nshttpparam data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshttpparam -name <string>
        Get nshttpparam object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshttpparam -Filter @{ 'name'='<value>' }
        Get nshttpparam data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNshttpparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nshttpparam/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNshttpparam: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nshttpparam objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshttpparam -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nshttpparam objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshttpparam -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nshttpparam objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshttpparam -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nshttpparam configuration for property ''"

            } else {
                Write-Verbose "Retrieving nshttpparam configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshttpparam -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNshttpparam: Ended"
    }
}

function Invoke-ADCAddNshttpprofile {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for HTTP profile resource.
    .PARAMETER Name
        Name for an HTTP profile. Must begin with a letter, number, or the underscore \(_\) character. Other characters allowed, after the first character, are the hyphen \(-\), period \(.\), hash \(\#\), space \( \), at \(@\), colon \(:\), and equal \(=\) characters. The name of a HTTP profile cannot be changed after it is created.
        CLI Users: If the name includes one or more spaces, enclose the name in double or single quotation marks \(for example, "my http profile" or 'my http profile'\).
    .PARAMETER Dropinvalreqs
        Drop invalid HTTP requests or responses.
        Possible values = ENABLED, DISABLED
    .PARAMETER Markhttp09inval
        Mark HTTP/0.9 requests as invalid.
        Possible values = ENABLED, DISABLED
    .PARAMETER Markconnreqinval
        Mark CONNECT requests as invalid.
        Possible values = ENABLED, DISABLED
    .PARAMETER Marktracereqinval
        Mark TRACE requests as invalid.
        Possible values = ENABLED, DISABLED
    .PARAMETER Markrfc7230noncompliantinval
        Mark RFC7230 non-compliant transaction as invalid.
        Possible values = ENABLED, DISABLED
    .PARAMETER Markhttpheaderextrawserror
        Mark Http header with extra white space as invalid.
        Possible values = ENABLED, DISABLED
    .PARAMETER Cmponpush
        Start data compression on receiving a TCP packet with PUSH flag set.
        Possible values = ENABLED, DISABLED
    .PARAMETER Conmultiplex
        Reuse server connections for requests from more than one client connections.
        Possible values = ENABLED, DISABLED
    .PARAMETER Maxreusepool
        Maximum limit on the number of connections, from the Citrix ADC to a particular server that are kept in the reuse pool. This setting is helpful for optimal memory utilization and for reducing the idle connections to the server just after the peak time. Zero implies no limit on reuse pool size. If non-zero value is given, it has to be greater than or equal to the number of running Packet Engines.
    .PARAMETER Dropextracrlf
        Drop any extra 'CR' and 'LF' characters present after the header.
        Possible values = ENABLED, DISABLED
    .PARAMETER Incomphdrdelay
        Maximum time to wait, in milliseconds, between incomplete header packets. If the header packets take longer to arrive at Citrix ADC, the connection is silently dropped.
    .PARAMETER Websocket
        HTTP connection to be upgraded to a web socket connection. Once upgraded, Citrix ADC does not process Layer 7 traffic on this connection.
        Possible values = ENABLED, DISABLED
    .PARAMETER Rtsptunnel
        Allow RTSP tunnel in HTTP. Once application/x-rtsp-tunnelled is seen in Accept or Content-Type header, Citrix ADC does not process Layer 7 traffic on this connection.
        Possible values = ENABLED, DISABLED
    .PARAMETER Reqtimeout
        Time, in seconds, within which the HTTP request must complete. If the request does not complete within this time, the specified request timeout action is executed. Zero disables the timeout.
    .PARAMETER Adpttimeout
        Adapts the configured request timeout based on flow conditions. The timeout is increased or decreased internally and applied on the flow.
        Possible values = ENABLED, DISABLED
    .PARAMETER Reqtimeoutaction
        Action to take when the HTTP request does not complete within the specified request timeout duration. You can configure the following actions:
        * RESET - Send RST (reset) to client when timeout occurs.
        * DROP - Drop silently when timeout occurs.
        * Custom responder action - Name of the responder action to trigger when timeout occurs, used to send custom message.
    .PARAMETER Dropextradata
        Drop any extra data when server sends more data than the specified content-length.
        Possible values = ENABLED, DISABLED
    .PARAMETER Weblog
        Enable or disable web logging.
        Possible values = ENABLED, DISABLED
    .PARAMETER Clientiphdrexpr
        Name of the header that contains the real client IP address.
    .PARAMETER Maxreq
        Maximum number of requests allowed on a single connection. Zero implies no limit on the number of requests.
    .PARAMETER Persistentetag
        Generate the persistent Citrix ADC specific ETag for the HTTP response with ETag header.
        Possible values = ENABLED, DISABLED
    .PARAMETER Http2
        Choose whether to enable support for HTTP/2.
        Possible values = ENABLED, DISABLED
    .PARAMETER Http2direct
        Choose whether to enable support for Direct HTTP/2.
        Possible values = ENABLED, DISABLED
    .PARAMETER Http2strictcipher
        Choose whether to enable strict HTTP/2 cipher selection.
        Possible values = ENABLED, DISABLED
    .PARAMETER Http2altsvcframe
        Choose whether to enable support for sending HTTP/2 ALTSVC frames. When enabled, the ADC sends HTTP/2 ALTSVC frames to HTTP/2 clients, instead of the Alt-Svc response header field. Not applicable to servers.
        Possible values = ENABLED, DISABLED
    .PARAMETER Altsvc
        Choose whether to enable support for Alternative Services.
        Possible values = ENABLED, DISABLED
    .PARAMETER Altsvcvalue
        Configure a custom Alternative Services header value that should be inserted in the response to advertise a HTTP/SSL/HTTP_QUIC vserver.
    .PARAMETER Reusepooltimeout
        Idle timeout (in seconds) for server connections in re-use pool. Connections in the re-use pool are flushed, if they remain idle for the configured timeout.
    .PARAMETER Maxheaderlen
        Number of bytes to be queued to look for complete header before returning error. If complete header is not obtained after queuing these many bytes, request will be marked as invalid and no L7 processing will be done for that TCP connection.
    .PARAMETER Minreusepool
        Minimum limit on the number of connections, from the Citrix ADC to a particular server that are kept in the reuse pool. This setting is helpful for optimal memory utilization and for reducing the idle connections to the server just after the peak time. Zero implies no limit on reuse pool size.
    .PARAMETER Http2maxheaderlistsize
        Maximum size of header list that the Citrix ADC is prepared to accept, in bytes. NOTE: The actual plain text header size that the Citrix ADC accepts is limited by maxHeaderLen. Please change maxHeaderLen parameter as well when modifying http2MaxHeaderListSize.
    .PARAMETER Http2maxframesize
        Maximum size of the frame payload that the Citrix ADC is willing to receive, in bytes.
    .PARAMETER Http2maxconcurrentstreams
        Maximum number of concurrent streams that is allowed per connection.
    .PARAMETER Http2initialconnwindowsize
        Initial window size for connection level flow control, in bytes.
    .PARAMETER Http2initialwindowsize
        Initial window size for stream level flow control, in bytes.
    .PARAMETER Http2headertablesize
        Maximum size of the header compression table used to decode header blocks, in bytes.
    .PARAMETER Http2minseverconn
        Minimum number of HTTP2 connections established to backend server, on receiving HTTP requests from client before multiplexing the streams into the available HTTP/2 connections.
    .PARAMETER Http2maxpingframespermin
        Maximum number of ping frames allowed in HTTP2 connection per minute.
    .PARAMETER Http2maxsettingsframespermin
        Maximum number of settings frames allowed in HTTP2 connection per minute.
    .PARAMETER Http2maxresetframespermin
        Maximum number of reset frames allowed in HTTP/2 connection per minute.
    .PARAMETER Http2maxemptyframespermin
        Maximum number of empty frames allowed in HTTP2 connection per minute.
    .PARAMETER Grpcholdlimit
        Maximum size in bytes allowed to buffer gRPC packets till trailer is received.
    .PARAMETER Grpcholdtimeout
        Maximum time in milliseconds allowed to buffer gRPC packets till trailer is received. The value should be in multiples of 100.
    .PARAMETER Grpclengthdelimitation
        Set to DISABLED for gRPC without a length delimitation.
        Possible values = ENABLED, DISABLED
    .PARAMETER Apdexcltresptimethreshold
        This option sets the satisfactory threshold (T) for client response time in milliseconds to be used for APDEX calculations. This means a transaction responding in less than this threshold is considered satisfactory. Transaction responding between T and 4*T is considered tolerable. Any transaction responding in more than 4*T time is considered frustrating. Citrix ADC maintains stats for such tolerable and frustrating transcations. And client response time related apdex counters are only updated on a vserver which receives clients traffic.
    .PARAMETER Http3
        Choose whether to enable support for HTTP/3.
        Possible values = ENABLED, DISABLED
    .PARAMETER Http3maxheaderfieldsectionsize
        Maximum size of the HTTP/3 header field section, in bytes.
    .PARAMETER Http3maxheadertablesize
        Maximum size of the HTTP/3 QPACK dynamic header table, in bytes.
    .PARAMETER Http3maxheaderblockedstreams
        Maximum number of HTTP/3 streams that can be blocked while HTTP/3 headers are being decoded.
    .PARAMETER PassThru
        Return details about the created nshttpprofile item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNshttpprofile -name <string>
        An example how to add nshttpprofile configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNshttpprofile
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nshttpprofile/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateLength(1, 127)]
        [string]$Name,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Dropinvalreqs = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Markhttp09inval = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Markconnreqinval = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Marktracereqinval = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Markrfc7230noncompliantinval = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Markhttpheaderextrawserror = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Cmponpush = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Conmultiplex = 'ENABLED',

        [ValidateRange(0, 360000)]
        [double]$Maxreusepool = '0',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Dropextracrlf = 'ENABLED',

        [ValidateRange(1, 360000)]
        [double]$Incomphdrdelay = '7000',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Websocket = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Rtsptunnel = 'DISABLED',

        [ValidateRange(0, 86400)]
        [double]$Reqtimeout = '0',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Adpttimeout = 'DISABLED',

        [string]$Reqtimeoutaction,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Dropextradata = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Weblog = 'ENABLED',

        [string]$Clientiphdrexpr,

        [ValidateRange(0, 65534)]
        [double]$Maxreq = '0',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Persistentetag = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Http2 = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Http2direct = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Http2strictcipher = 'ENABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Http2altsvcframe = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Altsvc = 'DISABLED',

        [string]$Altsvcvalue,

        [ValidateRange(0, 31536000)]
        [double]$Reusepooltimeout = '0',

        [ValidateRange(2048, 122880)]
        [double]$Maxheaderlen = '24820',

        [ValidateRange(0, 360000)]
        [double]$Minreusepool = '0',

        [ValidateRange(8192, 131071)]
        [double]$Http2maxheaderlistsize = '24576',

        [ValidateRange(16384, 32768)]
        [double]$Http2maxframesize = '16384',

        [ValidateRange(0, 1000)]
        [double]$Http2maxconcurrentstreams = '100',

        [ValidateRange(65535, 67108864)]
        [double]$Http2initialconnwindowsize = '65535',

        [ValidateRange(8192, 20971520)]
        [double]$Http2initialwindowsize = '65535',

        [ValidateRange(0, 131072)]
        [double]$Http2headertablesize = '4096',

        [ValidateRange(1, 360000)]
        [double]$Http2minseverconn = '20',

        [ValidateRange(1, 360000)]
        [double]$Http2maxpingframespermin = '60',

        [ValidateRange(1, 360000)]
        [double]$Http2maxsettingsframespermin = '15',

        [ValidateRange(1, 360000)]
        [double]$Http2maxresetframespermin = '90',

        [ValidateRange(1, 360000)]
        [double]$Http2maxemptyframespermin = '60',

        [ValidateRange(0, 33554432)]
        [double]$Grpcholdlimit = '131072',

        [ValidateRange(0, 180000)]
        [double]$Grpcholdtimeout = '1000',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Grpclengthdelimitation = 'ENABLED',

        [ValidateRange(1, 3600000)]
        [double]$Apdexcltresptimethreshold = '500',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Http3 = 'DISABLED',

        [ValidateRange(8192, 131072)]
        [double]$Http3maxheaderfieldsectionsize = '24576',

        [ValidateRange(0, 131072)]
        [double]$Http3maxheadertablesize = '4096',

        [ValidateRange(1, 500)]
        [double]$Http3maxheaderblockedstreams = '100',

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNshttpprofile: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('dropinvalreqs') ) { $payload.Add('dropinvalreqs', $dropinvalreqs) }
            if ( $PSBoundParameters.ContainsKey('markhttp09inval') ) { $payload.Add('markhttp09inval', $markhttp09inval) }
            if ( $PSBoundParameters.ContainsKey('markconnreqinval') ) { $payload.Add('markconnreqinval', $markconnreqinval) }
            if ( $PSBoundParameters.ContainsKey('marktracereqinval') ) { $payload.Add('marktracereqinval', $marktracereqinval) }
            if ( $PSBoundParameters.ContainsKey('markrfc7230noncompliantinval') ) { $payload.Add('markrfc7230noncompliantinval', $markrfc7230noncompliantinval) }
            if ( $PSBoundParameters.ContainsKey('markhttpheaderextrawserror') ) { $payload.Add('markhttpheaderextrawserror', $markhttpheaderextrawserror) }
            if ( $PSBoundParameters.ContainsKey('cmponpush') ) { $payload.Add('cmponpush', $cmponpush) }
            if ( $PSBoundParameters.ContainsKey('conmultiplex') ) { $payload.Add('conmultiplex', $conmultiplex) }
            if ( $PSBoundParameters.ContainsKey('maxreusepool') ) { $payload.Add('maxreusepool', $maxreusepool) }
            if ( $PSBoundParameters.ContainsKey('dropextracrlf') ) { $payload.Add('dropextracrlf', $dropextracrlf) }
            if ( $PSBoundParameters.ContainsKey('incomphdrdelay') ) { $payload.Add('incomphdrdelay', $incomphdrdelay) }
            if ( $PSBoundParameters.ContainsKey('websocket') ) { $payload.Add('websocket', $websocket) }
            if ( $PSBoundParameters.ContainsKey('rtsptunnel') ) { $payload.Add('rtsptunnel', $rtsptunnel) }
            if ( $PSBoundParameters.ContainsKey('reqtimeout') ) { $payload.Add('reqtimeout', $reqtimeout) }
            if ( $PSBoundParameters.ContainsKey('adpttimeout') ) { $payload.Add('adpttimeout', $adpttimeout) }
            if ( $PSBoundParameters.ContainsKey('reqtimeoutaction') ) { $payload.Add('reqtimeoutaction', $reqtimeoutaction) }
            if ( $PSBoundParameters.ContainsKey('dropextradata') ) { $payload.Add('dropextradata', $dropextradata) }
            if ( $PSBoundParameters.ContainsKey('weblog') ) { $payload.Add('weblog', $weblog) }
            if ( $PSBoundParameters.ContainsKey('clientiphdrexpr') ) { $payload.Add('clientiphdrexpr', $clientiphdrexpr) }
            if ( $PSBoundParameters.ContainsKey('maxreq') ) { $payload.Add('maxreq', $maxreq) }
            if ( $PSBoundParameters.ContainsKey('persistentetag') ) { $payload.Add('persistentetag', $persistentetag) }
            if ( $PSBoundParameters.ContainsKey('http2') ) { $payload.Add('http2', $http2) }
            if ( $PSBoundParameters.ContainsKey('http2direct') ) { $payload.Add('http2direct', $http2direct) }
            if ( $PSBoundParameters.ContainsKey('http2strictcipher') ) { $payload.Add('http2strictcipher', $http2strictcipher) }
            if ( $PSBoundParameters.ContainsKey('http2altsvcframe') ) { $payload.Add('http2altsvcframe', $http2altsvcframe) }
            if ( $PSBoundParameters.ContainsKey('altsvc') ) { $payload.Add('altsvc', $altsvc) }
            if ( $PSBoundParameters.ContainsKey('altsvcvalue') ) { $payload.Add('altsvcvalue', $altsvcvalue) }
            if ( $PSBoundParameters.ContainsKey('reusepooltimeout') ) { $payload.Add('reusepooltimeout', $reusepooltimeout) }
            if ( $PSBoundParameters.ContainsKey('maxheaderlen') ) { $payload.Add('maxheaderlen', $maxheaderlen) }
            if ( $PSBoundParameters.ContainsKey('minreusepool') ) { $payload.Add('minreusepool', $minreusepool) }
            if ( $PSBoundParameters.ContainsKey('http2maxheaderlistsize') ) { $payload.Add('http2maxheaderlistsize', $http2maxheaderlistsize) }
            if ( $PSBoundParameters.ContainsKey('http2maxframesize') ) { $payload.Add('http2maxframesize', $http2maxframesize) }
            if ( $PSBoundParameters.ContainsKey('http2maxconcurrentstreams') ) { $payload.Add('http2maxconcurrentstreams', $http2maxconcurrentstreams) }
            if ( $PSBoundParameters.ContainsKey('http2initialconnwindowsize') ) { $payload.Add('http2initialconnwindowsize', $http2initialconnwindowsize) }
            if ( $PSBoundParameters.ContainsKey('http2initialwindowsize') ) { $payload.Add('http2initialwindowsize', $http2initialwindowsize) }
            if ( $PSBoundParameters.ContainsKey('http2headertablesize') ) { $payload.Add('http2headertablesize', $http2headertablesize) }
            if ( $PSBoundParameters.ContainsKey('http2minseverconn') ) { $payload.Add('http2minseverconn', $http2minseverconn) }
            if ( $PSBoundParameters.ContainsKey('http2maxpingframespermin') ) { $payload.Add('http2maxpingframespermin', $http2maxpingframespermin) }
            if ( $PSBoundParameters.ContainsKey('http2maxsettingsframespermin') ) { $payload.Add('http2maxsettingsframespermin', $http2maxsettingsframespermin) }
            if ( $PSBoundParameters.ContainsKey('http2maxresetframespermin') ) { $payload.Add('http2maxresetframespermin', $http2maxresetframespermin) }
            if ( $PSBoundParameters.ContainsKey('http2maxemptyframespermin') ) { $payload.Add('http2maxemptyframespermin', $http2maxemptyframespermin) }
            if ( $PSBoundParameters.ContainsKey('grpcholdlimit') ) { $payload.Add('grpcholdlimit', $grpcholdlimit) }
            if ( $PSBoundParameters.ContainsKey('grpcholdtimeout') ) { $payload.Add('grpcholdtimeout', $grpcholdtimeout) }
            if ( $PSBoundParameters.ContainsKey('grpclengthdelimitation') ) { $payload.Add('grpclengthdelimitation', $grpclengthdelimitation) }
            if ( $PSBoundParameters.ContainsKey('apdexcltresptimethreshold') ) { $payload.Add('apdexcltresptimethreshold', $apdexcltresptimethreshold) }
            if ( $PSBoundParameters.ContainsKey('http3') ) { $payload.Add('http3', $http3) }
            if ( $PSBoundParameters.ContainsKey('http3maxheaderfieldsectionsize') ) { $payload.Add('http3maxheaderfieldsectionsize', $http3maxheaderfieldsectionsize) }
            if ( $PSBoundParameters.ContainsKey('http3maxheadertablesize') ) { $payload.Add('http3maxheadertablesize', $http3maxheadertablesize) }
            if ( $PSBoundParameters.ContainsKey('http3maxheaderblockedstreams') ) { $payload.Add('http3maxheaderblockedstreams', $http3maxheaderblockedstreams) }
            if ( $PSCmdlet.ShouldProcess("nshttpprofile", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nshttpprofile -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNshttpprofile -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNshttpprofile: Finished"
    }
}

function Invoke-ADCDeleteNshttpprofile {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for HTTP profile resource.
    .PARAMETER Name
        Name for an HTTP profile. Must begin with a letter, number, or the underscore \(_\) character. Other characters allowed, after the first character, are the hyphen \(-\), period \(.\), hash \(\#\), space \( \), at \(@\), colon \(:\), and equal \(=\) characters. The name of a HTTP profile cannot be changed after it is created.
        CLI Users: If the name includes one or more spaces, enclose the name in double or single quotation marks \(for example, "my http profile" or 'my http profile'\).
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNshttpprofile -Name <string>
        An example how to delete nshttpprofile configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNshttpprofile
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nshttpprofile/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Name 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNshttpprofile: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$name", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nshttpprofile -NitroPath nitro/v1/config -Resource $name -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNshttpprofile: Finished"
    }
}

function Invoke-ADCUpdateNshttpprofile {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for HTTP profile resource.
    .PARAMETER Name
        Name for an HTTP profile. Must begin with a letter, number, or the underscore \(_\) character. Other characters allowed, after the first character, are the hyphen \(-\), period \(.\), hash \(\#\), space \( \), at \(@\), colon \(:\), and equal \(=\) characters. The name of a HTTP profile cannot be changed after it is created.
        CLI Users: If the name includes one or more spaces, enclose the name in double or single quotation marks \(for example, "my http profile" or 'my http profile'\).
    .PARAMETER Dropinvalreqs
        Drop invalid HTTP requests or responses.
        Possible values = ENABLED, DISABLED
    .PARAMETER Markhttp09inval
        Mark HTTP/0.9 requests as invalid.
        Possible values = ENABLED, DISABLED
    .PARAMETER Markconnreqinval
        Mark CONNECT requests as invalid.
        Possible values = ENABLED, DISABLED
    .PARAMETER Marktracereqinval
        Mark TRACE requests as invalid.
        Possible values = ENABLED, DISABLED
    .PARAMETER Markrfc7230noncompliantinval
        Mark RFC7230 non-compliant transaction as invalid.
        Possible values = ENABLED, DISABLED
    .PARAMETER Markhttpheaderextrawserror
        Mark Http header with extra white space as invalid.
        Possible values = ENABLED, DISABLED
    .PARAMETER Cmponpush
        Start data compression on receiving a TCP packet with PUSH flag set.
        Possible values = ENABLED, DISABLED
    .PARAMETER Conmultiplex
        Reuse server connections for requests from more than one client connections.
        Possible values = ENABLED, DISABLED
    .PARAMETER Maxreusepool
        Maximum limit on the number of connections, from the Citrix ADC to a particular server that are kept in the reuse pool. This setting is helpful for optimal memory utilization and for reducing the idle connections to the server just after the peak time. Zero implies no limit on reuse pool size. If non-zero value is given, it has to be greater than or equal to the number of running Packet Engines.
    .PARAMETER Dropextracrlf
        Drop any extra 'CR' and 'LF' characters present after the header.
        Possible values = ENABLED, DISABLED
    .PARAMETER Incomphdrdelay
        Maximum time to wait, in milliseconds, between incomplete header packets. If the header packets take longer to arrive at Citrix ADC, the connection is silently dropped.
    .PARAMETER Websocket
        HTTP connection to be upgraded to a web socket connection. Once upgraded, Citrix ADC does not process Layer 7 traffic on this connection.
        Possible values = ENABLED, DISABLED
    .PARAMETER Rtsptunnel
        Allow RTSP tunnel in HTTP. Once application/x-rtsp-tunnelled is seen in Accept or Content-Type header, Citrix ADC does not process Layer 7 traffic on this connection.
        Possible values = ENABLED, DISABLED
    .PARAMETER Reqtimeout
        Time, in seconds, within which the HTTP request must complete. If the request does not complete within this time, the specified request timeout action is executed. Zero disables the timeout.
    .PARAMETER Adpttimeout
        Adapts the configured request timeout based on flow conditions. The timeout is increased or decreased internally and applied on the flow.
        Possible values = ENABLED, DISABLED
    .PARAMETER Reqtimeoutaction
        Action to take when the HTTP request does not complete within the specified request timeout duration. You can configure the following actions:
        * RESET - Send RST (reset) to client when timeout occurs.
        * DROP - Drop silently when timeout occurs.
        * Custom responder action - Name of the responder action to trigger when timeout occurs, used to send custom message.
    .PARAMETER Dropextradata
        Drop any extra data when server sends more data than the specified content-length.
        Possible values = ENABLED, DISABLED
    .PARAMETER Weblog
        Enable or disable web logging.
        Possible values = ENABLED, DISABLED
    .PARAMETER Clientiphdrexpr
        Name of the header that contains the real client IP address.
    .PARAMETER Maxreq
        Maximum number of requests allowed on a single connection. Zero implies no limit on the number of requests.
    .PARAMETER Persistentetag
        Generate the persistent Citrix ADC specific ETag for the HTTP response with ETag header.
        Possible values = ENABLED, DISABLED
    .PARAMETER Http2
        Choose whether to enable support for HTTP/2.
        Possible values = ENABLED, DISABLED
    .PARAMETER Http2direct
        Choose whether to enable support for Direct HTTP/2.
        Possible values = ENABLED, DISABLED
    .PARAMETER Http2strictcipher
        Choose whether to enable strict HTTP/2 cipher selection.
        Possible values = ENABLED, DISABLED
    .PARAMETER Http2altsvcframe
        Choose whether to enable support for sending HTTP/2 ALTSVC frames. When enabled, the ADC sends HTTP/2 ALTSVC frames to HTTP/2 clients, instead of the Alt-Svc response header field. Not applicable to servers.
        Possible values = ENABLED, DISABLED
    .PARAMETER Altsvc
        Choose whether to enable support for Alternative Services.
        Possible values = ENABLED, DISABLED
    .PARAMETER Altsvcvalue
        Configure a custom Alternative Services header value that should be inserted in the response to advertise a HTTP/SSL/HTTP_QUIC vserver.
    .PARAMETER Http2maxheaderlistsize
        Maximum size of header list that the Citrix ADC is prepared to accept, in bytes. NOTE: The actual plain text header size that the Citrix ADC accepts is limited by maxHeaderLen. Please change maxHeaderLen parameter as well when modifying http2MaxHeaderListSize.
    .PARAMETER Http2maxframesize
        Maximum size of the frame payload that the Citrix ADC is willing to receive, in bytes.
    .PARAMETER Http2maxconcurrentstreams
        Maximum number of concurrent streams that is allowed per connection.
    .PARAMETER Http2initialconnwindowsize
        Initial window size for connection level flow control, in bytes.
    .PARAMETER Http2initialwindowsize
        Initial window size for stream level flow control, in bytes.
    .PARAMETER Http2headertablesize
        Maximum size of the header compression table used to decode header blocks, in bytes.
    .PARAMETER Http2minseverconn
        Minimum number of HTTP2 connections established to backend server, on receiving HTTP requests from client before multiplexing the streams into the available HTTP/2 connections.
    .PARAMETER Http2maxpingframespermin
        Maximum number of ping frames allowed in HTTP2 connection per minute.
    .PARAMETER Http2maxsettingsframespermin
        Maximum number of settings frames allowed in HTTP2 connection per minute.
    .PARAMETER Http2maxresetframespermin
        Maximum number of reset frames allowed in HTTP/2 connection per minute.
    .PARAMETER Http2maxemptyframespermin
        Maximum number of empty frames allowed in HTTP2 connection per minute.
    .PARAMETER Grpcholdlimit
        Maximum size in bytes allowed to buffer gRPC packets till trailer is received.
    .PARAMETER Grpcholdtimeout
        Maximum time in milliseconds allowed to buffer gRPC packets till trailer is received. The value should be in multiples of 100.
    .PARAMETER Grpclengthdelimitation
        Set to DISABLED for gRPC without a length delimitation.
        Possible values = ENABLED, DISABLED
    .PARAMETER Reusepooltimeout
        Idle timeout (in seconds) for server connections in re-use pool. Connections in the re-use pool are flushed, if they remain idle for the configured timeout.
    .PARAMETER Maxheaderlen
        Number of bytes to be queued to look for complete header before returning error. If complete header is not obtained after queuing these many bytes, request will be marked as invalid and no L7 processing will be done for that TCP connection.
    .PARAMETER Minreusepool
        Minimum limit on the number of connections, from the Citrix ADC to a particular server that are kept in the reuse pool. This setting is helpful for optimal memory utilization and for reducing the idle connections to the server just after the peak time. Zero implies no limit on reuse pool size.
    .PARAMETER Apdexcltresptimethreshold
        This option sets the satisfactory threshold (T) for client response time in milliseconds to be used for APDEX calculations. This means a transaction responding in less than this threshold is considered satisfactory. Transaction responding between T and 4*T is considered tolerable. Any transaction responding in more than 4*T time is considered frustrating. Citrix ADC maintains stats for such tolerable and frustrating transcations. And client response time related apdex counters are only updated on a vserver which receives clients traffic.
    .PARAMETER Http3
        Choose whether to enable support for HTTP/3.
        Possible values = ENABLED, DISABLED
    .PARAMETER Http3maxheaderfieldsectionsize
        Maximum size of the HTTP/3 header field section, in bytes.
    .PARAMETER Http3maxheadertablesize
        Maximum size of the HTTP/3 QPACK dynamic header table, in bytes.
    .PARAMETER Http3maxheaderblockedstreams
        Maximum number of HTTP/3 streams that can be blocked while HTTP/3 headers are being decoded.
    .PARAMETER PassThru
        Return details about the created nshttpprofile item.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNshttpprofile -name <string>
        An example how to update nshttpprofile configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNshttpprofile
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nshttpprofile/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateLength(1, 127)]
        [string]$Name,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Dropinvalreqs,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Markhttp09inval,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Markconnreqinval,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Marktracereqinval,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Markrfc7230noncompliantinval,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Markhttpheaderextrawserror,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Cmponpush,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Conmultiplex,

        [ValidateRange(0, 360000)]
        [double]$Maxreusepool,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Dropextracrlf,

        [ValidateRange(1, 360000)]
        [double]$Incomphdrdelay,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Websocket,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Rtsptunnel,

        [ValidateRange(0, 86400)]
        [double]$Reqtimeout,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Adpttimeout,

        [string]$Reqtimeoutaction,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Dropextradata,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Weblog,

        [string]$Clientiphdrexpr,

        [ValidateRange(0, 65534)]
        [double]$Maxreq,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Persistentetag,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Http2,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Http2direct,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Http2strictcipher,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Http2altsvcframe,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Altsvc,

        [string]$Altsvcvalue,

        [ValidateRange(8192, 131071)]
        [double]$Http2maxheaderlistsize,

        [ValidateRange(16384, 32768)]
        [double]$Http2maxframesize,

        [ValidateRange(0, 1000)]
        [double]$Http2maxconcurrentstreams,

        [ValidateRange(65535, 67108864)]
        [double]$Http2initialconnwindowsize,

        [ValidateRange(8192, 20971520)]
        [double]$Http2initialwindowsize,

        [ValidateRange(0, 131072)]
        [double]$Http2headertablesize,

        [ValidateRange(1, 360000)]
        [double]$Http2minseverconn,

        [ValidateRange(1, 360000)]
        [double]$Http2maxpingframespermin,

        [ValidateRange(1, 360000)]
        [double]$Http2maxsettingsframespermin,

        [ValidateRange(1, 360000)]
        [double]$Http2maxresetframespermin,

        [ValidateRange(1, 360000)]
        [double]$Http2maxemptyframespermin,

        [ValidateRange(0, 33554432)]
        [double]$Grpcholdlimit,

        [ValidateRange(0, 180000)]
        [double]$Grpcholdtimeout,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Grpclengthdelimitation,

        [ValidateRange(0, 31536000)]
        [double]$Reusepooltimeout,

        [ValidateRange(2048, 122880)]
        [double]$Maxheaderlen,

        [ValidateRange(0, 360000)]
        [double]$Minreusepool,

        [ValidateRange(1, 3600000)]
        [double]$Apdexcltresptimethreshold,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Http3,

        [ValidateRange(8192, 131072)]
        [double]$Http3maxheaderfieldsectionsize,

        [ValidateRange(0, 131072)]
        [double]$Http3maxheadertablesize,

        [ValidateRange(1, 500)]
        [double]$Http3maxheaderblockedstreams,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNshttpprofile: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('dropinvalreqs') ) { $payload.Add('dropinvalreqs', $dropinvalreqs) }
            if ( $PSBoundParameters.ContainsKey('markhttp09inval') ) { $payload.Add('markhttp09inval', $markhttp09inval) }
            if ( $PSBoundParameters.ContainsKey('markconnreqinval') ) { $payload.Add('markconnreqinval', $markconnreqinval) }
            if ( $PSBoundParameters.ContainsKey('marktracereqinval') ) { $payload.Add('marktracereqinval', $marktracereqinval) }
            if ( $PSBoundParameters.ContainsKey('markrfc7230noncompliantinval') ) { $payload.Add('markrfc7230noncompliantinval', $markrfc7230noncompliantinval) }
            if ( $PSBoundParameters.ContainsKey('markhttpheaderextrawserror') ) { $payload.Add('markhttpheaderextrawserror', $markhttpheaderextrawserror) }
            if ( $PSBoundParameters.ContainsKey('cmponpush') ) { $payload.Add('cmponpush', $cmponpush) }
            if ( $PSBoundParameters.ContainsKey('conmultiplex') ) { $payload.Add('conmultiplex', $conmultiplex) }
            if ( $PSBoundParameters.ContainsKey('maxreusepool') ) { $payload.Add('maxreusepool', $maxreusepool) }
            if ( $PSBoundParameters.ContainsKey('dropextracrlf') ) { $payload.Add('dropextracrlf', $dropextracrlf) }
            if ( $PSBoundParameters.ContainsKey('incomphdrdelay') ) { $payload.Add('incomphdrdelay', $incomphdrdelay) }
            if ( $PSBoundParameters.ContainsKey('websocket') ) { $payload.Add('websocket', $websocket) }
            if ( $PSBoundParameters.ContainsKey('rtsptunnel') ) { $payload.Add('rtsptunnel', $rtsptunnel) }
            if ( $PSBoundParameters.ContainsKey('reqtimeout') ) { $payload.Add('reqtimeout', $reqtimeout) }
            if ( $PSBoundParameters.ContainsKey('adpttimeout') ) { $payload.Add('adpttimeout', $adpttimeout) }
            if ( $PSBoundParameters.ContainsKey('reqtimeoutaction') ) { $payload.Add('reqtimeoutaction', $reqtimeoutaction) }
            if ( $PSBoundParameters.ContainsKey('dropextradata') ) { $payload.Add('dropextradata', $dropextradata) }
            if ( $PSBoundParameters.ContainsKey('weblog') ) { $payload.Add('weblog', $weblog) }
            if ( $PSBoundParameters.ContainsKey('clientiphdrexpr') ) { $payload.Add('clientiphdrexpr', $clientiphdrexpr) }
            if ( $PSBoundParameters.ContainsKey('maxreq') ) { $payload.Add('maxreq', $maxreq) }
            if ( $PSBoundParameters.ContainsKey('persistentetag') ) { $payload.Add('persistentetag', $persistentetag) }
            if ( $PSBoundParameters.ContainsKey('http2') ) { $payload.Add('http2', $http2) }
            if ( $PSBoundParameters.ContainsKey('http2direct') ) { $payload.Add('http2direct', $http2direct) }
            if ( $PSBoundParameters.ContainsKey('http2strictcipher') ) { $payload.Add('http2strictcipher', $http2strictcipher) }
            if ( $PSBoundParameters.ContainsKey('http2altsvcframe') ) { $payload.Add('http2altsvcframe', $http2altsvcframe) }
            if ( $PSBoundParameters.ContainsKey('altsvc') ) { $payload.Add('altsvc', $altsvc) }
            if ( $PSBoundParameters.ContainsKey('altsvcvalue') ) { $payload.Add('altsvcvalue', $altsvcvalue) }
            if ( $PSBoundParameters.ContainsKey('http2maxheaderlistsize') ) { $payload.Add('http2maxheaderlistsize', $http2maxheaderlistsize) }
            if ( $PSBoundParameters.ContainsKey('http2maxframesize') ) { $payload.Add('http2maxframesize', $http2maxframesize) }
            if ( $PSBoundParameters.ContainsKey('http2maxconcurrentstreams') ) { $payload.Add('http2maxconcurrentstreams', $http2maxconcurrentstreams) }
            if ( $PSBoundParameters.ContainsKey('http2initialconnwindowsize') ) { $payload.Add('http2initialconnwindowsize', $http2initialconnwindowsize) }
            if ( $PSBoundParameters.ContainsKey('http2initialwindowsize') ) { $payload.Add('http2initialwindowsize', $http2initialwindowsize) }
            if ( $PSBoundParameters.ContainsKey('http2headertablesize') ) { $payload.Add('http2headertablesize', $http2headertablesize) }
            if ( $PSBoundParameters.ContainsKey('http2minseverconn') ) { $payload.Add('http2minseverconn', $http2minseverconn) }
            if ( $PSBoundParameters.ContainsKey('http2maxpingframespermin') ) { $payload.Add('http2maxpingframespermin', $http2maxpingframespermin) }
            if ( $PSBoundParameters.ContainsKey('http2maxsettingsframespermin') ) { $payload.Add('http2maxsettingsframespermin', $http2maxsettingsframespermin) }
            if ( $PSBoundParameters.ContainsKey('http2maxresetframespermin') ) { $payload.Add('http2maxresetframespermin', $http2maxresetframespermin) }
            if ( $PSBoundParameters.ContainsKey('http2maxemptyframespermin') ) { $payload.Add('http2maxemptyframespermin', $http2maxemptyframespermin) }
            if ( $PSBoundParameters.ContainsKey('grpcholdlimit') ) { $payload.Add('grpcholdlimit', $grpcholdlimit) }
            if ( $PSBoundParameters.ContainsKey('grpcholdtimeout') ) { $payload.Add('grpcholdtimeout', $grpcholdtimeout) }
            if ( $PSBoundParameters.ContainsKey('grpclengthdelimitation') ) { $payload.Add('grpclengthdelimitation', $grpclengthdelimitation) }
            if ( $PSBoundParameters.ContainsKey('reusepooltimeout') ) { $payload.Add('reusepooltimeout', $reusepooltimeout) }
            if ( $PSBoundParameters.ContainsKey('maxheaderlen') ) { $payload.Add('maxheaderlen', $maxheaderlen) }
            if ( $PSBoundParameters.ContainsKey('minreusepool') ) { $payload.Add('minreusepool', $minreusepool) }
            if ( $PSBoundParameters.ContainsKey('apdexcltresptimethreshold') ) { $payload.Add('apdexcltresptimethreshold', $apdexcltresptimethreshold) }
            if ( $PSBoundParameters.ContainsKey('http3') ) { $payload.Add('http3', $http3) }
            if ( $PSBoundParameters.ContainsKey('http3maxheaderfieldsectionsize') ) { $payload.Add('http3maxheaderfieldsectionsize', $http3maxheaderfieldsectionsize) }
            if ( $PSBoundParameters.ContainsKey('http3maxheadertablesize') ) { $payload.Add('http3maxheadertablesize', $http3maxheadertablesize) }
            if ( $PSBoundParameters.ContainsKey('http3maxheaderblockedstreams') ) { $payload.Add('http3maxheaderblockedstreams', $http3maxheaderblockedstreams) }
            if ( $PSCmdlet.ShouldProcess("nshttpprofile", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nshttpprofile -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNshttpprofile -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNshttpprofile: Finished"
    }
}

function Invoke-ADCUnsetNshttpprofile {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for HTTP profile resource.
    .PARAMETER Name
        Name for an HTTP profile. Must begin with a letter, number, or the underscore \(_\) character. Other characters allowed, after the first character, are the hyphen \(-\), period \(.\), hash \(\#\), space \( \), at \(@\), colon \(:\), and equal \(=\) characters. The name of a HTTP profile cannot be changed after it is created.
        CLI Users: If the name includes one or more spaces, enclose the name in double or single quotation marks \(for example, "my http profile" or 'my http profile'\).
    .PARAMETER Dropinvalreqs
        Drop invalid HTTP requests or responses.
        Possible values = ENABLED, DISABLED
    .PARAMETER Markhttp09inval
        Mark HTTP/0.9 requests as invalid.
        Possible values = ENABLED, DISABLED
    .PARAMETER Markconnreqinval
        Mark CONNECT requests as invalid.
        Possible values = ENABLED, DISABLED
    .PARAMETER Marktracereqinval
        Mark TRACE requests as invalid.
        Possible values = ENABLED, DISABLED
    .PARAMETER Markrfc7230noncompliantinval
        Mark RFC7230 non-compliant transaction as invalid.
        Possible values = ENABLED, DISABLED
    .PARAMETER Markhttpheaderextrawserror
        Mark Http header with extra white space as invalid.
        Possible values = ENABLED, DISABLED
    .PARAMETER Cmponpush
        Start data compression on receiving a TCP packet with PUSH flag set.
        Possible values = ENABLED, DISABLED
    .PARAMETER Conmultiplex
        Reuse server connections for requests from more than one client connections.
        Possible values = ENABLED, DISABLED
    .PARAMETER Maxreusepool
        Maximum limit on the number of connections, from the Citrix ADC to a particular server that are kept in the reuse pool. This setting is helpful for optimal memory utilization and for reducing the idle connections to the server just after the peak time. Zero implies no limit on reuse pool size. If non-zero value is given, it has to be greater than or equal to the number of running Packet Engines.
    .PARAMETER Dropextracrlf
        Drop any extra 'CR' and 'LF' characters present after the header.
        Possible values = ENABLED, DISABLED
    .PARAMETER Incomphdrdelay
        Maximum time to wait, in milliseconds, between incomplete header packets. If the header packets take longer to arrive at Citrix ADC, the connection is silently dropped.
    .PARAMETER Websocket
        HTTP connection to be upgraded to a web socket connection. Once upgraded, Citrix ADC does not process Layer 7 traffic on this connection.
        Possible values = ENABLED, DISABLED
    .PARAMETER Dropextradata
        Drop any extra data when server sends more data than the specified content-length.
        Possible values = ENABLED, DISABLED
    .PARAMETER Clientiphdrexpr
        Name of the header that contains the real client IP address.
    .PARAMETER Reqtimeout
        Time, in seconds, within which the HTTP request must complete. If the request does not complete within this time, the specified request timeout action is executed. Zero disables the timeout.
    .PARAMETER Adpttimeout
        Adapts the configured request timeout based on flow conditions. The timeout is increased or decreased internally and applied on the flow.
        Possible values = ENABLED, DISABLED
    .PARAMETER Reqtimeoutaction
        Action to take when the HTTP request does not complete within the specified request timeout duration. You can configure the following actions:
        * RESET - Send RST (reset) to client when timeout occurs.
        * DROP - Drop silently when timeout occurs.
        * Custom responder action - Name of the responder action to trigger when timeout occurs, used to send custom message.
    .PARAMETER Weblog
        Enable or disable web logging.
        Possible values = ENABLED, DISABLED
    .PARAMETER Maxreq
        Maximum number of requests allowed on a single connection. Zero implies no limit on the number of requests.
    .PARAMETER Persistentetag
        Generate the persistent Citrix ADC specific ETag for the HTTP response with ETag header.
        Possible values = ENABLED, DISABLED
    .PARAMETER Http2
        Choose whether to enable support for HTTP/2.
        Possible values = ENABLED, DISABLED
    .PARAMETER Http2maxheaderlistsize
        Maximum size of header list that the Citrix ADC is prepared to accept, in bytes. NOTE: The actual plain text header size that the Citrix ADC accepts is limited by maxHeaderLen. Please change maxHeaderLen parameter as well when modifying http2MaxHeaderListSize.
    .PARAMETER Http2maxframesize
        Maximum size of the frame payload that the Citrix ADC is willing to receive, in bytes.
    .PARAMETER Http2maxconcurrentstreams
        Maximum number of concurrent streams that is allowed per connection.
    .PARAMETER Http2initialwindowsize
        Initial window size for stream level flow control, in bytes.
    .PARAMETER Http2headertablesize
        Maximum size of the header compression table used to decode header blocks, in bytes.
    .PARAMETER Http2minseverconn
        Minimum number of HTTP2 connections established to backend server, on receiving HTTP requests from client before multiplexing the streams into the available HTTP/2 connections.
    .PARAMETER Http2maxpingframespermin
        Maximum number of ping frames allowed in HTTP2 connection per minute.
    .PARAMETER Http2maxsettingsframespermin
        Maximum number of settings frames allowed in HTTP2 connection per minute.
    .PARAMETER Http2maxresetframespermin
        Maximum number of reset frames allowed in HTTP/2 connection per minute.
    .PARAMETER Http2maxemptyframespermin
        Maximum number of empty frames allowed in HTTP2 connection per minute.
    .PARAMETER Http2altsvcframe
        Choose whether to enable support for sending HTTP/2 ALTSVC frames. When enabled, the ADC sends HTTP/2 ALTSVC frames to HTTP/2 clients, instead of the Alt-Svc response header field. Not applicable to servers.
        Possible values = ENABLED, DISABLED
    .PARAMETER Altsvcvalue
        Configure a custom Alternative Services header value that should be inserted in the response to advertise a HTTP/SSL/HTTP_QUIC vserver.
    .PARAMETER Reusepooltimeout
        Idle timeout (in seconds) for server connections in re-use pool. Connections in the re-use pool are flushed, if they remain idle for the configured timeout.
    .PARAMETER Maxheaderlen
        Number of bytes to be queued to look for complete header before returning error. If complete header is not obtained after queuing these many bytes, request will be marked as invalid and no L7 processing will be done for that TCP connection.
    .PARAMETER Rtsptunnel
        Allow RTSP tunnel in HTTP. Once application/x-rtsp-tunnelled is seen in Accept or Content-Type header, Citrix ADC does not process Layer 7 traffic on this connection.
        Possible values = ENABLED, DISABLED
    .PARAMETER Minreusepool
        Minimum limit on the number of connections, from the Citrix ADC to a particular server that are kept in the reuse pool. This setting is helpful for optimal memory utilization and for reducing the idle connections to the server just after the peak time. Zero implies no limit on reuse pool size.
    .PARAMETER Apdexcltresptimethreshold
        This option sets the satisfactory threshold (T) for client response time in milliseconds to be used for APDEX calculations. This means a transaction responding in less than this threshold is considered satisfactory. Transaction responding between T and 4*T is considered tolerable. Any transaction responding in more than 4*T time is considered frustrating. Citrix ADC maintains stats for such tolerable and frustrating transcations. And client response time related apdex counters are only updated on a vserver which receives clients traffic.
    .PARAMETER Http3
        Choose whether to enable support for HTTP/3.
        Possible values = ENABLED, DISABLED
    .PARAMETER Http3maxheaderfieldsectionsize
        Maximum size of the HTTP/3 header field section, in bytes.
    .PARAMETER Http3maxheadertablesize
        Maximum size of the HTTP/3 QPACK dynamic header table, in bytes.
    .PARAMETER Http3maxheaderblockedstreams
        Maximum number of HTTP/3 streams that can be blocked while HTTP/3 headers are being decoded.
    .PARAMETER Http2direct
        Choose whether to enable support for Direct HTTP/2.
        Possible values = ENABLED, DISABLED
    .PARAMETER Http2strictcipher
        Choose whether to enable strict HTTP/2 cipher selection.
        Possible values = ENABLED, DISABLED
    .PARAMETER Altsvc
        Choose whether to enable support for Alternative Services.
        Possible values = ENABLED, DISABLED
    .PARAMETER Http2initialconnwindowsize
        Initial window size for connection level flow control, in bytes.
    .PARAMETER Grpcholdlimit
        Maximum size in bytes allowed to buffer gRPC packets till trailer is received.
    .PARAMETER Grpcholdtimeout
        Maximum time in milliseconds allowed to buffer gRPC packets till trailer is received. The value should be in multiples of 100.
    .PARAMETER Grpclengthdelimitation
        Set to DISABLED for gRPC without a length delimitation.
        Possible values = ENABLED, DISABLED
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNshttpprofile -name <string>
        An example how to unset nshttpprofile configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNshttpprofile
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nshttpprofile
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateLength(1, 127)]
        [string]$Name,

        [Boolean]$dropinvalreqs,

        [Boolean]$markhttp09inval,

        [Boolean]$markconnreqinval,

        [Boolean]$marktracereqinval,

        [Boolean]$markrfc7230noncompliantinval,

        [Boolean]$markhttpheaderextrawserror,

        [Boolean]$cmponpush,

        [Boolean]$conmultiplex,

        [Boolean]$maxreusepool,

        [Boolean]$dropextracrlf,

        [Boolean]$incomphdrdelay,

        [Boolean]$websocket,

        [Boolean]$dropextradata,

        [Boolean]$clientiphdrexpr,

        [Boolean]$reqtimeout,

        [Boolean]$adpttimeout,

        [Boolean]$reqtimeoutaction,

        [Boolean]$weblog,

        [Boolean]$maxreq,

        [Boolean]$persistentetag,

        [Boolean]$http2,

        [Boolean]$http2maxheaderlistsize,

        [Boolean]$http2maxframesize,

        [Boolean]$http2maxconcurrentstreams,

        [Boolean]$http2initialwindowsize,

        [Boolean]$http2headertablesize,

        [Boolean]$http2minseverconn,

        [Boolean]$http2maxpingframespermin,

        [Boolean]$http2maxsettingsframespermin,

        [Boolean]$http2maxresetframespermin,

        [Boolean]$http2maxemptyframespermin,

        [Boolean]$http2altsvcframe,

        [Boolean]$altsvcvalue,

        [Boolean]$reusepooltimeout,

        [Boolean]$maxheaderlen,

        [Boolean]$rtsptunnel,

        [Boolean]$minreusepool,

        [Boolean]$apdexcltresptimethreshold,

        [Boolean]$http3,

        [Boolean]$http3maxheaderfieldsectionsize,

        [Boolean]$http3maxheadertablesize,

        [Boolean]$http3maxheaderblockedstreams,

        [Boolean]$http2direct,

        [Boolean]$http2strictcipher,

        [Boolean]$altsvc,

        [Boolean]$http2initialconnwindowsize,

        [Boolean]$grpcholdlimit,

        [Boolean]$grpcholdtimeout,

        [Boolean]$grpclengthdelimitation 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNshttpprofile: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('dropinvalreqs') ) { $payload.Add('dropinvalreqs', $dropinvalreqs) }
            if ( $PSBoundParameters.ContainsKey('markhttp09inval') ) { $payload.Add('markhttp09inval', $markhttp09inval) }
            if ( $PSBoundParameters.ContainsKey('markconnreqinval') ) { $payload.Add('markconnreqinval', $markconnreqinval) }
            if ( $PSBoundParameters.ContainsKey('marktracereqinval') ) { $payload.Add('marktracereqinval', $marktracereqinval) }
            if ( $PSBoundParameters.ContainsKey('markrfc7230noncompliantinval') ) { $payload.Add('markrfc7230noncompliantinval', $markrfc7230noncompliantinval) }
            if ( $PSBoundParameters.ContainsKey('markhttpheaderextrawserror') ) { $payload.Add('markhttpheaderextrawserror', $markhttpheaderextrawserror) }
            if ( $PSBoundParameters.ContainsKey('cmponpush') ) { $payload.Add('cmponpush', $cmponpush) }
            if ( $PSBoundParameters.ContainsKey('conmultiplex') ) { $payload.Add('conmultiplex', $conmultiplex) }
            if ( $PSBoundParameters.ContainsKey('maxreusepool') ) { $payload.Add('maxreusepool', $maxreusepool) }
            if ( $PSBoundParameters.ContainsKey('dropextracrlf') ) { $payload.Add('dropextracrlf', $dropextracrlf) }
            if ( $PSBoundParameters.ContainsKey('incomphdrdelay') ) { $payload.Add('incomphdrdelay', $incomphdrdelay) }
            if ( $PSBoundParameters.ContainsKey('websocket') ) { $payload.Add('websocket', $websocket) }
            if ( $PSBoundParameters.ContainsKey('dropextradata') ) { $payload.Add('dropextradata', $dropextradata) }
            if ( $PSBoundParameters.ContainsKey('clientiphdrexpr') ) { $payload.Add('clientiphdrexpr', $clientiphdrexpr) }
            if ( $PSBoundParameters.ContainsKey('reqtimeout') ) { $payload.Add('reqtimeout', $reqtimeout) }
            if ( $PSBoundParameters.ContainsKey('adpttimeout') ) { $payload.Add('adpttimeout', $adpttimeout) }
            if ( $PSBoundParameters.ContainsKey('reqtimeoutaction') ) { $payload.Add('reqtimeoutaction', $reqtimeoutaction) }
            if ( $PSBoundParameters.ContainsKey('weblog') ) { $payload.Add('weblog', $weblog) }
            if ( $PSBoundParameters.ContainsKey('maxreq') ) { $payload.Add('maxreq', $maxreq) }
            if ( $PSBoundParameters.ContainsKey('persistentetag') ) { $payload.Add('persistentetag', $persistentetag) }
            if ( $PSBoundParameters.ContainsKey('http2') ) { $payload.Add('http2', $http2) }
            if ( $PSBoundParameters.ContainsKey('http2maxheaderlistsize') ) { $payload.Add('http2maxheaderlistsize', $http2maxheaderlistsize) }
            if ( $PSBoundParameters.ContainsKey('http2maxframesize') ) { $payload.Add('http2maxframesize', $http2maxframesize) }
            if ( $PSBoundParameters.ContainsKey('http2maxconcurrentstreams') ) { $payload.Add('http2maxconcurrentstreams', $http2maxconcurrentstreams) }
            if ( $PSBoundParameters.ContainsKey('http2initialwindowsize') ) { $payload.Add('http2initialwindowsize', $http2initialwindowsize) }
            if ( $PSBoundParameters.ContainsKey('http2headertablesize') ) { $payload.Add('http2headertablesize', $http2headertablesize) }
            if ( $PSBoundParameters.ContainsKey('http2minseverconn') ) { $payload.Add('http2minseverconn', $http2minseverconn) }
            if ( $PSBoundParameters.ContainsKey('http2maxpingframespermin') ) { $payload.Add('http2maxpingframespermin', $http2maxpingframespermin) }
            if ( $PSBoundParameters.ContainsKey('http2maxsettingsframespermin') ) { $payload.Add('http2maxsettingsframespermin', $http2maxsettingsframespermin) }
            if ( $PSBoundParameters.ContainsKey('http2maxresetframespermin') ) { $payload.Add('http2maxresetframespermin', $http2maxresetframespermin) }
            if ( $PSBoundParameters.ContainsKey('http2maxemptyframespermin') ) { $payload.Add('http2maxemptyframespermin', $http2maxemptyframespermin) }
            if ( $PSBoundParameters.ContainsKey('http2altsvcframe') ) { $payload.Add('http2altsvcframe', $http2altsvcframe) }
            if ( $PSBoundParameters.ContainsKey('altsvcvalue') ) { $payload.Add('altsvcvalue', $altsvcvalue) }
            if ( $PSBoundParameters.ContainsKey('reusepooltimeout') ) { $payload.Add('reusepooltimeout', $reusepooltimeout) }
            if ( $PSBoundParameters.ContainsKey('maxheaderlen') ) { $payload.Add('maxheaderlen', $maxheaderlen) }
            if ( $PSBoundParameters.ContainsKey('rtsptunnel') ) { $payload.Add('rtsptunnel', $rtsptunnel) }
            if ( $PSBoundParameters.ContainsKey('minreusepool') ) { $payload.Add('minreusepool', $minreusepool) }
            if ( $PSBoundParameters.ContainsKey('apdexcltresptimethreshold') ) { $payload.Add('apdexcltresptimethreshold', $apdexcltresptimethreshold) }
            if ( $PSBoundParameters.ContainsKey('http3') ) { $payload.Add('http3', $http3) }
            if ( $PSBoundParameters.ContainsKey('http3maxheaderfieldsectionsize') ) { $payload.Add('http3maxheaderfieldsectionsize', $http3maxheaderfieldsectionsize) }
            if ( $PSBoundParameters.ContainsKey('http3maxheadertablesize') ) { $payload.Add('http3maxheadertablesize', $http3maxheadertablesize) }
            if ( $PSBoundParameters.ContainsKey('http3maxheaderblockedstreams') ) { $payload.Add('http3maxheaderblockedstreams', $http3maxheaderblockedstreams) }
            if ( $PSBoundParameters.ContainsKey('http2direct') ) { $payload.Add('http2direct', $http2direct) }
            if ( $PSBoundParameters.ContainsKey('http2strictcipher') ) { $payload.Add('http2strictcipher', $http2strictcipher) }
            if ( $PSBoundParameters.ContainsKey('altsvc') ) { $payload.Add('altsvc', $altsvc) }
            if ( $PSBoundParameters.ContainsKey('http2initialconnwindowsize') ) { $payload.Add('http2initialconnwindowsize', $http2initialconnwindowsize) }
            if ( $PSBoundParameters.ContainsKey('grpcholdlimit') ) { $payload.Add('grpcholdlimit', $grpcholdlimit) }
            if ( $PSBoundParameters.ContainsKey('grpcholdtimeout') ) { $payload.Add('grpcholdtimeout', $grpcholdtimeout) }
            if ( $PSBoundParameters.ContainsKey('grpclengthdelimitation') ) { $payload.Add('grpclengthdelimitation', $grpclengthdelimitation) }
            if ( $PSCmdlet.ShouldProcess("$name", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nshttpprofile -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNshttpprofile: Finished"
    }
}

function Invoke-ADCGetNshttpprofile {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for HTTP profile resource.
    .PARAMETER Name
        Name for an HTTP profile. Must begin with a letter, number, or the underscore \(_\) character. Other characters allowed, after the first character, are the hyphen \(-\), period \(.\), hash \(\#\), space \( \), at \(@\), colon \(:\), and equal \(=\) characters. The name of a HTTP profile cannot be changed after it is created.
        CLI Users: If the name includes one or more spaces, enclose the name in double or single quotation marks \(for example, "my http profile" or 'my http profile'\).
    .PARAMETER GetAll
        Retrieve all nshttpprofile object(s).
    .PARAMETER Count
        If specified, the count of the nshttpprofile object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshttpprofile
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshttpprofile -GetAll
        Get all nshttpprofile data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshttpprofile -Count
        Get the number of nshttpprofile objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshttpprofile -name <string>
        Get nshttpprofile object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNshttpprofile -Filter @{ 'name'='<value>' }
        Get nshttpprofile data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNshttpprofile
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nshttpprofile/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateLength(1, 127)]
        [string]$Name,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNshttpprofile: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nshttpprofile objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshttpprofile -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nshttpprofile objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshttpprofile -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nshttpprofile objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshttpprofile -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nshttpprofile configuration for property 'name'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshttpprofile -NitroPath nitro/v1/config -Resource $name -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nshttpprofile configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nshttpprofile -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNshttpprofile: Ended"
    }
}

function Invoke-ADCAddNsicapprofile {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for ICAP profile resource.
    .PARAMETER Name
        Name for an ICAP profile. Must begin with a letter, number, or the underscore \(_\) character. Other characters allowed, after the first character, are the hyphen \(-\), period \(.\), hash \(\#\), space \( \), at \(@\), colon \(:\), and equal \(=\) characters. The name of a ICAP profile cannot be changed after it is created.
        CLI Users: If the name includes one or more spaces, enclose the name in double or single quotation marks \(for example, "my icap profile" or 'my icap profile'\).
    .PARAMETER Preview
        Enable or Disable preview header with ICAP request. This feature allows an ICAP server to see the beginning of a transaction, then decide if it wants to opt-out of the transaction early instead of receiving the remainder of the request message.
        Possible values = ENABLED, DISABLED
    .PARAMETER Previewlength
        Value of Preview Header field. Citrix ADC uses the minimum of this set value and the preview size received on OPTIONS response.
    .PARAMETER Uri
        URI representing icap service. It is a mandatory argument while creating an icapprofile.
    .PARAMETER Hostheader
        ICAP Host Header.
    .PARAMETER Useragent
        ICAP User Agent Header String.
    .PARAMETER Mode
        ICAP Mode of operation. It is a mandatory argument while creating an icapprofile.
        Possible values = REQMOD, RESPMOD
    .PARAMETER Queryparams
        Query parameters to be included with ICAP request URI. Entered values should be in arg=value format. For more than one parameters, add ; separated values. e.g.: arg1=val1;arg2=val2.
    .PARAMETER Connectionkeepalive
        If enabled, Citrix ADC keeps the ICAP connection alive after a transaction to reuse it to send next ICAP request.
        Possible values = ENABLED, DISABLED
    .PARAMETER Allow204
        Enable or Disable sending Allow: 204 header in ICAP request.
        Possible values = ENABLED, DISABLED
    .PARAMETER Inserticapheaders
        Insert custom ICAP headers in the ICAP request to send to ICAP server. The headers can be static or can be dynamically constructed using PI Policy Expression. For example, to send static user agent and Client's IP address, the expression can be specified as "User-Agent: NS-ICAP-Client/V1.0\r\nX-Client-IP: "+CLIENT.IP.SRC+"\r\n".
        The Citrix ADC does not check the validity of the specified header name-value. You must manually validate the specified header syntax.
    .PARAMETER Inserthttprequest
        Exact HTTP request, in the form of an expression, which the Citrix ADC encapsulates and sends to the ICAP server. If you set this parameter, the ICAP request is sent using only this header. This can be used when the HTTP header is not available to send or ICAP server only needs part of the incoming HTTP request. The request expression is constrained by the feature for which it is used.
        The Citrix ADC does not check the validity of this request. You must manually validate the request.
    .PARAMETER Reqtimeout
        Time, in seconds, within which the remote server should respond to the ICAP-request. If the Netscaler does not receive full response with this time, the specified request timeout action is performed. Zero value disables this timeout functionality.
    .PARAMETER Reqtimeoutaction
        Name of the action to perform if the Vserver/Server representing the remote service does not respond with any response within the timeout value configured. The Supported actions are
        * BYPASS - This Ignores the remote server response and sends the request/response to Client/Server.
        * If the ICAP response with Encapsulated headers is not received within the request-timeout value configured, this Ignores the remote ICAP server response and sends the Full request/response to Server/Client.
        * RESET - Reset the client connection by closing it. The client program, such as a browser, will handle this and may inform the user. The client may then resend the request if desired.
        * DROP - Drop the request without sending a response to the user.
        Possible values = BYPASS, DROP, RESET
    .PARAMETER Logaction
        Name of the audit message action which would be evaluated on receiving the ICAP response to emit the logs.
    .PARAMETER PassThru
        Return details about the created nsicapprofile item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNsicapprofile -name <string> -uri <string> -mode <string>
        An example how to add nsicapprofile configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNsicapprofile
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsicapprofile/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateLength(1, 127)]
        [string]$Name,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Preview = 'DISABLED',

        [ValidateRange(0, 4294967294)]
        [double]$Previewlength = '4096',

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Uri,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Hostheader,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Useragent,

        [Parameter(Mandatory)]
        [ValidateSet('REQMOD', 'RESPMOD')]
        [string]$Mode,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Queryparams,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Connectionkeepalive = 'ENABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Allow204 = 'ENABLED',

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Inserticapheaders,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Inserthttprequest,

        [ValidateRange(0, 86400)]
        [double]$Reqtimeout = '0',

        [ValidateSet('BYPASS', 'DROP', 'RESET')]
        [string]$Reqtimeoutaction = 'RESET',

        [string]$Logaction,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNsicapprofile: Starting"
    }
    process {
        try {
            $payload = @{ name = $name
                uri            = $uri
                mode           = $mode
            }
            if ( $PSBoundParameters.ContainsKey('preview') ) { $payload.Add('preview', $preview) }
            if ( $PSBoundParameters.ContainsKey('previewlength') ) { $payload.Add('previewlength', $previewlength) }
            if ( $PSBoundParameters.ContainsKey('hostheader') ) { $payload.Add('hostheader', $hostheader) }
            if ( $PSBoundParameters.ContainsKey('useragent') ) { $payload.Add('useragent', $useragent) }
            if ( $PSBoundParameters.ContainsKey('queryparams') ) { $payload.Add('queryparams', $queryparams) }
            if ( $PSBoundParameters.ContainsKey('connectionkeepalive') ) { $payload.Add('connectionkeepalive', $connectionkeepalive) }
            if ( $PSBoundParameters.ContainsKey('allow204') ) { $payload.Add('allow204', $allow204) }
            if ( $PSBoundParameters.ContainsKey('inserticapheaders') ) { $payload.Add('inserticapheaders', $inserticapheaders) }
            if ( $PSBoundParameters.ContainsKey('inserthttprequest') ) { $payload.Add('inserthttprequest', $inserthttprequest) }
            if ( $PSBoundParameters.ContainsKey('reqtimeout') ) { $payload.Add('reqtimeout', $reqtimeout) }
            if ( $PSBoundParameters.ContainsKey('reqtimeoutaction') ) { $payload.Add('reqtimeoutaction', $reqtimeoutaction) }
            if ( $PSBoundParameters.ContainsKey('logaction') ) { $payload.Add('logaction', $logaction) }
            if ( $PSCmdlet.ShouldProcess("nsicapprofile", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsicapprofile -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsicapprofile -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNsicapprofile: Finished"
    }
}

function Invoke-ADCDeleteNsicapprofile {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for ICAP profile resource.
    .PARAMETER Name
        Name for an ICAP profile. Must begin with a letter, number, or the underscore \(_\) character. Other characters allowed, after the first character, are the hyphen \(-\), period \(.\), hash \(\#\), space \( \), at \(@\), colon \(:\), and equal \(=\) characters. The name of a ICAP profile cannot be changed after it is created.
        CLI Users: If the name includes one or more spaces, enclose the name in double or single quotation marks \(for example, "my icap profile" or 'my icap profile'\).
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNsicapprofile -Name <string>
        An example how to delete nsicapprofile configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNsicapprofile
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsicapprofile/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Name 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNsicapprofile: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$name", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nsicapprofile -NitroPath nitro/v1/config -Resource $name -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNsicapprofile: Finished"
    }
}

function Invoke-ADCUpdateNsicapprofile {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for ICAP profile resource.
    .PARAMETER Name
        Name for an ICAP profile. Must begin with a letter, number, or the underscore \(_\) character. Other characters allowed, after the first character, are the hyphen \(-\), period \(.\), hash \(\#\), space \( \), at \(@\), colon \(:\), and equal \(=\) characters. The name of a ICAP profile cannot be changed after it is created.
        CLI Users: If the name includes one or more spaces, enclose the name in double or single quotation marks \(for example, "my icap profile" or 'my icap profile'\).
    .PARAMETER Preview
        Enable or Disable preview header with ICAP request. This feature allows an ICAP server to see the beginning of a transaction, then decide if it wants to opt-out of the transaction early instead of receiving the remainder of the request message.
        Possible values = ENABLED, DISABLED
    .PARAMETER Previewlength
        Value of Preview Header field. Citrix ADC uses the minimum of this set value and the preview size received on OPTIONS response.
    .PARAMETER Uri
        URI representing icap service. It is a mandatory argument while creating an icapprofile.
    .PARAMETER Hostheader
        ICAP Host Header.
    .PARAMETER Useragent
        ICAP User Agent Header String.
    .PARAMETER Mode
        ICAP Mode of operation. It is a mandatory argument while creating an icapprofile.
        Possible values = REQMOD, RESPMOD
    .PARAMETER Queryparams
        Query parameters to be included with ICAP request URI. Entered values should be in arg=value format. For more than one parameters, add ; separated values. e.g.: arg1=val1;arg2=val2.
    .PARAMETER Connectionkeepalive
        If enabled, Citrix ADC keeps the ICAP connection alive after a transaction to reuse it to send next ICAP request.
        Possible values = ENABLED, DISABLED
    .PARAMETER Allow204
        Enable or Disable sending Allow: 204 header in ICAP request.
        Possible values = ENABLED, DISABLED
    .PARAMETER Inserticapheaders
        Insert custom ICAP headers in the ICAP request to send to ICAP server. The headers can be static or can be dynamically constructed using PI Policy Expression. For example, to send static user agent and Client's IP address, the expression can be specified as "User-Agent: NS-ICAP-Client/V1.0\r\nX-Client-IP: "+CLIENT.IP.SRC+"\r\n".
        The Citrix ADC does not check the validity of the specified header name-value. You must manually validate the specified header syntax.
    .PARAMETER Inserthttprequest
        Exact HTTP request, in the form of an expression, which the Citrix ADC encapsulates and sends to the ICAP server. If you set this parameter, the ICAP request is sent using only this header. This can be used when the HTTP header is not available to send or ICAP server only needs part of the incoming HTTP request. The request expression is constrained by the feature for which it is used.
        The Citrix ADC does not check the validity of this request. You must manually validate the request.
    .PARAMETER Reqtimeout
        Time, in seconds, within which the remote server should respond to the ICAP-request. If the Netscaler does not receive full response with this time, the specified request timeout action is performed. Zero value disables this timeout functionality.
    .PARAMETER Reqtimeoutaction
        Name of the action to perform if the Vserver/Server representing the remote service does not respond with any response within the timeout value configured. The Supported actions are
        * BYPASS - This Ignores the remote server response and sends the request/response to Client/Server.
        * If the ICAP response with Encapsulated headers is not received within the request-timeout value configured, this Ignores the remote ICAP server response and sends the Full request/response to Server/Client.
        * RESET - Reset the client connection by closing it. The client program, such as a browser, will handle this and may inform the user. The client may then resend the request if desired.
        * DROP - Drop the request without sending a response to the user.
        Possible values = BYPASS, DROP, RESET
    .PARAMETER Logaction
        Name of the audit message action which would be evaluated on receiving the ICAP response to emit the logs.
    .PARAMETER PassThru
        Return details about the created nsicapprofile item.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsicapprofile -name <string>
        An example how to update nsicapprofile configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsicapprofile
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsicapprofile/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateLength(1, 127)]
        [string]$Name,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Preview,

        [ValidateRange(0, 4294967294)]
        [double]$Previewlength,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Uri,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Hostheader,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Useragent,

        [ValidateSet('REQMOD', 'RESPMOD')]
        [string]$Mode,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Queryparams,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Connectionkeepalive,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Allow204,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Inserticapheaders,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Inserthttprequest,

        [ValidateRange(0, 86400)]
        [double]$Reqtimeout,

        [ValidateSet('BYPASS', 'DROP', 'RESET')]
        [string]$Reqtimeoutaction,

        [string]$Logaction,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsicapprofile: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('preview') ) { $payload.Add('preview', $preview) }
            if ( $PSBoundParameters.ContainsKey('previewlength') ) { $payload.Add('previewlength', $previewlength) }
            if ( $PSBoundParameters.ContainsKey('uri') ) { $payload.Add('uri', $uri) }
            if ( $PSBoundParameters.ContainsKey('hostheader') ) { $payload.Add('hostheader', $hostheader) }
            if ( $PSBoundParameters.ContainsKey('useragent') ) { $payload.Add('useragent', $useragent) }
            if ( $PSBoundParameters.ContainsKey('mode') ) { $payload.Add('mode', $mode) }
            if ( $PSBoundParameters.ContainsKey('queryparams') ) { $payload.Add('queryparams', $queryparams) }
            if ( $PSBoundParameters.ContainsKey('connectionkeepalive') ) { $payload.Add('connectionkeepalive', $connectionkeepalive) }
            if ( $PSBoundParameters.ContainsKey('allow204') ) { $payload.Add('allow204', $allow204) }
            if ( $PSBoundParameters.ContainsKey('inserticapheaders') ) { $payload.Add('inserticapheaders', $inserticapheaders) }
            if ( $PSBoundParameters.ContainsKey('inserthttprequest') ) { $payload.Add('inserthttprequest', $inserthttprequest) }
            if ( $PSBoundParameters.ContainsKey('reqtimeout') ) { $payload.Add('reqtimeout', $reqtimeout) }
            if ( $PSBoundParameters.ContainsKey('reqtimeoutaction') ) { $payload.Add('reqtimeoutaction', $reqtimeoutaction) }
            if ( $PSBoundParameters.ContainsKey('logaction') ) { $payload.Add('logaction', $logaction) }
            if ( $PSCmdlet.ShouldProcess("nsicapprofile", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsicapprofile -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsicapprofile -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsicapprofile: Finished"
    }
}

function Invoke-ADCUnsetNsicapprofile {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for ICAP profile resource.
    .PARAMETER Name
        Name for an ICAP profile. Must begin with a letter, number, or the underscore \(_\) character. Other characters allowed, after the first character, are the hyphen \(-\), period \(.\), hash \(\#\), space \( \), at \(@\), colon \(:\), and equal \(=\) characters. The name of a ICAP profile cannot be changed after it is created.
        CLI Users: If the name includes one or more spaces, enclose the name in double or single quotation marks \(for example, "my icap profile" or 'my icap profile'\).
    .PARAMETER Preview
        Enable or Disable preview header with ICAP request. This feature allows an ICAP server to see the beginning of a transaction, then decide if it wants to opt-out of the transaction early instead of receiving the remainder of the request message.
        Possible values = ENABLED, DISABLED
    .PARAMETER Previewlength
        Value of Preview Header field. Citrix ADC uses the minimum of this set value and the preview size received on OPTIONS response.
    .PARAMETER Hostheader
        ICAP Host Header.
    .PARAMETER Useragent
        ICAP User Agent Header String.
    .PARAMETER Queryparams
        Query parameters to be included with ICAP request URI. Entered values should be in arg=value format. For more than one parameters, add ; separated values. e.g.: arg1=val1;arg2=val2.
    .PARAMETER Connectionkeepalive
        If enabled, Citrix ADC keeps the ICAP connection alive after a transaction to reuse it to send next ICAP request.
        Possible values = ENABLED, DISABLED
    .PARAMETER Allow204
        Enable or Disable sending Allow: 204 header in ICAP request.
        Possible values = ENABLED, DISABLED
    .PARAMETER Inserticapheaders
        Insert custom ICAP headers in the ICAP request to send to ICAP server. The headers can be static or can be dynamically constructed using PI Policy Expression. For example, to send static user agent and Client's IP address, the expression can be specified as "User-Agent: NS-ICAP-Client/V1.0\r\nX-Client-IP: "+CLIENT.IP.SRC+"\r\n".
        The Citrix ADC does not check the validity of the specified header name-value. You must manually validate the specified header syntax.
    .PARAMETER Inserthttprequest
        Exact HTTP request, in the form of an expression, which the Citrix ADC encapsulates and sends to the ICAP server. If you set this parameter, the ICAP request is sent using only this header. This can be used when the HTTP header is not available to send or ICAP server only needs part of the incoming HTTP request. The request expression is constrained by the feature for which it is used.
        The Citrix ADC does not check the validity of this request. You must manually validate the request.
    .PARAMETER Reqtimeout
        Time, in seconds, within which the remote server should respond to the ICAP-request. If the Netscaler does not receive full response with this time, the specified request timeout action is performed. Zero value disables this timeout functionality.
    .PARAMETER Reqtimeoutaction
        Name of the action to perform if the Vserver/Server representing the remote service does not respond with any response within the timeout value configured. The Supported actions are
        * BYPASS - This Ignores the remote server response and sends the request/response to Client/Server.
        * If the ICAP response with Encapsulated headers is not received within the request-timeout value configured, this Ignores the remote ICAP server response and sends the Full request/response to Server/Client.
        * RESET - Reset the client connection by closing it. The client program, such as a browser, will handle this and may inform the user. The client may then resend the request if desired.
        * DROP - Drop the request without sending a response to the user.
        Possible values = BYPASS, DROP, RESET
    .PARAMETER Logaction
        Name of the audit message action which would be evaluated on receiving the ICAP response to emit the logs.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNsicapprofile -name <string>
        An example how to unset nsicapprofile configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNsicapprofile
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsicapprofile
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateLength(1, 127)]
        [string]$Name,

        [Boolean]$preview,

        [Boolean]$previewlength,

        [Boolean]$hostheader,

        [Boolean]$useragent,

        [Boolean]$queryparams,

        [Boolean]$connectionkeepalive,

        [Boolean]$allow204,

        [Boolean]$inserticapheaders,

        [Boolean]$inserthttprequest,

        [Boolean]$reqtimeout,

        [Boolean]$reqtimeoutaction,

        [Boolean]$logaction 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNsicapprofile: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('preview') ) { $payload.Add('preview', $preview) }
            if ( $PSBoundParameters.ContainsKey('previewlength') ) { $payload.Add('previewlength', $previewlength) }
            if ( $PSBoundParameters.ContainsKey('hostheader') ) { $payload.Add('hostheader', $hostheader) }
            if ( $PSBoundParameters.ContainsKey('useragent') ) { $payload.Add('useragent', $useragent) }
            if ( $PSBoundParameters.ContainsKey('queryparams') ) { $payload.Add('queryparams', $queryparams) }
            if ( $PSBoundParameters.ContainsKey('connectionkeepalive') ) { $payload.Add('connectionkeepalive', $connectionkeepalive) }
            if ( $PSBoundParameters.ContainsKey('allow204') ) { $payload.Add('allow204', $allow204) }
            if ( $PSBoundParameters.ContainsKey('inserticapheaders') ) { $payload.Add('inserticapheaders', $inserticapheaders) }
            if ( $PSBoundParameters.ContainsKey('inserthttprequest') ) { $payload.Add('inserthttprequest', $inserthttprequest) }
            if ( $PSBoundParameters.ContainsKey('reqtimeout') ) { $payload.Add('reqtimeout', $reqtimeout) }
            if ( $PSBoundParameters.ContainsKey('reqtimeoutaction') ) { $payload.Add('reqtimeoutaction', $reqtimeoutaction) }
            if ( $PSBoundParameters.ContainsKey('logaction') ) { $payload.Add('logaction', $logaction) }
            if ( $PSCmdlet.ShouldProcess("$name", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nsicapprofile -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNsicapprofile: Finished"
    }
}

function Invoke-ADCGetNsicapprofile {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for ICAP profile resource.
    .PARAMETER Name
        Name for an ICAP profile. Must begin with a letter, number, or the underscore \(_\) character. Other characters allowed, after the first character, are the hyphen \(-\), period \(.\), hash \(\#\), space \( \), at \(@\), colon \(:\), and equal \(=\) characters. The name of a ICAP profile cannot be changed after it is created.
        CLI Users: If the name includes one or more spaces, enclose the name in double or single quotation marks \(for example, "my icap profile" or 'my icap profile'\).
    .PARAMETER GetAll
        Retrieve all nsicapprofile object(s).
    .PARAMETER Count
        If specified, the count of the nsicapprofile object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsicapprofile
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsicapprofile -GetAll
        Get all nsicapprofile data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsicapprofile -Count
        Get the number of nsicapprofile objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsicapprofile -name <string>
        Get nsicapprofile object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsicapprofile -Filter @{ 'name'='<value>' }
        Get nsicapprofile data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsicapprofile
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsicapprofile/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateLength(1, 127)]
        [string]$Name,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNsicapprofile: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsicapprofile objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsicapprofile -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsicapprofile objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsicapprofile -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsicapprofile objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsicapprofile -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsicapprofile configuration for property 'name'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsicapprofile -NitroPath nitro/v1/config -Resource $name -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nsicapprofile configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsicapprofile -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsicapprofile: Ended"
    }
}

function Invoke-ADCAddNsip {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for ip resource.
    .PARAMETER Ipaddress
        IPv4 address to create on the Citrix ADC. Cannot be changed after the IP address is created.
    .PARAMETER Netmask
        Subnet mask associated with the IP address.
    .PARAMETER Type
        Type of the IP address to create on the Citrix ADC. Cannot be changed after the IP address is created. The following are the different types of Citrix ADC owned IP addresses:
        * A Subnet IP (SNIP) address is used by the Citrix ADC to communicate with the servers. The Citrix ADC also uses the subnet IP address when generating its own packets, such as packets related to dynamic routing protocols, or to send monitor probes to check the health of the servers.
        * A Virtual IP (VIP) address is the IP address associated with a virtual server. It is the IP address to which clients connect. An appliance managing a wide range of traffic may have many VIPs configured. Some of the attributes of the VIP address are customized to meet the requirements of the virtual server.
        * A GSLB site IP (GSLBIP) address is associated with a GSLB site. It is not mandatory to specify a GSLBIP address when you initially configure the Citrix ADC. A GSLBIP address is used only when you create a GSLB site.
        * A Cluster IP (CLIP) address is the management address of the cluster. All cluster configurations must be performed by accessing the cluster through this IP address.
        Possible values = SNIP, VIP, NSIP, GSLBsiteIP, CLIP
    .PARAMETER Arp
        Respond to ARP requests for this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Icmp
        Respond to ICMP requests for this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Vserver
        Use this option to set (enable or disable) the virtual server attribute for this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Telnet
        Allow Telnet access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ftp
        Allow File Transfer Protocol (FTP) access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Gui
        Allow graphical user interface (GUI) access to this IP address.
        Possible values = ENABLED, SECUREONLY, DISABLED
    .PARAMETER Ssh
        Allow secure shell (SSH) access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Snmp
        Allow Simple Network Management Protocol (SNMP) access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mgmtaccess
        Allow access to management applications on this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Restrictaccess
        Block access to nonmanagement applications on this IP. This option is applicable for MIPs, SNIPs, and NSIP, and is disabled by default. Nonmanagement applications can run on the underlying Citrix ADC Free BSD operating system.
        Possible values = ENABLED, DISABLED
    .PARAMETER Dynamicrouting
        Allow dynamic routing on this IP address. Specific to Subnet IP (SNIP) address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Decrementttl
        Decrement TTL by 1 when ENABLED.This setting is applicable only for UDP traffic.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ospf
        Use this option to enable or disable OSPF on this IP address for the entity.
        Possible values = ENABLED, DISABLED
    .PARAMETER Bgp
        Use this option to enable or disable BGP on this IP address for the entity.
        Possible values = ENABLED, DISABLED
    .PARAMETER Rip
        Use this option to enable or disable RIP on this IP address for the entity.
        Possible values = ENABLED, DISABLED
    .PARAMETER Hostroute
        Option to push the VIP to ZebOS routing table for Kernel route redistribution through dynamic routing protocols.
        Possible values = ENABLED, DISABLED
    .PARAMETER Advertiseondefaultpartition
        Advertise VIPs from Shared VLAN on Default Partition.
        Possible values = ENABLED, DISABLED
    .PARAMETER Networkroute
        Option to push the SNIP subnet to ZebOS routing table for Kernel route redistribution through dynamic routing protocol.
        Possible values = ENABLED, DISABLED
    .PARAMETER Tag
        Tag value for the network/host route associated with this IP.
    .PARAMETER Hostrtgw
        IP address of the gateway of the route for this VIP address.
    .PARAMETER Metric
        Integer value to add to or subtract from the cost of the route advertised for the VIP address.
    .PARAMETER Vserverrhilevel
        Advertise the route for the Virtual IP (VIP) address on the basis of the state of the virtual servers associated with that VIP.
        * NONE - Advertise the route for the VIP address, regardless of the state of the virtual servers associated with the address.
        * ONE VSERVER - Advertise the route for the VIP address if at least one of the associated virtual servers is in UP state.
        * ALL VSERVER - Advertise the route for the VIP address if all of the associated virtual servers are in UP state.
        * VSVR_CNTRLD - Advertise the route for the VIP address according to the RHIstate (RHI STATE) parameter setting on all the associated virtual servers of the VIP address along with their states.
        When Vserver RHI Level (RHI) parameter is set to VSVR_CNTRLD, the following are different RHI behaviors for the VIP address on the basis of RHIstate (RHI STATE) settings on the virtual servers associated with the VIP address:
        * If you set RHI STATE to PASSIVE on all virtual servers, the Citrix ADC always advertises the route for the VIP address.
        * If you set RHI STATE to ACTIVE on all virtual servers, the Citrix ADC advertises the route for the VIP address if at least one of the associated virtual servers is in UP state.
        *If you set RHI STATE to ACTIVE on some and PASSIVE on others, the Citrix ADC advertises the route for the VIP address if at least one of the associated virtual servers, whose RHI STATE set to ACTIVE, is in UP state.
        Possible values = ONE_VSERVER, ALL_VSERVERS, NONE, VSVR_CNTRLD
    .PARAMETER Ospflsatype
        Type of LSAs to be used by the OSPF protocol, running on the Citrix ADC, for advertising the route for this VIP address.
        Possible values = TYPE1, TYPE5
    .PARAMETER Ospfarea
        ID of the area in which the type1 link-state advertisements (LSAs) are to be advertised for this virtual IP (VIP) address by the OSPF protocol running on the Citrix ADC. When this parameter is not set, the VIP is advertised on all areas.
    .PARAMETER State
        Enable or disable the IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Vrid
        A positive integer that uniquely identifies a VMAC address for binding to this VIP address. This binding is used to set up Citrix ADCs in an active-active configuration using VRRP.
    .PARAMETER Icmpresponse
        Respond to ICMP requests for a Virtual IP (VIP) address on the basis of the states of the virtual servers associated with that VIP. Available settings function as follows:
        * NONE - The Citrix ADC responds to any ICMP request for the VIP address, irrespective of the states of the virtual servers associated with the address.
        * ONE VSERVER - The Citrix ADC responds to any ICMP request for the VIP address if at least one of the associated virtual servers is in UP state.
        * ALL VSERVER - The Citrix ADC responds to any ICMP request for the VIP address if all of the associated virtual servers are in UP state.
        * VSVR_CNTRLD - The behavior depends on the ICMP VSERVER RESPONSE setting on all the associated virtual servers.
        The following settings can be made for the ICMP VSERVER RESPONSE parameter on a virtual server:
        * If you set ICMP VSERVER RESPONSE to PASSIVE on all virtual servers, Citrix ADC always responds.
        * If you set ICMP VSERVER RESPONSE to ACTIVE on all virtual servers, Citrix ADC responds if even one virtual server is UP.
        * When you set ICMP VSERVER RESPONSE to ACTIVE on some and PASSIVE on others, Citrix ADC responds if even one virtual server set to ACTIVE is UP.
        Possible values = NONE, ONE_VSERVER, ALL_VSERVERS, VSVR_CNTRLD
    .PARAMETER Ownernode
        The owner node in a Cluster for this IP address. Owner node can vary from 0 to 31. If ownernode is not specified then the IP is treated as Striped IP.
    .PARAMETER Arpresponse
        Respond to ARP requests for a Virtual IP (VIP) address on the basis of the states of the virtual servers associated with that VIP. Available settings function as follows:
        * NONE - The Citrix ADC responds to any ARP request for the VIP address, irrespective of the states of the virtual servers associated with the address.
        * ONE VSERVER - The Citrix ADC responds to any ARP request for the VIP address if at least one of the associated virtual servers is in UP state.
        * ALL VSERVER - The Citrix ADC responds to any ARP request for the VIP address if all of the associated virtual servers are in UP state.
        Possible values = NONE, ONE_VSERVER, ALL_VSERVERS
    .PARAMETER Ownerdownresponse
        in cluster system, if the owner node is down, whether should it respond to icmp/arp.
        Possible values = YES, NO
    .PARAMETER Td
        Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0. TD id 4095 is used reserved for LSN use .
    .PARAMETER Arpowner
        The arp owner in a Cluster for this IP address. It can vary from 0 to 31.
    .PARAMETER Mptcpadvertise
        If enabled, this IP will be advertised by Citrix ADC to MPTCP enabled clients as part of ADD_ADDR option.
        Possible values = YES, NO
    .EXAMPLE
        PS C:\>Invoke-ADCAddNsip -ipaddress <string> -netmask <string>
        An example how to add nsip configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNsip
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsip/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Ipaddress,

        [Parameter(Mandatory)]
        [string]$Netmask,

        [ValidateSet('SNIP', 'VIP', 'NSIP', 'GSLBsiteIP', 'CLIP')]
        [string]$Type = 'SNIP',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Arp = 'ENABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Icmp = 'ENABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Vserver = 'ENABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Telnet = 'ENABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ftp = 'ENABLED',

        [ValidateSet('ENABLED', 'SECUREONLY', 'DISABLED')]
        [string]$Gui = 'ENABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ssh = 'ENABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Snmp = 'ENABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Mgmtaccess = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Restrictaccess = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Dynamicrouting = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Decrementttl = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ospf = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Bgp = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Rip = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Hostroute,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Advertiseondefaultpartition = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Networkroute,

        [double]$Tag = '0',

        [string]$Hostrtgw = '-1',

        [int]$Metric,

        [ValidateSet('ONE_VSERVER', 'ALL_VSERVERS', 'NONE', 'VSVR_CNTRLD')]
        [string]$Vserverrhilevel = 'ONE_VSERVER',

        [ValidateSet('TYPE1', 'TYPE5')]
        [string]$Ospflsatype = 'TYPE5',

        [ValidateRange(0, 4294967294)]
        [double]$Ospfarea = '-1',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$State = 'ENABLED',

        [ValidateRange(1, 255)]
        [double]$Vrid,

        [ValidateSet('NONE', 'ONE_VSERVER', 'ALL_VSERVERS', 'VSVR_CNTRLD')]
        [string]$Icmpresponse = '5',

        [double]$Ownernode = '255',

        [ValidateSet('NONE', 'ONE_VSERVER', 'ALL_VSERVERS')]
        [string]$Arpresponse = '5',

        [ValidateSet('YES', 'NO')]
        [string]$Ownerdownresponse = 'YES',

        [ValidateRange(0, 4095)]
        [double]$Td,

        [double]$Arpowner = '255',

        [ValidateSet('YES', 'NO')]
        [string]$Mptcpadvertise = 'NO' 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNsip: Starting"
    }
    process {
        try {
            $payload = @{ ipaddress = $ipaddress
                netmask             = $netmask
            }
            if ( $PSBoundParameters.ContainsKey('type') ) { $payload.Add('type', $type) }
            if ( $PSBoundParameters.ContainsKey('arp') ) { $payload.Add('arp', $arp) }
            if ( $PSBoundParameters.ContainsKey('icmp') ) { $payload.Add('icmp', $icmp) }
            if ( $PSBoundParameters.ContainsKey('vserver') ) { $payload.Add('vserver', $vserver) }
            if ( $PSBoundParameters.ContainsKey('telnet') ) { $payload.Add('telnet', $telnet) }
            if ( $PSBoundParameters.ContainsKey('ftp') ) { $payload.Add('ftp', $ftp) }
            if ( $PSBoundParameters.ContainsKey('gui') ) { $payload.Add('gui', $gui) }
            if ( $PSBoundParameters.ContainsKey('ssh') ) { $payload.Add('ssh', $ssh) }
            if ( $PSBoundParameters.ContainsKey('snmp') ) { $payload.Add('snmp', $snmp) }
            if ( $PSBoundParameters.ContainsKey('mgmtaccess') ) { $payload.Add('mgmtaccess', $mgmtaccess) }
            if ( $PSBoundParameters.ContainsKey('restrictaccess') ) { $payload.Add('restrictaccess', $restrictaccess) }
            if ( $PSBoundParameters.ContainsKey('dynamicrouting') ) { $payload.Add('dynamicrouting', $dynamicrouting) }
            if ( $PSBoundParameters.ContainsKey('decrementttl') ) { $payload.Add('decrementttl', $decrementttl) }
            if ( $PSBoundParameters.ContainsKey('ospf') ) { $payload.Add('ospf', $ospf) }
            if ( $PSBoundParameters.ContainsKey('bgp') ) { $payload.Add('bgp', $bgp) }
            if ( $PSBoundParameters.ContainsKey('rip') ) { $payload.Add('rip', $rip) }
            if ( $PSBoundParameters.ContainsKey('hostroute') ) { $payload.Add('hostroute', $hostroute) }
            if ( $PSBoundParameters.ContainsKey('advertiseondefaultpartition') ) { $payload.Add('advertiseondefaultpartition', $advertiseondefaultpartition) }
            if ( $PSBoundParameters.ContainsKey('networkroute') ) { $payload.Add('networkroute', $networkroute) }
            if ( $PSBoundParameters.ContainsKey('tag') ) { $payload.Add('tag', $tag) }
            if ( $PSBoundParameters.ContainsKey('hostrtgw') ) { $payload.Add('hostrtgw', $hostrtgw) }
            if ( $PSBoundParameters.ContainsKey('metric') ) { $payload.Add('metric', $metric) }
            if ( $PSBoundParameters.ContainsKey('vserverrhilevel') ) { $payload.Add('vserverrhilevel', $vserverrhilevel) }
            if ( $PSBoundParameters.ContainsKey('ospflsatype') ) { $payload.Add('ospflsatype', $ospflsatype) }
            if ( $PSBoundParameters.ContainsKey('ospfarea') ) { $payload.Add('ospfarea', $ospfarea) }
            if ( $PSBoundParameters.ContainsKey('state') ) { $payload.Add('state', $state) }
            if ( $PSBoundParameters.ContainsKey('vrid') ) { $payload.Add('vrid', $vrid) }
            if ( $PSBoundParameters.ContainsKey('icmpresponse') ) { $payload.Add('icmpresponse', $icmpresponse) }
            if ( $PSBoundParameters.ContainsKey('ownernode') ) { $payload.Add('ownernode', $ownernode) }
            if ( $PSBoundParameters.ContainsKey('arpresponse') ) { $payload.Add('arpresponse', $arpresponse) }
            if ( $PSBoundParameters.ContainsKey('ownerdownresponse') ) { $payload.Add('ownerdownresponse', $ownerdownresponse) }
            if ( $PSBoundParameters.ContainsKey('td') ) { $payload.Add('td', $td) }
            if ( $PSBoundParameters.ContainsKey('arpowner') ) { $payload.Add('arpowner', $arpowner) }
            if ( $PSBoundParameters.ContainsKey('mptcpadvertise') ) { $payload.Add('mptcpadvertise', $mptcpadvertise) }
            if ( $PSCmdlet.ShouldProcess("nsip", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsip -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNsip: Finished"
    }
}

function Invoke-ADCDeleteNsip {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for ip resource.
    .PARAMETER Ipaddress
        IPv4 address to create on the Citrix ADC. Cannot be changed after the IP address is created.
    .PARAMETER Td
        Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0. TD id 4095 is used reserved for LSN use .
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNsip -Ipaddress <string>
        An example how to delete nsip configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNsip
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsip/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Ipaddress,

        [double]$Td 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNsip: Starting"
    }
    process {
        try {
            $arguments = @{ }
            if ( $PSBoundParameters.ContainsKey('Td') ) { $arguments.Add('td', $Td) }
            if ( $PSCmdlet.ShouldProcess("$ipaddress", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nsip -NitroPath nitro/v1/config -Resource $ipaddress -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNsip: Finished"
    }
}

function Invoke-ADCUpdateNsip {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for ip resource.
    .PARAMETER Ipaddress
        IPv4 address to create on the Citrix ADC. Cannot be changed after the IP address is created.
    .PARAMETER Td
        Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0. TD id 4095 is used reserved for LSN use .
    .PARAMETER Netmask
        Subnet mask associated with the IP address.
    .PARAMETER Arp
        Respond to ARP requests for this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Icmp
        Respond to ICMP requests for this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Vserver
        Use this option to set (enable or disable) the virtual server attribute for this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Telnet
        Allow Telnet access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ftp
        Allow File Transfer Protocol (FTP) access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Gui
        Allow graphical user interface (GUI) access to this IP address.
        Possible values = ENABLED, SECUREONLY, DISABLED
    .PARAMETER Ssh
        Allow secure shell (SSH) access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Snmp
        Allow Simple Network Management Protocol (SNMP) access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mgmtaccess
        Allow access to management applications on this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Restrictaccess
        Block access to nonmanagement applications on this IP. This option is applicable for MIPs, SNIPs, and NSIP, and is disabled by default. Nonmanagement applications can run on the underlying Citrix ADC Free BSD operating system.
        Possible values = ENABLED, DISABLED
    .PARAMETER Decrementttl
        Decrement TTL by 1 when ENABLED.This setting is applicable only for UDP traffic.
        Possible values = ENABLED, DISABLED
    .PARAMETER Dynamicrouting
        Allow dynamic routing on this IP address. Specific to Subnet IP (SNIP) address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ospf
        Use this option to enable or disable OSPF on this IP address for the entity.
        Possible values = ENABLED, DISABLED
    .PARAMETER Bgp
        Use this option to enable or disable BGP on this IP address for the entity.
        Possible values = ENABLED, DISABLED
    .PARAMETER Rip
        Use this option to enable or disable RIP on this IP address for the entity.
        Possible values = ENABLED, DISABLED
    .PARAMETER Hostroute
        Option to push the VIP to ZebOS routing table for Kernel route redistribution through dynamic routing protocols.
        Possible values = ENABLED, DISABLED
    .PARAMETER Advertiseondefaultpartition
        Advertise VIPs from Shared VLAN on Default Partition.
        Possible values = ENABLED, DISABLED
    .PARAMETER Networkroute
        Option to push the SNIP subnet to ZebOS routing table for Kernel route redistribution through dynamic routing protocol.
        Possible values = ENABLED, DISABLED
    .PARAMETER Hostrtgw
        IP address of the gateway of the route for this VIP address.
    .PARAMETER Metric
        Integer value to add to or subtract from the cost of the route advertised for the VIP address.
    .PARAMETER Vserverrhilevel
        Advertise the route for the Virtual IP (VIP) address on the basis of the state of the virtual servers associated with that VIP.
        * NONE - Advertise the route for the VIP address, regardless of the state of the virtual servers associated with the address.
        * ONE VSERVER - Advertise the route for the VIP address if at least one of the associated virtual servers is in UP state.
        * ALL VSERVER - Advertise the route for the VIP address if all of the associated virtual servers are in UP state.
        * VSVR_CNTRLD - Advertise the route for the VIP address according to the RHIstate (RHI STATE) parameter setting on all the associated virtual servers of the VIP address along with their states.
        When Vserver RHI Level (RHI) parameter is set to VSVR_CNTRLD, the following are different RHI behaviors for the VIP address on the basis of RHIstate (RHI STATE) settings on the virtual servers associated with the VIP address:
        * If you set RHI STATE to PASSIVE on all virtual servers, the Citrix ADC always advertises the route for the VIP address.
        * If you set RHI STATE to ACTIVE on all virtual servers, the Citrix ADC advertises the route for the VIP address if at least one of the associated virtual servers is in UP state.
        *If you set RHI STATE to ACTIVE on some and PASSIVE on others, the Citrix ADC advertises the route for the VIP address if at least one of the associated virtual servers, whose RHI STATE set to ACTIVE, is in UP state.
        Possible values = ONE_VSERVER, ALL_VSERVERS, NONE, VSVR_CNTRLD
    .PARAMETER Ospflsatype
        Type of LSAs to be used by the OSPF protocol, running on the Citrix ADC, for advertising the route for this VIP address.
        Possible values = TYPE1, TYPE5
    .PARAMETER Ospfarea
        ID of the area in which the type1 link-state advertisements (LSAs) are to be advertised for this virtual IP (VIP) address by the OSPF protocol running on the Citrix ADC. When this parameter is not set, the VIP is advertised on all areas.
    .PARAMETER Tag
        Tag value for the network/host route associated with this IP.
    .PARAMETER Vrid
        A positive integer that uniquely identifies a VMAC address for binding to this VIP address. This binding is used to set up Citrix ADCs in an active-active configuration using VRRP.
    .PARAMETER Icmpresponse
        Respond to ICMP requests for a Virtual IP (VIP) address on the basis of the states of the virtual servers associated with that VIP. Available settings function as follows:
        * NONE - The Citrix ADC responds to any ICMP request for the VIP address, irrespective of the states of the virtual servers associated with the address.
        * ONE VSERVER - The Citrix ADC responds to any ICMP request for the VIP address if at least one of the associated virtual servers is in UP state.
        * ALL VSERVER - The Citrix ADC responds to any ICMP request for the VIP address if all of the associated virtual servers are in UP state.
        * VSVR_CNTRLD - The behavior depends on the ICMP VSERVER RESPONSE setting on all the associated virtual servers.
        The following settings can be made for the ICMP VSERVER RESPONSE parameter on a virtual server:
        * If you set ICMP VSERVER RESPONSE to PASSIVE on all virtual servers, Citrix ADC always responds.
        * If you set ICMP VSERVER RESPONSE to ACTIVE on all virtual servers, Citrix ADC responds if even one virtual server is UP.
        * When you set ICMP VSERVER RESPONSE to ACTIVE on some and PASSIVE on others, Citrix ADC responds if even one virtual server set to ACTIVE is UP.
        Possible values = NONE, ONE_VSERVER, ALL_VSERVERS, VSVR_CNTRLD
    .PARAMETER Arpresponse
        Respond to ARP requests for a Virtual IP (VIP) address on the basis of the states of the virtual servers associated with that VIP. Available settings function as follows:
        * NONE - The Citrix ADC responds to any ARP request for the VIP address, irrespective of the states of the virtual servers associated with the address.
        * ONE VSERVER - The Citrix ADC responds to any ARP request for the VIP address if at least one of the associated virtual servers is in UP state.
        * ALL VSERVER - The Citrix ADC responds to any ARP request for the VIP address if all of the associated virtual servers are in UP state.
        Possible values = NONE, ONE_VSERVER, ALL_VSERVERS
    .PARAMETER Ownerdownresponse
        in cluster system, if the owner node is down, whether should it respond to icmp/arp.
        Possible values = YES, NO
    .PARAMETER Arpowner
        The arp owner in a Cluster for this IP address. It can vary from 0 to 31.
    .PARAMETER Mptcpadvertise
        If enabled, this IP will be advertised by Citrix ADC to MPTCP enabled clients as part of ADD_ADDR option.
        Possible values = YES, NO
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsip -ipaddress <string>
        An example how to update nsip configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsip
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsip/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Ipaddress,

        [ValidateRange(0, 4095)]
        [double]$Td,

        [string]$Netmask,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Arp,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Icmp,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Vserver,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Telnet,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ftp,

        [ValidateSet('ENABLED', 'SECUREONLY', 'DISABLED')]
        [string]$Gui,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ssh,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Snmp,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Mgmtaccess,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Restrictaccess,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Decrementttl,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Dynamicrouting,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ospf,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Bgp,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Rip,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Hostroute,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Advertiseondefaultpartition,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Networkroute,

        [string]$Hostrtgw,

        [int]$Metric,

        [ValidateSet('ONE_VSERVER', 'ALL_VSERVERS', 'NONE', 'VSVR_CNTRLD')]
        [string]$Vserverrhilevel,

        [ValidateSet('TYPE1', 'TYPE5')]
        [string]$Ospflsatype,

        [ValidateRange(0, 4294967294)]
        [double]$Ospfarea,

        [double]$Tag,

        [ValidateRange(1, 255)]
        [double]$Vrid,

        [ValidateSet('NONE', 'ONE_VSERVER', 'ALL_VSERVERS', 'VSVR_CNTRLD')]
        [string]$Icmpresponse,

        [ValidateSet('NONE', 'ONE_VSERVER', 'ALL_VSERVERS')]
        [string]$Arpresponse,

        [ValidateSet('YES', 'NO')]
        [string]$Ownerdownresponse,

        [double]$Arpowner,

        [ValidateSet('YES', 'NO')]
        [string]$Mptcpadvertise 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsip: Starting"
    }
    process {
        try {
            $payload = @{ ipaddress = $ipaddress }
            if ( $PSBoundParameters.ContainsKey('td') ) { $payload.Add('td', $td) }
            if ( $PSBoundParameters.ContainsKey('netmask') ) { $payload.Add('netmask', $netmask) }
            if ( $PSBoundParameters.ContainsKey('arp') ) { $payload.Add('arp', $arp) }
            if ( $PSBoundParameters.ContainsKey('icmp') ) { $payload.Add('icmp', $icmp) }
            if ( $PSBoundParameters.ContainsKey('vserver') ) { $payload.Add('vserver', $vserver) }
            if ( $PSBoundParameters.ContainsKey('telnet') ) { $payload.Add('telnet', $telnet) }
            if ( $PSBoundParameters.ContainsKey('ftp') ) { $payload.Add('ftp', $ftp) }
            if ( $PSBoundParameters.ContainsKey('gui') ) { $payload.Add('gui', $gui) }
            if ( $PSBoundParameters.ContainsKey('ssh') ) { $payload.Add('ssh', $ssh) }
            if ( $PSBoundParameters.ContainsKey('snmp') ) { $payload.Add('snmp', $snmp) }
            if ( $PSBoundParameters.ContainsKey('mgmtaccess') ) { $payload.Add('mgmtaccess', $mgmtaccess) }
            if ( $PSBoundParameters.ContainsKey('restrictaccess') ) { $payload.Add('restrictaccess', $restrictaccess) }
            if ( $PSBoundParameters.ContainsKey('decrementttl') ) { $payload.Add('decrementttl', $decrementttl) }
            if ( $PSBoundParameters.ContainsKey('dynamicrouting') ) { $payload.Add('dynamicrouting', $dynamicrouting) }
            if ( $PSBoundParameters.ContainsKey('ospf') ) { $payload.Add('ospf', $ospf) }
            if ( $PSBoundParameters.ContainsKey('bgp') ) { $payload.Add('bgp', $bgp) }
            if ( $PSBoundParameters.ContainsKey('rip') ) { $payload.Add('rip', $rip) }
            if ( $PSBoundParameters.ContainsKey('hostroute') ) { $payload.Add('hostroute', $hostroute) }
            if ( $PSBoundParameters.ContainsKey('advertiseondefaultpartition') ) { $payload.Add('advertiseondefaultpartition', $advertiseondefaultpartition) }
            if ( $PSBoundParameters.ContainsKey('networkroute') ) { $payload.Add('networkroute', $networkroute) }
            if ( $PSBoundParameters.ContainsKey('hostrtgw') ) { $payload.Add('hostrtgw', $hostrtgw) }
            if ( $PSBoundParameters.ContainsKey('metric') ) { $payload.Add('metric', $metric) }
            if ( $PSBoundParameters.ContainsKey('vserverrhilevel') ) { $payload.Add('vserverrhilevel', $vserverrhilevel) }
            if ( $PSBoundParameters.ContainsKey('ospflsatype') ) { $payload.Add('ospflsatype', $ospflsatype) }
            if ( $PSBoundParameters.ContainsKey('ospfarea') ) { $payload.Add('ospfarea', $ospfarea) }
            if ( $PSBoundParameters.ContainsKey('tag') ) { $payload.Add('tag', $tag) }
            if ( $PSBoundParameters.ContainsKey('vrid') ) { $payload.Add('vrid', $vrid) }
            if ( $PSBoundParameters.ContainsKey('icmpresponse') ) { $payload.Add('icmpresponse', $icmpresponse) }
            if ( $PSBoundParameters.ContainsKey('arpresponse') ) { $payload.Add('arpresponse', $arpresponse) }
            if ( $PSBoundParameters.ContainsKey('ownerdownresponse') ) { $payload.Add('ownerdownresponse', $ownerdownresponse) }
            if ( $PSBoundParameters.ContainsKey('arpowner') ) { $payload.Add('arpowner', $arpowner) }
            if ( $PSBoundParameters.ContainsKey('mptcpadvertise') ) { $payload.Add('mptcpadvertise', $mptcpadvertise) }
            if ( $PSCmdlet.ShouldProcess("nsip", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsip -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsip: Finished"
    }
}

function Invoke-ADCUnsetNsip {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for ip resource.
    .PARAMETER Ipaddress
        IPv4 address to create on the Citrix ADC. Cannot be changed after the IP address is created.
    .PARAMETER Td
        Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0. TD id 4095 is used reserved for LSN use .
    .PARAMETER Ospfarea
        ID of the area in which the type1 link-state advertisements (LSAs) are to be advertised for this virtual IP (VIP) address by the OSPF protocol running on the Citrix ADC. When this parameter is not set, the VIP is advertised on all areas.
    .PARAMETER Hostrtgw
        IP address of the gateway of the route for this VIP address.
    .PARAMETER Netmask
        Subnet mask associated with the IP address.
    .PARAMETER Arp
        Respond to ARP requests for this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Icmp
        Respond to ICMP requests for this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Vserver
        Use this option to set (enable or disable) the virtual server attribute for this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Telnet
        Allow Telnet access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ftp
        Allow File Transfer Protocol (FTP) access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Gui
        Allow graphical user interface (GUI) access to this IP address.
        Possible values = ENABLED, SECUREONLY, DISABLED
    .PARAMETER Ssh
        Allow secure shell (SSH) access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Snmp
        Allow Simple Network Management Protocol (SNMP) access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mgmtaccess
        Allow access to management applications on this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Restrictaccess
        Block access to nonmanagement applications on this IP. This option is applicable for MIPs, SNIPs, and NSIP, and is disabled by default. Nonmanagement applications can run on the underlying Citrix ADC Free BSD operating system.
        Possible values = ENABLED, DISABLED
    .PARAMETER Decrementttl
        Decrement TTL by 1 when ENABLED.This setting is applicable only for UDP traffic.
        Possible values = ENABLED, DISABLED
    .PARAMETER Dynamicrouting
        Allow dynamic routing on this IP address. Specific to Subnet IP (SNIP) address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ospf
        Use this option to enable or disable OSPF on this IP address for the entity.
        Possible values = ENABLED, DISABLED
    .PARAMETER Bgp
        Use this option to enable or disable BGP on this IP address for the entity.
        Possible values = ENABLED, DISABLED
    .PARAMETER Rip
        Use this option to enable or disable RIP on this IP address for the entity.
        Possible values = ENABLED, DISABLED
    .PARAMETER Hostroute
        Option to push the VIP to ZebOS routing table for Kernel route redistribution through dynamic routing protocols.
        Possible values = ENABLED, DISABLED
    .PARAMETER Advertiseondefaultpartition
        Advertise VIPs from Shared VLAN on Default Partition.
        Possible values = ENABLED, DISABLED
    .PARAMETER Networkroute
        Option to push the SNIP subnet to ZebOS routing table for Kernel route redistribution through dynamic routing protocol.
        Possible values = ENABLED, DISABLED
    .PARAMETER Metric
        Integer value to add to or subtract from the cost of the route advertised for the VIP address.
    .PARAMETER Vserverrhilevel
        Advertise the route for the Virtual IP (VIP) address on the basis of the state of the virtual servers associated with that VIP.
        * NONE - Advertise the route for the VIP address, regardless of the state of the virtual servers associated with the address.
        * ONE VSERVER - Advertise the route for the VIP address if at least one of the associated virtual servers is in UP state.
        * ALL VSERVER - Advertise the route for the VIP address if all of the associated virtual servers are in UP state.
        * VSVR_CNTRLD - Advertise the route for the VIP address according to the RHIstate (RHI STATE) parameter setting on all the associated virtual servers of the VIP address along with their states.
        When Vserver RHI Level (RHI) parameter is set to VSVR_CNTRLD, the following are different RHI behaviors for the VIP address on the basis of RHIstate (RHI STATE) settings on the virtual servers associated with the VIP address:
        * If you set RHI STATE to PASSIVE on all virtual servers, the Citrix ADC always advertises the route for the VIP address.
        * If you set RHI STATE to ACTIVE on all virtual servers, the Citrix ADC advertises the route for the VIP address if at least one of the associated virtual servers is in UP state.
        *If you set RHI STATE to ACTIVE on some and PASSIVE on others, the Citrix ADC advertises the route for the VIP address if at least one of the associated virtual servers, whose RHI STATE set to ACTIVE, is in UP state.
        Possible values = ONE_VSERVER, ALL_VSERVERS, NONE, VSVR_CNTRLD
    .PARAMETER Ospflsatype
        Type of LSAs to be used by the OSPF protocol, running on the Citrix ADC, for advertising the route for this VIP address.
        Possible values = TYPE1, TYPE5
    .PARAMETER Tag
        Tag value for the network/host route associated with this IP.
    .PARAMETER Vrid
        A positive integer that uniquely identifies a VMAC address for binding to this VIP address. This binding is used to set up Citrix ADCs in an active-active configuration using VRRP.
    .PARAMETER Icmpresponse
        Respond to ICMP requests for a Virtual IP (VIP) address on the basis of the states of the virtual servers associated with that VIP. Available settings function as follows:
        * NONE - The Citrix ADC responds to any ICMP request for the VIP address, irrespective of the states of the virtual servers associated with the address.
        * ONE VSERVER - The Citrix ADC responds to any ICMP request for the VIP address if at least one of the associated virtual servers is in UP state.
        * ALL VSERVER - The Citrix ADC responds to any ICMP request for the VIP address if all of the associated virtual servers are in UP state.
        * VSVR_CNTRLD - The behavior depends on the ICMP VSERVER RESPONSE setting on all the associated virtual servers.
        The following settings can be made for the ICMP VSERVER RESPONSE parameter on a virtual server:
        * If you set ICMP VSERVER RESPONSE to PASSIVE on all virtual servers, Citrix ADC always responds.
        * If you set ICMP VSERVER RESPONSE to ACTIVE on all virtual servers, Citrix ADC responds if even one virtual server is UP.
        * When you set ICMP VSERVER RESPONSE to ACTIVE on some and PASSIVE on others, Citrix ADC responds if even one virtual server set to ACTIVE is UP.
        Possible values = NONE, ONE_VSERVER, ALL_VSERVERS, VSVR_CNTRLD
    .PARAMETER Arpresponse
        Respond to ARP requests for a Virtual IP (VIP) address on the basis of the states of the virtual servers associated with that VIP. Available settings function as follows:
        * NONE - The Citrix ADC responds to any ARP request for the VIP address, irrespective of the states of the virtual servers associated with the address.
        * ONE VSERVER - The Citrix ADC responds to any ARP request for the VIP address if at least one of the associated virtual servers is in UP state.
        * ALL VSERVER - The Citrix ADC responds to any ARP request for the VIP address if all of the associated virtual servers are in UP state.
        Possible values = NONE, ONE_VSERVER, ALL_VSERVERS
    .PARAMETER Ownerdownresponse
        in cluster system, if the owner node is down, whether should it respond to icmp/arp.
        Possible values = YES, NO
    .PARAMETER Arpowner
        The arp owner in a Cluster for this IP address. It can vary from 0 to 31.
    .PARAMETER Mptcpadvertise
        If enabled, this IP will be advertised by Citrix ADC to MPTCP enabled clients as part of ADD_ADDR option.
        Possible values = YES, NO
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNsip -ipaddress <string>
        An example how to unset nsip configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNsip
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsip
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Ipaddress,

        [Boolean]$td,

        [Boolean]$ospfarea,

        [Boolean]$hostrtgw,

        [Boolean]$netmask,

        [Boolean]$arp,

        [Boolean]$icmp,

        [Boolean]$vserver,

        [Boolean]$telnet,

        [Boolean]$ftp,

        [Boolean]$gui,

        [Boolean]$ssh,

        [Boolean]$snmp,

        [Boolean]$mgmtaccess,

        [Boolean]$restrictaccess,

        [Boolean]$decrementttl,

        [Boolean]$dynamicrouting,

        [Boolean]$ospf,

        [Boolean]$bgp,

        [Boolean]$rip,

        [Boolean]$hostroute,

        [Boolean]$advertiseondefaultpartition,

        [Boolean]$networkroute,

        [Boolean]$metric,

        [Boolean]$vserverrhilevel,

        [Boolean]$ospflsatype,

        [Boolean]$tag,

        [Boolean]$vrid,

        [Boolean]$icmpresponse,

        [Boolean]$arpresponse,

        [Boolean]$ownerdownresponse,

        [Boolean]$arpowner,

        [Boolean]$mptcpadvertise 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNsip: Starting"
    }
    process {
        try {
            $payload = @{ ipaddress = $ipaddress }
            if ( $PSBoundParameters.ContainsKey('td') ) { $payload.Add('td', $td) }
            if ( $PSBoundParameters.ContainsKey('ospfarea') ) { $payload.Add('ospfarea', $ospfarea) }
            if ( $PSBoundParameters.ContainsKey('hostrtgw') ) { $payload.Add('hostrtgw', $hostrtgw) }
            if ( $PSBoundParameters.ContainsKey('netmask') ) { $payload.Add('netmask', $netmask) }
            if ( $PSBoundParameters.ContainsKey('arp') ) { $payload.Add('arp', $arp) }
            if ( $PSBoundParameters.ContainsKey('icmp') ) { $payload.Add('icmp', $icmp) }
            if ( $PSBoundParameters.ContainsKey('vserver') ) { $payload.Add('vserver', $vserver) }
            if ( $PSBoundParameters.ContainsKey('telnet') ) { $payload.Add('telnet', $telnet) }
            if ( $PSBoundParameters.ContainsKey('ftp') ) { $payload.Add('ftp', $ftp) }
            if ( $PSBoundParameters.ContainsKey('gui') ) { $payload.Add('gui', $gui) }
            if ( $PSBoundParameters.ContainsKey('ssh') ) { $payload.Add('ssh', $ssh) }
            if ( $PSBoundParameters.ContainsKey('snmp') ) { $payload.Add('snmp', $snmp) }
            if ( $PSBoundParameters.ContainsKey('mgmtaccess') ) { $payload.Add('mgmtaccess', $mgmtaccess) }
            if ( $PSBoundParameters.ContainsKey('restrictaccess') ) { $payload.Add('restrictaccess', $restrictaccess) }
            if ( $PSBoundParameters.ContainsKey('decrementttl') ) { $payload.Add('decrementttl', $decrementttl) }
            if ( $PSBoundParameters.ContainsKey('dynamicrouting') ) { $payload.Add('dynamicrouting', $dynamicrouting) }
            if ( $PSBoundParameters.ContainsKey('ospf') ) { $payload.Add('ospf', $ospf) }
            if ( $PSBoundParameters.ContainsKey('bgp') ) { $payload.Add('bgp', $bgp) }
            if ( $PSBoundParameters.ContainsKey('rip') ) { $payload.Add('rip', $rip) }
            if ( $PSBoundParameters.ContainsKey('hostroute') ) { $payload.Add('hostroute', $hostroute) }
            if ( $PSBoundParameters.ContainsKey('advertiseondefaultpartition') ) { $payload.Add('advertiseondefaultpartition', $advertiseondefaultpartition) }
            if ( $PSBoundParameters.ContainsKey('networkroute') ) { $payload.Add('networkroute', $networkroute) }
            if ( $PSBoundParameters.ContainsKey('metric') ) { $payload.Add('metric', $metric) }
            if ( $PSBoundParameters.ContainsKey('vserverrhilevel') ) { $payload.Add('vserverrhilevel', $vserverrhilevel) }
            if ( $PSBoundParameters.ContainsKey('ospflsatype') ) { $payload.Add('ospflsatype', $ospflsatype) }
            if ( $PSBoundParameters.ContainsKey('tag') ) { $payload.Add('tag', $tag) }
            if ( $PSBoundParameters.ContainsKey('vrid') ) { $payload.Add('vrid', $vrid) }
            if ( $PSBoundParameters.ContainsKey('icmpresponse') ) { $payload.Add('icmpresponse', $icmpresponse) }
            if ( $PSBoundParameters.ContainsKey('arpresponse') ) { $payload.Add('arpresponse', $arpresponse) }
            if ( $PSBoundParameters.ContainsKey('ownerdownresponse') ) { $payload.Add('ownerdownresponse', $ownerdownresponse) }
            if ( $PSBoundParameters.ContainsKey('arpowner') ) { $payload.Add('arpowner', $arpowner) }
            if ( $PSBoundParameters.ContainsKey('mptcpadvertise') ) { $payload.Add('mptcpadvertise', $mptcpadvertise) }
            if ( $PSCmdlet.ShouldProcess("$ipaddress", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nsip -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNsip: Finished"
    }
}

function Invoke-ADCEnableNsip {
    <#
    .SYNOPSIS
        Enable NS configuration Object.
    .DESCRIPTION
        Configuration for ip resource.
    .PARAMETER Ipaddress
        IPv4 address to create on the Citrix ADC. Cannot be changed after the IP address is created.
    .PARAMETER Td
        Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0. TD id 4095 is used reserved for LSN use .
    .EXAMPLE
        PS C:\>Invoke-ADCEnableNsip -ipaddress <string>
        An example how to enable nsip configuration Object(s).
    .NOTES
        File Name : Invoke-ADCEnableNsip
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsip/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Ipaddress,

        [ValidateRange(0, 4095)]
        [double]$Td 

    )
    begin {
        Write-Verbose "Invoke-ADCEnableNsip: Starting"
    }
    process {
        try {
            $payload = @{ ipaddress = $ipaddress }
            if ( $PSBoundParameters.ContainsKey('td') ) { $payload.Add('td', $td) }
            if ( $PSCmdlet.ShouldProcess($Name, "Enable NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsip -Action enable -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCEnableNsip: Finished"
    }
}

function Invoke-ADCDisableNsip {
    <#
    .SYNOPSIS
        Disable NS configuration Object.
    .DESCRIPTION
        Configuration for ip resource.
    .PARAMETER Ipaddress
        IPv4 address to create on the Citrix ADC. Cannot be changed after the IP address is created.
    .PARAMETER Td
        Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0. TD id 4095 is used reserved for LSN use .
    .EXAMPLE
        PS C:\>Invoke-ADCDisableNsip -ipaddress <string>
        An example how to disable nsip configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDisableNsip
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsip/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Ipaddress,

        [ValidateRange(0, 4095)]
        [double]$Td 

    )
    begin {
        Write-Verbose "Invoke-ADCDisableNsip: Starting"
    }
    process {
        try {
            $payload = @{ ipaddress = $ipaddress }
            if ( $PSBoundParameters.ContainsKey('td') ) { $payload.Add('td', $td) }
            if ( $PSCmdlet.ShouldProcess($Name, "Disable NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsip -Action disable -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDisableNsip: Finished"
    }
}

function Invoke-ADCGetNsip {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for ip resource.
    .PARAMETER Ipaddress
        IPv4 address to create on the Citrix ADC. Cannot be changed after the IP address is created.
    .PARAMETER Td
        Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0. TD id 4095 is used reserved for LSN use .
    .PARAMETER Type
        Type of the IP address to create on the Citrix ADC. Cannot be changed after the IP address is created. The following are the different types of Citrix ADC owned IP addresses:
        * A Subnet IP (SNIP) address is used by the Citrix ADC to communicate with the servers. The Citrix ADC also uses the subnet IP address when generating its own packets, such as packets related to dynamic routing protocols, or to send monitor probes to check the health of the servers.
        * A Virtual IP (VIP) address is the IP address associated with a virtual server. It is the IP address to which clients connect. An appliance managing a wide range of traffic may have many VIPs configured. Some of the attributes of the VIP address are customized to meet the requirements of the virtual server.
        * A GSLB site IP (GSLBIP) address is associated with a GSLB site. It is not mandatory to specify a GSLBIP address when you initially configure the Citrix ADC. A GSLBIP address is used only when you create a GSLB site.
        * A Cluster IP (CLIP) address is the management address of the cluster. All cluster configurations must be performed by accessing the cluster through this IP address.
        Possible values = SNIP, VIP, NSIP, GSLBsiteIP, CLIP
    .PARAMETER GetAll
        Retrieve all nsip object(s).
    .PARAMETER Count
        If specified, the count of the nsip object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsip
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsip -GetAll
        Get all nsip data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsip -Count
        Get the number of nsip objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsip -name <string>
        Get nsip object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsip -Filter @{ 'name'='<value>' }
        Get nsip data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsip
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsip/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByArgument')]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Ipaddress,

        [Parameter(ParameterSetName = 'GetByArgument')]
        [ValidateRange(0, 4095)]
        [double]$Td,

        [Parameter(ParameterSetName = 'GetByArgument')]
        [ValidateSet('SNIP', 'VIP', 'NSIP', 'GSLBsiteIP', 'CLIP')]
        [string]$Type,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNsip: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsip objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsip -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsip objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsip -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsip objects by arguments"
                $arguments = @{ } 
                if ( $PSBoundParameters.ContainsKey('ipaddress') ) { $arguments.Add('ipaddress', $ipaddress) } 
                if ( $PSBoundParameters.ContainsKey('td') ) { $arguments.Add('td', $td) } 
                if ( $PSBoundParameters.ContainsKey('type') ) { $arguments.Add('type', $type) }
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsip -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsip configuration for property ''"

            } else {
                Write-Verbose "Retrieving nsip configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsip -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsip: Ended"
    }
}

function Invoke-ADCAddNsip6 {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for ip6 resource.
    .PARAMETER Ipv6address
        IPv6 address to create on the Citrix ADC.
    .PARAMETER Scope
        Scope of the IPv6 address to be created. Cannot be changed after the IP address is created.
        Possible values = global, link-local
    .PARAMETER Type
        Type of IP address to be created on the Citrix ADC. Cannot be changed after the IP address is created.
        Possible values = NSIP, VIP, SNIP, GSLBsiteIP, ADNSsvcIP, RADIUSListenersvcIP, CLIP
    .PARAMETER Vlan
        The VLAN number.
    .PARAMETER Nd
        Respond to Neighbor Discovery (ND) requests for this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Icmp
        Respond to ICMP requests for this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Vserver
        Enable or disable the state of all the virtual servers associated with this VIP6 address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Telnet
        Allow Telnet access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ftp
        Allow File Transfer Protocol (FTP) access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Gui
        Allow graphical user interface (GUI) access to this IP address.
        Possible values = ENABLED, SECUREONLY, DISABLED
    .PARAMETER Ssh
        Allow secure Shell (SSH) access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Snmp
        Allow Simple Network Management Protocol (SNMP) access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mgmtaccess
        Allow access to management applications on this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Restrictaccess
        Block access to nonmanagement applications on this IP address. This option is applicable forMIP6s, SNIP6s, and NSIP6s, and is disabled by default. Nonmanagement applications can run on the underlying Citrix ADC Free BSD operating system.
        Possible values = ENABLED, DISABLED
    .PARAMETER Dynamicrouting
        Allow dynamic routing on this IP address. Specific to Subnet IPv6 (SNIP6) address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Decrementhoplimit
        Decrement Hop Limit by 1 when ENABLED.This setting is applicable only for UDP traffic.
        Possible values = ENABLED, DISABLED
    .PARAMETER Hostroute
        Option to push the VIP6 to ZebOS routing table for Kernel route redistribution through dynamic routing protocols.
        Possible values = ENABLED, DISABLED
    .PARAMETER Advertiseondefaultpartition
        Advertise VIPs from Shared VLAN on Default Partition.
        Possible values = ENABLED, DISABLED
    .PARAMETER Networkroute
        Option to push the SNIP6 subnet to ZebOS routing table for Kernel route redistribution through dynamic routing protocol.
        Possible values = ENABLED, DISABLED
    .PARAMETER Tag
        Tag value for the network/host route associated with this IP.
    .PARAMETER Ip6hostrtgw
        IPv6 address of the gateway for the route. If Gateway is not set, VIP uses :: as the gateway.
    .PARAMETER Metric
        Integer value to add to or subtract from the cost of the route advertised for the VIP6 address.
    .PARAMETER Vserverrhilevel
        Advertise or do not advertise the route for the Virtual IP (VIP6) address on the basis of the state of the virtual servers associated with that VIP6.
        * NONE - Advertise the route for the VIP6 address, irrespective of the state of the virtual servers associated with the address.
        * ONE VSERVER - Advertise the route for the VIP6 address if at least one of the associated virtual servers is in UP state.
        * ALL VSERVER - Advertise the route for the VIP6 address if all of the associated virtual servers are in UP state.
        * VSVR_CNTRLD. Advertise the route for the VIP address according to the RHIstate (RHI STATE) parameter setting on all the associated virtual servers of the VIP address along with their states.
        When Vserver RHI Level (RHI) parameter is set to VSVR_CNTRLD, the following are different RHI behaviors for the VIP address on the basis of RHIstate (RHI STATE) settings on the virtual servers associated with the VIP address:
        * If you set RHI STATE to PASSIVE on all virtual servers, the Citrix ADC always advertises the route for the VIP address.
        * If you set RHI STATE to ACTIVE on all virtual servers, the Citrix ADC advertises the route for the VIP address if at least one of the associated virtual servers is in UP state.
        *If you set RHI STATE to ACTIVE on some and PASSIVE on others, the Citrix ADC advertises the route for the VIP address if at least one of the associated virtual servers, whose RHI STATE set to ACTIVE, is in UP state.
        Possible values = ONE_VSERVER, ALL_VSERVERS, NONE, VSVR_CNTRLD
    .PARAMETER Ospf6lsatype
        Type of LSAs to be used by the IPv6 OSPF protocol, running on the Citrix ADC, for advertising the route for the VIP6 address.
        Possible values = INTRA_AREA, EXTERNAL
    .PARAMETER Ospfarea
        ID of the area in which the Intra-Area-Prefix LSAs are to be advertised for the VIP6 address by the IPv6 OSPF protocol running on the Citrix ADC. When ospfArea is not set, VIP6 is advertised on all areas.
    .PARAMETER State
        Enable or disable the IP address.
        Possible values = DISABLED, ENABLED
    .PARAMETER Map
        Mapped IPV4 address for the IPV6 address.
    .PARAMETER Vrid6
        A positive integer that uniquely identifies a VMAC address for binding to this VIP address. This binding is used to set up Citrix ADCs in an active-active configuration using VRRP.
    .PARAMETER Ownernode
        ID of the cluster node for which you are adding the IP address. Must be used if you want the IP address to be active only on the specific node. Can be configured only through the cluster IP address. Cannot be changed after the IP address is created.
    .PARAMETER Ownerdownresponse
        in cluster system, if the owner node is down, whether should it respond to icmp/arp.
        Possible values = YES, NO
    .PARAMETER Td
        Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0.
    .PARAMETER Ndowner
        NdOwner in Cluster for VIPS and Striped SNIPS.
    .PARAMETER Mptcpadvertise
        If enabled, this IP will be advertised by Citrix ADC to MPTCP enabled clients as part of ADD_ADDR option.
        Possible values = YES, NO
    .EXAMPLE
        PS C:\>Invoke-ADCAddNsip6 -ipv6address <string>
        An example how to add nsip6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNsip6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsip6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Ipv6address,

        [ValidateSet('global', 'link-local')]
        [string]$Scope = 'global',

        [ValidateSet('NSIP', 'VIP', 'SNIP', 'GSLBsiteIP', 'ADNSsvcIP', 'RADIUSListenersvcIP', 'CLIP')]
        [string]$Type = 'SNIP',

        [ValidateRange(0, 4094)]
        [double]$Vlan = '0',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Nd = 'ENABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Icmp = 'ENABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Vserver = 'ENABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Telnet = 'ENABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ftp = 'ENABLED',

        [ValidateSet('ENABLED', 'SECUREONLY', 'DISABLED')]
        [string]$Gui = 'ENABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ssh = 'ENABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Snmp = 'ENABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Mgmtaccess = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Restrictaccess = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Dynamicrouting = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Decrementhoplimit = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Hostroute,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Advertiseondefaultpartition = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Networkroute,

        [double]$Tag = '0',

        [string]$Ip6hostrtgw = '0',

        [int]$Metric,

        [ValidateSet('ONE_VSERVER', 'ALL_VSERVERS', 'NONE', 'VSVR_CNTRLD')]
        [string]$Vserverrhilevel = 'ONE_VSERVER',

        [ValidateSet('INTRA_AREA', 'EXTERNAL')]
        [string]$Ospf6lsatype = 'EXTERNAL',

        [ValidateRange(0, 4294967294)]
        [double]$Ospfarea = '-1',

        [ValidateSet('DISABLED', 'ENABLED')]
        [string]$State = 'ENABLED',

        [string]$Map,

        [ValidateRange(1, 255)]
        [double]$Vrid6,

        [double]$Ownernode = '255',

        [ValidateSet('YES', 'NO')]
        [string]$Ownerdownresponse = 'YES',

        [ValidateRange(0, 4094)]
        [double]$Td,

        [double]$Ndowner = '255',

        [ValidateSet('YES', 'NO')]
        [string]$Mptcpadvertise = 'NO' 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNsip6: Starting"
    }
    process {
        try {
            $payload = @{ ipv6address = $ipv6address }
            if ( $PSBoundParameters.ContainsKey('scope') ) { $payload.Add('scope', $scope) }
            if ( $PSBoundParameters.ContainsKey('type') ) { $payload.Add('type', $type) }
            if ( $PSBoundParameters.ContainsKey('vlan') ) { $payload.Add('vlan', $vlan) }
            if ( $PSBoundParameters.ContainsKey('nd') ) { $payload.Add('nd', $nd) }
            if ( $PSBoundParameters.ContainsKey('icmp') ) { $payload.Add('icmp', $icmp) }
            if ( $PSBoundParameters.ContainsKey('vserver') ) { $payload.Add('vserver', $vserver) }
            if ( $PSBoundParameters.ContainsKey('telnet') ) { $payload.Add('telnet', $telnet) }
            if ( $PSBoundParameters.ContainsKey('ftp') ) { $payload.Add('ftp', $ftp) }
            if ( $PSBoundParameters.ContainsKey('gui') ) { $payload.Add('gui', $gui) }
            if ( $PSBoundParameters.ContainsKey('ssh') ) { $payload.Add('ssh', $ssh) }
            if ( $PSBoundParameters.ContainsKey('snmp') ) { $payload.Add('snmp', $snmp) }
            if ( $PSBoundParameters.ContainsKey('mgmtaccess') ) { $payload.Add('mgmtaccess', $mgmtaccess) }
            if ( $PSBoundParameters.ContainsKey('restrictaccess') ) { $payload.Add('restrictaccess', $restrictaccess) }
            if ( $PSBoundParameters.ContainsKey('dynamicrouting') ) { $payload.Add('dynamicrouting', $dynamicrouting) }
            if ( $PSBoundParameters.ContainsKey('decrementhoplimit') ) { $payload.Add('decrementhoplimit', $decrementhoplimit) }
            if ( $PSBoundParameters.ContainsKey('hostroute') ) { $payload.Add('hostroute', $hostroute) }
            if ( $PSBoundParameters.ContainsKey('advertiseondefaultpartition') ) { $payload.Add('advertiseondefaultpartition', $advertiseondefaultpartition) }
            if ( $PSBoundParameters.ContainsKey('networkroute') ) { $payload.Add('networkroute', $networkroute) }
            if ( $PSBoundParameters.ContainsKey('tag') ) { $payload.Add('tag', $tag) }
            if ( $PSBoundParameters.ContainsKey('ip6hostrtgw') ) { $payload.Add('ip6hostrtgw', $ip6hostrtgw) }
            if ( $PSBoundParameters.ContainsKey('metric') ) { $payload.Add('metric', $metric) }
            if ( $PSBoundParameters.ContainsKey('vserverrhilevel') ) { $payload.Add('vserverrhilevel', $vserverrhilevel) }
            if ( $PSBoundParameters.ContainsKey('ospf6lsatype') ) { $payload.Add('ospf6lsatype', $ospf6lsatype) }
            if ( $PSBoundParameters.ContainsKey('ospfarea') ) { $payload.Add('ospfarea', $ospfarea) }
            if ( $PSBoundParameters.ContainsKey('state') ) { $payload.Add('state', $state) }
            if ( $PSBoundParameters.ContainsKey('map') ) { $payload.Add('map', $map) }
            if ( $PSBoundParameters.ContainsKey('vrid6') ) { $payload.Add('vrid6', $vrid6) }
            if ( $PSBoundParameters.ContainsKey('ownernode') ) { $payload.Add('ownernode', $ownernode) }
            if ( $PSBoundParameters.ContainsKey('ownerdownresponse') ) { $payload.Add('ownerdownresponse', $ownerdownresponse) }
            if ( $PSBoundParameters.ContainsKey('td') ) { $payload.Add('td', $td) }
            if ( $PSBoundParameters.ContainsKey('ndowner') ) { $payload.Add('ndowner', $ndowner) }
            if ( $PSBoundParameters.ContainsKey('mptcpadvertise') ) { $payload.Add('mptcpadvertise', $mptcpadvertise) }
            if ( $PSCmdlet.ShouldProcess("nsip6", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsip6 -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNsip6: Finished"
    }
}

function Invoke-ADCDeleteNsip6 {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for ip6 resource.
    .PARAMETER Ipv6address
        IPv6 address to create on the Citrix ADC.
    .PARAMETER Td
        Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNsip6 -Ipv6address <string>
        An example how to delete nsip6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNsip6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsip6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Ipv6address,

        [double]$Td 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNsip6: Starting"
    }
    process {
        try {
            $arguments = @{ }
            if ( $PSBoundParameters.ContainsKey('Td') ) { $arguments.Add('td', $Td) }
            if ( $PSCmdlet.ShouldProcess("$ipv6address", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nsip6 -NitroPath nitro/v1/config -Resource $ipv6address -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNsip6: Finished"
    }
}

function Invoke-ADCUpdateNsip6 {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for ip6 resource.
    .PARAMETER Ipv6address
        IPv6 address to create on the Citrix ADC.
    .PARAMETER Td
        Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0.
    .PARAMETER Nd
        Respond to Neighbor Discovery (ND) requests for this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Icmp
        Respond to ICMP requests for this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Vserver
        Enable or disable the state of all the virtual servers associated with this VIP6 address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Telnet
        Allow Telnet access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ftp
        Allow File Transfer Protocol (FTP) access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Gui
        Allow graphical user interface (GUI) access to this IP address.
        Possible values = ENABLED, SECUREONLY, DISABLED
    .PARAMETER Ssh
        Allow secure Shell (SSH) access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Snmp
        Allow Simple Network Management Protocol (SNMP) access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mgmtaccess
        Allow access to management applications on this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ownerdownresponse
        in cluster system, if the owner node is down, whether should it respond to icmp/arp.
        Possible values = YES, NO
    .PARAMETER Restrictaccess
        Block access to nonmanagement applications on this IP address. This option is applicable forMIP6s, SNIP6s, and NSIP6s, and is disabled by default. Nonmanagement applications can run on the underlying Citrix ADC Free BSD operating system.
        Possible values = ENABLED, DISABLED
    .PARAMETER State
        Enable or disable the IP address.
        Possible values = DISABLED, ENABLED
    .PARAMETER Map
        Mapped IPV4 address for the IPV6 address.
    .PARAMETER Decrementhoplimit
        Decrement Hop Limit by 1 when ENABLED.This setting is applicable only for UDP traffic.
        Possible values = ENABLED, DISABLED
    .PARAMETER Dynamicrouting
        Allow dynamic routing on this IP address. Specific to Subnet IPv6 (SNIP6) address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Hostroute
        Option to push the VIP6 to ZebOS routing table for Kernel route redistribution through dynamic routing protocols.
        Possible values = ENABLED, DISABLED
    .PARAMETER Advertiseondefaultpartition
        Advertise VIPs from Shared VLAN on Default Partition.
        Possible values = ENABLED, DISABLED
    .PARAMETER Networkroute
        Option to push the SNIP6 subnet to ZebOS routing table for Kernel route redistribution through dynamic routing protocol.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ip6hostrtgw
        IPv6 address of the gateway for the route. If Gateway is not set, VIP uses :: as the gateway.
    .PARAMETER Metric
        Integer value to add to or subtract from the cost of the route advertised for the VIP6 address.
    .PARAMETER Vserverrhilevel
        Advertise or do not advertise the route for the Virtual IP (VIP6) address on the basis of the state of the virtual servers associated with that VIP6.
        * NONE - Advertise the route for the VIP6 address, irrespective of the state of the virtual servers associated with the address.
        * ONE VSERVER - Advertise the route for the VIP6 address if at least one of the associated virtual servers is in UP state.
        * ALL VSERVER - Advertise the route for the VIP6 address if all of the associated virtual servers are in UP state.
        * VSVR_CNTRLD. Advertise the route for the VIP address according to the RHIstate (RHI STATE) parameter setting on all the associated virtual servers of the VIP address along with their states.
        When Vserver RHI Level (RHI) parameter is set to VSVR_CNTRLD, the following are different RHI behaviors for the VIP address on the basis of RHIstate (RHI STATE) settings on the virtual servers associated with the VIP address:
        * If you set RHI STATE to PASSIVE on all virtual servers, the Citrix ADC always advertises the route for the VIP address.
        * If you set RHI STATE to ACTIVE on all virtual servers, the Citrix ADC advertises the route for the VIP address if at least one of the associated virtual servers is in UP state.
        *If you set RHI STATE to ACTIVE on some and PASSIVE on others, the Citrix ADC advertises the route for the VIP address if at least one of the associated virtual servers, whose RHI STATE set to ACTIVE, is in UP state.
        Possible values = ONE_VSERVER, ALL_VSERVERS, NONE, VSVR_CNTRLD
    .PARAMETER Ospf6lsatype
        Type of LSAs to be used by the IPv6 OSPF protocol, running on the Citrix ADC, for advertising the route for the VIP6 address.
        Possible values = INTRA_AREA, EXTERNAL
    .PARAMETER Ospfarea
        ID of the area in which the Intra-Area-Prefix LSAs are to be advertised for the VIP6 address by the IPv6 OSPF protocol running on the Citrix ADC. When ospfArea is not set, VIP6 is advertised on all areas.
    .PARAMETER Tag
        Tag value for the network/host route associated with this IP.
    .PARAMETER Vrid6
        A positive integer that uniquely identifies a VMAC address for binding to this VIP address. This binding is used to set up Citrix ADCs in an active-active configuration using VRRP.
    .PARAMETER Ndowner
        NdOwner in Cluster for VIPS and Striped SNIPS.
    .PARAMETER Mptcpadvertise
        If enabled, this IP will be advertised by Citrix ADC to MPTCP enabled clients as part of ADD_ADDR option.
        Possible values = YES, NO
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsip6 -ipv6address <string>
        An example how to update nsip6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsip6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsip6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Ipv6address,

        [ValidateRange(0, 4094)]
        [double]$Td,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Nd,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Icmp,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Vserver,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Telnet,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ftp,

        [ValidateSet('ENABLED', 'SECUREONLY', 'DISABLED')]
        [string]$Gui,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ssh,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Snmp,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Mgmtaccess,

        [ValidateSet('YES', 'NO')]
        [string]$Ownerdownresponse,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Restrictaccess,

        [ValidateSet('DISABLED', 'ENABLED')]
        [string]$State,

        [string]$Map,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Decrementhoplimit,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Dynamicrouting,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Hostroute,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Advertiseondefaultpartition,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Networkroute,

        [string]$Ip6hostrtgw,

        [int]$Metric,

        [ValidateSet('ONE_VSERVER', 'ALL_VSERVERS', 'NONE', 'VSVR_CNTRLD')]
        [string]$Vserverrhilevel,

        [ValidateSet('INTRA_AREA', 'EXTERNAL')]
        [string]$Ospf6lsatype,

        [ValidateRange(0, 4294967294)]
        [double]$Ospfarea,

        [double]$Tag,

        [ValidateRange(1, 255)]
        [double]$Vrid6,

        [double]$Ndowner,

        [ValidateSet('YES', 'NO')]
        [string]$Mptcpadvertise 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsip6: Starting"
    }
    process {
        try {
            $payload = @{ ipv6address = $ipv6address }
            if ( $PSBoundParameters.ContainsKey('td') ) { $payload.Add('td', $td) }
            if ( $PSBoundParameters.ContainsKey('nd') ) { $payload.Add('nd', $nd) }
            if ( $PSBoundParameters.ContainsKey('icmp') ) { $payload.Add('icmp', $icmp) }
            if ( $PSBoundParameters.ContainsKey('vserver') ) { $payload.Add('vserver', $vserver) }
            if ( $PSBoundParameters.ContainsKey('telnet') ) { $payload.Add('telnet', $telnet) }
            if ( $PSBoundParameters.ContainsKey('ftp') ) { $payload.Add('ftp', $ftp) }
            if ( $PSBoundParameters.ContainsKey('gui') ) { $payload.Add('gui', $gui) }
            if ( $PSBoundParameters.ContainsKey('ssh') ) { $payload.Add('ssh', $ssh) }
            if ( $PSBoundParameters.ContainsKey('snmp') ) { $payload.Add('snmp', $snmp) }
            if ( $PSBoundParameters.ContainsKey('mgmtaccess') ) { $payload.Add('mgmtaccess', $mgmtaccess) }
            if ( $PSBoundParameters.ContainsKey('ownerdownresponse') ) { $payload.Add('ownerdownresponse', $ownerdownresponse) }
            if ( $PSBoundParameters.ContainsKey('restrictaccess') ) { $payload.Add('restrictaccess', $restrictaccess) }
            if ( $PSBoundParameters.ContainsKey('state') ) { $payload.Add('state', $state) }
            if ( $PSBoundParameters.ContainsKey('map') ) { $payload.Add('map', $map) }
            if ( $PSBoundParameters.ContainsKey('decrementhoplimit') ) { $payload.Add('decrementhoplimit', $decrementhoplimit) }
            if ( $PSBoundParameters.ContainsKey('dynamicrouting') ) { $payload.Add('dynamicrouting', $dynamicrouting) }
            if ( $PSBoundParameters.ContainsKey('hostroute') ) { $payload.Add('hostroute', $hostroute) }
            if ( $PSBoundParameters.ContainsKey('advertiseondefaultpartition') ) { $payload.Add('advertiseondefaultpartition', $advertiseondefaultpartition) }
            if ( $PSBoundParameters.ContainsKey('networkroute') ) { $payload.Add('networkroute', $networkroute) }
            if ( $PSBoundParameters.ContainsKey('ip6hostrtgw') ) { $payload.Add('ip6hostrtgw', $ip6hostrtgw) }
            if ( $PSBoundParameters.ContainsKey('metric') ) { $payload.Add('metric', $metric) }
            if ( $PSBoundParameters.ContainsKey('vserverrhilevel') ) { $payload.Add('vserverrhilevel', $vserverrhilevel) }
            if ( $PSBoundParameters.ContainsKey('ospf6lsatype') ) { $payload.Add('ospf6lsatype', $ospf6lsatype) }
            if ( $PSBoundParameters.ContainsKey('ospfarea') ) { $payload.Add('ospfarea', $ospfarea) }
            if ( $PSBoundParameters.ContainsKey('tag') ) { $payload.Add('tag', $tag) }
            if ( $PSBoundParameters.ContainsKey('vrid6') ) { $payload.Add('vrid6', $vrid6) }
            if ( $PSBoundParameters.ContainsKey('ndowner') ) { $payload.Add('ndowner', $ndowner) }
            if ( $PSBoundParameters.ContainsKey('mptcpadvertise') ) { $payload.Add('mptcpadvertise', $mptcpadvertise) }
            if ( $PSCmdlet.ShouldProcess("nsip6", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsip6 -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsip6: Finished"
    }
}

function Invoke-ADCUnsetNsip6 {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for ip6 resource.
    .PARAMETER Ipv6address
        IPv6 address to create on the Citrix ADC.
    .PARAMETER Td
        Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0.
    .PARAMETER Ospfarea
        ID of the area in which the Intra-Area-Prefix LSAs are to be advertised for the VIP6 address by the IPv6 OSPF protocol running on the Citrix ADC. When ospfArea is not set, VIP6 is advertised on all areas.
    .PARAMETER Nd
        Respond to Neighbor Discovery (ND) requests for this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Icmp
        Respond to ICMP requests for this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Vserver
        Enable or disable the state of all the virtual servers associated with this VIP6 address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Telnet
        Allow Telnet access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ftp
        Allow File Transfer Protocol (FTP) access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Gui
        Allow graphical user interface (GUI) access to this IP address.
        Possible values = ENABLED, SECUREONLY, DISABLED
    .PARAMETER Ssh
        Allow secure Shell (SSH) access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Snmp
        Allow Simple Network Management Protocol (SNMP) access to this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mgmtaccess
        Allow access to management applications on this IP address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ownerdownresponse
        in cluster system, if the owner node is down, whether should it respond to icmp/arp.
        Possible values = YES, NO
    .PARAMETER Restrictaccess
        Block access to nonmanagement applications on this IP address. This option is applicable forMIP6s, SNIP6s, and NSIP6s, and is disabled by default. Nonmanagement applications can run on the underlying Citrix ADC Free BSD operating system.
        Possible values = ENABLED, DISABLED
    .PARAMETER State
        Enable or disable the IP address.
        Possible values = DISABLED, ENABLED
    .PARAMETER Map
        Mapped IPV4 address for the IPV6 address.
    .PARAMETER Decrementhoplimit
        Decrement Hop Limit by 1 when ENABLED.This setting is applicable only for UDP traffic.
        Possible values = ENABLED, DISABLED
    .PARAMETER Dynamicrouting
        Allow dynamic routing on this IP address. Specific to Subnet IPv6 (SNIP6) address.
        Possible values = ENABLED, DISABLED
    .PARAMETER Hostroute
        Option to push the VIP6 to ZebOS routing table for Kernel route redistribution through dynamic routing protocols.
        Possible values = ENABLED, DISABLED
    .PARAMETER Advertiseondefaultpartition
        Advertise VIPs from Shared VLAN on Default Partition.
        Possible values = ENABLED, DISABLED
    .PARAMETER Networkroute
        Option to push the SNIP6 subnet to ZebOS routing table for Kernel route redistribution through dynamic routing protocol.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ip6hostrtgw
        IPv6 address of the gateway for the route. If Gateway is not set, VIP uses :: as the gateway.
    .PARAMETER Metric
        Integer value to add to or subtract from the cost of the route advertised for the VIP6 address.
    .PARAMETER Vserverrhilevel
        Advertise or do not advertise the route for the Virtual IP (VIP6) address on the basis of the state of the virtual servers associated with that VIP6.
        * NONE - Advertise the route for the VIP6 address, irrespective of the state of the virtual servers associated with the address.
        * ONE VSERVER - Advertise the route for the VIP6 address if at least one of the associated virtual servers is in UP state.
        * ALL VSERVER - Advertise the route for the VIP6 address if all of the associated virtual servers are in UP state.
        * VSVR_CNTRLD. Advertise the route for the VIP address according to the RHIstate (RHI STATE) parameter setting on all the associated virtual servers of the VIP address along with their states.
        When Vserver RHI Level (RHI) parameter is set to VSVR_CNTRLD, the following are different RHI behaviors for the VIP address on the basis of RHIstate (RHI STATE) settings on the virtual servers associated with the VIP address:
        * If you set RHI STATE to PASSIVE on all virtual servers, the Citrix ADC always advertises the route for the VIP address.
        * If you set RHI STATE to ACTIVE on all virtual servers, the Citrix ADC advertises the route for the VIP address if at least one of the associated virtual servers is in UP state.
        *If you set RHI STATE to ACTIVE on some and PASSIVE on others, the Citrix ADC advertises the route for the VIP address if at least one of the associated virtual servers, whose RHI STATE set to ACTIVE, is in UP state.
        Possible values = ONE_VSERVER, ALL_VSERVERS, NONE, VSVR_CNTRLD
    .PARAMETER Ospf6lsatype
        Type of LSAs to be used by the IPv6 OSPF protocol, running on the Citrix ADC, for advertising the route for the VIP6 address.
        Possible values = INTRA_AREA, EXTERNAL
    .PARAMETER Tag
        Tag value for the network/host route associated with this IP.
    .PARAMETER Vrid6
        A positive integer that uniquely identifies a VMAC address for binding to this VIP address. This binding is used to set up Citrix ADCs in an active-active configuration using VRRP.
    .PARAMETER Ndowner
        NdOwner in Cluster for VIPS and Striped SNIPS.
    .PARAMETER Mptcpadvertise
        If enabled, this IP will be advertised by Citrix ADC to MPTCP enabled clients as part of ADD_ADDR option.
        Possible values = YES, NO
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNsip6 -ipv6address <string>
        An example how to unset nsip6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNsip6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsip6
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Ipv6address,

        [Boolean]$td,

        [Boolean]$ospfarea,

        [Boolean]$nd,

        [Boolean]$icmp,

        [Boolean]$vserver,

        [Boolean]$telnet,

        [Boolean]$ftp,

        [Boolean]$gui,

        [Boolean]$ssh,

        [Boolean]$snmp,

        [Boolean]$mgmtaccess,

        [Boolean]$ownerdownresponse,

        [Boolean]$restrictaccess,

        [Boolean]$state,

        [Boolean]$map,

        [Boolean]$decrementhoplimit,

        [Boolean]$dynamicrouting,

        [Boolean]$hostroute,

        [Boolean]$advertiseondefaultpartition,

        [Boolean]$networkroute,

        [Boolean]$ip6hostrtgw,

        [Boolean]$metric,

        [Boolean]$vserverrhilevel,

        [Boolean]$ospf6lsatype,

        [Boolean]$tag,

        [Boolean]$vrid6,

        [Boolean]$ndowner,

        [Boolean]$mptcpadvertise 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNsip6: Starting"
    }
    process {
        try {
            $payload = @{ ipv6address = $ipv6address }
            if ( $PSBoundParameters.ContainsKey('td') ) { $payload.Add('td', $td) }
            if ( $PSBoundParameters.ContainsKey('ospfarea') ) { $payload.Add('ospfarea', $ospfarea) }
            if ( $PSBoundParameters.ContainsKey('nd') ) { $payload.Add('nd', $nd) }
            if ( $PSBoundParameters.ContainsKey('icmp') ) { $payload.Add('icmp', $icmp) }
            if ( $PSBoundParameters.ContainsKey('vserver') ) { $payload.Add('vserver', $vserver) }
            if ( $PSBoundParameters.ContainsKey('telnet') ) { $payload.Add('telnet', $telnet) }
            if ( $PSBoundParameters.ContainsKey('ftp') ) { $payload.Add('ftp', $ftp) }
            if ( $PSBoundParameters.ContainsKey('gui') ) { $payload.Add('gui', $gui) }
            if ( $PSBoundParameters.ContainsKey('ssh') ) { $payload.Add('ssh', $ssh) }
            if ( $PSBoundParameters.ContainsKey('snmp') ) { $payload.Add('snmp', $snmp) }
            if ( $PSBoundParameters.ContainsKey('mgmtaccess') ) { $payload.Add('mgmtaccess', $mgmtaccess) }
            if ( $PSBoundParameters.ContainsKey('ownerdownresponse') ) { $payload.Add('ownerdownresponse', $ownerdownresponse) }
            if ( $PSBoundParameters.ContainsKey('restrictaccess') ) { $payload.Add('restrictaccess', $restrictaccess) }
            if ( $PSBoundParameters.ContainsKey('state') ) { $payload.Add('state', $state) }
            if ( $PSBoundParameters.ContainsKey('map') ) { $payload.Add('map', $map) }
            if ( $PSBoundParameters.ContainsKey('decrementhoplimit') ) { $payload.Add('decrementhoplimit', $decrementhoplimit) }
            if ( $PSBoundParameters.ContainsKey('dynamicrouting') ) { $payload.Add('dynamicrouting', $dynamicrouting) }
            if ( $PSBoundParameters.ContainsKey('hostroute') ) { $payload.Add('hostroute', $hostroute) }
            if ( $PSBoundParameters.ContainsKey('advertiseondefaultpartition') ) { $payload.Add('advertiseondefaultpartition', $advertiseondefaultpartition) }
            if ( $PSBoundParameters.ContainsKey('networkroute') ) { $payload.Add('networkroute', $networkroute) }
            if ( $PSBoundParameters.ContainsKey('ip6hostrtgw') ) { $payload.Add('ip6hostrtgw', $ip6hostrtgw) }
            if ( $PSBoundParameters.ContainsKey('metric') ) { $payload.Add('metric', $metric) }
            if ( $PSBoundParameters.ContainsKey('vserverrhilevel') ) { $payload.Add('vserverrhilevel', $vserverrhilevel) }
            if ( $PSBoundParameters.ContainsKey('ospf6lsatype') ) { $payload.Add('ospf6lsatype', $ospf6lsatype) }
            if ( $PSBoundParameters.ContainsKey('tag') ) { $payload.Add('tag', $tag) }
            if ( $PSBoundParameters.ContainsKey('vrid6') ) { $payload.Add('vrid6', $vrid6) }
            if ( $PSBoundParameters.ContainsKey('ndowner') ) { $payload.Add('ndowner', $ndowner) }
            if ( $PSBoundParameters.ContainsKey('mptcpadvertise') ) { $payload.Add('mptcpadvertise', $mptcpadvertise) }
            if ( $PSCmdlet.ShouldProcess("$ipv6address", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nsip6 -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNsip6: Finished"
    }
}

function Invoke-ADCGetNsip6 {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for ip6 resource.
    .PARAMETER GetAll
        Retrieve all nsip6 object(s).
    .PARAMETER Count
        If specified, the count of the nsip6 object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsip6
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsip6 -GetAll
        Get all nsip6 data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsip6 -Count
        Get the number of nsip6 objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsip6 -name <string>
        Get nsip6 object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsip6 -Filter @{ 'name'='<value>' }
        Get nsip6 data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsip6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsip6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNsip6: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsip6 objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsip6 -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsip6 objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsip6 -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsip6 objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsip6 -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsip6 configuration for property ''"

            } else {
                Write-Verbose "Retrieving nsip6 configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsip6 -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsip6: Ended"
    }
}

function Invoke-ADCGetNslicense {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for license resource.
    .PARAMETER GetAll
        Retrieve all nslicense object(s).
    .PARAMETER Count
        If specified, the count of the nslicense object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslicense
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslicense -GetAll
        Get all nslicense data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslicense -name <string>
        Get nslicense object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslicense -Filter @{ 'name'='<value>' }
        Get nslicense data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNslicense
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslicense/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNslicense: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nslicense objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslicense -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nslicense objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslicense -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nslicense objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslicense -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nslicense configuration for property ''"

            } else {
                Write-Verbose "Retrieving nslicense configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslicense -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNslicense: Ended"
    }
}

function Invoke-ADCAddNslicenseproxyserver {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for licenseproxyserver resource.
    .PARAMETER Serverip
        IP address of the License proxy server.
    .PARAMETER Servername
        Fully qualified domain name of the License proxy server.
    .PARAMETER Port
        License proxy server port.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNslicenseproxyserver -port <double>
        An example how to add nslicenseproxyserver configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNslicenseproxyserver
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslicenseproxyserver/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Serverip,

        [string]$Servername,

        [Parameter(Mandatory)]
        [double]$Port 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNslicenseproxyserver: Starting"
    }
    process {
        try {
            $payload = @{ port = $port }
            if ( $PSBoundParameters.ContainsKey('serverip') ) { $payload.Add('serverip', $serverip) }
            if ( $PSBoundParameters.ContainsKey('servername') ) { $payload.Add('servername', $servername) }
            if ( $PSCmdlet.ShouldProcess("nslicenseproxyserver", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nslicenseproxyserver -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNslicenseproxyserver: Finished"
    }
}

function Invoke-ADCDeleteNslicenseproxyserver {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for licenseproxyserver resource.
    .PARAMETER Serverip
        IP address of the License proxy server.
    .PARAMETER Servername
        Fully qualified domain name of the License proxy server.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNslicenseproxyserver -Serverip <string>
        An example how to delete nslicenseproxyserver configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNslicenseproxyserver
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslicenseproxyserver/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Serverip,

        [string]$Servername 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNslicenseproxyserver: Starting"
    }
    process {
        try {
            $arguments = @{ }
            if ( $PSBoundParameters.ContainsKey('Servername') ) { $arguments.Add('servername', $Servername) }
            if ( $PSCmdlet.ShouldProcess("$serverip", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nslicenseproxyserver -NitroPath nitro/v1/config -Resource $serverip -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNslicenseproxyserver: Finished"
    }
}

function Invoke-ADCUpdateNslicenseproxyserver {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for licenseproxyserver resource.
    .PARAMETER Serverip
        IP address of the License proxy server.
    .PARAMETER Servername
        Fully qualified domain name of the License proxy server.
    .PARAMETER Port
        License proxy server port.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNslicenseproxyserver -port <double>
        An example how to update nslicenseproxyserver configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNslicenseproxyserver
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslicenseproxyserver/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Serverip,

        [string]$Servername,

        [Parameter(Mandatory)]
        [double]$Port 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNslicenseproxyserver: Starting"
    }
    process {
        try {
            $payload = @{ port = $port }
            if ( $PSBoundParameters.ContainsKey('serverip') ) { $payload.Add('serverip', $serverip) }
            if ( $PSBoundParameters.ContainsKey('servername') ) { $payload.Add('servername', $servername) }
            if ( $PSCmdlet.ShouldProcess("nslicenseproxyserver", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nslicenseproxyserver -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNslicenseproxyserver: Finished"
    }
}

function Invoke-ADCGetNslicenseproxyserver {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for licenseproxyserver resource.
    .PARAMETER GetAll
        Retrieve all nslicenseproxyserver object(s).
    .PARAMETER Count
        If specified, the count of the nslicenseproxyserver object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslicenseproxyserver
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslicenseproxyserver -GetAll
        Get all nslicenseproxyserver data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslicenseproxyserver -Count
        Get the number of nslicenseproxyserver objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslicenseproxyserver -name <string>
        Get nslicenseproxyserver object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslicenseproxyserver -Filter @{ 'name'='<value>' }
        Get nslicenseproxyserver data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNslicenseproxyserver
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslicenseproxyserver/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNslicenseproxyserver: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nslicenseproxyserver objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslicenseproxyserver -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nslicenseproxyserver objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslicenseproxyserver -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nslicenseproxyserver objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslicenseproxyserver -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nslicenseproxyserver configuration for property ''"

            } else {
                Write-Verbose "Retrieving nslicenseproxyserver configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslicenseproxyserver -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNslicenseproxyserver: Ended"
    }
}

function Invoke-ADCAddNslicenseserver {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for licenseserver resource.
    .PARAMETER Licenseserverip
        IP address of the License server.
    .PARAMETER Servername
        Fully qualified domain name of the License server.
    .PARAMETER Port
        License server port.
    .PARAMETER Forceupdateip
        If this flag is used while adding the licenseserver, existing config will be overwritten. Use this flag only if you are sure that the new licenseserver has the required capacity.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNslicenseserver
        An example how to add nslicenseserver configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNslicenseserver
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslicenseserver/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Licenseserverip,

        [string]$Servername,

        [double]$Port,

        [boolean]$Forceupdateip 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNslicenseserver: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('licenseserverip') ) { $payload.Add('licenseserverip', $licenseserverip) }
            if ( $PSBoundParameters.ContainsKey('servername') ) { $payload.Add('servername', $servername) }
            if ( $PSBoundParameters.ContainsKey('port') ) { $payload.Add('port', $port) }
            if ( $PSBoundParameters.ContainsKey('forceupdateip') ) { $payload.Add('forceupdateip', $forceupdateip) }
            if ( $PSCmdlet.ShouldProcess("nslicenseserver", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nslicenseserver -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNslicenseserver: Finished"
    }
}

function Invoke-ADCDeleteNslicenseserver {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for licenseserver resource.
    .PARAMETER Licenseserverip
        IP address of the License server.
    .PARAMETER Servername
        Fully qualified domain name of the License server.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNslicenseserver -Licenseserverip <string>
        An example how to delete nslicenseserver configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNslicenseserver
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslicenseserver/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Licenseserverip,

        [string]$Servername 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNslicenseserver: Starting"
    }
    process {
        try {
            $arguments = @{ }
            if ( $PSBoundParameters.ContainsKey('Servername') ) { $arguments.Add('servername', $Servername) }
            if ( $PSCmdlet.ShouldProcess("$licenseserverip", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nslicenseserver -NitroPath nitro/v1/config -Resource $licenseserverip -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNslicenseserver: Finished"
    }
}

function Invoke-ADCUpdateNslicenseserver {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for licenseserver resource.
    .PARAMETER Licenseserverip
        IP address of the License server.
    .PARAMETER Servername
        Fully qualified domain name of the License server.
    .PARAMETER Port
        License server port.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNslicenseserver
        An example how to update nslicenseserver configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNslicenseserver
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslicenseserver/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Licenseserverip,

        [string]$Servername,

        [double]$Port 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNslicenseserver: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('licenseserverip') ) { $payload.Add('licenseserverip', $licenseserverip) }
            if ( $PSBoundParameters.ContainsKey('servername') ) { $payload.Add('servername', $servername) }
            if ( $PSBoundParameters.ContainsKey('port') ) { $payload.Add('port', $port) }
            if ( $PSCmdlet.ShouldProcess("nslicenseserver", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nslicenseserver -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNslicenseserver: Finished"
    }
}

function Invoke-ADCGetNslicenseserver {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for licenseserver resource.
    .PARAMETER Licenseserverip
        IP address of the License server.
    .PARAMETER Servername
        Fully qualified domain name of the License server.
    .PARAMETER Nodeid
        Unique number that identifies the cluster node.
    .PARAMETER GetAll
        Retrieve all nslicenseserver object(s).
    .PARAMETER Count
        If specified, the count of the nslicenseserver object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslicenseserver
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslicenseserver -GetAll
        Get all nslicenseserver data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslicenseserver -Count
        Get the number of nslicenseserver objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslicenseserver -name <string>
        Get nslicenseserver object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslicenseserver -Filter @{ 'name'='<value>' }
        Get nslicenseserver data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNslicenseserver
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslicenseserver/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByArgument')]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Licenseserverip,

        [Parameter(ParameterSetName = 'GetByArgument')]
        [string]$Servername,

        [Parameter(ParameterSetName = 'GetByArgument')]
        [ValidateRange(0, 31)]
        [double]$Nodeid,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNslicenseserver: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nslicenseserver objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslicenseserver -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nslicenseserver objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslicenseserver -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nslicenseserver objects by arguments"
                $arguments = @{ } 
                if ( $PSBoundParameters.ContainsKey('licenseserverip') ) { $arguments.Add('licenseserverip', $licenseserverip) } 
                if ( $PSBoundParameters.ContainsKey('servername') ) { $arguments.Add('servername', $servername) } 
                if ( $PSBoundParameters.ContainsKey('nodeid') ) { $arguments.Add('nodeid', $nodeid) }
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslicenseserver -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nslicenseserver configuration for property ''"

            } else {
                Write-Verbose "Retrieving nslicenseserver configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslicenseserver -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNslicenseserver: Ended"
    }
}

function Invoke-ADCGetNslicenseserverpool {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for licenseserver resource.
    .PARAMETER GetAll
        Retrieve all nslicenseserverpool object(s).
    .PARAMETER Count
        If specified, the count of the nslicenseserverpool object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslicenseserverpool
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslicenseserverpool -GetAll
        Get all nslicenseserverpool data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslicenseserverpool -name <string>
        Get nslicenseserverpool object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslicenseserverpool -Filter @{ 'name'='<value>' }
        Get nslicenseserverpool data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNslicenseserverpool
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslicenseserverpool/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNslicenseserverpool: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nslicenseserverpool objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslicenseserverpool -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nslicenseserverpool objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslicenseserverpool -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nslicenseserverpool objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslicenseserverpool -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nslicenseserverpool configuration for property ''"

            } else {
                Write-Verbose "Retrieving nslicenseserverpool configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslicenseserverpool -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNslicenseserverpool: Ended"
    }
}

function Invoke-ADCAddNslimitidentifier {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for limit Indetifier resource.
    .PARAMETER Limitidentifier
        Name for a rate limit identifier. Must begin with an ASCII letter or underscore (_) character, and must consist only of ASCII alphanumeric or underscore characters. Reserved words must not be used.
    .PARAMETER Threshold
        Maximum number of requests that are allowed in the given timeslice when requests (mode is set as REQUEST_RATE) are tracked per timeslice.
        When connections (mode is set as CONNECTION) are tracked, it is the total number of connections that would be let through.
    .PARAMETER Timeslice
        Time interval, in milliseconds, specified in multiples of 10, during which requests are tracked to check if they cross the threshold. This argument is needed only when the mode is set to REQUEST_RATE.
    .PARAMETER Mode
        Defines the type of traffic to be tracked.
        * REQUEST_RATE - Tracks requests/timeslice.
        * CONNECTION - Tracks active transactions.
        Examples
        1. To permit 20 requests in 10 ms and 2 traps in 10 ms:
        add limitidentifier limit_req -mode request_rate -limitType smooth -timeslice 1000 -Threshold 2000 -trapsInTimeSlice 200
        2. To permit 50 requests in 10 ms:
        set limitidentifier limit_req -mode request_rate -timeslice 1000 -Threshold 5000 -limitType smooth
        3. To permit 1 request in 40 ms:
        set limitidentifier limit_req -mode request_rate -timeslice 2000 -Threshold 50 -limitType smooth
        4. To permit 1 request in 200 ms and 1 trap in 130 ms:
        set limitidentifier limit_req -mode request_rate -timeslice 1000 -Threshold 5 -limitType smooth -trapsInTimeSlice 8
        5. To permit 5000 requests in 1000 ms and 200 traps in 1000 ms:
        set limitidentifier limit_req -mode request_rate -timeslice 1000 -Threshold 5000 -limitType BURSTY.
        Possible values = CONNECTION, REQUEST_RATE, NONE
    .PARAMETER Limittype
        Smooth or bursty request type.
        * SMOOTH - When you want the permitted number of requests in a given interval of time to be spread evenly across the timeslice
        * BURSTY - When you want the permitted number of requests to exhaust the quota anytime within the timeslice.
        This argument is needed only when the mode is set to REQUEST_RATE.
        Possible values = BURSTY, SMOOTH
    .PARAMETER Selectorname
        Name of the rate limit selector. If this argument is NULL, rate limiting will be applied on all traffic received by the virtual server or the Citrix ADC (depending on whether the limit identifier is bound to a virtual server or globally) without any filtering.
    .PARAMETER Maxbandwidth
        Maximum bandwidth permitted, in kbps.
    .PARAMETER Trapsintimeslice
        Number of traps to be sent in the timeslice configured. A value of 0 indicates that traps are disabled.
    .PARAMETER PassThru
        Return details about the created nslimitidentifier item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNslimitidentifier -limitidentifier <string>
        An example how to add nslimitidentifier configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNslimitidentifier
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslimitidentifier/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([a-zA-Z0-9]|[_])+)$')]
        [string]$Limitidentifier,

        [double]$Threshold = '1',

        [double]$Timeslice = '1000',

        [ValidateSet('CONNECTION', 'REQUEST_RATE', 'NONE')]
        [string]$Mode = 'REQUEST_RATE',

        [ValidateSet('BURSTY', 'SMOOTH')]
        [string]$Limittype = 'BURSTY',

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Selectorname,

        [ValidateRange(0, 4294967287)]
        [double]$Maxbandwidth,

        [ValidateRange(0, 65535)]
        [double]$Trapsintimeslice,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNslimitidentifier: Starting"
    }
    process {
        try {
            $payload = @{ limitidentifier = $limitidentifier }
            if ( $PSBoundParameters.ContainsKey('threshold') ) { $payload.Add('threshold', $threshold) }
            if ( $PSBoundParameters.ContainsKey('timeslice') ) { $payload.Add('timeslice', $timeslice) }
            if ( $PSBoundParameters.ContainsKey('mode') ) { $payload.Add('mode', $mode) }
            if ( $PSBoundParameters.ContainsKey('limittype') ) { $payload.Add('limittype', $limittype) }
            if ( $PSBoundParameters.ContainsKey('selectorname') ) { $payload.Add('selectorname', $selectorname) }
            if ( $PSBoundParameters.ContainsKey('maxbandwidth') ) { $payload.Add('maxbandwidth', $maxbandwidth) }
            if ( $PSBoundParameters.ContainsKey('trapsintimeslice') ) { $payload.Add('trapsintimeslice', $trapsintimeslice) }
            if ( $PSCmdlet.ShouldProcess("nslimitidentifier", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nslimitidentifier -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNslimitidentifier -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNslimitidentifier: Finished"
    }
}

function Invoke-ADCDeleteNslimitidentifier {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for limit Indetifier resource.
    .PARAMETER Limitidentifier
        Name for a rate limit identifier. Must begin with an ASCII letter or underscore (_) character, and must consist only of ASCII alphanumeric or underscore characters. Reserved words must not be used.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNslimitidentifier -Limitidentifier <string>
        An example how to delete nslimitidentifier configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNslimitidentifier
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslimitidentifier/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Limitidentifier 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNslimitidentifier: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$limitidentifier", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nslimitidentifier -NitroPath nitro/v1/config -Resource $limitidentifier -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNslimitidentifier: Finished"
    }
}

function Invoke-ADCUpdateNslimitidentifier {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for limit Indetifier resource.
    .PARAMETER Limitidentifier
        Name for a rate limit identifier. Must begin with an ASCII letter or underscore (_) character, and must consist only of ASCII alphanumeric or underscore characters. Reserved words must not be used.
    .PARAMETER Threshold
        Maximum number of requests that are allowed in the given timeslice when requests (mode is set as REQUEST_RATE) are tracked per timeslice.
        When connections (mode is set as CONNECTION) are tracked, it is the total number of connections that would be let through.
    .PARAMETER Timeslice
        Time interval, in milliseconds, specified in multiples of 10, during which requests are tracked to check if they cross the threshold. This argument is needed only when the mode is set to REQUEST_RATE.
    .PARAMETER Mode
        Defines the type of traffic to be tracked.
        * REQUEST_RATE - Tracks requests/timeslice.
        * CONNECTION - Tracks active transactions.
        Examples
        1. To permit 20 requests in 10 ms and 2 traps in 10 ms:
        add limitidentifier limit_req -mode request_rate -limitType smooth -timeslice 1000 -Threshold 2000 -trapsInTimeSlice 200
        2. To permit 50 requests in 10 ms:
        set limitidentifier limit_req -mode request_rate -timeslice 1000 -Threshold 5000 -limitType smooth
        3. To permit 1 request in 40 ms:
        set limitidentifier limit_req -mode request_rate -timeslice 2000 -Threshold 50 -limitType smooth
        4. To permit 1 request in 200 ms and 1 trap in 130 ms:
        set limitidentifier limit_req -mode request_rate -timeslice 1000 -Threshold 5 -limitType smooth -trapsInTimeSlice 8
        5. To permit 5000 requests in 1000 ms and 200 traps in 1000 ms:
        set limitidentifier limit_req -mode request_rate -timeslice 1000 -Threshold 5000 -limitType BURSTY.
        Possible values = CONNECTION, REQUEST_RATE, NONE
    .PARAMETER Limittype
        Smooth or bursty request type.
        * SMOOTH - When you want the permitted number of requests in a given interval of time to be spread evenly across the timeslice
        * BURSTY - When you want the permitted number of requests to exhaust the quota anytime within the timeslice.
        This argument is needed only when the mode is set to REQUEST_RATE.
        Possible values = BURSTY, SMOOTH
    .PARAMETER Selectorname
        Name of the rate limit selector. If this argument is NULL, rate limiting will be applied on all traffic received by the virtual server or the Citrix ADC (depending on whether the limit identifier is bound to a virtual server or globally) without any filtering.
    .PARAMETER Maxbandwidth
        Maximum bandwidth permitted, in kbps.
    .PARAMETER Trapsintimeslice
        Number of traps to be sent in the timeslice configured. A value of 0 indicates that traps are disabled.
    .PARAMETER PassThru
        Return details about the created nslimitidentifier item.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNslimitidentifier -limitidentifier <string>
        An example how to update nslimitidentifier configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNslimitidentifier
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslimitidentifier/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([a-zA-Z0-9]|[_])+)$')]
        [string]$Limitidentifier,

        [double]$Threshold,

        [double]$Timeslice,

        [ValidateSet('CONNECTION', 'REQUEST_RATE', 'NONE')]
        [string]$Mode,

        [ValidateSet('BURSTY', 'SMOOTH')]
        [string]$Limittype,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Selectorname,

        [ValidateRange(0, 4294967287)]
        [double]$Maxbandwidth,

        [ValidateRange(0, 65535)]
        [double]$Trapsintimeslice,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNslimitidentifier: Starting"
    }
    process {
        try {
            $payload = @{ limitidentifier = $limitidentifier }
            if ( $PSBoundParameters.ContainsKey('threshold') ) { $payload.Add('threshold', $threshold) }
            if ( $PSBoundParameters.ContainsKey('timeslice') ) { $payload.Add('timeslice', $timeslice) }
            if ( $PSBoundParameters.ContainsKey('mode') ) { $payload.Add('mode', $mode) }
            if ( $PSBoundParameters.ContainsKey('limittype') ) { $payload.Add('limittype', $limittype) }
            if ( $PSBoundParameters.ContainsKey('selectorname') ) { $payload.Add('selectorname', $selectorname) }
            if ( $PSBoundParameters.ContainsKey('maxbandwidth') ) { $payload.Add('maxbandwidth', $maxbandwidth) }
            if ( $PSBoundParameters.ContainsKey('trapsintimeslice') ) { $payload.Add('trapsintimeslice', $trapsintimeslice) }
            if ( $PSCmdlet.ShouldProcess("nslimitidentifier", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nslimitidentifier -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNslimitidentifier -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNslimitidentifier: Finished"
    }
}

function Invoke-ADCUnsetNslimitidentifier {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for limit Indetifier resource.
    .PARAMETER Limitidentifier
        Name for a rate limit identifier. Must begin with an ASCII letter or underscore (_) character, and must consist only of ASCII alphanumeric or underscore characters. Reserved words must not be used.
    .PARAMETER Selectorname
        Name of the rate limit selector. If this argument is NULL, rate limiting will be applied on all traffic received by the virtual server or the Citrix ADC (depending on whether the limit identifier is bound to a virtual server or globally) without any filtering.
    .PARAMETER Threshold
        Maximum number of requests that are allowed in the given timeslice when requests (mode is set as REQUEST_RATE) are tracked per timeslice.
        When connections (mode is set as CONNECTION) are tracked, it is the total number of connections that would be let through.
    .PARAMETER Timeslice
        Time interval, in milliseconds, specified in multiples of 10, during which requests are tracked to check if they cross the threshold. This argument is needed only when the mode is set to REQUEST_RATE.
    .PARAMETER Mode
        Defines the type of traffic to be tracked.
        * REQUEST_RATE - Tracks requests/timeslice.
        * CONNECTION - Tracks active transactions.
        Examples
        1. To permit 20 requests in 10 ms and 2 traps in 10 ms:
        add limitidentifier limit_req -mode request_rate -limitType smooth -timeslice 1000 -Threshold 2000 -trapsInTimeSlice 200
        2. To permit 50 requests in 10 ms:
        set limitidentifier limit_req -mode request_rate -timeslice 1000 -Threshold 5000 -limitType smooth
        3. To permit 1 request in 40 ms:
        set limitidentifier limit_req -mode request_rate -timeslice 2000 -Threshold 50 -limitType smooth
        4. To permit 1 request in 200 ms and 1 trap in 130 ms:
        set limitidentifier limit_req -mode request_rate -timeslice 1000 -Threshold 5 -limitType smooth -trapsInTimeSlice 8
        5. To permit 5000 requests in 1000 ms and 200 traps in 1000 ms:
        set limitidentifier limit_req -mode request_rate -timeslice 1000 -Threshold 5000 -limitType BURSTY.
        Possible values = CONNECTION, REQUEST_RATE, NONE
    .PARAMETER Limittype
        Smooth or bursty request type.
        * SMOOTH - When you want the permitted number of requests in a given interval of time to be spread evenly across the timeslice
        * BURSTY - When you want the permitted number of requests to exhaust the quota anytime within the timeslice.
        This argument is needed only when the mode is set to REQUEST_RATE.
        Possible values = BURSTY, SMOOTH
    .PARAMETER Maxbandwidth
        Maximum bandwidth permitted, in kbps.
    .PARAMETER Trapsintimeslice
        Number of traps to be sent in the timeslice configured. A value of 0 indicates that traps are disabled.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNslimitidentifier -limitidentifier <string>
        An example how to unset nslimitidentifier configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNslimitidentifier
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslimitidentifier
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([a-zA-Z0-9]|[_])+)$')]
        [string]$Limitidentifier,

        [Boolean]$selectorname,

        [Boolean]$threshold,

        [Boolean]$timeslice,

        [Boolean]$mode,

        [Boolean]$limittype,

        [Boolean]$maxbandwidth,

        [Boolean]$trapsintimeslice 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNslimitidentifier: Starting"
    }
    process {
        try {
            $payload = @{ limitidentifier = $limitidentifier }
            if ( $PSBoundParameters.ContainsKey('selectorname') ) { $payload.Add('selectorname', $selectorname) }
            if ( $PSBoundParameters.ContainsKey('threshold') ) { $payload.Add('threshold', $threshold) }
            if ( $PSBoundParameters.ContainsKey('timeslice') ) { $payload.Add('timeslice', $timeslice) }
            if ( $PSBoundParameters.ContainsKey('mode') ) { $payload.Add('mode', $mode) }
            if ( $PSBoundParameters.ContainsKey('limittype') ) { $payload.Add('limittype', $limittype) }
            if ( $PSBoundParameters.ContainsKey('maxbandwidth') ) { $payload.Add('maxbandwidth', $maxbandwidth) }
            if ( $PSBoundParameters.ContainsKey('trapsintimeslice') ) { $payload.Add('trapsintimeslice', $trapsintimeslice) }
            if ( $PSCmdlet.ShouldProcess("$limitidentifier", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nslimitidentifier -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNslimitidentifier: Finished"
    }
}

function Invoke-ADCGetNslimitidentifier {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for limit Indetifier resource.
    .PARAMETER Limitidentifier
        Name for a rate limit identifier. Must begin with an ASCII letter or underscore (_) character, and must consist only of ASCII alphanumeric or underscore characters. Reserved words must not be used.
    .PARAMETER GetAll
        Retrieve all nslimitidentifier object(s).
    .PARAMETER Count
        If specified, the count of the nslimitidentifier object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitidentifier
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitidentifier -GetAll
        Get all nslimitidentifier data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitidentifier -Count
        Get the number of nslimitidentifier objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitidentifier -name <string>
        Get nslimitidentifier object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitidentifier -Filter @{ 'name'='<value>' }
        Get nslimitidentifier data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNslimitidentifier
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslimitidentifier/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([a-zA-Z0-9]|[_])+)$')]
        [string]$Limitidentifier,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNslimitidentifier: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nslimitidentifier objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitidentifier -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nslimitidentifier objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitidentifier -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nslimitidentifier objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitidentifier -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nslimitidentifier configuration for property 'limitidentifier'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitidentifier -NitroPath nitro/v1/config -Resource $limitidentifier -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nslimitidentifier configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitidentifier -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNslimitidentifier: Ended"
    }
}

function Invoke-ADCGetNslimitidentifierbinding {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Binding object which returns the resources bound to nslimitidentifier.
    .PARAMETER Limitidentifier
        Name of the rate limit identifier about which to display information. If a name is not provided, information about all rate limit identifiers is shown.
    .PARAMETER GetAll
        Retrieve all nslimitidentifier_binding object(s).
    .PARAMETER Count
        If specified, the count of the nslimitidentifier_binding object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitidentifierbinding
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitidentifierbinding -GetAll
        Get all nslimitidentifier_binding data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitidentifierbinding -name <string>
        Get nslimitidentifier_binding object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitidentifierbinding -Filter @{ 'name'='<value>' }
        Get nslimitidentifier_binding data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNslimitidentifierbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslimitidentifier_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [string]$Limitidentifier,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNslimitidentifierbinding: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{  bulkbindings = 'yes' }
                Write-Verbose "Retrieving all nslimitidentifier_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitidentifier_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nslimitidentifier_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitidentifier_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nslimitidentifier_binding objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitidentifier_binding -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nslimitidentifier_binding configuration for property 'limitidentifier'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitidentifier_binding -NitroPath nitro/v1/config -Resource $limitidentifier -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nslimitidentifier_binding configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitidentifier_binding -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNslimitidentifierbinding: Ended"
    }
}

function Invoke-ADCGetNslimitidentifiernslimitsessionsbinding {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Binding object showing the nslimitsessions that can be bound to nslimitidentifier.
    .PARAMETER Limitidentifier
        Name of the rate limit identifier about which to display information. If a name is not provided, information about all rate limit identifiers is shown.
    .PARAMETER GetAll
        Retrieve all nslimitidentifier_nslimitsessions_binding object(s).
    .PARAMETER Count
        If specified, the count of the nslimitidentifier_nslimitsessions_binding object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitidentifiernslimitsessionsbinding
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitidentifiernslimitsessionsbinding -GetAll
        Get all nslimitidentifier_nslimitsessions_binding data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitidentifiernslimitsessionsbinding -Count
        Get the number of nslimitidentifier_nslimitsessions_binding objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitidentifiernslimitsessionsbinding -name <string>
        Get nslimitidentifier_nslimitsessions_binding object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitidentifiernslimitsessionsbinding -Filter @{ 'name'='<value>' }
        Get nslimitidentifier_nslimitsessions_binding data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNslimitidentifiernslimitsessionsbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslimitidentifier_nslimitsessions_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [string]$Limitidentifier,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNslimitidentifiernslimitsessionsbinding: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{  bulkbindings = 'yes' }
                Write-Verbose "Retrieving all nslimitidentifier_nslimitsessions_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitidentifier_nslimitsessions_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nslimitidentifier_nslimitsessions_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitidentifier_nslimitsessions_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nslimitidentifier_nslimitsessions_binding objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitidentifier_nslimitsessions_binding -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nslimitidentifier_nslimitsessions_binding configuration for property 'limitidentifier'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitidentifier_nslimitsessions_binding -NitroPath nitro/v1/config -Resource $limitidentifier -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nslimitidentifier_nslimitsessions_binding configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitidentifier_nslimitsessions_binding -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNslimitidentifiernslimitsessionsbinding: Ended"
    }
}

function Invoke-ADCAddNslimitselector {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for limit selector resource.
    .PARAMETER Selectorname
        .
    .PARAMETER Rule
        .
    .PARAMETER PassThru
        Return details about the created nslimitselector item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNslimitselector -selectorname <string> -rule <string[]>
        An example how to add nslimitselector configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNslimitselector
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslimitselector/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Selectorname,

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string[]]$Rule,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNslimitselector: Starting"
    }
    process {
        try {
            $payload = @{ selectorname = $selectorname
                rule                   = $rule
            }

            if ( $PSCmdlet.ShouldProcess("nslimitselector", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nslimitselector -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNslimitselector -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNslimitselector: Finished"
    }
}

function Invoke-ADCDeleteNslimitselector {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for limit selector resource.
    .PARAMETER Selectorname
        .
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNslimitselector -Selectorname <string>
        An example how to delete nslimitselector configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNslimitselector
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslimitselector/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Selectorname 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNslimitselector: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$selectorname", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nslimitselector -NitroPath nitro/v1/config -Resource $selectorname -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNslimitselector: Finished"
    }
}

function Invoke-ADCUpdateNslimitselector {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for limit selector resource.
    .PARAMETER Selectorname
        .
    .PARAMETER Rule
        .
    .PARAMETER PassThru
        Return details about the created nslimitselector item.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNslimitselector -selectorname <string>
        An example how to update nslimitselector configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNslimitselector
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslimitselector/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Selectorname,

        [ValidateScript({ $_.Length -gt 1 })]
        [string[]]$Rule,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNslimitselector: Starting"
    }
    process {
        try {
            $payload = @{ selectorname = $selectorname }
            if ( $PSBoundParameters.ContainsKey('rule') ) { $payload.Add('rule', $rule) }
            if ( $PSCmdlet.ShouldProcess("nslimitselector", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nslimitselector -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNslimitselector -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNslimitselector: Finished"
    }
}

function Invoke-ADCUnsetNslimitselector {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for limit selector resource.
    .PARAMETER Selectorname
        .
    .PARAMETER Rule
        .
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNslimitselector -selectorname <string>
        An example how to unset nslimitselector configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNslimitselector
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslimitselector
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [string]$Selectorname,

        [Boolean]$rule 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNslimitselector: Starting"
    }
    process {
        try {
            $payload = @{ selectorname = $selectorname }
            if ( $PSBoundParameters.ContainsKey('rule') ) { $payload.Add('rule', $rule) }
            if ( $PSCmdlet.ShouldProcess("$selectorname", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nslimitselector -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNslimitselector: Finished"
    }
}

function Invoke-ADCGetNslimitselector {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for limit selector resource.
    .PARAMETER Selectorname
        .
    .PARAMETER GetAll
        Retrieve all nslimitselector object(s).
    .PARAMETER Count
        If specified, the count of the nslimitselector object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitselector
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitselector -GetAll
        Get all nslimitselector data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitselector -Count
        Get the number of nslimitselector objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitselector -name <string>
        Get nslimitselector object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitselector -Filter @{ 'name'='<value>' }
        Get nslimitselector data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNslimitselector
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslimitselector/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [string]$Selectorname,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNslimitselector: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nslimitselector objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitselector -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nslimitselector objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitselector -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nslimitselector objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitselector -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nslimitselector configuration for property 'selectorname'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitselector -NitroPath nitro/v1/config -Resource $selectorname -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nslimitselector configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitselector -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNslimitselector: Ended"
    }
}

function Invoke-ADCClearNslimitsessions {
    <#
    .SYNOPSIS
        Clear NS configuration Object.
    .DESCRIPTION
        Configuration for limit sessions resource.
    .PARAMETER Limitidentifier
        Name of the rate limit identifier for which to display the sessions.
    .EXAMPLE
        PS C:\>Invoke-ADCClearNslimitsessions -limitidentifier <string>
        An example how to clear nslimitsessions configuration Object(s).
    .NOTES
        File Name : Invoke-ADCClearNslimitsessions
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslimitsessions/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Limitidentifier 

    )
    begin {
        Write-Verbose "Invoke-ADCClearNslimitsessions: Starting"
    }
    process {
        try {
            $payload = @{ limitidentifier = $limitidentifier }

            if ( $PSCmdlet.ShouldProcess($Name, "Clear NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nslimitsessions -Action clear -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCClearNslimitsessions: Finished"
    }
}

function Invoke-ADCGetNslimitsessions {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for limit sessions resource.
    .PARAMETER Limitidentifier
        Name of the rate limit identifier for which to display the sessions.
    .PARAMETER Detail
        Show the individual hash values.
    .PARAMETER GetAll
        Retrieve all nslimitsessions object(s).
    .PARAMETER Count
        If specified, the count of the nslimitsessions object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitsessions
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitsessions -GetAll
        Get all nslimitsessions data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitsessions -Count
        Get the number of nslimitsessions objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitsessions -name <string>
        Get nslimitsessions object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNslimitsessions -Filter @{ 'name'='<value>' }
        Get nslimitsessions data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNslimitsessions
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nslimitsessions/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByArgument')]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Limitidentifier,

        [Parameter(ParameterSetName = 'GetByArgument')]
        [boolean]$Detail,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNslimitsessions: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nslimitsessions objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitsessions -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nslimitsessions objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitsessions -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nslimitsessions objects by arguments"
                $arguments = @{ } 
                if ( $PSBoundParameters.ContainsKey('limitidentifier') ) { $arguments.Add('limitidentifier', $limitidentifier) } 
                if ( $PSBoundParameters.ContainsKey('detail') ) { $arguments.Add('detail', $detail) }
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitsessions -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nslimitsessions configuration for property ''"

            } else {
                Write-Verbose "Retrieving nslimitsessions configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nslimitsessions -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNslimitsessions: Ended"
    }
}

function Invoke-ADCGetNsmigration {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for Migration operation resource.
    .PARAMETER GetAll
        Retrieve all nsmigration object(s).
    .PARAMETER Count
        If specified, the count of the nsmigration object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsmigration
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsmigration -GetAll
        Get all nsmigration data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsmigration -name <string>
        Get nsmigration object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsmigration -Filter @{ 'name'='<value>' }
        Get nsmigration data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsmigration
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsmigration/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNsmigration: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsmigration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsmigration -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsmigration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsmigration -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsmigration objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsmigration -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsmigration configuration for property ''"

            } else {
                Write-Verbose "Retrieving nsmigration configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsmigration -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsmigration: Ended"
    }
}

function Invoke-ADCEnableNsmode {
    <#
    .SYNOPSIS
        Enable NS configuration Object.
    .DESCRIPTION
        Configuration for ns mode resource.
    .PARAMETER Mode
        Mode to be enabled. Multiple modes can be specified by providing a blank space between each mode.
        Possible values = FR, FastRamp, L2, L2mode, L3, L3mode, USIP, UseSourceIP, CKA, ClientKeepAlive, TCPB, TCPBuffering, MBF, MACbasedforwarding, Edge, USNIP, SRADV, DRADV, IRADV, SRADV6, DRADV6, PMTUD, RISE_APBR, RISE_RHI, BridgeBPDUs, ULFD
    .EXAMPLE
        PS C:\>Invoke-ADCEnableNsmode
        An example how to enable nsmode configuration Object(s).
    .NOTES
        File Name : Invoke-ADCEnableNsmode
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsmode/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateSet('FR', 'FastRamp', 'L2', 'L2mode', 'L3', 'L3mode', 'USIP', 'UseSourceIP', 'CKA', 'ClientKeepAlive', 'TCPB', 'TCPBuffering', 'MBF', 'MACbasedforwarding', 'Edge', 'USNIP', 'SRADV', 'DRADV', 'IRADV', 'SRADV6', 'DRADV6', 'PMTUD', 'RISE_APBR', 'RISE_RHI', 'BridgeBPDUs', 'ULFD')]
        [string[]]$Mode 

    )
    begin {
        Write-Verbose "Invoke-ADCEnableNsmode: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('mode') ) { $payload.Add('mode', $mode) }
            if ( $PSCmdlet.ShouldProcess($Name, "Enable NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsmode -Action enable -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCEnableNsmode: Finished"
    }
}

function Invoke-ADCDisableNsmode {
    <#
    .SYNOPSIS
        Disable NS configuration Object.
    .DESCRIPTION
        Configuration for ns mode resource.
    .PARAMETER Mode
        Mode to be enabled. Multiple modes can be specified by providing a blank space between each mode.
        Possible values = FR, FastRamp, L2, L2mode, L3, L3mode, USIP, UseSourceIP, CKA, ClientKeepAlive, TCPB, TCPBuffering, MBF, MACbasedforwarding, Edge, USNIP, SRADV, DRADV, IRADV, SRADV6, DRADV6, PMTUD, RISE_APBR, RISE_RHI, BridgeBPDUs, ULFD
    .EXAMPLE
        PS C:\>Invoke-ADCDisableNsmode
        An example how to disable nsmode configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDisableNsmode
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsmode/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateSet('FR', 'FastRamp', 'L2', 'L2mode', 'L3', 'L3mode', 'USIP', 'UseSourceIP', 'CKA', 'ClientKeepAlive', 'TCPB', 'TCPBuffering', 'MBF', 'MACbasedforwarding', 'Edge', 'USNIP', 'SRADV', 'DRADV', 'IRADV', 'SRADV6', 'DRADV6', 'PMTUD', 'RISE_APBR', 'RISE_RHI', 'BridgeBPDUs', 'ULFD')]
        [string[]]$Mode 

    )
    begin {
        Write-Verbose "Invoke-ADCDisableNsmode: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('mode') ) { $payload.Add('mode', $mode) }
            if ( $PSCmdlet.ShouldProcess($Name, "Disable NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsmode -Action disable -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDisableNsmode: Finished"
    }
}

function Invoke-ADCGetNsmode {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for ns mode resource.
    .PARAMETER GetAll
        Retrieve all nsmode object(s).
    .PARAMETER Count
        If specified, the count of the nsmode object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsmode
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsmode -GetAll
        Get all nsmode data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsmode -name <string>
        Get nsmode object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsmode -Filter @{ 'name'='<value>' }
        Get nsmode data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsmode
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsmode/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNsmode: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsmode objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsmode -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsmode objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsmode -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsmode objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsmode -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsmode configuration for property ''"

            } else {
                Write-Verbose "Retrieving nsmode configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsmode -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsmode: Ended"
    }
}

function Invoke-ADCUpdateNsparam {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for Citrix ADC parameters resource.
    .PARAMETER Httpport
        HTTP ports on the web server. This allows the system to perform connection off-load for any client request that has a destination port matching one of these configured ports.
    .PARAMETER Maxconn
        Maximum number of connections that will be made from the appliance to the web server(s) attached to it. The value entered here is applied globally to all attached servers.
    .PARAMETER Maxreq
        Maximum number of requests that the system can pass on a particular connection between the appliance and a server attached to it. Setting this value to 0 allows an unlimited number of requests to be passed. This value is overridden by the maximum number of requests configured on the individual service.
    .PARAMETER Cip
        Enable or disable the insertion of the actual client IP address into the HTTP header request passed from the client to one, some, or all servers attached to the system. The passed address can then be accessed through a minor modification to the server.
        * If the CIP header is specified, it will be used as the client IP header.
        * If the CIP header is not specified, the value that has been set will be used as the client IP header.
        Possible values = ENABLED, DISABLED
    .PARAMETER Cipheader
        Text that will be used as the client IP address header.
    .PARAMETER Cookieversion
        Version of the cookie inserted by the system.
        Possible values = 0, 1
    .PARAMETER Securecookie
        Enable or disable secure flag for persistence cookie.
        Possible values = ENABLED, DISABLED
    .PARAMETER Pmtumin
        Minimum path MTU value that Citrix ADC will process in the ICMP fragmentation needed message. If the ICMP message contains a value less than this value, then this value is used instead.
    .PARAMETER Pmtutimeout
        Interval, in minutes, for flushing the PMTU entries.
    .PARAMETER Ftpportrange
        Minimum and maximum port (port range) that FTP services are allowed to use.
    .PARAMETER Crportrange
        Port range for cache redirection services.
    .PARAMETER Timezone
        Time zone for the Citrix ADC. Name of the time zone should be specified as argument.
    .PARAMETER Grantquotamaxclient
        Percentage of shared quota to be granted at a time for maxClient.
    .PARAMETER Exclusivequotamaxclient
        Percentage of maxClient to be given to PEs.
    .PARAMETER Grantquotaspillover
        Percentage of shared quota to be granted at a time for spillover.
    .PARAMETER Exclusivequotaspillover
        Percentage of maximum limit to be given to PEs.
    .PARAMETER Useproxyport
        Enable/Disable use_proxy_port setting.
        Possible values = ENABLED, DISABLED
    .PARAMETER Internaluserlogin
        Enables/disables the internal user from logging in to the appliance. Before disabling internal user login, you must have key-based authentication set up on the appliance. The file name for the key pair must be "ns_comm_key".
        Possible values = ENABLED, DISABLED
    .PARAMETER Aftpallowrandomsourceport
        Allow the FTP server to come from a random source port for active FTP data connections.
        Possible values = ENABLED, DISABLED
    .PARAMETER Icaports
        The ICA ports on the Web server. This allows the system to perform connection off-load for any
        client request that has a destination port matching one of these configured ports.
    .PARAMETER Tcpcip
        Enable or disable the insertion of the client TCP/IP header in TCP payload passed from the client to one, some, or all servers attached to the system. The passed address can then be accessed through a minor modification to the server.
        Possible values = ENABLED, DISABLED
    .PARAMETER Servicepathingressvlan
        VLAN on which the subscriber traffic arrives on the appliance.
    .PARAMETER Secureicaports
        The Secure ICA ports on the Web server. This allows the system to perform connection off-load for any
        client request that has a destination port matching one of these configured ports.
    .PARAMETER Mgmthttpport
        This allow the configuration of management HTTP port.
    .PARAMETER Mgmthttpsport
        This allows the configuration of management HTTPS port.
    .PARAMETER Proxyprotocol
        Disable/Enable v1 or v2 proxy protocol header for client info insertion.
        Possible values = ENABLED, DISABLED
    .PARAMETER Advancedanalyticsstats
        Disable/Enable advanace analytics stats.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ipttl
        Set the IP Time to Live (TTL) and Hop Limit value for all outgoing packets from Citrix ADC.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsparam
        An example how to update nsparam configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsparam/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateRange(1, 65535)]
        [int[]]$Httpport,

        [ValidateRange(0, 4294967294)]
        [double]$Maxconn,

        [ValidateRange(0, 65535)]
        [double]$Maxreq,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Cip,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Cipheader,

        [ValidateSet('0', '1')]
        [string]$Cookieversion,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Securecookie,

        [ValidateRange(168, 1500)]
        [double]$Pmtumin,

        [ValidateRange(1, 1440)]
        [double]$Pmtutimeout,

        [ValidateLength(1024, 64000)]
        [string]$Ftpportrange,

        [ValidateLength(1, 65535)]
        [string]$Crportrange,

        [ValidateLength(1, 63)]
        [string]$Timezone,

        [ValidateRange(0, 100)]
        [double]$Grantquotamaxclient,

        [ValidateRange(0, 100)]
        [double]$Exclusivequotamaxclient,

        [ValidateRange(0, 100)]
        [double]$Grantquotaspillover,

        [ValidateRange(0, 100)]
        [double]$Exclusivequotaspillover,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Useproxyport,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Internaluserlogin,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Aftpallowrandomsourceport,

        [int[]]$Icaports,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Tcpcip,

        [double]$Servicepathingressvlan,

        [int[]]$Secureicaports,

        [ValidateRange(1, 65534)]
        [int]$Mgmthttpport,

        [ValidateRange(1, 65534)]
        [int]$Mgmthttpsport,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Proxyprotocol,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Advancedanalyticsstats,

        [ValidateRange(1, 255)]
        [double]$Ipttl 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsparam: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('httpport') ) { $payload.Add('httpport', $httpport) }
            if ( $PSBoundParameters.ContainsKey('maxconn') ) { $payload.Add('maxconn', $maxconn) }
            if ( $PSBoundParameters.ContainsKey('maxreq') ) { $payload.Add('maxreq', $maxreq) }
            if ( $PSBoundParameters.ContainsKey('cip') ) { $payload.Add('cip', $cip) }
            if ( $PSBoundParameters.ContainsKey('cipheader') ) { $payload.Add('cipheader', $cipheader) }
            if ( $PSBoundParameters.ContainsKey('cookieversion') ) { $payload.Add('cookieversion', $cookieversion) }
            if ( $PSBoundParameters.ContainsKey('securecookie') ) { $payload.Add('securecookie', $securecookie) }
            if ( $PSBoundParameters.ContainsKey('pmtumin') ) { $payload.Add('pmtumin', $pmtumin) }
            if ( $PSBoundParameters.ContainsKey('pmtutimeout') ) { $payload.Add('pmtutimeout', $pmtutimeout) }
            if ( $PSBoundParameters.ContainsKey('ftpportrange') ) { $payload.Add('ftpportrange', $ftpportrange) }
            if ( $PSBoundParameters.ContainsKey('crportrange') ) { $payload.Add('crportrange', $crportrange) }
            if ( $PSBoundParameters.ContainsKey('timezone') ) { $payload.Add('timezone', $timezone) }
            if ( $PSBoundParameters.ContainsKey('grantquotamaxclient') ) { $payload.Add('grantquotamaxclient', $grantquotamaxclient) }
            if ( $PSBoundParameters.ContainsKey('exclusivequotamaxclient') ) { $payload.Add('exclusivequotamaxclient', $exclusivequotamaxclient) }
            if ( $PSBoundParameters.ContainsKey('grantquotaspillover') ) { $payload.Add('grantquotaspillover', $grantquotaspillover) }
            if ( $PSBoundParameters.ContainsKey('exclusivequotaspillover') ) { $payload.Add('exclusivequotaspillover', $exclusivequotaspillover) }
            if ( $PSBoundParameters.ContainsKey('useproxyport') ) { $payload.Add('useproxyport', $useproxyport) }
            if ( $PSBoundParameters.ContainsKey('internaluserlogin') ) { $payload.Add('internaluserlogin', $internaluserlogin) }
            if ( $PSBoundParameters.ContainsKey('aftpallowrandomsourceport') ) { $payload.Add('aftpallowrandomsourceport', $aftpallowrandomsourceport) }
            if ( $PSBoundParameters.ContainsKey('icaports') ) { $payload.Add('icaports', $icaports) }
            if ( $PSBoundParameters.ContainsKey('tcpcip') ) { $payload.Add('tcpcip', $tcpcip) }
            if ( $PSBoundParameters.ContainsKey('servicepathingressvlan') ) { $payload.Add('servicepathingressvlan', $servicepathingressvlan) }
            if ( $PSBoundParameters.ContainsKey('secureicaports') ) { $payload.Add('secureicaports', $secureicaports) }
            if ( $PSBoundParameters.ContainsKey('mgmthttpport') ) { $payload.Add('mgmthttpport', $mgmthttpport) }
            if ( $PSBoundParameters.ContainsKey('mgmthttpsport') ) { $payload.Add('mgmthttpsport', $mgmthttpsport) }
            if ( $PSBoundParameters.ContainsKey('proxyprotocol') ) { $payload.Add('proxyprotocol', $proxyprotocol) }
            if ( $PSBoundParameters.ContainsKey('advancedanalyticsstats') ) { $payload.Add('advancedanalyticsstats', $advancedanalyticsstats) }
            if ( $PSBoundParameters.ContainsKey('ipttl') ) { $payload.Add('ipttl', $ipttl) }
            if ( $PSCmdlet.ShouldProcess("nsparam", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsparam -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsparam: Finished"
    }
}

function Invoke-ADCUnsetNsparam {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for Citrix ADC parameters resource.
    .PARAMETER Ftpportrange
        Minimum and maximum port (port range) that FTP services are allowed to use.
    .PARAMETER Crportrange
        Port range for cache redirection services.
    .PARAMETER Aftpallowrandomsourceport
        Allow the FTP server to come from a random source port for active FTP data connections.
        Possible values = ENABLED, DISABLED
    .PARAMETER Httpport
        HTTP ports on the web server. This allows the system to perform connection off-load for any client request that has a destination port matching one of these configured ports.
    .PARAMETER Maxconn
        Maximum number of connections that will be made from the appliance to the web server(s) attached to it. The value entered here is applied globally to all attached servers.
    .PARAMETER Maxreq
        Maximum number of requests that the system can pass on a particular connection between the appliance and a server attached to it. Setting this value to 0 allows an unlimited number of requests to be passed. This value is overridden by the maximum number of requests configured on the individual service.
    .PARAMETER Cip
        Enable or disable the insertion of the actual client IP address into the HTTP header request passed from the client to one, some, or all servers attached to the system. The passed address can then be accessed through a minor modification to the server.
        * If the CIP header is specified, it will be used as the client IP header.
        * If the CIP header is not specified, the value that has been set will be used as the client IP header.
        Possible values = ENABLED, DISABLED
    .PARAMETER Cipheader
        Text that will be used as the client IP address header.
    .PARAMETER Cookieversion
        Version of the cookie inserted by the system.
        Possible values = 0, 1
    .PARAMETER Securecookie
        Enable or disable secure flag for persistence cookie.
        Possible values = ENABLED, DISABLED
    .PARAMETER Pmtumin
        Minimum path MTU value that Citrix ADC will process in the ICMP fragmentation needed message. If the ICMP message contains a value less than this value, then this value is used instead.
    .PARAMETER Pmtutimeout
        Interval, in minutes, for flushing the PMTU entries.
    .PARAMETER Timezone
        Time zone for the Citrix ADC. Name of the time zone should be specified as argument.
    .PARAMETER Grantquotamaxclient
        Percentage of shared quota to be granted at a time for maxClient.
    .PARAMETER Exclusivequotamaxclient
        Percentage of maxClient to be given to PEs.
    .PARAMETER Grantquotaspillover
        Percentage of shared quota to be granted at a time for spillover.
    .PARAMETER Exclusivequotaspillover
        Percentage of maximum limit to be given to PEs.
    .PARAMETER Useproxyport
        Enable/Disable use_proxy_port setting.
        Possible values = ENABLED, DISABLED
    .PARAMETER Internaluserlogin
        Enables/disables the internal user from logging in to the appliance. Before disabling internal user login, you must have key-based authentication set up on the appliance. The file name for the key pair must be "ns_comm_key".
        Possible values = ENABLED, DISABLED
    .PARAMETER Icaports
        The ICA ports on the Web server. This allows the system to perform connection off-load for any
        client request that has a destination port matching one of these configured ports.
    .PARAMETER Tcpcip
        Enable or disable the insertion of the client TCP/IP header in TCP payload passed from the client to one, some, or all servers attached to the system. The passed address can then be accessed through a minor modification to the server.
        Possible values = ENABLED, DISABLED
    .PARAMETER Servicepathingressvlan
        VLAN on which the subscriber traffic arrives on the appliance.
    .PARAMETER Secureicaports
        The Secure ICA ports on the Web server. This allows the system to perform connection off-load for any
        client request that has a destination port matching one of these configured ports.
    .PARAMETER Mgmthttpport
        This allow the configuration of management HTTP port.
    .PARAMETER Mgmthttpsport
        This allows the configuration of management HTTPS port.
    .PARAMETER Proxyprotocol
        Disable/Enable v1 or v2 proxy protocol header for client info insertion.
        Possible values = ENABLED, DISABLED
    .PARAMETER Advancedanalyticsstats
        Disable/Enable advanace analytics stats.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ipttl
        Set the IP Time to Live (TTL) and Hop Limit value for all outgoing packets from Citrix ADC.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNsparam
        An example how to unset nsparam configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNsparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsparam
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Boolean]$ftpportrange,

        [Boolean]$crportrange,

        [Boolean]$aftpallowrandomsourceport,

        [Boolean]$httpport,

        [Boolean]$maxconn,

        [Boolean]$maxreq,

        [Boolean]$cip,

        [Boolean]$cipheader,

        [Boolean]$cookieversion,

        [Boolean]$securecookie,

        [Boolean]$pmtumin,

        [Boolean]$pmtutimeout,

        [Boolean]$timezone,

        [Boolean]$grantquotamaxclient,

        [Boolean]$exclusivequotamaxclient,

        [Boolean]$grantquotaspillover,

        [Boolean]$exclusivequotaspillover,

        [Boolean]$useproxyport,

        [Boolean]$internaluserlogin,

        [Boolean]$icaports,

        [Boolean]$tcpcip,

        [Boolean]$servicepathingressvlan,

        [Boolean]$secureicaports,

        [Boolean]$mgmthttpport,

        [Boolean]$mgmthttpsport,

        [Boolean]$proxyprotocol,

        [Boolean]$advancedanalyticsstats,

        [Boolean]$ipttl 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNsparam: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('ftpportrange') ) { $payload.Add('ftpportrange', $ftpportrange) }
            if ( $PSBoundParameters.ContainsKey('crportrange') ) { $payload.Add('crportrange', $crportrange) }
            if ( $PSBoundParameters.ContainsKey('aftpallowrandomsourceport') ) { $payload.Add('aftpallowrandomsourceport', $aftpallowrandomsourceport) }
            if ( $PSBoundParameters.ContainsKey('httpport') ) { $payload.Add('httpport', $httpport) }
            if ( $PSBoundParameters.ContainsKey('maxconn') ) { $payload.Add('maxconn', $maxconn) }
            if ( $PSBoundParameters.ContainsKey('maxreq') ) { $payload.Add('maxreq', $maxreq) }
            if ( $PSBoundParameters.ContainsKey('cip') ) { $payload.Add('cip', $cip) }
            if ( $PSBoundParameters.ContainsKey('cipheader') ) { $payload.Add('cipheader', $cipheader) }
            if ( $PSBoundParameters.ContainsKey('cookieversion') ) { $payload.Add('cookieversion', $cookieversion) }
            if ( $PSBoundParameters.ContainsKey('securecookie') ) { $payload.Add('securecookie', $securecookie) }
            if ( $PSBoundParameters.ContainsKey('pmtumin') ) { $payload.Add('pmtumin', $pmtumin) }
            if ( $PSBoundParameters.ContainsKey('pmtutimeout') ) { $payload.Add('pmtutimeout', $pmtutimeout) }
            if ( $PSBoundParameters.ContainsKey('timezone') ) { $payload.Add('timezone', $timezone) }
            if ( $PSBoundParameters.ContainsKey('grantquotamaxclient') ) { $payload.Add('grantquotamaxclient', $grantquotamaxclient) }
            if ( $PSBoundParameters.ContainsKey('exclusivequotamaxclient') ) { $payload.Add('exclusivequotamaxclient', $exclusivequotamaxclient) }
            if ( $PSBoundParameters.ContainsKey('grantquotaspillover') ) { $payload.Add('grantquotaspillover', $grantquotaspillover) }
            if ( $PSBoundParameters.ContainsKey('exclusivequotaspillover') ) { $payload.Add('exclusivequotaspillover', $exclusivequotaspillover) }
            if ( $PSBoundParameters.ContainsKey('useproxyport') ) { $payload.Add('useproxyport', $useproxyport) }
            if ( $PSBoundParameters.ContainsKey('internaluserlogin') ) { $payload.Add('internaluserlogin', $internaluserlogin) }
            if ( $PSBoundParameters.ContainsKey('icaports') ) { $payload.Add('icaports', $icaports) }
            if ( $PSBoundParameters.ContainsKey('tcpcip') ) { $payload.Add('tcpcip', $tcpcip) }
            if ( $PSBoundParameters.ContainsKey('servicepathingressvlan') ) { $payload.Add('servicepathingressvlan', $servicepathingressvlan) }
            if ( $PSBoundParameters.ContainsKey('secureicaports') ) { $payload.Add('secureicaports', $secureicaports) }
            if ( $PSBoundParameters.ContainsKey('mgmthttpport') ) { $payload.Add('mgmthttpport', $mgmthttpport) }
            if ( $PSBoundParameters.ContainsKey('mgmthttpsport') ) { $payload.Add('mgmthttpsport', $mgmthttpsport) }
            if ( $PSBoundParameters.ContainsKey('proxyprotocol') ) { $payload.Add('proxyprotocol', $proxyprotocol) }
            if ( $PSBoundParameters.ContainsKey('advancedanalyticsstats') ) { $payload.Add('advancedanalyticsstats', $advancedanalyticsstats) }
            if ( $PSBoundParameters.ContainsKey('ipttl') ) { $payload.Add('ipttl', $ipttl) }
            if ( $PSCmdlet.ShouldProcess("nsparam", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nsparam -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNsparam: Finished"
    }
}

function Invoke-ADCGetNsparam {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for Citrix ADC parameters resource.
    .PARAMETER GetAll
        Retrieve all nsparam object(s).
    .PARAMETER Count
        If specified, the count of the nsparam object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsparam
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsparam -GetAll
        Get all nsparam data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsparam -name <string>
        Get nsparam object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsparam -Filter @{ 'name'='<value>' }
        Get nsparam data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsparam/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNsparam: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsparam objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsparam -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsparam objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsparam -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsparam objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsparam -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsparam configuration for property ''"

            } else {
                Write-Verbose "Retrieving nsparam configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsparam -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsparam: Ended"
    }
}

function Invoke-ADCAddNspartition {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for admin partition resource.
    .PARAMETER Partitionname
        Name of the Partition. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER Maxbandwidth
        Maximum bandwidth, in Kbps, that the partition can consume. A zero value indicates the bandwidth is unrestricted on the partition and it can consume up to the system limits.
    .PARAMETER Minbandwidth
        Minimum bandwidth, in Kbps, that the partition can consume. A zero value indicates the bandwidth is unrestricted on the partition and it can consume up to the system limits.
    .PARAMETER Maxconn
        Maximum number of concurrent connections that can be open in the partition. A zero value indicates no limit on number of open connections.
    .PARAMETER Maxmemlimit
        Maximum memory, in megabytes, allocated to the partition. A zero value indicates the memory is unlimited on the partition and it can consume up to the system limits.
    .PARAMETER Partitionmac
        Special MAC address for the partition which is used for communication over shared vlans in this partition. If not specified, the MAC address is auto-generated.
    .PARAMETER PassThru
        Return details about the created nspartition item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNspartition -partitionname <string>
        An example how to add nspartition configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNspartition
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspartition/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Partitionname,

        [double]$Maxbandwidth = '10240',

        [double]$Minbandwidth = '10240',

        [double]$Maxconn = '1024',

        [ValidateRange(0, 1048576)]
        [double]$Maxmemlimit = '10',

        [string]$Partitionmac,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNspartition: Starting"
    }
    process {
        try {
            $payload = @{ partitionname = $partitionname }
            if ( $PSBoundParameters.ContainsKey('maxbandwidth') ) { $payload.Add('maxbandwidth', $maxbandwidth) }
            if ( $PSBoundParameters.ContainsKey('minbandwidth') ) { $payload.Add('minbandwidth', $minbandwidth) }
            if ( $PSBoundParameters.ContainsKey('maxconn') ) { $payload.Add('maxconn', $maxconn) }
            if ( $PSBoundParameters.ContainsKey('maxmemlimit') ) { $payload.Add('maxmemlimit', $maxmemlimit) }
            if ( $PSBoundParameters.ContainsKey('partitionmac') ) { $payload.Add('partitionmac', $partitionmac) }
            if ( $PSCmdlet.ShouldProcess("nspartition", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nspartition -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNspartition -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNspartition: Finished"
    }
}

function Invoke-ADCDeleteNspartition {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for admin partition resource.
    .PARAMETER Partitionname
        Name of the Partition. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNspartition -Partitionname <string>
        An example how to delete nspartition configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNspartition
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspartition/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Partitionname 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNspartition: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$partitionname", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nspartition -NitroPath nitro/v1/config -Resource $partitionname -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNspartition: Finished"
    }
}

function Invoke-ADCUpdateNspartition {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for admin partition resource.
    .PARAMETER Partitionname
        Name of the Partition. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER Maxbandwidth
        Maximum bandwidth, in Kbps, that the partition can consume. A zero value indicates the bandwidth is unrestricted on the partition and it can consume up to the system limits.
    .PARAMETER Minbandwidth
        Minimum bandwidth, in Kbps, that the partition can consume. A zero value indicates the bandwidth is unrestricted on the partition and it can consume up to the system limits.
    .PARAMETER Maxconn
        Maximum number of concurrent connections that can be open in the partition. A zero value indicates no limit on number of open connections.
    .PARAMETER Maxmemlimit
        Maximum memory, in megabytes, allocated to the partition. A zero value indicates the memory is unlimited on the partition and it can consume up to the system limits.
    .PARAMETER Partitionmac
        Special MAC address for the partition which is used for communication over shared vlans in this partition. If not specified, the MAC address is auto-generated.
    .PARAMETER PassThru
        Return details about the created nspartition item.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNspartition -partitionname <string>
        An example how to update nspartition configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNspartition
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspartition/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Partitionname,

        [double]$Maxbandwidth,

        [double]$Minbandwidth,

        [double]$Maxconn,

        [ValidateRange(0, 1048576)]
        [double]$Maxmemlimit,

        [string]$Partitionmac,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNspartition: Starting"
    }
    process {
        try {
            $payload = @{ partitionname = $partitionname }
            if ( $PSBoundParameters.ContainsKey('maxbandwidth') ) { $payload.Add('maxbandwidth', $maxbandwidth) }
            if ( $PSBoundParameters.ContainsKey('minbandwidth') ) { $payload.Add('minbandwidth', $minbandwidth) }
            if ( $PSBoundParameters.ContainsKey('maxconn') ) { $payload.Add('maxconn', $maxconn) }
            if ( $PSBoundParameters.ContainsKey('maxmemlimit') ) { $payload.Add('maxmemlimit', $maxmemlimit) }
            if ( $PSBoundParameters.ContainsKey('partitionmac') ) { $payload.Add('partitionmac', $partitionmac) }
            if ( $PSCmdlet.ShouldProcess("nspartition", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nspartition -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNspartition -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNspartition: Finished"
    }
}

function Invoke-ADCUnsetNspartition {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for admin partition resource.
    .PARAMETER Partitionname
        Name of the Partition. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER Maxbandwidth
        Maximum bandwidth, in Kbps, that the partition can consume. A zero value indicates the bandwidth is unrestricted on the partition and it can consume up to the system limits.
    .PARAMETER Minbandwidth
        Minimum bandwidth, in Kbps, that the partition can consume. A zero value indicates the bandwidth is unrestricted on the partition and it can consume up to the system limits.
    .PARAMETER Maxconn
        Maximum number of concurrent connections that can be open in the partition. A zero value indicates no limit on number of open connections.
    .PARAMETER Maxmemlimit
        Maximum memory, in megabytes, allocated to the partition. A zero value indicates the memory is unlimited on the partition and it can consume up to the system limits.
    .PARAMETER Partitionmac
        Special MAC address for the partition which is used for communication over shared vlans in this partition. If not specified, the MAC address is auto-generated.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNspartition -partitionname <string>
        An example how to unset nspartition configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNspartition
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspartition
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Partitionname,

        [Boolean]$maxbandwidth,

        [Boolean]$minbandwidth,

        [Boolean]$maxconn,

        [Boolean]$maxmemlimit,

        [Boolean]$partitionmac 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNspartition: Starting"
    }
    process {
        try {
            $payload = @{ partitionname = $partitionname }
            if ( $PSBoundParameters.ContainsKey('maxbandwidth') ) { $payload.Add('maxbandwidth', $maxbandwidth) }
            if ( $PSBoundParameters.ContainsKey('minbandwidth') ) { $payload.Add('minbandwidth', $minbandwidth) }
            if ( $PSBoundParameters.ContainsKey('maxconn') ) { $payload.Add('maxconn', $maxconn) }
            if ( $PSBoundParameters.ContainsKey('maxmemlimit') ) { $payload.Add('maxmemlimit', $maxmemlimit) }
            if ( $PSBoundParameters.ContainsKey('partitionmac') ) { $payload.Add('partitionmac', $partitionmac) }
            if ( $PSCmdlet.ShouldProcess("$partitionname", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nspartition -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNspartition: Finished"
    }
}

function Invoke-ADCSwitchNspartition {
    <#
    .SYNOPSIS
        Switch NS configuration Object.
    .DESCRIPTION
        Configuration for admin partition resource.
    .PARAMETER Partitionname
        Name of the Partition. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER Force
        Switches to new admin partition without prompt for saving configuration. Configuration will not be saved.
    .PARAMETER Save
        Switches to new admin partition without prompt for saving configuration. Configuration will be saved.
    .PARAMETER PassThru
        Return details about the created nspartition item.
    .EXAMPLE
        PS C:\>Invoke-ADCSwitchNspartition -partitionname <string>
        An example how to switch nspartition configuration Object(s).
    .NOTES
        File Name : Invoke-ADCSwitchNspartition
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspartition/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Partitionname,

        [boolean]$Force,

        [boolean]$Save,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCSwitchNspartition: Starting"
    }
    process {
        try {
            $payload = @{ partitionname = $partitionname }
            if ( $PSBoundParameters.ContainsKey('force') ) { $payload.Add('force', $force) }
            if ( $PSBoundParameters.ContainsKey('save') ) { $payload.Add('save', $save) }
            if ( $PSCmdlet.ShouldProcess("nspartition", "Switch NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nspartition -Action switch -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNspartition -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCSwitchNspartition: Finished"
    }
}

function Invoke-ADCGetNspartition {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for admin partition resource.
    .PARAMETER Partitionname
        Name of the Partition. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER GetAll
        Retrieve all nspartition object(s).
    .PARAMETER Count
        If specified, the count of the nspartition object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartition
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartition -GetAll
        Get all nspartition data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartition -Count
        Get the number of nspartition objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartition -name <string>
        Get nspartition object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartition -Filter @{ 'name'='<value>' }
        Get nspartition data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNspartition
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspartition/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Partitionname,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNspartition: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nspartition objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nspartition objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nspartition objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nspartition configuration for property 'partitionname'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition -NitroPath nitro/v1/config -Resource $partitionname -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nspartition configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNspartition: Ended"
    }
}

function Invoke-ADCGetNspartitionmac {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for partition MACs resource.
    .PARAMETER GetAll
        Retrieve all nspartitionmac object(s).
    .PARAMETER Count
        If specified, the count of the nspartitionmac object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionmac
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionmac -GetAll
        Get all nspartitionmac data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionmac -Count
        Get the number of nspartitionmac objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionmac -name <string>
        Get nspartitionmac object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionmac -Filter @{ 'name'='<value>' }
        Get nspartitionmac data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNspartitionmac
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspartitionmac/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNspartitionmac: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nspartitionmac objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartitionmac -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nspartitionmac objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartitionmac -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nspartitionmac objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartitionmac -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nspartitionmac configuration for property ''"

            } else {
                Write-Verbose "Retrieving nspartitionmac configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartitionmac -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNspartitionmac: Ended"
    }
}

function Invoke-ADCGetNspartitionbinding {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Binding object which returns the resources bound to nspartition.
    .PARAMETER Partitionname
        Name of partition for which to display parameters.
    .PARAMETER GetAll
        Retrieve all nspartition_binding object(s).
    .PARAMETER Count
        If specified, the count of the nspartition_binding object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionbinding
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionbinding -GetAll
        Get all nspartition_binding data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionbinding -name <string>
        Get nspartition_binding object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionbinding -Filter @{ 'name'='<value>' }
        Get nspartition_binding data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNspartitionbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspartition_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Partitionname,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNspartitionbinding: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{  bulkbindings = 'yes' }
                Write-Verbose "Retrieving all nspartition_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nspartition_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nspartition_binding objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition_binding -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nspartition_binding configuration for property 'partitionname'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition_binding -NitroPath nitro/v1/config -Resource $partitionname -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nspartition_binding configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition_binding -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNspartitionbinding: Ended"
    }
}

function Invoke-ADCAddNspartitionbridgegroupbinding {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Binding object showing the bridgegroup that can be bound to nspartition.
    .PARAMETER Partitionname
        Name of the Partition. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER Bridgegroup
        Identifier of the bridge group that is assigned to this partition.
    .PARAMETER PassThru
        Return details about the created nspartition_bridgegroup_binding item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNspartitionbridgegroupbinding -partitionname <string>
        An example how to add nspartition_bridgegroup_binding configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNspartitionbridgegroupbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspartition_bridgegroup_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Partitionname,

        [ValidateRange(1, 1000)]
        [double]$Bridgegroup,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNspartitionbridgegroupbinding: Starting"
    }
    process {
        try {
            $payload = @{ partitionname = $partitionname }
            if ( $PSBoundParameters.ContainsKey('bridgegroup') ) { $payload.Add('bridgegroup', $bridgegroup) }
            if ( $PSCmdlet.ShouldProcess("nspartition_bridgegroup_binding", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nspartition_bridgegroup_binding -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNspartitionbridgegroupbinding -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNspartitionbridgegroupbinding: Finished"
    }
}

function Invoke-ADCDeleteNspartitionbridgegroupbinding {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Binding object showing the bridgegroup that can be bound to nspartition.
    .PARAMETER Partitionname
        Name of the Partition. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER Bridgegroup
        Identifier of the bridge group that is assigned to this partition.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNspartitionbridgegroupbinding -Partitionname <string>
        An example how to delete nspartition_bridgegroup_binding configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNspartitionbridgegroupbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspartition_bridgegroup_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Partitionname,

        [double]$Bridgegroup 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNspartitionbridgegroupbinding: Starting"
    }
    process {
        try {
            $arguments = @{ }
            if ( $PSBoundParameters.ContainsKey('Bridgegroup') ) { $arguments.Add('bridgegroup', $Bridgegroup) }
            if ( $PSCmdlet.ShouldProcess("$partitionname", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nspartition_bridgegroup_binding -NitroPath nitro/v1/config -Resource $partitionname -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNspartitionbridgegroupbinding: Finished"
    }
}

function Invoke-ADCGetNspartitionbridgegroupbinding {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Binding object showing the bridgegroup that can be bound to nspartition.
    .PARAMETER Partitionname
        Name of the Partition. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER GetAll
        Retrieve all nspartition_bridgegroup_binding object(s).
    .PARAMETER Count
        If specified, the count of the nspartition_bridgegroup_binding object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionbridgegroupbinding
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionbridgegroupbinding -GetAll
        Get all nspartition_bridgegroup_binding data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionbridgegroupbinding -Count
        Get the number of nspartition_bridgegroup_binding objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionbridgegroupbinding -name <string>
        Get nspartition_bridgegroup_binding object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionbridgegroupbinding -Filter @{ 'name'='<value>' }
        Get nspartition_bridgegroup_binding data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNspartitionbridgegroupbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspartition_bridgegroup_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Partitionname,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNspartitionbridgegroupbinding: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{  bulkbindings = 'yes' }
                Write-Verbose "Retrieving all nspartition_bridgegroup_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition_bridgegroup_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nspartition_bridgegroup_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition_bridgegroup_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nspartition_bridgegroup_binding objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition_bridgegroup_binding -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nspartition_bridgegroup_binding configuration for property 'partitionname'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition_bridgegroup_binding -NitroPath nitro/v1/config -Resource $partitionname -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nspartition_bridgegroup_binding configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition_bridgegroup_binding -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNspartitionbridgegroupbinding: Ended"
    }
}

function Invoke-ADCAddNspartitionvlanbinding {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Binding object showing the vlan that can be bound to nspartition.
    .PARAMETER Partitionname
        Name of the Partition. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER Vlan
        Identifier of the vlan that is assigned to this partition.
    .PARAMETER PassThru
        Return details about the created nspartition_vlan_binding item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNspartitionvlanbinding -partitionname <string>
        An example how to add nspartition_vlan_binding configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNspartitionvlanbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspartition_vlan_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Partitionname,

        [ValidateRange(1, 4094)]
        [double]$Vlan,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNspartitionvlanbinding: Starting"
    }
    process {
        try {
            $payload = @{ partitionname = $partitionname }
            if ( $PSBoundParameters.ContainsKey('vlan') ) { $payload.Add('vlan', $vlan) }
            if ( $PSCmdlet.ShouldProcess("nspartition_vlan_binding", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nspartition_vlan_binding -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNspartitionvlanbinding -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNspartitionvlanbinding: Finished"
    }
}

function Invoke-ADCDeleteNspartitionvlanbinding {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Binding object showing the vlan that can be bound to nspartition.
    .PARAMETER Partitionname
        Name of the Partition. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER Vlan
        Identifier of the vlan that is assigned to this partition.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNspartitionvlanbinding -Partitionname <string>
        An example how to delete nspartition_vlan_binding configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNspartitionvlanbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspartition_vlan_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Partitionname,

        [double]$Vlan 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNspartitionvlanbinding: Starting"
    }
    process {
        try {
            $arguments = @{ }
            if ( $PSBoundParameters.ContainsKey('Vlan') ) { $arguments.Add('vlan', $Vlan) }
            if ( $PSCmdlet.ShouldProcess("$partitionname", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nspartition_vlan_binding -NitroPath nitro/v1/config -Resource $partitionname -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNspartitionvlanbinding: Finished"
    }
}

function Invoke-ADCGetNspartitionvlanbinding {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Binding object showing the vlan that can be bound to nspartition.
    .PARAMETER Partitionname
        Name of the Partition. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER GetAll
        Retrieve all nspartition_vlan_binding object(s).
    .PARAMETER Count
        If specified, the count of the nspartition_vlan_binding object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionvlanbinding
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionvlanbinding -GetAll
        Get all nspartition_vlan_binding data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionvlanbinding -Count
        Get the number of nspartition_vlan_binding objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionvlanbinding -name <string>
        Get nspartition_vlan_binding object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionvlanbinding -Filter @{ 'name'='<value>' }
        Get nspartition_vlan_binding data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNspartitionvlanbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspartition_vlan_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Partitionname,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNspartitionvlanbinding: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{  bulkbindings = 'yes' }
                Write-Verbose "Retrieving all nspartition_vlan_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition_vlan_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nspartition_vlan_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition_vlan_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nspartition_vlan_binding objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition_vlan_binding -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nspartition_vlan_binding configuration for property 'partitionname'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition_vlan_binding -NitroPath nitro/v1/config -Resource $partitionname -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nspartition_vlan_binding configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition_vlan_binding -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNspartitionvlanbinding: Ended"
    }
}

function Invoke-ADCAddNspartitionvxlanbinding {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Binding object showing the vxlan that can be bound to nspartition.
    .PARAMETER Partitionname
        Name of the Partition. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER Vxlan
        Identifier of the vxlan that is assigned to this partition.
    .PARAMETER PassThru
        Return details about the created nspartition_vxlan_binding item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNspartitionvxlanbinding -partitionname <string>
        An example how to add nspartition_vxlan_binding configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNspartitionvxlanbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspartition_vxlan_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Partitionname,

        [ValidateRange(1, 16777215)]
        [double]$Vxlan,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNspartitionvxlanbinding: Starting"
    }
    process {
        try {
            $payload = @{ partitionname = $partitionname }
            if ( $PSBoundParameters.ContainsKey('vxlan') ) { $payload.Add('vxlan', $vxlan) }
            if ( $PSCmdlet.ShouldProcess("nspartition_vxlan_binding", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nspartition_vxlan_binding -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNspartitionvxlanbinding -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNspartitionvxlanbinding: Finished"
    }
}

function Invoke-ADCDeleteNspartitionvxlanbinding {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Binding object showing the vxlan that can be bound to nspartition.
    .PARAMETER Partitionname
        Name of the Partition. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER Vxlan
        Identifier of the vxlan that is assigned to this partition.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNspartitionvxlanbinding -Partitionname <string>
        An example how to delete nspartition_vxlan_binding configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNspartitionvxlanbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspartition_vxlan_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Partitionname,

        [double]$Vxlan 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNspartitionvxlanbinding: Starting"
    }
    process {
        try {
            $arguments = @{ }
            if ( $PSBoundParameters.ContainsKey('Vxlan') ) { $arguments.Add('vxlan', $Vxlan) }
            if ( $PSCmdlet.ShouldProcess("$partitionname", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nspartition_vxlan_binding -NitroPath nitro/v1/config -Resource $partitionname -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNspartitionvxlanbinding: Finished"
    }
}

function Invoke-ADCGetNspartitionvxlanbinding {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Binding object showing the vxlan that can be bound to nspartition.
    .PARAMETER Partitionname
        Name of the Partition. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER GetAll
        Retrieve all nspartition_vxlan_binding object(s).
    .PARAMETER Count
        If specified, the count of the nspartition_vxlan_binding object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionvxlanbinding
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionvxlanbinding -GetAll
        Get all nspartition_vxlan_binding data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionvxlanbinding -Count
        Get the number of nspartition_vxlan_binding objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionvxlanbinding -name <string>
        Get nspartition_vxlan_binding object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspartitionvxlanbinding -Filter @{ 'name'='<value>' }
        Get nspartition_vxlan_binding data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNspartitionvxlanbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspartition_vxlan_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Partitionname,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNspartitionvxlanbinding: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{  bulkbindings = 'yes' }
                Write-Verbose "Retrieving all nspartition_vxlan_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition_vxlan_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nspartition_vxlan_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition_vxlan_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nspartition_vxlan_binding objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition_vxlan_binding -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nspartition_vxlan_binding configuration for property 'partitionname'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition_vxlan_binding -NitroPath nitro/v1/config -Resource $partitionname -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nspartition_vxlan_binding configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspartition_vxlan_binding -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNspartitionvxlanbinding: Ended"
    }
}

function Invoke-ADCAddNspbr {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for Policy Based Routing(PBR) entry resource.
    .PARAMETER Name
        Name for the PBR. Must begin with an ASCII alphabetic or underscore \(_\) character, and must contain only ASCII alphanumeric, underscore, hash \(\#\), period \(.\), space, colon \(:\), at \(@\), equals \(=\), and hyphen \(-\) characters. Cannot be changed after the PBR is created.
    .PARAMETER Action
        Action to perform on the outgoing IPv4 packets that match the PBR.
        Available settings function as follows:
        * ALLOW - The Citrix ADC sends the packet to the designated next-hop router.
        * DENY - The Citrix ADC applies the routing table for normal destination-based routing.
        Possible values = ALLOW, DENY
    .PARAMETER Td
        Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0.
    .PARAMETER Srcip
        IP address or range of IP addresses to match against the source IP address of an outgoing IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 10.102.29.30-10.102.29.189.
    .PARAMETER Srcipop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Srcipval
        IP address or range of IP addresses to match against the source IP address of an outgoing IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 10.102.29.30-10.102.29.189.
    .PARAMETER Srcport
        Port number or range of port numbers to match against the source port number of an outgoing IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Srcportop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Srcportval
        Port number or range of port numbers to match against the source port number of an outgoing IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Destip
        IP address or range of IP addresses to match against the destination IP address of an outgoing IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 10.102.29.30-10.102.29.189.
    .PARAMETER Destipop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Destipval
        IP address or range of IP addresses to match against the destination IP address of an outgoing IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 10.102.29.30-10.102.29.189.
    .PARAMETER Destport
        Port number or range of port numbers to match against the destination port number of an outgoing IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Destportop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Destportval
        Port number or range of port numbers to match against the destination port number of an outgoing IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Nexthop
        IP address of the next hop router or the name of the link load balancing virtual server to which to send matching packets if action is set to ALLOW.
        If you specify a link load balancing (LLB) virtual server, which can provide a backup if a next hop link fails, first make sure that the next hops bound to the LLB virtual server are actually next hops that are directly connected to the Citrix ADC. Otherwise, the Citrix ADC throws an error when you attempt to create the PBR. The next hop can be null to represent null routes.
    .PARAMETER Nexthopval
        The Next Hop IP address or gateway name.
    .PARAMETER Iptunnel
        The Tunnel name.
    .PARAMETER Iptunnelname
        The iptunnel name where packets need to be forwarded upon.
    .PARAMETER Vxlanvlanmap
        The vlan to vxlan mapping to be applied for incoming packets over this pbr tunnel.
    .PARAMETER Srcmac
        MAC address to match against the source MAC address of an outgoing IPv4 packet.
    .PARAMETER Srcmacmask
        Used to define range of Source MAC address. It takes string of 0 and 1, 0s are for exact match and 1s for wildcard. For matching first 3 bytes of MAC address, srcMacMask value "000000111111". .
    .PARAMETER Protocol
        Protocol, identified by protocol name, to match against the protocol of an outgoing IPv4 packet.
        Possible values = ICMP, IGMP, TCP, EGP, IGP, ARGUS, UDP, RDP, RSVP, EIGRP, L2TP, ISIS, GGP, IPoverIP, ST, CBT, BBN-RCC-M, NVP-II, PUP, EMCON, XNET, CHAOS, MUX, DCN-MEAS, HMP, PRM, XNS-IDP, TRUNK-1, TRUNK-2, LEAF-1, LEAF-2, IRTP, ISO-TP4, NETBLT, MFE-NSP, MERIT-INP, SEP, 3PC, IDPR, XTP, DDP, IDPR-CMTP, TP++, IL, IPv6, SDRP, IPv6-Route, IPv6-Frag, IDRP, GRE, MHRP, BNA, ESP, AH, I-NLSP, SWIPE, NARP, MOBILE, TLSP, SKIP, ICMPV6, IPv6-NoNx, IPv6-Opts, Any-Host-Internal-Protocol, CFTP, Any-Local-Network, SAT-EXPAK, KRYPTOLAN, RVD, IPPC, Any-Distributed-File-System, TFTP, VISA, IPCV, CPNX, CPHB, WSN, PVP, BR-SAT-MO, SUN-ND, WB-MON, WB-EXPAK, ISO-IP, VMTP, SECURE-VM, VINES, TTP, NSFNET-IG, DGP, TCF, OSPFIGP, Sprite-RP, LARP, MTP, AX.25, IPIP, MICP, SCC-SP, ETHERIP, Any-Private-Encryption-Scheme, GMTP, IFMP, PNNI, PIM, ARIS, SCPS, QNX, A/N, IPComp, SNP, Compaq-Pe, IPX-in-IP, VRRP, PGM, Any-0-Hop-Protocol, ENCAP, DDX, IATP, STP, SRP, UTI, SMP, SM, PTP, FIRE, CRTP, CRUDP, SSCOPMCE, IPLT, SPS, PIPE, SCTP, FC, RSVP-E2E-IGNORE, Mobility-Header, UDPLite
    .PARAMETER Protocolnumber
        Protocol, identified by protocol number, to match against the protocol of an outgoing IPv4 packet.
    .PARAMETER Vlan
        ID of the VLAN. The Citrix ADC compares the PBR only to the outgoing packets on the specified VLAN. If you do not specify any interface ID, the appliance compares the PBR to the outgoing packets on all VLANs.
    .PARAMETER Vxlan
        ID of the VXLAN. The Citrix ADC compares the PBR only to the outgoing packets on the specified VXLAN. If you do not specify any interface ID, the appliance compares the PBR to the outgoing packets on all VXLANs.
    .PARAMETER Interface
        ID of an interface. The Citrix ADC compares the PBR only to the outgoing packets on the specified interface. If you do not specify any value, the appliance compares the PBR to the outgoing packets on all interfaces.
    .PARAMETER Priority
        Priority of the PBR, which determines the order in which it is evaluated relative to the other PBRs. If you do not specify priorities while creating PBRs, the PBRs are evaluated in the order in which they are created.
    .PARAMETER Msr
        Monitor the route specified byte Next Hop parameter. This parameter is not applicable if you specify a link load balancing (LLB) virtual server name with the Next Hop parameter.
        Possible values = ENABLED, DISABLED
    .PARAMETER Monitor
        The name of the monitor.(Can be only of type ping or ARP ).
    .PARAMETER State
        Enable or disable the PBR. After you apply the PBRs, the Citrix ADC compares outgoing packets to the enabled PBRs.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ownergroup
        The owner node group in a Cluster for this pbr rule. If ownernode is not specified then the pbr rule is treated as Striped pbr rule.
    .PARAMETER PassThru
        Return details about the created nspbr item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNspbr -name <string> -action <string>
        An example how to add nspbr configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNspbr
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspbr/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [Parameter(Mandatory)]
        [ValidateSet('ALLOW', 'DENY')]
        [string]$Action,

        [ValidateRange(0, 4094)]
        [double]$Td,

        [boolean]$Srcip,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Srcipop,

        [string]$Srcipval,

        [boolean]$Srcport,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Srcportop,

        [string]$Srcportval,

        [boolean]$Destip,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Destipop,

        [string]$Destipval,

        [boolean]$Destport,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Destportop,

        [string]$Destportval,

        [boolean]$Nexthop,

        [string]$Nexthopval,

        [boolean]$Iptunnel,

        [string]$Iptunnelname,

        [string]$Vxlanvlanmap,

        [string]$Srcmac,

        [string]$Srcmacmask = '"000000000000"',

        [ValidateSet('ICMP', 'IGMP', 'TCP', 'EGP', 'IGP', 'ARGUS', 'UDP', 'RDP', 'RSVP', 'EIGRP', 'L2TP', 'ISIS', 'GGP', 'IPoverIP', 'ST', 'CBT', 'BBN-RCC-M', 'NVP-II', 'PUP', 'EMCON', 'XNET', 'CHAOS', 'MUX', 'DCN-MEAS', 'HMP', 'PRM', 'XNS-IDP', 'TRUNK-1', 'TRUNK-2', 'LEAF-1', 'LEAF-2', 'IRTP', 'ISO-TP4', 'NETBLT', 'MFE-NSP', 'MERIT-INP', 'SEP', '3PC', 'IDPR', 'XTP', 'DDP', 'IDPR-CMTP', 'TP++', 'IL', 'IPv6', 'SDRP', 'IPv6-Route', 'IPv6-Frag', 'IDRP', 'GRE', 'MHRP', 'BNA', 'ESP', 'AH', 'I-NLSP', 'SWIPE', 'NARP', 'MOBILE', 'TLSP', 'SKIP', 'ICMPV6', 'IPv6-NoNx', 'IPv6-Opts', 'Any-Host-Internal-Protocol', 'CFTP', 'Any-Local-Network', 'SAT-EXPAK', 'KRYPTOLAN', 'RVD', 'IPPC', 'Any-Distributed-File-System', 'TFTP', 'VISA', 'IPCV', 'CPNX', 'CPHB', 'WSN', 'PVP', 'BR-SAT-MO', 'SUN-ND', 'WB-MON', 'WB-EXPAK', 'ISO-IP', 'VMTP', 'SECURE-VM', 'VINES', 'TTP', 'NSFNET-IG', 'DGP', 'TCF', 'OSPFIGP', 'Sprite-RP', 'LARP', 'MTP', 'AX.25', 'IPIP', 'MICP', 'SCC-SP', 'ETHERIP', 'Any-Private-Encryption-Scheme', 'GMTP', 'IFMP', 'PNNI', 'PIM', 'ARIS', 'SCPS', 'QNX', 'A/N', 'IPComp', 'SNP', 'Compaq-Pe', 'IPX-in-IP', 'VRRP', 'PGM', 'Any-0-Hop-Protocol', 'ENCAP', 'DDX', 'IATP', 'STP', 'SRP', 'UTI', 'SMP', 'SM', 'PTP', 'FIRE', 'CRTP', 'CRUDP', 'SSCOPMCE', 'IPLT', 'SPS', 'PIPE', 'SCTP', 'FC', 'RSVP-E2E-IGNORE', 'Mobility-Header', 'UDPLite')]
        [string]$Protocol,

        [ValidateRange(1, 255)]
        [double]$Protocolnumber,

        [ValidateRange(1, 4094)]
        [double]$Vlan,

        [ValidateRange(1, 16777215)]
        [double]$Vxlan,

        [string]$Interface,

        [ValidateRange(1, 81920)]
        [double]$Priority,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Msr = 'DISABLED',

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Monitor,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$State = 'ENABLED',

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Ownergroup = 'DEFAULT_NG',

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNspbr: Starting"
    }
    process {
        try {
            $payload = @{ name = $name
                action         = $action
            }
            if ( $PSBoundParameters.ContainsKey('td') ) { $payload.Add('td', $td) }
            if ( $PSBoundParameters.ContainsKey('srcip') ) { $payload.Add('srcip', $srcip) }
            if ( $PSBoundParameters.ContainsKey('srcipop') ) { $payload.Add('srcipop', $srcipop) }
            if ( $PSBoundParameters.ContainsKey('srcipval') ) { $payload.Add('srcipval', $srcipval) }
            if ( $PSBoundParameters.ContainsKey('srcport') ) { $payload.Add('srcport', $srcport) }
            if ( $PSBoundParameters.ContainsKey('srcportop') ) { $payload.Add('srcportop', $srcportop) }
            if ( $PSBoundParameters.ContainsKey('srcportval') ) { $payload.Add('srcportval', $srcportval) }
            if ( $PSBoundParameters.ContainsKey('destip') ) { $payload.Add('destip', $destip) }
            if ( $PSBoundParameters.ContainsKey('destipop') ) { $payload.Add('destipop', $destipop) }
            if ( $PSBoundParameters.ContainsKey('destipval') ) { $payload.Add('destipval', $destipval) }
            if ( $PSBoundParameters.ContainsKey('destport') ) { $payload.Add('destport', $destport) }
            if ( $PSBoundParameters.ContainsKey('destportop') ) { $payload.Add('destportop', $destportop) }
            if ( $PSBoundParameters.ContainsKey('destportval') ) { $payload.Add('destportval', $destportval) }
            if ( $PSBoundParameters.ContainsKey('nexthop') ) { $payload.Add('nexthop', $nexthop) }
            if ( $PSBoundParameters.ContainsKey('nexthopval') ) { $payload.Add('nexthopval', $nexthopval) }
            if ( $PSBoundParameters.ContainsKey('iptunnel') ) { $payload.Add('iptunnel', $iptunnel) }
            if ( $PSBoundParameters.ContainsKey('iptunnelname') ) { $payload.Add('iptunnelname', $iptunnelname) }
            if ( $PSBoundParameters.ContainsKey('vxlanvlanmap') ) { $payload.Add('vxlanvlanmap', $vxlanvlanmap) }
            if ( $PSBoundParameters.ContainsKey('srcmac') ) { $payload.Add('srcmac', $srcmac) }
            if ( $PSBoundParameters.ContainsKey('srcmacmask') ) { $payload.Add('srcmacmask', $srcmacmask) }
            if ( $PSBoundParameters.ContainsKey('protocol') ) { $payload.Add('protocol', $protocol) }
            if ( $PSBoundParameters.ContainsKey('protocolnumber') ) { $payload.Add('protocolnumber', $protocolnumber) }
            if ( $PSBoundParameters.ContainsKey('vlan') ) { $payload.Add('vlan', $vlan) }
            if ( $PSBoundParameters.ContainsKey('vxlan') ) { $payload.Add('vxlan', $vxlan) }
            if ( $PSBoundParameters.ContainsKey('Interface') ) { $payload.Add('Interface', $Interface) }
            if ( $PSBoundParameters.ContainsKey('priority') ) { $payload.Add('priority', $priority) }
            if ( $PSBoundParameters.ContainsKey('msr') ) { $payload.Add('msr', $msr) }
            if ( $PSBoundParameters.ContainsKey('monitor') ) { $payload.Add('monitor', $monitor) }
            if ( $PSBoundParameters.ContainsKey('state') ) { $payload.Add('state', $state) }
            if ( $PSBoundParameters.ContainsKey('ownergroup') ) { $payload.Add('ownergroup', $ownergroup) }
            if ( $PSCmdlet.ShouldProcess("nspbr", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nspbr -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNspbr -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNspbr: Finished"
    }
}

function Invoke-ADCDeleteNspbr {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for Policy Based Routing(PBR) entry resource.
    .PARAMETER Name
        Name for the PBR. Must begin with an ASCII alphabetic or underscore \(_\) character, and must contain only ASCII alphanumeric, underscore, hash \(\#\), period \(.\), space, colon \(:\), at \(@\), equals \(=\), and hyphen \(-\) characters. Cannot be changed after the PBR is created.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNspbr -Name <string>
        An example how to delete nspbr configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNspbr
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspbr/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Name 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNspbr: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$name", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nspbr -NitroPath nitro/v1/config -Resource $name -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNspbr: Finished"
    }
}

function Invoke-ADCUpdateNspbr {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for Policy Based Routing(PBR) entry resource.
    .PARAMETER Name
        Name for the PBR. Must begin with an ASCII alphabetic or underscore \(_\) character, and must contain only ASCII alphanumeric, underscore, hash \(\#\), period \(.\), space, colon \(:\), at \(@\), equals \(=\), and hyphen \(-\) characters. Cannot be changed after the PBR is created.
    .PARAMETER Action
        Action to perform on the outgoing IPv4 packets that match the PBR.
        Available settings function as follows:
        * ALLOW - The Citrix ADC sends the packet to the designated next-hop router.
        * DENY - The Citrix ADC applies the routing table for normal destination-based routing.
        Possible values = ALLOW, DENY
    .PARAMETER Srcip
        IP address or range of IP addresses to match against the source IP address of an outgoing IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 10.102.29.30-10.102.29.189.
    .PARAMETER Srcipop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Srcipval
        IP address or range of IP addresses to match against the source IP address of an outgoing IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 10.102.29.30-10.102.29.189.
    .PARAMETER Srcport
        Port number or range of port numbers to match against the source port number of an outgoing IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Srcportop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Srcportval
        Port number or range of port numbers to match against the source port number of an outgoing IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Destip
        IP address or range of IP addresses to match against the destination IP address of an outgoing IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 10.102.29.30-10.102.29.189.
    .PARAMETER Destipop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Destipval
        IP address or range of IP addresses to match against the destination IP address of an outgoing IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 10.102.29.30-10.102.29.189.
    .PARAMETER Destport
        Port number or range of port numbers to match against the destination port number of an outgoing IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Destportop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Destportval
        Port number or range of port numbers to match against the destination port number of an outgoing IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Nexthop
        IP address of the next hop router or the name of the link load balancing virtual server to which to send matching packets if action is set to ALLOW.
        If you specify a link load balancing (LLB) virtual server, which can provide a backup if a next hop link fails, first make sure that the next hops bound to the LLB virtual server are actually next hops that are directly connected to the Citrix ADC. Otherwise, the Citrix ADC throws an error when you attempt to create the PBR. The next hop can be null to represent null routes.
    .PARAMETER Nexthopval
        The Next Hop IP address or gateway name.
    .PARAMETER Iptunnel
        The Tunnel name.
    .PARAMETER Iptunnelname
        The iptunnel name where packets need to be forwarded upon.
    .PARAMETER Vxlanvlanmap
        The vlan to vxlan mapping to be applied for incoming packets over this pbr tunnel.
    .PARAMETER Srcmac
        MAC address to match against the source MAC address of an outgoing IPv4 packet.
    .PARAMETER Srcmacmask
        Used to define range of Source MAC address. It takes string of 0 and 1, 0s are for exact match and 1s for wildcard. For matching first 3 bytes of MAC address, srcMacMask value "000000111111". .
    .PARAMETER Protocol
        Protocol, identified by protocol name, to match against the protocol of an outgoing IPv4 packet.
        Possible values = ICMP, IGMP, TCP, EGP, IGP, ARGUS, UDP, RDP, RSVP, EIGRP, L2TP, ISIS, GGP, IPoverIP, ST, CBT, BBN-RCC-M, NVP-II, PUP, EMCON, XNET, CHAOS, MUX, DCN-MEAS, HMP, PRM, XNS-IDP, TRUNK-1, TRUNK-2, LEAF-1, LEAF-2, IRTP, ISO-TP4, NETBLT, MFE-NSP, MERIT-INP, SEP, 3PC, IDPR, XTP, DDP, IDPR-CMTP, TP++, IL, IPv6, SDRP, IPv6-Route, IPv6-Frag, IDRP, GRE, MHRP, BNA, ESP, AH, I-NLSP, SWIPE, NARP, MOBILE, TLSP, SKIP, ICMPV6, IPv6-NoNx, IPv6-Opts, Any-Host-Internal-Protocol, CFTP, Any-Local-Network, SAT-EXPAK, KRYPTOLAN, RVD, IPPC, Any-Distributed-File-System, TFTP, VISA, IPCV, CPNX, CPHB, WSN, PVP, BR-SAT-MO, SUN-ND, WB-MON, WB-EXPAK, ISO-IP, VMTP, SECURE-VM, VINES, TTP, NSFNET-IG, DGP, TCF, OSPFIGP, Sprite-RP, LARP, MTP, AX.25, IPIP, MICP, SCC-SP, ETHERIP, Any-Private-Encryption-Scheme, GMTP, IFMP, PNNI, PIM, ARIS, SCPS, QNX, A/N, IPComp, SNP, Compaq-Pe, IPX-in-IP, VRRP, PGM, Any-0-Hop-Protocol, ENCAP, DDX, IATP, STP, SRP, UTI, SMP, SM, PTP, FIRE, CRTP, CRUDP, SSCOPMCE, IPLT, SPS, PIPE, SCTP, FC, RSVP-E2E-IGNORE, Mobility-Header, UDPLite
    .PARAMETER Protocolnumber
        Protocol, identified by protocol number, to match against the protocol of an outgoing IPv4 packet.
    .PARAMETER Vlan
        ID of the VLAN. The Citrix ADC compares the PBR only to the outgoing packets on the specified VLAN. If you do not specify any interface ID, the appliance compares the PBR to the outgoing packets on all VLANs.
    .PARAMETER Vxlan
        ID of the VXLAN. The Citrix ADC compares the PBR only to the outgoing packets on the specified VXLAN. If you do not specify any interface ID, the appliance compares the PBR to the outgoing packets on all VXLANs.
    .PARAMETER Interface
        ID of an interface. The Citrix ADC compares the PBR only to the outgoing packets on the specified interface. If you do not specify any value, the appliance compares the PBR to the outgoing packets on all interfaces.
    .PARAMETER Priority
        Priority of the PBR, which determines the order in which it is evaluated relative to the other PBRs. If you do not specify priorities while creating PBRs, the PBRs are evaluated in the order in which they are created.
    .PARAMETER Msr
        Monitor the route specified byte Next Hop parameter. This parameter is not applicable if you specify a link load balancing (LLB) virtual server name with the Next Hop parameter.
        Possible values = ENABLED, DISABLED
    .PARAMETER Monitor
        The name of the monitor.(Can be only of type ping or ARP ).
    .PARAMETER PassThru
        Return details about the created nspbr item.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNspbr -name <string>
        An example how to update nspbr configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNspbr
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspbr/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [ValidateSet('ALLOW', 'DENY')]
        [string]$Action,

        [boolean]$Srcip,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Srcipop,

        [string]$Srcipval,

        [boolean]$Srcport,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Srcportop,

        [string]$Srcportval,

        [boolean]$Destip,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Destipop,

        [string]$Destipval,

        [boolean]$Destport,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Destportop,

        [string]$Destportval,

        [boolean]$Nexthop,

        [string]$Nexthopval,

        [boolean]$Iptunnel,

        [string]$Iptunnelname,

        [string]$Vxlanvlanmap,

        [string]$Srcmac,

        [string]$Srcmacmask,

        [ValidateSet('ICMP', 'IGMP', 'TCP', 'EGP', 'IGP', 'ARGUS', 'UDP', 'RDP', 'RSVP', 'EIGRP', 'L2TP', 'ISIS', 'GGP', 'IPoverIP', 'ST', 'CBT', 'BBN-RCC-M', 'NVP-II', 'PUP', 'EMCON', 'XNET', 'CHAOS', 'MUX', 'DCN-MEAS', 'HMP', 'PRM', 'XNS-IDP', 'TRUNK-1', 'TRUNK-2', 'LEAF-1', 'LEAF-2', 'IRTP', 'ISO-TP4', 'NETBLT', 'MFE-NSP', 'MERIT-INP', 'SEP', '3PC', 'IDPR', 'XTP', 'DDP', 'IDPR-CMTP', 'TP++', 'IL', 'IPv6', 'SDRP', 'IPv6-Route', 'IPv6-Frag', 'IDRP', 'GRE', 'MHRP', 'BNA', 'ESP', 'AH', 'I-NLSP', 'SWIPE', 'NARP', 'MOBILE', 'TLSP', 'SKIP', 'ICMPV6', 'IPv6-NoNx', 'IPv6-Opts', 'Any-Host-Internal-Protocol', 'CFTP', 'Any-Local-Network', 'SAT-EXPAK', 'KRYPTOLAN', 'RVD', 'IPPC', 'Any-Distributed-File-System', 'TFTP', 'VISA', 'IPCV', 'CPNX', 'CPHB', 'WSN', 'PVP', 'BR-SAT-MO', 'SUN-ND', 'WB-MON', 'WB-EXPAK', 'ISO-IP', 'VMTP', 'SECURE-VM', 'VINES', 'TTP', 'NSFNET-IG', 'DGP', 'TCF', 'OSPFIGP', 'Sprite-RP', 'LARP', 'MTP', 'AX.25', 'IPIP', 'MICP', 'SCC-SP', 'ETHERIP', 'Any-Private-Encryption-Scheme', 'GMTP', 'IFMP', 'PNNI', 'PIM', 'ARIS', 'SCPS', 'QNX', 'A/N', 'IPComp', 'SNP', 'Compaq-Pe', 'IPX-in-IP', 'VRRP', 'PGM', 'Any-0-Hop-Protocol', 'ENCAP', 'DDX', 'IATP', 'STP', 'SRP', 'UTI', 'SMP', 'SM', 'PTP', 'FIRE', 'CRTP', 'CRUDP', 'SSCOPMCE', 'IPLT', 'SPS', 'PIPE', 'SCTP', 'FC', 'RSVP-E2E-IGNORE', 'Mobility-Header', 'UDPLite')]
        [string]$Protocol,

        [ValidateRange(1, 255)]
        [double]$Protocolnumber,

        [ValidateRange(1, 4094)]
        [double]$Vlan,

        [ValidateRange(1, 16777215)]
        [double]$Vxlan,

        [string]$Interface,

        [ValidateRange(1, 81920)]
        [double]$Priority,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Msr,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Monitor,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNspbr: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('action') ) { $payload.Add('action', $action) }
            if ( $PSBoundParameters.ContainsKey('srcip') ) { $payload.Add('srcip', $srcip) }
            if ( $PSBoundParameters.ContainsKey('srcipop') ) { $payload.Add('srcipop', $srcipop) }
            if ( $PSBoundParameters.ContainsKey('srcipval') ) { $payload.Add('srcipval', $srcipval) }
            if ( $PSBoundParameters.ContainsKey('srcport') ) { $payload.Add('srcport', $srcport) }
            if ( $PSBoundParameters.ContainsKey('srcportop') ) { $payload.Add('srcportop', $srcportop) }
            if ( $PSBoundParameters.ContainsKey('srcportval') ) { $payload.Add('srcportval', $srcportval) }
            if ( $PSBoundParameters.ContainsKey('destip') ) { $payload.Add('destip', $destip) }
            if ( $PSBoundParameters.ContainsKey('destipop') ) { $payload.Add('destipop', $destipop) }
            if ( $PSBoundParameters.ContainsKey('destipval') ) { $payload.Add('destipval', $destipval) }
            if ( $PSBoundParameters.ContainsKey('destport') ) { $payload.Add('destport', $destport) }
            if ( $PSBoundParameters.ContainsKey('destportop') ) { $payload.Add('destportop', $destportop) }
            if ( $PSBoundParameters.ContainsKey('destportval') ) { $payload.Add('destportval', $destportval) }
            if ( $PSBoundParameters.ContainsKey('nexthop') ) { $payload.Add('nexthop', $nexthop) }
            if ( $PSBoundParameters.ContainsKey('nexthopval') ) { $payload.Add('nexthopval', $nexthopval) }
            if ( $PSBoundParameters.ContainsKey('iptunnel') ) { $payload.Add('iptunnel', $iptunnel) }
            if ( $PSBoundParameters.ContainsKey('iptunnelname') ) { $payload.Add('iptunnelname', $iptunnelname) }
            if ( $PSBoundParameters.ContainsKey('vxlanvlanmap') ) { $payload.Add('vxlanvlanmap', $vxlanvlanmap) }
            if ( $PSBoundParameters.ContainsKey('srcmac') ) { $payload.Add('srcmac', $srcmac) }
            if ( $PSBoundParameters.ContainsKey('srcmacmask') ) { $payload.Add('srcmacmask', $srcmacmask) }
            if ( $PSBoundParameters.ContainsKey('protocol') ) { $payload.Add('protocol', $protocol) }
            if ( $PSBoundParameters.ContainsKey('protocolnumber') ) { $payload.Add('protocolnumber', $protocolnumber) }
            if ( $PSBoundParameters.ContainsKey('vlan') ) { $payload.Add('vlan', $vlan) }
            if ( $PSBoundParameters.ContainsKey('vxlan') ) { $payload.Add('vxlan', $vxlan) }
            if ( $PSBoundParameters.ContainsKey('Interface') ) { $payload.Add('Interface', $Interface) }
            if ( $PSBoundParameters.ContainsKey('priority') ) { $payload.Add('priority', $priority) }
            if ( $PSBoundParameters.ContainsKey('msr') ) { $payload.Add('msr', $msr) }
            if ( $PSBoundParameters.ContainsKey('monitor') ) { $payload.Add('monitor', $monitor) }
            if ( $PSCmdlet.ShouldProcess("nspbr", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nspbr -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNspbr -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNspbr: Finished"
    }
}

function Invoke-ADCUnsetNspbr {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for Policy Based Routing(PBR) entry resource.
    .PARAMETER Name
        Name for the PBR. Must begin with an ASCII alphabetic or underscore \(_\) character, and must contain only ASCII alphanumeric, underscore, hash \(\#\), period \(.\), space, colon \(:\), at \(@\), equals \(=\), and hyphen \(-\) characters. Cannot be changed after the PBR is created.
    .PARAMETER Srcip
        IP address or range of IP addresses to match against the source IP address of an outgoing IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 10.102.29.30-10.102.29.189.
    .PARAMETER Srcport
        Port number or range of port numbers to match against the source port number of an outgoing IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Destip
        IP address or range of IP addresses to match against the destination IP address of an outgoing IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 10.102.29.30-10.102.29.189.
    .PARAMETER Destport
        Port number or range of port numbers to match against the destination port number of an outgoing IPv4 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Nexthop
        IP address of the next hop router or the name of the link load balancing virtual server to which to send matching packets if action is set to ALLOW.
        If you specify a link load balancing (LLB) virtual server, which can provide a backup if a next hop link fails, first make sure that the next hops bound to the LLB virtual server are actually next hops that are directly connected to the Citrix ADC. Otherwise, the Citrix ADC throws an error when you attempt to create the PBR. The next hop can be null to represent null routes.
    .PARAMETER Iptunnel
        The Tunnel name.
    .PARAMETER Vxlanvlanmap
        The vlan to vxlan mapping to be applied for incoming packets over this pbr tunnel.
    .PARAMETER Srcmac
        MAC address to match against the source MAC address of an outgoing IPv4 packet.
    .PARAMETER Srcmacmask
        Used to define range of Source MAC address. It takes string of 0 and 1, 0s are for exact match and 1s for wildcard. For matching first 3 bytes of MAC address, srcMacMask value "000000111111". .
    .PARAMETER Protocol
        Protocol, identified by protocol name, to match against the protocol of an outgoing IPv4 packet.
        Possible values = ICMP, IGMP, TCP, EGP, IGP, ARGUS, UDP, RDP, RSVP, EIGRP, L2TP, ISIS, GGP, IPoverIP, ST, CBT, BBN-RCC-M, NVP-II, PUP, EMCON, XNET, CHAOS, MUX, DCN-MEAS, HMP, PRM, XNS-IDP, TRUNK-1, TRUNK-2, LEAF-1, LEAF-2, IRTP, ISO-TP4, NETBLT, MFE-NSP, MERIT-INP, SEP, 3PC, IDPR, XTP, DDP, IDPR-CMTP, TP++, IL, IPv6, SDRP, IPv6-Route, IPv6-Frag, IDRP, GRE, MHRP, BNA, ESP, AH, I-NLSP, SWIPE, NARP, MOBILE, TLSP, SKIP, ICMPV6, IPv6-NoNx, IPv6-Opts, Any-Host-Internal-Protocol, CFTP, Any-Local-Network, SAT-EXPAK, KRYPTOLAN, RVD, IPPC, Any-Distributed-File-System, TFTP, VISA, IPCV, CPNX, CPHB, WSN, PVP, BR-SAT-MO, SUN-ND, WB-MON, WB-EXPAK, ISO-IP, VMTP, SECURE-VM, VINES, TTP, NSFNET-IG, DGP, TCF, OSPFIGP, Sprite-RP, LARP, MTP, AX.25, IPIP, MICP, SCC-SP, ETHERIP, Any-Private-Encryption-Scheme, GMTP, IFMP, PNNI, PIM, ARIS, SCPS, QNX, A/N, IPComp, SNP, Compaq-Pe, IPX-in-IP, VRRP, PGM, Any-0-Hop-Protocol, ENCAP, DDX, IATP, STP, SRP, UTI, SMP, SM, PTP, FIRE, CRTP, CRUDP, SSCOPMCE, IPLT, SPS, PIPE, SCTP, FC, RSVP-E2E-IGNORE, Mobility-Header, UDPLite
    .PARAMETER Vlan
        ID of the VLAN. The Citrix ADC compares the PBR only to the outgoing packets on the specified VLAN. If you do not specify any interface ID, the appliance compares the PBR to the outgoing packets on all VLANs.
    .PARAMETER Vxlan
        ID of the VXLAN. The Citrix ADC compares the PBR only to the outgoing packets on the specified VXLAN. If you do not specify any interface ID, the appliance compares the PBR to the outgoing packets on all VXLANs.
    .PARAMETER Interface
        ID of an interface. The Citrix ADC compares the PBR only to the outgoing packets on the specified interface. If you do not specify any value, the appliance compares the PBR to the outgoing packets on all interfaces.
    .PARAMETER Msr
        Monitor the route specified byte Next Hop parameter. This parameter is not applicable if you specify a link load balancing (LLB) virtual server name with the Next Hop parameter.
        Possible values = ENABLED, DISABLED
    .PARAMETER Monitor
        The name of the monitor.(Can be only of type ping or ARP ).
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNspbr -name <string>
        An example how to unset nspbr configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNspbr
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspbr
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [Boolean]$srcip,

        [Boolean]$srcport,

        [Boolean]$destip,

        [Boolean]$destport,

        [Boolean]$nexthop,

        [Boolean]$iptunnel,

        [Boolean]$vxlanvlanmap,

        [Boolean]$srcmac,

        [Boolean]$srcmacmask,

        [Boolean]$protocol,

        [Boolean]$vlan,

        [Boolean]$vxlan,

        [Boolean]$Interface,

        [Boolean]$msr,

        [Boolean]$monitor 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNspbr: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('srcip') ) { $payload.Add('srcip', $srcip) }
            if ( $PSBoundParameters.ContainsKey('srcport') ) { $payload.Add('srcport', $srcport) }
            if ( $PSBoundParameters.ContainsKey('destip') ) { $payload.Add('destip', $destip) }
            if ( $PSBoundParameters.ContainsKey('destport') ) { $payload.Add('destport', $destport) }
            if ( $PSBoundParameters.ContainsKey('nexthop') ) { $payload.Add('nexthop', $nexthop) }
            if ( $PSBoundParameters.ContainsKey('iptunnel') ) { $payload.Add('iptunnel', $iptunnel) }
            if ( $PSBoundParameters.ContainsKey('vxlanvlanmap') ) { $payload.Add('vxlanvlanmap', $vxlanvlanmap) }
            if ( $PSBoundParameters.ContainsKey('srcmac') ) { $payload.Add('srcmac', $srcmac) }
            if ( $PSBoundParameters.ContainsKey('srcmacmask') ) { $payload.Add('srcmacmask', $srcmacmask) }
            if ( $PSBoundParameters.ContainsKey('protocol') ) { $payload.Add('protocol', $protocol) }
            if ( $PSBoundParameters.ContainsKey('vlan') ) { $payload.Add('vlan', $vlan) }
            if ( $PSBoundParameters.ContainsKey('vxlan') ) { $payload.Add('vxlan', $vxlan) }
            if ( $PSBoundParameters.ContainsKey('Interface') ) { $payload.Add('Interface', $Interface) }
            if ( $PSBoundParameters.ContainsKey('msr') ) { $payload.Add('msr', $msr) }
            if ( $PSBoundParameters.ContainsKey('monitor') ) { $payload.Add('monitor', $monitor) }
            if ( $PSCmdlet.ShouldProcess("$name", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nspbr -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNspbr: Finished"
    }
}

function Invoke-ADCEnableNspbr {
    <#
    .SYNOPSIS
        Enable NS configuration Object.
    .DESCRIPTION
        Configuration for Policy Based Routing(PBR) entry resource.
    .PARAMETER Name
        Name for the PBR. Must begin with an ASCII alphabetic or underscore \(_\) character, and must contain only ASCII alphanumeric, underscore, hash \(\#\), period \(.\), space, colon \(:\), at \(@\), equals \(=\), and hyphen \(-\) characters. Cannot be changed after the PBR is created.
    .EXAMPLE
        PS C:\>Invoke-ADCEnableNspbr -name <string>
        An example how to enable nspbr configuration Object(s).
    .NOTES
        File Name : Invoke-ADCEnableNspbr
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspbr/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name 

    )
    begin {
        Write-Verbose "Invoke-ADCEnableNspbr: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }

            if ( $PSCmdlet.ShouldProcess($Name, "Enable NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nspbr -Action enable -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCEnableNspbr: Finished"
    }
}

function Invoke-ADCDisableNspbr {
    <#
    .SYNOPSIS
        Disable NS configuration Object.
    .DESCRIPTION
        Configuration for Policy Based Routing(PBR) entry resource.
    .PARAMETER Name
        Name for the PBR. Must begin with an ASCII alphabetic or underscore \(_\) character, and must contain only ASCII alphanumeric, underscore, hash \(\#\), period \(.\), space, colon \(:\), at \(@\), equals \(=\), and hyphen \(-\) characters. Cannot be changed after the PBR is created.
    .EXAMPLE
        PS C:\>Invoke-ADCDisableNspbr -name <string>
        An example how to disable nspbr configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDisableNspbr
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspbr/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name 

    )
    begin {
        Write-Verbose "Invoke-ADCDisableNspbr: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }

            if ( $PSCmdlet.ShouldProcess($Name, "Disable NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nspbr -Action disable -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDisableNspbr: Finished"
    }
}

function Invoke-ADCGetNspbr {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for Policy Based Routing(PBR) entry resource.
    .PARAMETER Name
        Name for the PBR. Must begin with an ASCII alphabetic or underscore \(_\) character, and must contain only ASCII alphanumeric, underscore, hash \(\#\), period \(.\), space, colon \(:\), at \(@\), equals \(=\), and hyphen \(-\) characters. Cannot be changed after the PBR is created.
    .PARAMETER GetAll
        Retrieve all nspbr object(s).
    .PARAMETER Count
        If specified, the count of the nspbr object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspbr
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspbr -GetAll
        Get all nspbr data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspbr -Count
        Get the number of nspbr objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspbr -name <string>
        Get nspbr object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspbr -Filter @{ 'name'='<value>' }
        Get nspbr data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNspbr
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspbr/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNspbr: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nspbr objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspbr -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nspbr objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspbr -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nspbr objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspbr -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nspbr configuration for property 'name'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspbr -NitroPath nitro/v1/config -Resource $name -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nspbr configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspbr -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNspbr: Ended"
    }
}

function Invoke-ADCAddNspbr6 {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for PBR6 entry resource.
    .PARAMETER Name
        Name for the PBR6. Must begin with an ASCII alphabetic or underscore \(_\) character, and must contain only ASCII alphanumeric, underscore, hash \(\#\), period \(.\), space, colon \(:\), at \(@\), equals \(=\), and hyphen \(-\) characters. Cannot be changed after the PBR6 is created.
    .PARAMETER Td
        Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0.
    .PARAMETER Action
        Action to perform on the outgoing IPv6 packets that match the PBR6.
        Available settings function as follows:
        * ALLOW - The Citrix ADC sends the packet to the designated next-hop router.
        * DENY - The Citrix ADC applies the routing table for normal destination-based routing.
        Possible values = ALLOW, DENY
    .PARAMETER Srcipv6
        IP address or range of IP addresses to match against the source IP address of an outgoing IPv6 packet. In the command line interface, separate the range with a hyphen.
    .PARAMETER Srcipop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Srcipv6val
        IP address or range of IP addresses to match against the source IP address of an outgoing IPv6 packet. In the command line interface, separate the range with a hyphen.
    .PARAMETER Srcport
        Port number or range of port numbers to match against the source port number of an outgoing IPv6 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
    .PARAMETER Srcportop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Srcportval
        Source port (range).
    .PARAMETER Destipv6
        IP address or range of IP addresses to match against the destination IP address of an outgoing IPv6 packet. In the command line interface, separate the range with a hyphen.
    .PARAMETER Destipop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Destipv6val
        IP address or range of IP addresses to match against the destination IP address of an outgoing IPv6 packet. In the command line interface, separate the range with a hyphen.
    .PARAMETER Destport
        Port number or range of port numbers to match against the destination port number of an outgoing IPv6 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Destportop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Destportval
        Destination port (range).
    .PARAMETER Srcmac
        MAC address to match against the source MAC address of an outgoing IPv6 packet.
    .PARAMETER Srcmacmask
        Used to define range of Source MAC address. It takes string of 0 and 1, 0s are for exact match and 1s for wildcard. For matching first 3 bytes of MAC address, srcMacMask value "000000111111". .
    .PARAMETER Protocol
        Protocol, identified by protocol name, to match against the protocol of an outgoing IPv6 packet.
        Possible values = ICMPV6, TCP, UDP, ICMP, IGMP, EGP, IGP, ARGUS, RDP, RSVP, EIGRP, L2TP, ISIS, GGP, IPoverIP, ST, CBT, BBN-RCC-M, NVP-II, PUP, EMCON, XNET, CHAOS, MUX, DCN-MEAS, HMP, PRM, XNS-IDP, TRUNK-1, TRUNK-2, LEAF-1, LEAF-2, IRTP, ISO-TP4, NETBLT, MFE-NSP, MERIT-INP, SEP, 3PC, IDPR, XTP, DDP, IDPR-CMTP, TP++, IL, IPv6, SDRP, IPv6-Route, IPv6-Frag, IDRP, GRE, MHRP, BNA, ESP, AH, I-NLSP, SWIPE, NARP, MOBILE, TLSP, SKIP, IPv6-NoNx, IPv6-Opts, Any-Host-Internal-Protocol, CFTP, Any-Local-Network, SAT-EXPAK, KRYPTOLAN, RVD, IPPC, Any-Distributed-File-System, TFTP, VISA, IPCV, CPNX, CPHB, WSN, PVP, BR-SAT-MO, SUN-ND, WB-MON, WB-EXPAK, ISO-IP, VMTP, SECURE-VM, VINES, TTP, NSFNET-IG, DGP, TCF, OSPFIGP, Sprite-RP, LARP, MTP, AX.25, IPIP, MICP, SCC-SP, ETHERIP, Any-Private-Encryption-Scheme, GMTP, IFMP, PNNI, PIM, ARIS, SCPS, QNX, A/N, IPComp, SNP, Compaq-Pe, IPX-in-IP, VRRP, PGM, Any-0-Hop-Protocol, ENCAP, DDX, IATP, STP, SRP, UTI, SMP, SM, PTP, FIRE, CRTP, CRUDP, SSCOPMCE, IPLT, SPS, PIPE, SCTP, FC, RSVP-E2E-IGNORE, Mobility-Header, UDPLite
    .PARAMETER Protocolnumber
        Protocol, identified by protocol number, to match against the protocol of an outgoing IPv6 packet.
    .PARAMETER Vlan
        ID of the VLAN. The Citrix ADC compares the PBR6 only to the outgoing packets on the specified VLAN. If you do not specify an interface ID, the appliance compares the PBR6 to the outgoing packets on all VLANs.
    .PARAMETER Vxlan
        ID of the VXLAN. The Citrix ADC compares the PBR6 only to the outgoing packets on the specified VXLAN. If you do not specify an interface ID, the appliance compares the PBR6 to the outgoing packets on all VXLANs.
    .PARAMETER Interface
        ID of an interface. The Citrix ADC compares the PBR6 only to the outgoing packets on the specified interface. If you do not specify a value, the appliance compares the PBR6 to the outgoing packets on all interfaces.
    .PARAMETER Priority
        Priority of the PBR6, which determines the order in which it is evaluated relative to the other PBR6s. If you do not specify priorities while creating PBR6s, the PBR6s are evaluated in the order in which they are created.
    .PARAMETER State
        Enable or disable the PBR6. After you apply the PBR6s, the Citrix ADC compares outgoing packets to the enabled PBR6s.
        Possible values = ENABLED, DISABLED
    .PARAMETER Msr
        Monitor the route specified by the Next Hop parameter.
        Possible values = ENABLED, DISABLED
    .PARAMETER Monitor
        The name of the monitor.(Can be only of type ping or ARP ).
    .PARAMETER Nexthop
        IP address of the next hop router to which to send matching packets if action is set to ALLOW. This next hop should be directly reachable from the appliance.
    .PARAMETER Nexthopval
        The Next Hop IPv6 address.
    .PARAMETER Iptunnel
        The iptunnel name where packets need to be forwarded upon.
    .PARAMETER Vxlanvlanmap
        The vlan to vxlan mapping to be applied for incoming packets over this pbr tunnel.
    .PARAMETER Nexthopvlan
        VLAN number to be used for link local nexthop .
    .PARAMETER Ownergroup
        The owner node group in a Cluster for this pbr rule. If owner node group is not specified then the pbr rule is treated as Striped pbr rule.
    .PARAMETER PassThru
        Return details about the created nspbr6 item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNspbr6 -name <string> -action <string>
        An example how to add nspbr6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNspbr6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspbr6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [ValidateRange(0, 4094)]
        [double]$Td,

        [Parameter(Mandatory)]
        [ValidateSet('ALLOW', 'DENY')]
        [string]$Action,

        [boolean]$Srcipv6,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Srcipop,

        [string]$Srcipv6val,

        [boolean]$Srcport,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Srcportop,

        [string]$Srcportval,

        [boolean]$Destipv6,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Destipop,

        [string]$Destipv6val,

        [boolean]$Destport,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Destportop,

        [string]$Destportval,

        [string]$Srcmac,

        [string]$Srcmacmask = '"000000000000"',

        [ValidateSet('ICMPV6', 'TCP', 'UDP', 'ICMP', 'IGMP', 'EGP', 'IGP', 'ARGUS', 'RDP', 'RSVP', 'EIGRP', 'L2TP', 'ISIS', 'GGP', 'IPoverIP', 'ST', 'CBT', 'BBN-RCC-M', 'NVP-II', 'PUP', 'EMCON', 'XNET', 'CHAOS', 'MUX', 'DCN-MEAS', 'HMP', 'PRM', 'XNS-IDP', 'TRUNK-1', 'TRUNK-2', 'LEAF-1', 'LEAF-2', 'IRTP', 'ISO-TP4', 'NETBLT', 'MFE-NSP', 'MERIT-INP', 'SEP', '3PC', 'IDPR', 'XTP', 'DDP', 'IDPR-CMTP', 'TP++', 'IL', 'IPv6', 'SDRP', 'IPv6-Route', 'IPv6-Frag', 'IDRP', 'GRE', 'MHRP', 'BNA', 'ESP', 'AH', 'I-NLSP', 'SWIPE', 'NARP', 'MOBILE', 'TLSP', 'SKIP', 'IPv6-NoNx', 'IPv6-Opts', 'Any-Host-Internal-Protocol', 'CFTP', 'Any-Local-Network', 'SAT-EXPAK', 'KRYPTOLAN', 'RVD', 'IPPC', 'Any-Distributed-File-System', 'TFTP', 'VISA', 'IPCV', 'CPNX', 'CPHB', 'WSN', 'PVP', 'BR-SAT-MO', 'SUN-ND', 'WB-MON', 'WB-EXPAK', 'ISO-IP', 'VMTP', 'SECURE-VM', 'VINES', 'TTP', 'NSFNET-IG', 'DGP', 'TCF', 'OSPFIGP', 'Sprite-RP', 'LARP', 'MTP', 'AX.25', 'IPIP', 'MICP', 'SCC-SP', 'ETHERIP', 'Any-Private-Encryption-Scheme', 'GMTP', 'IFMP', 'PNNI', 'PIM', 'ARIS', 'SCPS', 'QNX', 'A/N', 'IPComp', 'SNP', 'Compaq-Pe', 'IPX-in-IP', 'VRRP', 'PGM', 'Any-0-Hop-Protocol', 'ENCAP', 'DDX', 'IATP', 'STP', 'SRP', 'UTI', 'SMP', 'SM', 'PTP', 'FIRE', 'CRTP', 'CRUDP', 'SSCOPMCE', 'IPLT', 'SPS', 'PIPE', 'SCTP', 'FC', 'RSVP-E2E-IGNORE', 'Mobility-Header', 'UDPLite')]
        [string]$Protocol,

        [ValidateRange(1, 255)]
        [double]$Protocolnumber,

        [ValidateRange(1, 4094)]
        [double]$Vlan,

        [ValidateRange(1, 16777215)]
        [double]$Vxlan,

        [string]$Interface,

        [ValidateRange(1, 81920)]
        [double]$Priority,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$State = 'ENABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Msr = 'DISABLED',

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Monitor,

        [boolean]$Nexthop,

        [string]$Nexthopval,

        [string]$Iptunnel,

        [string]$Vxlanvlanmap,

        [ValidateRange(1, 4094)]
        [double]$Nexthopvlan,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Ownergroup = 'DEFAULT_NG',

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNspbr6: Starting"
    }
    process {
        try {
            $payload = @{ name = $name
                action         = $action
            }
            if ( $PSBoundParameters.ContainsKey('td') ) { $payload.Add('td', $td) }
            if ( $PSBoundParameters.ContainsKey('srcipv6') ) { $payload.Add('srcipv6', $srcipv6) }
            if ( $PSBoundParameters.ContainsKey('srcipop') ) { $payload.Add('srcipop', $srcipop) }
            if ( $PSBoundParameters.ContainsKey('srcipv6val') ) { $payload.Add('srcipv6val', $srcipv6val) }
            if ( $PSBoundParameters.ContainsKey('srcport') ) { $payload.Add('srcport', $srcport) }
            if ( $PSBoundParameters.ContainsKey('srcportop') ) { $payload.Add('srcportop', $srcportop) }
            if ( $PSBoundParameters.ContainsKey('srcportval') ) { $payload.Add('srcportval', $srcportval) }
            if ( $PSBoundParameters.ContainsKey('destipv6') ) { $payload.Add('destipv6', $destipv6) }
            if ( $PSBoundParameters.ContainsKey('destipop') ) { $payload.Add('destipop', $destipop) }
            if ( $PSBoundParameters.ContainsKey('destipv6val') ) { $payload.Add('destipv6val', $destipv6val) }
            if ( $PSBoundParameters.ContainsKey('destport') ) { $payload.Add('destport', $destport) }
            if ( $PSBoundParameters.ContainsKey('destportop') ) { $payload.Add('destportop', $destportop) }
            if ( $PSBoundParameters.ContainsKey('destportval') ) { $payload.Add('destportval', $destportval) }
            if ( $PSBoundParameters.ContainsKey('srcmac') ) { $payload.Add('srcmac', $srcmac) }
            if ( $PSBoundParameters.ContainsKey('srcmacmask') ) { $payload.Add('srcmacmask', $srcmacmask) }
            if ( $PSBoundParameters.ContainsKey('protocol') ) { $payload.Add('protocol', $protocol) }
            if ( $PSBoundParameters.ContainsKey('protocolnumber') ) { $payload.Add('protocolnumber', $protocolnumber) }
            if ( $PSBoundParameters.ContainsKey('vlan') ) { $payload.Add('vlan', $vlan) }
            if ( $PSBoundParameters.ContainsKey('vxlan') ) { $payload.Add('vxlan', $vxlan) }
            if ( $PSBoundParameters.ContainsKey('Interface') ) { $payload.Add('Interface', $Interface) }
            if ( $PSBoundParameters.ContainsKey('priority') ) { $payload.Add('priority', $priority) }
            if ( $PSBoundParameters.ContainsKey('state') ) { $payload.Add('state', $state) }
            if ( $PSBoundParameters.ContainsKey('msr') ) { $payload.Add('msr', $msr) }
            if ( $PSBoundParameters.ContainsKey('monitor') ) { $payload.Add('monitor', $monitor) }
            if ( $PSBoundParameters.ContainsKey('nexthop') ) { $payload.Add('nexthop', $nexthop) }
            if ( $PSBoundParameters.ContainsKey('nexthopval') ) { $payload.Add('nexthopval', $nexthopval) }
            if ( $PSBoundParameters.ContainsKey('iptunnel') ) { $payload.Add('iptunnel', $iptunnel) }
            if ( $PSBoundParameters.ContainsKey('vxlanvlanmap') ) { $payload.Add('vxlanvlanmap', $vxlanvlanmap) }
            if ( $PSBoundParameters.ContainsKey('nexthopvlan') ) { $payload.Add('nexthopvlan', $nexthopvlan) }
            if ( $PSBoundParameters.ContainsKey('ownergroup') ) { $payload.Add('ownergroup', $ownergroup) }
            if ( $PSCmdlet.ShouldProcess("nspbr6", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nspbr6 -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNspbr6 -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNspbr6: Finished"
    }
}

function Invoke-ADCRenumberNspbr6 {
    <#
    .SYNOPSIS
        Renumber NS configuration Object.
    .DESCRIPTION
        Configuration for PBR6 entry resource.
    .EXAMPLE
        PS C:\>Invoke-ADCRenumberNspbr6
        An example how to renumber nspbr6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCRenumberNspbr6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspbr6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession) 

    )
    begin {
        Write-Verbose "Invoke-ADCRenumberNspbr6: Starting"
    }
    process {
        try {
            $payload = @{ }

            if ( $PSCmdlet.ShouldProcess($Name, "Renumber NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nspbr6 -Action renumber -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCRenumberNspbr6: Finished"
    }
}

function Invoke-ADCDeleteNspbr6 {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for PBR6 entry resource.
    .PARAMETER Name
        Name for the PBR6. Must begin with an ASCII alphabetic or underscore \(_\) character, and must contain only ASCII alphanumeric, underscore, hash \(\#\), period \(.\), space, colon \(:\), at \(@\), equals \(=\), and hyphen \(-\) characters. Cannot be changed after the PBR6 is created.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNspbr6 -Name <string>
        An example how to delete nspbr6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNspbr6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspbr6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Name 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNspbr6: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$name", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nspbr6 -NitroPath nitro/v1/config -Resource $name -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNspbr6: Finished"
    }
}

function Invoke-ADCUpdateNspbr6 {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for PBR6 entry resource.
    .PARAMETER Name
        Name for the PBR6. Must begin with an ASCII alphabetic or underscore \(_\) character, and must contain only ASCII alphanumeric, underscore, hash \(\#\), period \(.\), space, colon \(:\), at \(@\), equals \(=\), and hyphen \(-\) characters. Cannot be changed after the PBR6 is created.
    .PARAMETER Action
        Action to perform on the outgoing IPv6 packets that match the PBR6.
        Available settings function as follows:
        * ALLOW - The Citrix ADC sends the packet to the designated next-hop router.
        * DENY - The Citrix ADC applies the routing table for normal destination-based routing.
        Possible values = ALLOW, DENY
    .PARAMETER Srcipv6
        IP address or range of IP addresses to match against the source IP address of an outgoing IPv6 packet. In the command line interface, separate the range with a hyphen.
    .PARAMETER Srcipop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Srcipv6val
        IP address or range of IP addresses to match against the source IP address of an outgoing IPv6 packet. In the command line interface, separate the range with a hyphen.
    .PARAMETER Srcport
        Port number or range of port numbers to match against the source port number of an outgoing IPv6 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
    .PARAMETER Srcportop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Srcportval
        Source port (range).
    .PARAMETER Destipv6
        IP address or range of IP addresses to match against the destination IP address of an outgoing IPv6 packet. In the command line interface, separate the range with a hyphen.
    .PARAMETER Destipop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Destipv6val
        IP address or range of IP addresses to match against the destination IP address of an outgoing IPv6 packet. In the command line interface, separate the range with a hyphen.
    .PARAMETER Destport
        Port number or range of port numbers to match against the destination port number of an outgoing IPv6 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Destportop
        Either the equals (=) or does not equal (!=) logical operator.
        Possible values = =, !=, EQ, NEQ
    .PARAMETER Destportval
        Destination port (range).
    .PARAMETER Srcmac
        MAC address to match against the source MAC address of an outgoing IPv6 packet.
    .PARAMETER Srcmacmask
        Used to define range of Source MAC address. It takes string of 0 and 1, 0s are for exact match and 1s for wildcard. For matching first 3 bytes of MAC address, srcMacMask value "000000111111". .
    .PARAMETER Protocol
        Protocol, identified by protocol name, to match against the protocol of an outgoing IPv6 packet.
        Possible values = ICMPV6, TCP, UDP, ICMP, IGMP, EGP, IGP, ARGUS, RDP, RSVP, EIGRP, L2TP, ISIS, GGP, IPoverIP, ST, CBT, BBN-RCC-M, NVP-II, PUP, EMCON, XNET, CHAOS, MUX, DCN-MEAS, HMP, PRM, XNS-IDP, TRUNK-1, TRUNK-2, LEAF-1, LEAF-2, IRTP, ISO-TP4, NETBLT, MFE-NSP, MERIT-INP, SEP, 3PC, IDPR, XTP, DDP, IDPR-CMTP, TP++, IL, IPv6, SDRP, IPv6-Route, IPv6-Frag, IDRP, GRE, MHRP, BNA, ESP, AH, I-NLSP, SWIPE, NARP, MOBILE, TLSP, SKIP, IPv6-NoNx, IPv6-Opts, Any-Host-Internal-Protocol, CFTP, Any-Local-Network, SAT-EXPAK, KRYPTOLAN, RVD, IPPC, Any-Distributed-File-System, TFTP, VISA, IPCV, CPNX, CPHB, WSN, PVP, BR-SAT-MO, SUN-ND, WB-MON, WB-EXPAK, ISO-IP, VMTP, SECURE-VM, VINES, TTP, NSFNET-IG, DGP, TCF, OSPFIGP, Sprite-RP, LARP, MTP, AX.25, IPIP, MICP, SCC-SP, ETHERIP, Any-Private-Encryption-Scheme, GMTP, IFMP, PNNI, PIM, ARIS, SCPS, QNX, A/N, IPComp, SNP, Compaq-Pe, IPX-in-IP, VRRP, PGM, Any-0-Hop-Protocol, ENCAP, DDX, IATP, STP, SRP, UTI, SMP, SM, PTP, FIRE, CRTP, CRUDP, SSCOPMCE, IPLT, SPS, PIPE, SCTP, FC, RSVP-E2E-IGNORE, Mobility-Header, UDPLite
    .PARAMETER Protocolnumber
        Protocol, identified by protocol number, to match against the protocol of an outgoing IPv6 packet.
    .PARAMETER Vlan
        ID of the VLAN. The Citrix ADC compares the PBR6 only to the outgoing packets on the specified VLAN. If you do not specify an interface ID, the appliance compares the PBR6 to the outgoing packets on all VLANs.
    .PARAMETER Vxlan
        ID of the VXLAN. The Citrix ADC compares the PBR6 only to the outgoing packets on the specified VXLAN. If you do not specify an interface ID, the appliance compares the PBR6 to the outgoing packets on all VXLANs.
    .PARAMETER Interface
        ID of an interface. The Citrix ADC compares the PBR6 only to the outgoing packets on the specified interface. If you do not specify a value, the appliance compares the PBR6 to the outgoing packets on all interfaces.
    .PARAMETER Priority
        Priority of the PBR6, which determines the order in which it is evaluated relative to the other PBR6s. If you do not specify priorities while creating PBR6s, the PBR6s are evaluated in the order in which they are created.
    .PARAMETER Msr
        Monitor the route specified by the Next Hop parameter.
        Possible values = ENABLED, DISABLED
    .PARAMETER Monitor
        The name of the monitor.(Can be only of type ping or ARP ).
    .PARAMETER Nexthop
        IP address of the next hop router to which to send matching packets if action is set to ALLOW. This next hop should be directly reachable from the appliance.
    .PARAMETER Nexthopval
        The Next Hop IPv6 address.
    .PARAMETER Iptunnel
        The iptunnel name where packets need to be forwarded upon.
    .PARAMETER Vxlanvlanmap
        The vlan to vxlan mapping to be applied for incoming packets over this pbr tunnel.
    .PARAMETER Nexthopvlan
        VLAN number to be used for link local nexthop .
    .PARAMETER PassThru
        Return details about the created nspbr6 item.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNspbr6 -name <string>
        An example how to update nspbr6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNspbr6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspbr6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [ValidateSet('ALLOW', 'DENY')]
        [string]$Action,

        [boolean]$Srcipv6,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Srcipop,

        [string]$Srcipv6val,

        [boolean]$Srcport,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Srcportop,

        [string]$Srcportval,

        [boolean]$Destipv6,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Destipop,

        [string]$Destipv6val,

        [boolean]$Destport,

        [ValidateSet('=', '!=', 'EQ', 'NEQ')]
        [string]$Destportop,

        [string]$Destportval,

        [string]$Srcmac,

        [string]$Srcmacmask,

        [ValidateSet('ICMPV6', 'TCP', 'UDP', 'ICMP', 'IGMP', 'EGP', 'IGP', 'ARGUS', 'RDP', 'RSVP', 'EIGRP', 'L2TP', 'ISIS', 'GGP', 'IPoverIP', 'ST', 'CBT', 'BBN-RCC-M', 'NVP-II', 'PUP', 'EMCON', 'XNET', 'CHAOS', 'MUX', 'DCN-MEAS', 'HMP', 'PRM', 'XNS-IDP', 'TRUNK-1', 'TRUNK-2', 'LEAF-1', 'LEAF-2', 'IRTP', 'ISO-TP4', 'NETBLT', 'MFE-NSP', 'MERIT-INP', 'SEP', '3PC', 'IDPR', 'XTP', 'DDP', 'IDPR-CMTP', 'TP++', 'IL', 'IPv6', 'SDRP', 'IPv6-Route', 'IPv6-Frag', 'IDRP', 'GRE', 'MHRP', 'BNA', 'ESP', 'AH', 'I-NLSP', 'SWIPE', 'NARP', 'MOBILE', 'TLSP', 'SKIP', 'IPv6-NoNx', 'IPv6-Opts', 'Any-Host-Internal-Protocol', 'CFTP', 'Any-Local-Network', 'SAT-EXPAK', 'KRYPTOLAN', 'RVD', 'IPPC', 'Any-Distributed-File-System', 'TFTP', 'VISA', 'IPCV', 'CPNX', 'CPHB', 'WSN', 'PVP', 'BR-SAT-MO', 'SUN-ND', 'WB-MON', 'WB-EXPAK', 'ISO-IP', 'VMTP', 'SECURE-VM', 'VINES', 'TTP', 'NSFNET-IG', 'DGP', 'TCF', 'OSPFIGP', 'Sprite-RP', 'LARP', 'MTP', 'AX.25', 'IPIP', 'MICP', 'SCC-SP', 'ETHERIP', 'Any-Private-Encryption-Scheme', 'GMTP', 'IFMP', 'PNNI', 'PIM', 'ARIS', 'SCPS', 'QNX', 'A/N', 'IPComp', 'SNP', 'Compaq-Pe', 'IPX-in-IP', 'VRRP', 'PGM', 'Any-0-Hop-Protocol', 'ENCAP', 'DDX', 'IATP', 'STP', 'SRP', 'UTI', 'SMP', 'SM', 'PTP', 'FIRE', 'CRTP', 'CRUDP', 'SSCOPMCE', 'IPLT', 'SPS', 'PIPE', 'SCTP', 'FC', 'RSVP-E2E-IGNORE', 'Mobility-Header', 'UDPLite')]
        [string]$Protocol,

        [ValidateRange(1, 255)]
        [double]$Protocolnumber,

        [ValidateRange(1, 4094)]
        [double]$Vlan,

        [ValidateRange(1, 16777215)]
        [double]$Vxlan,

        [string]$Interface,

        [ValidateRange(1, 81920)]
        [double]$Priority,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Msr,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Monitor,

        [boolean]$Nexthop,

        [string]$Nexthopval,

        [string]$Iptunnel,

        [string]$Vxlanvlanmap,

        [ValidateRange(1, 4094)]
        [double]$Nexthopvlan,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNspbr6: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('action') ) { $payload.Add('action', $action) }
            if ( $PSBoundParameters.ContainsKey('srcipv6') ) { $payload.Add('srcipv6', $srcipv6) }
            if ( $PSBoundParameters.ContainsKey('srcipop') ) { $payload.Add('srcipop', $srcipop) }
            if ( $PSBoundParameters.ContainsKey('srcipv6val') ) { $payload.Add('srcipv6val', $srcipv6val) }
            if ( $PSBoundParameters.ContainsKey('srcport') ) { $payload.Add('srcport', $srcport) }
            if ( $PSBoundParameters.ContainsKey('srcportop') ) { $payload.Add('srcportop', $srcportop) }
            if ( $PSBoundParameters.ContainsKey('srcportval') ) { $payload.Add('srcportval', $srcportval) }
            if ( $PSBoundParameters.ContainsKey('destipv6') ) { $payload.Add('destipv6', $destipv6) }
            if ( $PSBoundParameters.ContainsKey('destipop') ) { $payload.Add('destipop', $destipop) }
            if ( $PSBoundParameters.ContainsKey('destipv6val') ) { $payload.Add('destipv6val', $destipv6val) }
            if ( $PSBoundParameters.ContainsKey('destport') ) { $payload.Add('destport', $destport) }
            if ( $PSBoundParameters.ContainsKey('destportop') ) { $payload.Add('destportop', $destportop) }
            if ( $PSBoundParameters.ContainsKey('destportval') ) { $payload.Add('destportval', $destportval) }
            if ( $PSBoundParameters.ContainsKey('srcmac') ) { $payload.Add('srcmac', $srcmac) }
            if ( $PSBoundParameters.ContainsKey('srcmacmask') ) { $payload.Add('srcmacmask', $srcmacmask) }
            if ( $PSBoundParameters.ContainsKey('protocol') ) { $payload.Add('protocol', $protocol) }
            if ( $PSBoundParameters.ContainsKey('protocolnumber') ) { $payload.Add('protocolnumber', $protocolnumber) }
            if ( $PSBoundParameters.ContainsKey('vlan') ) { $payload.Add('vlan', $vlan) }
            if ( $PSBoundParameters.ContainsKey('vxlan') ) { $payload.Add('vxlan', $vxlan) }
            if ( $PSBoundParameters.ContainsKey('Interface') ) { $payload.Add('Interface', $Interface) }
            if ( $PSBoundParameters.ContainsKey('priority') ) { $payload.Add('priority', $priority) }
            if ( $PSBoundParameters.ContainsKey('msr') ) { $payload.Add('msr', $msr) }
            if ( $PSBoundParameters.ContainsKey('monitor') ) { $payload.Add('monitor', $monitor) }
            if ( $PSBoundParameters.ContainsKey('nexthop') ) { $payload.Add('nexthop', $nexthop) }
            if ( $PSBoundParameters.ContainsKey('nexthopval') ) { $payload.Add('nexthopval', $nexthopval) }
            if ( $PSBoundParameters.ContainsKey('iptunnel') ) { $payload.Add('iptunnel', $iptunnel) }
            if ( $PSBoundParameters.ContainsKey('vxlanvlanmap') ) { $payload.Add('vxlanvlanmap', $vxlanvlanmap) }
            if ( $PSBoundParameters.ContainsKey('nexthopvlan') ) { $payload.Add('nexthopvlan', $nexthopvlan) }
            if ( $PSCmdlet.ShouldProcess("nspbr6", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nspbr6 -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNspbr6 -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNspbr6: Finished"
    }
}

function Invoke-ADCUnsetNspbr6 {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for PBR6 entry resource.
    .PARAMETER Name
        Name for the PBR6. Must begin with an ASCII alphabetic or underscore \(_\) character, and must contain only ASCII alphanumeric, underscore, hash \(\#\), period \(.\), space, colon \(:\), at \(@\), equals \(=\), and hyphen \(-\) characters. Cannot be changed after the PBR6 is created.
    .PARAMETER Srcipv6
        IP address or range of IP addresses to match against the source IP address of an outgoing IPv6 packet. In the command line interface, separate the range with a hyphen.
    .PARAMETER Srcport
        Port number or range of port numbers to match against the source port number of an outgoing IPv6 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
    .PARAMETER Destipv6
        IP address or range of IP addresses to match against the destination IP address of an outgoing IPv6 packet. In the command line interface, separate the range with a hyphen.
    .PARAMETER Destport
        Port number or range of port numbers to match against the destination port number of an outgoing IPv6 packet. In the command line interface, separate the range with a hyphen. For example: 40-90.
        Note: The destination port can be specified only for TCP and UDP protocols.
    .PARAMETER Srcmac
        MAC address to match against the source MAC address of an outgoing IPv6 packet.
    .PARAMETER Srcmacmask
        Used to define range of Source MAC address. It takes string of 0 and 1, 0s are for exact match and 1s for wildcard. For matching first 3 bytes of MAC address, srcMacMask value "000000111111". .
    .PARAMETER Protocol
        Protocol, identified by protocol name, to match against the protocol of an outgoing IPv6 packet.
        Possible values = ICMPV6, TCP, UDP, ICMP, IGMP, EGP, IGP, ARGUS, RDP, RSVP, EIGRP, L2TP, ISIS, GGP, IPoverIP, ST, CBT, BBN-RCC-M, NVP-II, PUP, EMCON, XNET, CHAOS, MUX, DCN-MEAS, HMP, PRM, XNS-IDP, TRUNK-1, TRUNK-2, LEAF-1, LEAF-2, IRTP, ISO-TP4, NETBLT, MFE-NSP, MERIT-INP, SEP, 3PC, IDPR, XTP, DDP, IDPR-CMTP, TP++, IL, IPv6, SDRP, IPv6-Route, IPv6-Frag, IDRP, GRE, MHRP, BNA, ESP, AH, I-NLSP, SWIPE, NARP, MOBILE, TLSP, SKIP, IPv6-NoNx, IPv6-Opts, Any-Host-Internal-Protocol, CFTP, Any-Local-Network, SAT-EXPAK, KRYPTOLAN, RVD, IPPC, Any-Distributed-File-System, TFTP, VISA, IPCV, CPNX, CPHB, WSN, PVP, BR-SAT-MO, SUN-ND, WB-MON, WB-EXPAK, ISO-IP, VMTP, SECURE-VM, VINES, TTP, NSFNET-IG, DGP, TCF, OSPFIGP, Sprite-RP, LARP, MTP, AX.25, IPIP, MICP, SCC-SP, ETHERIP, Any-Private-Encryption-Scheme, GMTP, IFMP, PNNI, PIM, ARIS, SCPS, QNX, A/N, IPComp, SNP, Compaq-Pe, IPX-in-IP, VRRP, PGM, Any-0-Hop-Protocol, ENCAP, DDX, IATP, STP, SRP, UTI, SMP, SM, PTP, FIRE, CRTP, CRUDP, SSCOPMCE, IPLT, SPS, PIPE, SCTP, FC, RSVP-E2E-IGNORE, Mobility-Header, UDPLite
    .PARAMETER Interface
        ID of an interface. The Citrix ADC compares the PBR6 only to the outgoing packets on the specified interface. If you do not specify a value, the appliance compares the PBR6 to the outgoing packets on all interfaces.
    .PARAMETER Vlan
        ID of the VLAN. The Citrix ADC compares the PBR6 only to the outgoing packets on the specified VLAN. If you do not specify an interface ID, the appliance compares the PBR6 to the outgoing packets on all VLANs.
    .PARAMETER Vxlan
        ID of the VXLAN. The Citrix ADC compares the PBR6 only to the outgoing packets on the specified VXLAN. If you do not specify an interface ID, the appliance compares the PBR6 to the outgoing packets on all VXLANs.
    .PARAMETER Msr
        Monitor the route specified by the Next Hop parameter.
        Possible values = ENABLED, DISABLED
    .PARAMETER Monitor
        The name of the monitor.(Can be only of type ping or ARP ).
    .PARAMETER Nexthop
        IP address of the next hop router to which to send matching packets if action is set to ALLOW. This next hop should be directly reachable from the appliance.
    .PARAMETER Iptunnel
        The iptunnel name where packets need to be forwarded upon.
    .PARAMETER Nexthopvlan
        VLAN number to be used for link local nexthop .
    .PARAMETER Vxlanvlanmap
        The vlan to vxlan mapping to be applied for incoming packets over this pbr tunnel.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNspbr6 -name <string>
        An example how to unset nspbr6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNspbr6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspbr6
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [Boolean]$srcipv6,

        [Boolean]$srcport,

        [Boolean]$destipv6,

        [Boolean]$destport,

        [Boolean]$srcmac,

        [Boolean]$srcmacmask,

        [Boolean]$protocol,

        [Boolean]$Interface,

        [Boolean]$vlan,

        [Boolean]$vxlan,

        [Boolean]$msr,

        [Boolean]$monitor,

        [Boolean]$nexthop,

        [Boolean]$iptunnel,

        [Boolean]$nexthopvlan,

        [Boolean]$vxlanvlanmap 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNspbr6: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('srcipv6') ) { $payload.Add('srcipv6', $srcipv6) }
            if ( $PSBoundParameters.ContainsKey('srcport') ) { $payload.Add('srcport', $srcport) }
            if ( $PSBoundParameters.ContainsKey('destipv6') ) { $payload.Add('destipv6', $destipv6) }
            if ( $PSBoundParameters.ContainsKey('destport') ) { $payload.Add('destport', $destport) }
            if ( $PSBoundParameters.ContainsKey('srcmac') ) { $payload.Add('srcmac', $srcmac) }
            if ( $PSBoundParameters.ContainsKey('srcmacmask') ) { $payload.Add('srcmacmask', $srcmacmask) }
            if ( $PSBoundParameters.ContainsKey('protocol') ) { $payload.Add('protocol', $protocol) }
            if ( $PSBoundParameters.ContainsKey('Interface') ) { $payload.Add('Interface', $Interface) }
            if ( $PSBoundParameters.ContainsKey('vlan') ) { $payload.Add('vlan', $vlan) }
            if ( $PSBoundParameters.ContainsKey('vxlan') ) { $payload.Add('vxlan', $vxlan) }
            if ( $PSBoundParameters.ContainsKey('msr') ) { $payload.Add('msr', $msr) }
            if ( $PSBoundParameters.ContainsKey('monitor') ) { $payload.Add('monitor', $monitor) }
            if ( $PSBoundParameters.ContainsKey('nexthop') ) { $payload.Add('nexthop', $nexthop) }
            if ( $PSBoundParameters.ContainsKey('iptunnel') ) { $payload.Add('iptunnel', $iptunnel) }
            if ( $PSBoundParameters.ContainsKey('nexthopvlan') ) { $payload.Add('nexthopvlan', $nexthopvlan) }
            if ( $PSBoundParameters.ContainsKey('vxlanvlanmap') ) { $payload.Add('vxlanvlanmap', $vxlanvlanmap) }
            if ( $PSCmdlet.ShouldProcess("$name", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nspbr6 -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNspbr6: Finished"
    }
}

function Invoke-ADCEnableNspbr6 {
    <#
    .SYNOPSIS
        Enable NS configuration Object.
    .DESCRIPTION
        Configuration for PBR6 entry resource.
    .PARAMETER Name
        Name for the PBR6. Must begin with an ASCII alphabetic or underscore \(_\) character, and must contain only ASCII alphanumeric, underscore, hash \(\#\), period \(.\), space, colon \(:\), at \(@\), equals \(=\), and hyphen \(-\) characters. Cannot be changed after the PBR6 is created.
    .EXAMPLE
        PS C:\>Invoke-ADCEnableNspbr6 -name <string>
        An example how to enable nspbr6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCEnableNspbr6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspbr6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name 

    )
    begin {
        Write-Verbose "Invoke-ADCEnableNspbr6: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }

            if ( $PSCmdlet.ShouldProcess($Name, "Enable NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nspbr6 -Action enable -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCEnableNspbr6: Finished"
    }
}

function Invoke-ADCDisableNspbr6 {
    <#
    .SYNOPSIS
        Disable NS configuration Object.
    .DESCRIPTION
        Configuration for PBR6 entry resource.
    .PARAMETER Name
        Name for the PBR6. Must begin with an ASCII alphabetic or underscore \(_\) character, and must contain only ASCII alphanumeric, underscore, hash \(\#\), period \(.\), space, colon \(:\), at \(@\), equals \(=\), and hyphen \(-\) characters. Cannot be changed after the PBR6 is created.
    .EXAMPLE
        PS C:\>Invoke-ADCDisableNspbr6 -name <string>
        An example how to disable nspbr6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDisableNspbr6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspbr6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name 

    )
    begin {
        Write-Verbose "Invoke-ADCDisableNspbr6: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }

            if ( $PSCmdlet.ShouldProcess($Name, "Disable NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nspbr6 -Action disable -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDisableNspbr6: Finished"
    }
}

function Invoke-ADCClearNspbr6 {
    <#
    .SYNOPSIS
        Clear NS configuration Object.
    .DESCRIPTION
        Configuration for PBR6 entry resource.
    .EXAMPLE
        PS C:\>Invoke-ADCClearNspbr6
        An example how to clear nspbr6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCClearNspbr6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspbr6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession) 

    )
    begin {
        Write-Verbose "Invoke-ADCClearNspbr6: Starting"
    }
    process {
        try {
            $payload = @{ }

            if ( $PSCmdlet.ShouldProcess($Name, "Clear NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nspbr6 -Action clear -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCClearNspbr6: Finished"
    }
}

function Invoke-ADCApplyNspbr6 {
    <#
    .SYNOPSIS
        Apply NS configuration Object.
    .DESCRIPTION
        Configuration for PBR6 entry resource.
    .EXAMPLE
        PS C:\>Invoke-ADCApplyNspbr6
        An example how to apply nspbr6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCApplyNspbr6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspbr6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession) 

    )
    begin {
        Write-Verbose "Invoke-ADCApplyNspbr6: Starting"
    }
    process {
        try {
            $payload = @{ }

            if ( $PSCmdlet.ShouldProcess($Name, "Apply NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nspbr6 -Action apply -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCApplyNspbr6: Finished"
    }
}

function Invoke-ADCGetNspbr6 {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for PBR6 entry resource.
    .PARAMETER Name
        Name for the PBR6. Must begin with an ASCII alphabetic or underscore \(_\) character, and must contain only ASCII alphanumeric, underscore, hash \(\#\), period \(.\), space, colon \(:\), at \(@\), equals \(=\), and hyphen \(-\) characters. Cannot be changed after the PBR6 is created.
    .PARAMETER GetAll
        Retrieve all nspbr6 object(s).
    .PARAMETER Count
        If specified, the count of the nspbr6 object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspbr6
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspbr6 -GetAll
        Get all nspbr6 data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspbr6 -Count
        Get the number of nspbr6 objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspbr6 -name <string>
        Get nspbr6 object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNspbr6 -Filter @{ 'name'='<value>' }
        Get nspbr6 data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNspbr6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nspbr6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNspbr6: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nspbr6 objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspbr6 -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nspbr6 objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspbr6 -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nspbr6 objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspbr6 -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nspbr6 configuration for property 'name'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspbr6 -NitroPath nitro/v1/config -Resource $name -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nspbr6 configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nspbr6 -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNspbr6: Ended"
    }
}

function Invoke-ADCUpdateNsratecontrol {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for rate control resource.
    .PARAMETER Tcpthreshold
        Number of SYNs permitted per 10 milliseconds.
    .PARAMETER Udpthreshold
        Number of UDP packets permitted per 10 milliseconds.
    .PARAMETER Icmpthreshold
        Number of ICMP packets permitted per 10 milliseconds.
    .PARAMETER Tcprstthreshold
        The number of TCP RST packets permitted per 10 milli second. zero means rate control is disabled and 0xffffffff means every thing is rate controlled.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsratecontrol
        An example how to update nsratecontrol configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsratecontrol
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsratecontrol/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [double]$Tcpthreshold,

        [double]$Udpthreshold,

        [double]$Icmpthreshold,

        [double]$Tcprstthreshold 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsratecontrol: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('tcpthreshold') ) { $payload.Add('tcpthreshold', $tcpthreshold) }
            if ( $PSBoundParameters.ContainsKey('udpthreshold') ) { $payload.Add('udpthreshold', $udpthreshold) }
            if ( $PSBoundParameters.ContainsKey('icmpthreshold') ) { $payload.Add('icmpthreshold', $icmpthreshold) }
            if ( $PSBoundParameters.ContainsKey('tcprstthreshold') ) { $payload.Add('tcprstthreshold', $tcprstthreshold) }
            if ( $PSCmdlet.ShouldProcess("nsratecontrol", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsratecontrol -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsratecontrol: Finished"
    }
}

function Invoke-ADCUnsetNsratecontrol {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for rate control resource.
    .PARAMETER Tcpthreshold
        Number of SYNs permitted per 10 milliseconds.
    .PARAMETER Udpthreshold
        Number of UDP packets permitted per 10 milliseconds.
    .PARAMETER Icmpthreshold
        Number of ICMP packets permitted per 10 milliseconds.
    .PARAMETER Tcprstthreshold
        The number of TCP RST packets permitted per 10 milli second. zero means rate control is disabled and 0xffffffff means every thing is rate controlled.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNsratecontrol
        An example how to unset nsratecontrol configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNsratecontrol
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsratecontrol
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Boolean]$tcpthreshold,

        [Boolean]$udpthreshold,

        [Boolean]$icmpthreshold,

        [Boolean]$tcprstthreshold 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNsratecontrol: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('tcpthreshold') ) { $payload.Add('tcpthreshold', $tcpthreshold) }
            if ( $PSBoundParameters.ContainsKey('udpthreshold') ) { $payload.Add('udpthreshold', $udpthreshold) }
            if ( $PSBoundParameters.ContainsKey('icmpthreshold') ) { $payload.Add('icmpthreshold', $icmpthreshold) }
            if ( $PSBoundParameters.ContainsKey('tcprstthreshold') ) { $payload.Add('tcprstthreshold', $tcprstthreshold) }
            if ( $PSCmdlet.ShouldProcess("nsratecontrol", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nsratecontrol -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNsratecontrol: Finished"
    }
}

function Invoke-ADCGetNsratecontrol {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for rate control resource.
    .PARAMETER GetAll
        Retrieve all nsratecontrol object(s).
    .PARAMETER Count
        If specified, the count of the nsratecontrol object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsratecontrol
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsratecontrol -GetAll
        Get all nsratecontrol data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsratecontrol -name <string>
        Get nsratecontrol object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsratecontrol -Filter @{ 'name'='<value>' }
        Get nsratecontrol data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsratecontrol
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsratecontrol/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNsratecontrol: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsratecontrol objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsratecontrol -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsratecontrol objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsratecontrol -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsratecontrol objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsratecontrol -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsratecontrol configuration for property ''"

            } else {
                Write-Verbose "Retrieving nsratecontrol configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsratecontrol -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsratecontrol: Ended"
    }
}

function Invoke-ADCGetNsrollbackcmd {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for Generate rollback commands resource.
    .PARAMETER Filename
        File that contains the commands for which the rollback commands must be generated. Specify the full path of the file name.
    .PARAMETER Outtype
        Format in which the rollback commands must be generated.
        Possible values = cli, xml
    .PARAMETER GetAll
        Retrieve all nsrollbackcmd object(s).
    .PARAMETER Count
        If specified, the count of the nsrollbackcmd object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsrollbackcmd
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsrollbackcmd -GetAll
        Get all nsrollbackcmd data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsrollbackcmd -name <string>
        Get nsrollbackcmd object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsrollbackcmd -Filter @{ 'name'='<value>' }
        Get nsrollbackcmd data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsrollbackcmd
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsrollbackcmd/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByArgument')]
        [string]$Filename,

        [Parameter(ParameterSetName = 'GetByArgument')]
        [ValidateSet('cli', 'xml')]
        [string]$Outtype,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNsrollbackcmd: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsrollbackcmd objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsrollbackcmd -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsrollbackcmd objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsrollbackcmd -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsrollbackcmd objects by arguments"
                $arguments = @{ } 
                if ( $PSBoundParameters.ContainsKey('filename') ) { $arguments.Add('filename', $filename) } 
                if ( $PSBoundParameters.ContainsKey('outtype') ) { $arguments.Add('outtype', $outtype) }
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsrollbackcmd -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsrollbackcmd configuration for property ''"

            } else {
                Write-Verbose "Retrieving nsrollbackcmd configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsrollbackcmd -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsrollbackcmd: Ended"
    }
}

function Invoke-ADCUpdateNsrpcnode {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for rpc node resource.
    .PARAMETER Ipaddress
        IP address of the node. This has to be in the same subnet as the NSIP address.
    .PARAMETER Password
        Password to be used in authentication with the peer system node.
    .PARAMETER Srcip
        Source IP address to be used to communicate with the peer system node. The default value is 0, which means that the appliance uses the NSIP address as the source IP address.
    .PARAMETER Secure
        State of the channel when talking to the node.
        Possible values = YES, NO
    .PARAMETER Validatecert
        validate the server certificate for secure SSL connections.
        Possible values = YES, NO
    .PARAMETER PassThru
        Return details about the created nsrpcnode item.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsrpcnode -ipaddress <string>
        An example how to update nsrpcnode configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsrpcnode
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsrpcnode/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Ipaddress,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Password,

        [string]$Srcip,

        [ValidateSet('YES', 'NO')]
        [string]$Secure,

        [ValidateSet('YES', 'NO')]
        [string]$Validatecert,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsrpcnode: Starting"
    }
    process {
        try {
            $payload = @{ ipaddress = $ipaddress }
            if ( $PSBoundParameters.ContainsKey('password') ) { $payload.Add('password', $password) }
            if ( $PSBoundParameters.ContainsKey('srcip') ) { $payload.Add('srcip', $srcip) }
            if ( $PSBoundParameters.ContainsKey('secure') ) { $payload.Add('secure', $secure) }
            if ( $PSBoundParameters.ContainsKey('validatecert') ) { $payload.Add('validatecert', $validatecert) }
            if ( $PSCmdlet.ShouldProcess("nsrpcnode", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsrpcnode -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsrpcnode -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsrpcnode: Finished"
    }
}

function Invoke-ADCUnsetNsrpcnode {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for rpc node resource.
    .PARAMETER Ipaddress
        IP address of the node. This has to be in the same subnet as the NSIP address.
    .PARAMETER Password
        Password to be used in authentication with the peer system node.
    .PARAMETER Srcip
        Source IP address to be used to communicate with the peer system node. The default value is 0, which means that the appliance uses the NSIP address as the source IP address.
    .PARAMETER Secure
        State of the channel when talking to the node.
        Possible values = YES, NO
    .PARAMETER Validatecert
        validate the server certificate for secure SSL connections.
        Possible values = YES, NO
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNsrpcnode -ipaddress <string>
        An example how to unset nsrpcnode configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNsrpcnode
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsrpcnode
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Ipaddress,

        [Boolean]$password,

        [Boolean]$srcip,

        [Boolean]$secure,

        [Boolean]$validatecert 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNsrpcnode: Starting"
    }
    process {
        try {
            $payload = @{ ipaddress = $ipaddress }
            if ( $PSBoundParameters.ContainsKey('password') ) { $payload.Add('password', $password) }
            if ( $PSBoundParameters.ContainsKey('srcip') ) { $payload.Add('srcip', $srcip) }
            if ( $PSBoundParameters.ContainsKey('secure') ) { $payload.Add('secure', $secure) }
            if ( $PSBoundParameters.ContainsKey('validatecert') ) { $payload.Add('validatecert', $validatecert) }
            if ( $PSCmdlet.ShouldProcess("$ipaddress", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nsrpcnode -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNsrpcnode: Finished"
    }
}

function Invoke-ADCGetNsrpcnode {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for rpc node resource.
    .PARAMETER Ipaddress
        IP address of the node. This has to be in the same subnet as the NSIP address.
    .PARAMETER GetAll
        Retrieve all nsrpcnode object(s).
    .PARAMETER Count
        If specified, the count of the nsrpcnode object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsrpcnode
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsrpcnode -GetAll
        Get all nsrpcnode data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsrpcnode -Count
        Get the number of nsrpcnode objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsrpcnode -name <string>
        Get nsrpcnode object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsrpcnode -Filter @{ 'name'='<value>' }
        Get nsrpcnode data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsrpcnode
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsrpcnode/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Ipaddress,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNsrpcnode: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsrpcnode objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsrpcnode -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsrpcnode objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsrpcnode -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsrpcnode objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsrpcnode -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsrpcnode configuration for property 'ipaddress'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsrpcnode -NitroPath nitro/v1/config -Resource $ipaddress -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nsrpcnode configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsrpcnode -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsrpcnode: Ended"
    }
}

function Invoke-ADCGetNsrunningconfig {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for running configuration resource.
    .PARAMETER Withdefaults
        Include default values of parameters that have not been explicitly configured. If this argument is disabled, such parameters are not included.
    .PARAMETER GetAll
        Retrieve all nsrunningconfig object(s).
    .PARAMETER Count
        If specified, the count of the nsrunningconfig object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsrunningconfig
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsrunningconfig -GetAll
        Get all nsrunningconfig data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsrunningconfig -name <string>
        Get nsrunningconfig object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsrunningconfig -Filter @{ 'name'='<value>' }
        Get nsrunningconfig data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsrunningconfig
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsrunningconfig/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByArgument')]
        [boolean]$Withdefaults,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNsrunningconfig: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsrunningconfig objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsrunningconfig -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsrunningconfig objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsrunningconfig -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsrunningconfig objects by arguments"
                $arguments = @{ } 
                if ( $PSBoundParameters.ContainsKey('withdefaults') ) { $arguments.Add('withdefaults', $withdefaults) }
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsrunningconfig -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsrunningconfig configuration for property ''"

            } else {
                Write-Verbose "Retrieving nsrunningconfig configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsrunningconfig -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsrunningconfig: Ended"
    }
}

function Invoke-ADCGetNssavedconfig {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for last saved configuration resource.
    .PARAMETER GetAll
        Retrieve all nssavedconfig object(s).
    .PARAMETER Count
        If specified, the count of the nssavedconfig object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNssavedconfig
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNssavedconfig -GetAll
        Get all nssavedconfig data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNssavedconfig -name <string>
        Get nssavedconfig object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNssavedconfig -Filter @{ 'name'='<value>' }
        Get nssavedconfig data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNssavedconfig
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nssavedconfig/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNssavedconfig: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nssavedconfig objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nssavedconfig -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nssavedconfig objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nssavedconfig -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nssavedconfig objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nssavedconfig -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nssavedconfig configuration for property ''"

            } else {
                Write-Verbose "Retrieving nssavedconfig configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nssavedconfig -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNssavedconfig: Ended"
    }
}

function Invoke-ADCAddNsservicefunction {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for service Function resource.
    .PARAMETER Servicefunctionname
        Name of the service function to be created. Leading character must be a number or letter. Other characters allowed, after the first character, are @ _ - . (period) : (colon) # and space ( ).
    .PARAMETER Ingressvlan
        VLAN ID on which the traffic from service function reaches Citrix ADC.
    .PARAMETER PassThru
        Return details about the created nsservicefunction item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNsservicefunction -servicefunctionname <string> -ingressvlan <double>
        An example how to add nsservicefunction configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNsservicefunction
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsservicefunction/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Servicefunctionname,

        [Parameter(Mandatory)]
        [ValidateRange(1, 4094)]
        [double]$Ingressvlan,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNsservicefunction: Starting"
    }
    process {
        try {
            $payload = @{ servicefunctionname = $servicefunctionname
                ingressvlan                   = $ingressvlan
            }

            if ( $PSCmdlet.ShouldProcess("nsservicefunction", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsservicefunction -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsservicefunction -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNsservicefunction: Finished"
    }
}

function Invoke-ADCUpdateNsservicefunction {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for service Function resource.
    .PARAMETER Servicefunctionname
        Name of the service function to be created. Leading character must be a number or letter. Other characters allowed, after the first character, are @ _ - . (period) : (colon) # and space ( ).
    .PARAMETER Ingressvlan
        VLAN ID on which the traffic from service function reaches Citrix ADC.
    .PARAMETER PassThru
        Return details about the created nsservicefunction item.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsservicefunction -servicefunctionname <string>
        An example how to update nsservicefunction configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsservicefunction
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsservicefunction/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Servicefunctionname,

        [ValidateRange(1, 4094)]
        [double]$Ingressvlan,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsservicefunction: Starting"
    }
    process {
        try {
            $payload = @{ servicefunctionname = $servicefunctionname }
            if ( $PSBoundParameters.ContainsKey('ingressvlan') ) { $payload.Add('ingressvlan', $ingressvlan) }
            if ( $PSCmdlet.ShouldProcess("nsservicefunction", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsservicefunction -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsservicefunction -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsservicefunction: Finished"
    }
}

function Invoke-ADCDeleteNsservicefunction {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for service Function resource.
    .PARAMETER Servicefunctionname
        Name of the service function to be created. Leading character must be a number or letter. Other characters allowed, after the first character, are @ _ - . (period) : (colon) # and space ( ).
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNsservicefunction -Servicefunctionname <string>
        An example how to delete nsservicefunction configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNsservicefunction
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsservicefunction/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Servicefunctionname 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNsservicefunction: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$servicefunctionname", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nsservicefunction -NitroPath nitro/v1/config -Resource $servicefunctionname -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNsservicefunction: Finished"
    }
}

function Invoke-ADCGetNsservicefunction {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for service Function resource.
    .PARAMETER Servicefunctionname
        Name of the service function to be created. Leading character must be a number or letter. Other characters allowed, after the first character, are @ _ - . (period) : (colon) # and space ( ).
    .PARAMETER GetAll
        Retrieve all nsservicefunction object(s).
    .PARAMETER Count
        If specified, the count of the nsservicefunction object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsservicefunction
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsservicefunction -GetAll
        Get all nsservicefunction data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsservicefunction -Count
        Get the number of nsservicefunction objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsservicefunction -name <string>
        Get nsservicefunction object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsservicefunction -Filter @{ 'name'='<value>' }
        Get nsservicefunction data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsservicefunction
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsservicefunction/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Servicefunctionname,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNsservicefunction: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsservicefunction objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsservicefunction -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsservicefunction objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsservicefunction -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsservicefunction objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsservicefunction -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsservicefunction configuration for property 'servicefunctionname'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsservicefunction -NitroPath nitro/v1/config -Resource $servicefunctionname -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nsservicefunction configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsservicefunction -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsservicefunction: Ended"
    }
}

function Invoke-ADCAddNsservicepath {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for service Chain resource.
    .PARAMETER Servicepathname
        Name for the Service path. Must begin with an ASCII alphanumeric or underscore (_) character, and must
        contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-)
        characters.
    .PARAMETER PassThru
        Return details about the created nsservicepath item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNsservicepath -servicepathname <string>
        An example how to add nsservicepath configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNsservicepath
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsservicepath/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Servicepathname,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNsservicepath: Starting"
    }
    process {
        try {
            $payload = @{ servicepathname = $servicepathname }

            if ( $PSCmdlet.ShouldProcess("nsservicepath", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsservicepath -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsservicepath -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNsservicepath: Finished"
    }
}

function Invoke-ADCDeleteNsservicepath {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for service Chain resource.
    .PARAMETER Servicepathname
        Name for the Service path. Must begin with an ASCII alphanumeric or underscore (_) character, and must
        contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-)
        characters.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNsservicepath -Servicepathname <string>
        An example how to delete nsservicepath configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNsservicepath
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsservicepath/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Servicepathname 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNsservicepath: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$servicepathname", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nsservicepath -NitroPath nitro/v1/config -Resource $servicepathname -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNsservicepath: Finished"
    }
}

function Invoke-ADCGetNsservicepath {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for service Chain resource.
    .PARAMETER Servicepathname
        Name for the Service path. Must begin with an ASCII alphanumeric or underscore (_) character, and must
        contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-)
        characters.
    .PARAMETER GetAll
        Retrieve all nsservicepath object(s).
    .PARAMETER Count
        If specified, the count of the nsservicepath object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsservicepath
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsservicepath -GetAll
        Get all nsservicepath data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsservicepath -Count
        Get the number of nsservicepath objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsservicepath -name <string>
        Get nsservicepath object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsservicepath -Filter @{ 'name'='<value>' }
        Get nsservicepath data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsservicepath
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsservicepath/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Servicepathname,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNsservicepath: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsservicepath objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsservicepath -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsservicepath objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsservicepath -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsservicepath objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsservicepath -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsservicepath configuration for property 'servicepathname'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsservicepath -NitroPath nitro/v1/config -Resource $servicepathname -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nsservicepath configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsservicepath -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsservicepath: Ended"
    }
}

function Invoke-ADCGetNsservicepathbinding {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Binding object which returns the resources bound to nsservicepath.
    .PARAMETER Servicepathname
        Name for the Service path. Must begin with an ASCII alphanumeric or underscore (_) character, and must
        contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-)
        characters.
    .PARAMETER GetAll
        Retrieve all nsservicepath_binding object(s).
    .PARAMETER Count
        If specified, the count of the nsservicepath_binding object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsservicepathbinding
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsservicepathbinding -GetAll
        Get all nsservicepath_binding data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsservicepathbinding -name <string>
        Get nsservicepath_binding object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsservicepathbinding -Filter @{ 'name'='<value>' }
        Get nsservicepath_binding data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsservicepathbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsservicepath_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Servicepathname,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNsservicepathbinding: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{  bulkbindings = 'yes' }
                Write-Verbose "Retrieving all nsservicepath_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsservicepath_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsservicepath_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsservicepath_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsservicepath_binding objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsservicepath_binding -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsservicepath_binding configuration for property 'servicepathname'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsservicepath_binding -NitroPath nitro/v1/config -Resource $servicepathname -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nsservicepath_binding configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsservicepath_binding -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsservicepathbinding: Ended"
    }
}

function Invoke-ADCAddNsservicepathnsservicefunctionbinding {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Binding object showing the nsservicefunction that can be bound to nsservicepath.
    .PARAMETER Servicepathname
        Name for the Service path. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER Servicefunction
        List of service functions constituting the chain.
    .PARAMETER Index
        The serviceindex of each servicefunction in path.
    .PARAMETER PassThru
        Return details about the created nsservicepath_nsservicefunction_binding item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNsservicepathnsservicefunctionbinding -servicepathname <string> -servicefunction <string> -index <double>
        An example how to add nsservicepath_nsservicefunction_binding configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNsservicepathnsservicefunctionbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsservicepath_nsservicefunction_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Servicepathname,

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Servicefunction,

        [Parameter(Mandatory)]
        [double]$Index,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNsservicepathnsservicefunctionbinding: Starting"
    }
    process {
        try {
            $payload = @{ servicepathname = $servicepathname
                servicefunction           = $servicefunction
                index                     = $index
            }

            if ( $PSCmdlet.ShouldProcess("nsservicepath_nsservicefunction_binding", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsservicepath_nsservicefunction_binding -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsservicepathnsservicefunctionbinding -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNsservicepathnsservicefunctionbinding: Finished"
    }
}

function Invoke-ADCDeleteNsservicepathnsservicefunctionbinding {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Binding object showing the nsservicefunction that can be bound to nsservicepath.
    .PARAMETER Servicepathname
        Name for the Service path. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER Servicefunction
        List of service functions constituting the chain.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNsservicepathnsservicefunctionbinding -Servicepathname <string>
        An example how to delete nsservicepath_nsservicefunction_binding configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNsservicepathnsservicefunctionbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsservicepath_nsservicefunction_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Servicepathname,

        [string]$Servicefunction 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNsservicepathnsservicefunctionbinding: Starting"
    }
    process {
        try {
            $arguments = @{ }
            if ( $PSBoundParameters.ContainsKey('Servicefunction') ) { $arguments.Add('servicefunction', $Servicefunction) }
            if ( $PSCmdlet.ShouldProcess("$servicepathname", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nsservicepath_nsservicefunction_binding -NitroPath nitro/v1/config -Resource $servicepathname -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNsservicepathnsservicefunctionbinding: Finished"
    }
}

function Invoke-ADCGetNsservicepathnsservicefunctionbinding {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Binding object showing the nsservicefunction that can be bound to nsservicepath.
    .PARAMETER Servicepathname
        Name for the Service path. Must begin with an ASCII alphanumeric or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters.
    .PARAMETER GetAll
        Retrieve all nsservicepath_nsservicefunction_binding object(s).
    .PARAMETER Count
        If specified, the count of the nsservicepath_nsservicefunction_binding object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsservicepathnsservicefunctionbinding
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsservicepathnsservicefunctionbinding -GetAll
        Get all nsservicepath_nsservicefunction_binding data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsservicepathnsservicefunctionbinding -Count
        Get the number of nsservicepath_nsservicefunction_binding objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsservicepathnsservicefunctionbinding -name <string>
        Get nsservicepath_nsservicefunction_binding object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsservicepathnsservicefunctionbinding -Filter @{ 'name'='<value>' }
        Get nsservicepath_nsservicefunction_binding data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsservicepathnsservicefunctionbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsservicepath_nsservicefunction_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Servicepathname,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNsservicepathnsservicefunctionbinding: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{  bulkbindings = 'yes' }
                Write-Verbose "Retrieving all nsservicepath_nsservicefunction_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsservicepath_nsservicefunction_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsservicepath_nsservicefunction_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsservicepath_nsservicefunction_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsservicepath_nsservicefunction_binding objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsservicepath_nsservicefunction_binding -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsservicepath_nsservicefunction_binding configuration for property 'servicepathname'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsservicepath_nsservicefunction_binding -NitroPath nitro/v1/config -Resource $servicepathname -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nsservicepath_nsservicefunction_binding configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsservicepath_nsservicefunction_binding -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsservicepathnsservicefunctionbinding: Ended"
    }
}

function Invoke-ADCAddNssimpleacl {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for simple ACL resource.
    .PARAMETER Aclname
        Name for the simple ACL rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters. Cannot be changed after the simple ACL rule is created.
    .PARAMETER Aclaction
        Drop incoming IPv4 packets that match the simple ACL rule.
        Possible values = DENY
    .PARAMETER Td
        Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0.
    .PARAMETER Srcip
        IP address to match against the source IP address of an incoming IPv4 packet.
    .PARAMETER Destport
        Port number to match against the destination port number of an incoming IPv4 packet.
        DestPort is mandatory while setting Protocol. Omitting the port number and protocol creates an all-ports and all protocols simple ACL rule, which matches any port and any protocol. In that case, you cannot create another simple ACL rule specifying a specific port and the same source IPv4 address.
    .PARAMETER Protocol
        Protocol to match against the protocol of an incoming IPv4 packet. You must set this parameter if you have set the Destination Port parameter.
        Possible values = TCP, UDP
    .PARAMETER Ttl
        Number of seconds, in multiples of four, after which the simple ACL rule expires. If you do not want the simple ACL rule to expire, do not specify a TTL value.
    .PARAMETER PassThru
        Return details about the created nssimpleacl item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNssimpleacl -aclname <string> -aclaction <string> -srcip <string>
        An example how to add nssimpleacl configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNssimpleacl
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nssimpleacl/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Aclname,

        [Parameter(Mandatory)]
        [ValidateSet('DENY')]
        [string]$Aclaction,

        [ValidateRange(0, 4094)]
        [double]$Td,

        [Parameter(Mandatory)]
        [string]$Srcip,

        [ValidateRange(1, 65535)]
        [int]$Destport,

        [ValidateSet('TCP', 'UDP')]
        [string]$Protocol,

        [ValidateRange(4, 2147483647)]
        [double]$Ttl,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNssimpleacl: Starting"
    }
    process {
        try {
            $payload = @{ aclname = $aclname
                aclaction         = $aclaction
                srcip             = $srcip
            }
            if ( $PSBoundParameters.ContainsKey('td') ) { $payload.Add('td', $td) }
            if ( $PSBoundParameters.ContainsKey('destport') ) { $payload.Add('destport', $destport) }
            if ( $PSBoundParameters.ContainsKey('protocol') ) { $payload.Add('protocol', $protocol) }
            if ( $PSBoundParameters.ContainsKey('ttl') ) { $payload.Add('ttl', $ttl) }
            if ( $PSCmdlet.ShouldProcess("nssimpleacl", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nssimpleacl -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNssimpleacl -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNssimpleacl: Finished"
    }
}

function Invoke-ADCClearNssimpleacl {
    <#
    .SYNOPSIS
        Clear NS configuration Object.
    .DESCRIPTION
        Configuration for simple ACL resource.
    .EXAMPLE
        PS C:\>Invoke-ADCClearNssimpleacl
        An example how to clear nssimpleacl configuration Object(s).
    .NOTES
        File Name : Invoke-ADCClearNssimpleacl
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nssimpleacl/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession) 

    )
    begin {
        Write-Verbose "Invoke-ADCClearNssimpleacl: Starting"
    }
    process {
        try {
            $payload = @{ }

            if ( $PSCmdlet.ShouldProcess($Name, "Clear NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nssimpleacl -Action clear -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCClearNssimpleacl: Finished"
    }
}

function Invoke-ADCDeleteNssimpleacl {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for simple ACL resource.
    .PARAMETER Aclname
        Name for the simple ACL rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters. Cannot be changed after the simple ACL rule is created.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNssimpleacl -Aclname <string>
        An example how to delete nssimpleacl configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNssimpleacl
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nssimpleacl/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Aclname 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNssimpleacl: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$aclname", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nssimpleacl -NitroPath nitro/v1/config -Resource $aclname -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNssimpleacl: Finished"
    }
}

function Invoke-ADCFlushNssimpleacl {
    <#
    .SYNOPSIS
        Flush NS configuration Object.
    .DESCRIPTION
        Configuration for simple ACL resource.
    .PARAMETER Estsessions
        .
    .EXAMPLE
        PS C:\>Invoke-ADCFlushNssimpleacl -estsessions <boolean>
        An example how to flush nssimpleacl configuration Object(s).
    .NOTES
        File Name : Invoke-ADCFlushNssimpleacl
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nssimpleacl/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [boolean]$Estsessions 

    )
    begin {
        Write-Verbose "Invoke-ADCFlushNssimpleacl: Starting"
    }
    process {
        try {
            $payload = @{ estsessions = $estsessions }

            if ( $PSCmdlet.ShouldProcess($Name, "Flush NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nssimpleacl -Action flush -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCFlushNssimpleacl: Finished"
    }
}

function Invoke-ADCGetNssimpleacl {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for simple ACL resource.
    .PARAMETER Aclname
        Name for the simple ACL rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters. Cannot be changed after the simple ACL rule is created.
    .PARAMETER GetAll
        Retrieve all nssimpleacl object(s).
    .PARAMETER Count
        If specified, the count of the nssimpleacl object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNssimpleacl
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNssimpleacl -GetAll
        Get all nssimpleacl data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNssimpleacl -Count
        Get the number of nssimpleacl objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNssimpleacl -name <string>
        Get nssimpleacl object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNssimpleacl -Filter @{ 'name'='<value>' }
        Get nssimpleacl data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNssimpleacl
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nssimpleacl/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Aclname,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNssimpleacl: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nssimpleacl objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nssimpleacl -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nssimpleacl objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nssimpleacl -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nssimpleacl objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nssimpleacl -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nssimpleacl configuration for property 'aclname'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nssimpleacl -NitroPath nitro/v1/config -Resource $aclname -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nssimpleacl configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nssimpleacl -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNssimpleacl: Ended"
    }
}

function Invoke-ADCAddNssimpleacl6 {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for simple ACL6 resource.
    .PARAMETER Aclname
        Name for the simple ACL6 rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters. Cannot be changed after the simple ACL6 rule is created.
    .PARAMETER Td
        Integer value that uniquely identifies the traffic domain in which you want to configure the entity. If you do not specify an ID, the entity becomes part of the default traffic domain, which has an ID of 0.
    .PARAMETER Aclaction
        Drop incoming IPv6 packets that match the simple ACL6 rule.
        Possible values = DENY
    .PARAMETER Srcipv6
        IP address to match against the source IP address of an incoming IPv6 packet.
    .PARAMETER Destport
        Port number to match against the destination port number of an incoming IPv6 packet.
        DestPort is mandatory while setting Protocol. Omitting the port number and protocol creates an all-ports and all protocol simple ACL6 rule, which matches any port and any protocol. In that case, you cannot create another simple ACL6 rule specifying a specific port and the same source IPv6 address.
    .PARAMETER Protocol
        Protocol to match against the protocol of an incoming IPv6 packet. You must set this parameter if you set the Destination Port parameter.
        Possible values = TCP, UDP
    .PARAMETER Ttl
        Number of seconds, in multiples of four, after which the simple ACL6 rule expires. If you do not want the simple ACL6 rule to expire, do not specify a TTL value.
    .PARAMETER PassThru
        Return details about the created nssimpleacl6 item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNssimpleacl6 -aclname <string> -aclaction <string> -srcipv6 <string>
        An example how to add nssimpleacl6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNssimpleacl6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nssimpleacl6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Aclname,

        [ValidateRange(0, 4094)]
        [double]$Td,

        [Parameter(Mandatory)]
        [ValidateSet('DENY')]
        [string]$Aclaction,

        [Parameter(Mandatory)]
        [string]$Srcipv6,

        [ValidateRange(1, 65535)]
        [int]$Destport,

        [ValidateSet('TCP', 'UDP')]
        [string]$Protocol,

        [ValidateRange(4, 2147483647)]
        [double]$Ttl,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNssimpleacl6: Starting"
    }
    process {
        try {
            $payload = @{ aclname = $aclname
                aclaction         = $aclaction
                srcipv6           = $srcipv6
            }
            if ( $PSBoundParameters.ContainsKey('td') ) { $payload.Add('td', $td) }
            if ( $PSBoundParameters.ContainsKey('destport') ) { $payload.Add('destport', $destport) }
            if ( $PSBoundParameters.ContainsKey('protocol') ) { $payload.Add('protocol', $protocol) }
            if ( $PSBoundParameters.ContainsKey('ttl') ) { $payload.Add('ttl', $ttl) }
            if ( $PSCmdlet.ShouldProcess("nssimpleacl6", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nssimpleacl6 -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNssimpleacl6 -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNssimpleacl6: Finished"
    }
}

function Invoke-ADCClearNssimpleacl6 {
    <#
    .SYNOPSIS
        Clear NS configuration Object.
    .DESCRIPTION
        Configuration for simple ACL6 resource.
    .EXAMPLE
        PS C:\>Invoke-ADCClearNssimpleacl6
        An example how to clear nssimpleacl6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCClearNssimpleacl6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nssimpleacl6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession) 

    )
    begin {
        Write-Verbose "Invoke-ADCClearNssimpleacl6: Starting"
    }
    process {
        try {
            $payload = @{ }

            if ( $PSCmdlet.ShouldProcess($Name, "Clear NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nssimpleacl6 -Action clear -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCClearNssimpleacl6: Finished"
    }
}

function Invoke-ADCFlushNssimpleacl6 {
    <#
    .SYNOPSIS
        Flush NS configuration Object.
    .DESCRIPTION
        Configuration for simple ACL6 resource.
    .PARAMETER Estsessions
        .
    .EXAMPLE
        PS C:\>Invoke-ADCFlushNssimpleacl6 -estsessions <boolean>
        An example how to flush nssimpleacl6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCFlushNssimpleacl6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nssimpleacl6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [boolean]$Estsessions 

    )
    begin {
        Write-Verbose "Invoke-ADCFlushNssimpleacl6: Starting"
    }
    process {
        try {
            $payload = @{ estsessions = $estsessions }

            if ( $PSCmdlet.ShouldProcess($Name, "Flush NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nssimpleacl6 -Action flush -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCFlushNssimpleacl6: Finished"
    }
}

function Invoke-ADCDeleteNssimpleacl6 {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for simple ACL6 resource.
    .PARAMETER Aclname
        Name for the simple ACL6 rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters. Cannot be changed after the simple ACL6 rule is created.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNssimpleacl6 -Aclname <string>
        An example how to delete nssimpleacl6 configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNssimpleacl6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nssimpleacl6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Aclname 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNssimpleacl6: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$aclname", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nssimpleacl6 -NitroPath nitro/v1/config -Resource $aclname -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNssimpleacl6: Finished"
    }
}

function Invoke-ADCGetNssimpleacl6 {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for simple ACL6 resource.
    .PARAMETER Aclname
        Name for the simple ACL6 rule. Must begin with an ASCII alphabetic or underscore (_) character, and must contain only ASCII alphanumeric, underscore, hash (#), period (.), space, colon (:), at (@), equals (=), and hyphen (-) characters. Cannot be changed after the simple ACL6 rule is created.
    .PARAMETER GetAll
        Retrieve all nssimpleacl6 object(s).
    .PARAMETER Count
        If specified, the count of the nssimpleacl6 object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNssimpleacl6
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNssimpleacl6 -GetAll
        Get all nssimpleacl6 data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNssimpleacl6 -Count
        Get the number of nssimpleacl6 objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNssimpleacl6 -name <string>
        Get nssimpleacl6 object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNssimpleacl6 -Filter @{ 'name'='<value>' }
        Get nssimpleacl6 data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNssimpleacl6
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nssimpleacl6/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [ValidatePattern('^(([a-zA-Z0-9]|[_])+([\x00-\x7F]|[_]|[#]|[.][ ]|[:]|[@]|[=]|[-])+)$')]
        [string]$Aclname,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNssimpleacl6: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nssimpleacl6 objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nssimpleacl6 -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nssimpleacl6 objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nssimpleacl6 -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nssimpleacl6 objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nssimpleacl6 -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nssimpleacl6 configuration for property 'aclname'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nssimpleacl6 -NitroPath nitro/v1/config -Resource $aclname -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nssimpleacl6 configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nssimpleacl6 -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNssimpleacl6: Ended"
    }
}

function Invoke-ADCFlushNssourceroutecachetable {
    <#
    .SYNOPSIS
        Flush NS configuration Object.
    .DESCRIPTION
        Configuration for Source IP Mac Cache Table. resource.
    .EXAMPLE
        PS C:\>Invoke-ADCFlushNssourceroutecachetable
        An example how to flush nssourceroutecachetable configuration Object(s).
    .NOTES
        File Name : Invoke-ADCFlushNssourceroutecachetable
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nssourceroutecachetable/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession) 

    )
    begin {
        Write-Verbose "Invoke-ADCFlushNssourceroutecachetable: Starting"
    }
    process {
        try {
            $payload = @{ }

            if ( $PSCmdlet.ShouldProcess($Name, "Flush NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nssourceroutecachetable -Action flush -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCFlushNssourceroutecachetable: Finished"
    }
}

function Invoke-ADCGetNssourceroutecachetable {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for Source IP Mac Cache Table. resource.
    .PARAMETER GetAll
        Retrieve all nssourceroutecachetable object(s).
    .PARAMETER Count
        If specified, the count of the nssourceroutecachetable object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNssourceroutecachetable
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNssourceroutecachetable -GetAll
        Get all nssourceroutecachetable data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNssourceroutecachetable -Count
        Get the number of nssourceroutecachetable objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNssourceroutecachetable -name <string>
        Get nssourceroutecachetable object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNssourceroutecachetable -Filter @{ 'name'='<value>' }
        Get nssourceroutecachetable data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNssourceroutecachetable
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nssourceroutecachetable/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNssourceroutecachetable: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nssourceroutecachetable objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nssourceroutecachetable -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nssourceroutecachetable objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nssourceroutecachetable -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nssourceroutecachetable objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nssourceroutecachetable -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nssourceroutecachetable configuration for property ''"

            } else {
                Write-Verbose "Retrieving nssourceroutecachetable configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nssourceroutecachetable -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNssourceroutecachetable: Ended"
    }
}

function Invoke-ADCUpdateNsspparams {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for Surge Protection parameter resource.
    .PARAMETER Basethreshold
        Maximum number of server connections that can be opened before surge protection is activated.
    .PARAMETER Throttle
        Rate at which the system opens connections to the server.
        Possible values = Aggressive, Normal, Relaxed
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsspparams
        An example how to update nsspparams configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsspparams
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsspparams/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateRange(0, 32767)]
        [int]$Basethreshold,

        [ValidateSet('Aggressive', 'Normal', 'Relaxed')]
        [string]$Throttle 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsspparams: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('basethreshold') ) { $payload.Add('basethreshold', $basethreshold) }
            if ( $PSBoundParameters.ContainsKey('throttle') ) { $payload.Add('throttle', $throttle) }
            if ( $PSCmdlet.ShouldProcess("nsspparams", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsspparams -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsspparams: Finished"
    }
}

function Invoke-ADCUnsetNsspparams {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for Surge Protection parameter resource.
    .PARAMETER Basethreshold
        Maximum number of server connections that can be opened before surge protection is activated.
    .PARAMETER Throttle
        Rate at which the system opens connections to the server.
        Possible values = Aggressive, Normal, Relaxed
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNsspparams
        An example how to unset nsspparams configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNsspparams
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsspparams
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Boolean]$basethreshold,

        [Boolean]$throttle 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNsspparams: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('basethreshold') ) { $payload.Add('basethreshold', $basethreshold) }
            if ( $PSBoundParameters.ContainsKey('throttle') ) { $payload.Add('throttle', $throttle) }
            if ( $PSCmdlet.ShouldProcess("nsspparams", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nsspparams -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNsspparams: Finished"
    }
}

function Invoke-ADCGetNsspparams {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for Surge Protection parameter resource.
    .PARAMETER GetAll
        Retrieve all nsspparams object(s).
    .PARAMETER Count
        If specified, the count of the nsspparams object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsspparams
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsspparams -GetAll
        Get all nsspparams data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsspparams -name <string>
        Get nsspparams object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsspparams -Filter @{ 'name'='<value>' }
        Get nsspparams data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsspparams
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsspparams/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNsspparams: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsspparams objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsspparams -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsspparams objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsspparams -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsspparams objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsspparams -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsspparams configuration for property ''"

            } else {
                Write-Verbose "Retrieving nsspparams configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsspparams -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsspparams: Ended"
    }
}

function Invoke-ADCClearNsstats {
    <#
    .SYNOPSIS
        Clear NS configuration Object.
    .DESCRIPTION
        Configuration for stats resource.
    .PARAMETER Cleanuplevel
        The level of stats to be cleared. 'global' option will clear global counters only, 'all' option will clear all device counters also along with global counters. For both the cases only 'ever incrementing counters' i.e. total counters will be cleared.
        Possible values = global, all
    .EXAMPLE
        PS C:\>Invoke-ADCClearNsstats -cleanuplevel <string>
        An example how to clear nsstats configuration Object(s).
    .NOTES
        File Name : Invoke-ADCClearNsstats
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsstats/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateSet('global', 'all')]
        [string]$Cleanuplevel 

    )
    begin {
        Write-Verbose "Invoke-ADCClearNsstats: Starting"
    }
    process {
        try {
            $payload = @{ cleanuplevel = $cleanuplevel }

            if ( $PSCmdlet.ShouldProcess($Name, "Clear NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsstats -Action clear -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCClearNsstats: Finished"
    }
}

function Invoke-ADCFlushNssurgeq {
    <#
    .SYNOPSIS
        Flush NS configuration Object.
    .DESCRIPTION
        Configuration for surge queue resource.
    .PARAMETER Name
        Name of a virtual server, service or service group for which the SurgeQ must be flushed.
    .PARAMETER Servername
        Name of a service group member. This argument is needed when you want to flush the SurgeQ of a service group.
    .PARAMETER Port
        port on which server is bound to the entity(Servicegroup).
        * in CLI is represented as 65535 in NITRO API
    .EXAMPLE
        PS C:\>Invoke-ADCFlushNssurgeq
        An example how to flush nssurgeq configuration Object(s).
    .NOTES
        File Name : Invoke-ADCFlushNssurgeq
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nssurgeq/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [string]$Name,

        [string]$Servername,

        [ValidateRange(1, 65535)]
        [int]$Port 

    )
    begin {
        Write-Verbose "Invoke-ADCFlushNssurgeq: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('name') ) { $payload.Add('name', $name) }
            if ( $PSBoundParameters.ContainsKey('servername') ) { $payload.Add('servername', $servername) }
            if ( $PSBoundParameters.ContainsKey('port') ) { $payload.Add('port', $port) }
            if ( $PSCmdlet.ShouldProcess($Name, "Flush NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nssurgeq -Action flush -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCFlushNssurgeq: Finished"
    }
}

function Invoke-ADCUpdateNstcpbufparam {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for tcp buffer parameter resource.
    .PARAMETER Size
        TCP buffering size per connection, in kilobytes.
    .PARAMETER Memlimit
        Maximum memory, in megabytes, that can be used for buffering.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNstcpbufparam
        An example how to update nstcpbufparam configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNstcpbufparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstcpbufparam/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateRange(4, 20480)]
        [double]$Size,

        [double]$Memlimit 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNstcpbufparam: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('size') ) { $payload.Add('size', $size) }
            if ( $PSBoundParameters.ContainsKey('memlimit') ) { $payload.Add('memlimit', $memlimit) }
            if ( $PSCmdlet.ShouldProcess("nstcpbufparam", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nstcpbufparam -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNstcpbufparam: Finished"
    }
}

function Invoke-ADCUnsetNstcpbufparam {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for tcp buffer parameter resource.
    .PARAMETER Size
        TCP buffering size per connection, in kilobytes.
    .PARAMETER Memlimit
        Maximum memory, in megabytes, that can be used for buffering.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNstcpbufparam
        An example how to unset nstcpbufparam configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNstcpbufparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstcpbufparam
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Boolean]$size,

        [Boolean]$memlimit 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNstcpbufparam: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('size') ) { $payload.Add('size', $size) }
            if ( $PSBoundParameters.ContainsKey('memlimit') ) { $payload.Add('memlimit', $memlimit) }
            if ( $PSCmdlet.ShouldProcess("nstcpbufparam", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nstcpbufparam -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNstcpbufparam: Finished"
    }
}

function Invoke-ADCGetNstcpbufparam {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for tcp buffer parameter resource.
    .PARAMETER GetAll
        Retrieve all nstcpbufparam object(s).
    .PARAMETER Count
        If specified, the count of the nstcpbufparam object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstcpbufparam
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstcpbufparam -GetAll
        Get all nstcpbufparam data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstcpbufparam -name <string>
        Get nstcpbufparam object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstcpbufparam -Filter @{ 'name'='<value>' }
        Get nstcpbufparam data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNstcpbufparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstcpbufparam/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNstcpbufparam: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nstcpbufparam objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstcpbufparam -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nstcpbufparam objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstcpbufparam -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nstcpbufparam objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstcpbufparam -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nstcpbufparam configuration for property ''"

            } else {
                Write-Verbose "Retrieving nstcpbufparam configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstcpbufparam -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNstcpbufparam: Ended"
    }
}

function Invoke-ADCUpdateNstcpparam {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for tcp parameters resource.
    .PARAMETER Ws
        Enable or disable window scaling.
        Possible values = ENABLED, DISABLED
    .PARAMETER Wsval
        Factor used to calculate the new window size.
        This argument is needed only when the window scaling is enabled.
    .PARAMETER Sack
        Enable or disable Selective ACKnowledgement (SACK).
        Possible values = ENABLED, DISABLED
    .PARAMETER Learnvsvrmss
        Enable or disable maximum segment size (MSS) learning for virtual servers.
        Possible values = ENABLED, DISABLED
    .PARAMETER Maxburst
        Maximum number of TCP segments allowed in a burst.
    .PARAMETER Initialcwnd
        Initial maximum upper limit on the number of TCP packets that can be outstanding on the TCP link to the server.
    .PARAMETER Recvbuffsize
        TCP Receive buffer size.
    .PARAMETER Delayedack
        Timeout for TCP delayed ACK, in milliseconds.
    .PARAMETER Downstaterst
        Flag to switch on RST on down services.
        Possible values = ENABLED, DISABLED
    .PARAMETER Nagle
        Enable or disable the Nagle algorithm on TCP connections.
        Possible values = ENABLED, DISABLED
    .PARAMETER Limitedpersist
        Limit the number of persist (zero window) probes.
        Possible values = ENABLED, DISABLED
    .PARAMETER Oooqsize
        Maximum size of out-of-order packets queue. A value of 0 means no limit.
    .PARAMETER Ackonpush
        Send immediate positive acknowledgement (ACK) on receipt of TCP packets with PUSH flag.
        Possible values = ENABLED, DISABLED
    .PARAMETER Maxpktpermss
        Maximum number of TCP packets allowed per maximum segment size (MSS).
    .PARAMETER Pktperretx
        Maximum limit on the number of packets that should be retransmitted on receiving a partial ACK.
    .PARAMETER Minrto
        Minimum retransmission timeout, in milliseconds, specified in 10-millisecond increments (value must yield a whole number if divided by 10).
    .PARAMETER Slowstartincr
        Multiplier that determines the rate at which slow start increases the size of the TCP transmission window after each acknowledgement of successful transmission.
    .PARAMETER Maxdynserverprobes
        Maximum number of probes that Citrix ADC can send out in 10 milliseconds, to dynamically learn a service. Citrix ADC probes for the existence of the origin in case of wildcard virtual server or services.
    .PARAMETER Synholdfastgiveup
        Maximum threshold. After crossing this threshold number of outstanding probes for origin, the Citrix ADC reduces the number of connection retries for probe connections.
    .PARAMETER Maxsynholdperprobe
        Limit the number of client connections (SYN) waiting for status of single probe. Any new SYN packets will be dropped.
    .PARAMETER Maxsynhold
        Limit the number of client connections (SYN) waiting for status of probe system wide. Any new SYN packets will be dropped.
    .PARAMETER Msslearninterval
        Duration, in seconds, to sample the Maximum Segment Size (MSS) of the services. The Citrix ADC determines the best MSS to set for the virtual server based on this sampling. The argument to enable maximum segment size (MSS) for virtual servers must be enabled.
    .PARAMETER Msslearndelay
        Frequency, in seconds, at which the virtual servers learn the Maximum segment size (MSS) from the services. The argument to enable maximum segment size (MSS) for virtual servers must be enabled.
    .PARAMETER Maxtimewaitconn
        Maximum number of connections to hold in the TCP TIME_WAIT state on a packet engine. New connections entering TIME_WAIT state are proactively cleaned up.
    .PARAMETER Kaprobeupdatelastactivity
        Update last activity for KA probes.
        Possible values = ENABLED, DISABLED
    .PARAMETER Maxsynackretx
        When 'syncookie' is disabled in the TCP profile that is bound to the virtual server or service, and the number of TCP SYN+ACK retransmission by Citrix ADC for that virtual server or service crosses this threshold, the Citrix ADC responds by using the TCP SYN-Cookie mechanism.
    .PARAMETER Synattackdetection
        Detect TCP SYN packet flood and send an SNMP trap.
        Possible values = ENABLED, DISABLED
    .PARAMETER Connflushifnomem
        Flush an existing connection if no memory can be obtained for new connection.
        HALF_CLOSED_AND_IDLE: Flush a connection that is closed by us but not by peer, or failing that, a connection that is past configured idle time. New connection fails if no such connection can be found.
        FIFO: If no half-closed or idle connection can be found, flush the oldest non-management connection, even if it is active. New connection fails if the oldest few connections are management connections.
        Note: If you enable this setting, you should also consider lowering the zombie timeout and half-close timeout, while setting the Citrix ADC timeout.
        See Also: connFlushThres argument below.
        Possible values = NONE, HALFCLOSED_AND_IDLE, FIFO
    .PARAMETER Connflushthres
        Flush an existing connection (as configured through -connFlushIfNoMem FIFO) if the system has more than specified number of connections, and a new connection is to be established. Note: This value may be rounded down to be a whole multiple of the number of packet engines running.
    .PARAMETER Mptcpconcloseonpassivesf
        Accept DATA_FIN/FAST_CLOSE on passive subflow.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mptcpchecksum
        Use MPTCP DSS checksum.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mptcpsftimeout
        The timeout value in seconds for idle mptcp subflows. If this timeout is not set, idle subflows are cleared after cltTimeout of vserver.
    .PARAMETER Mptcpsfreplacetimeout
        The minimum idle time value in seconds for idle mptcp subflows after which the sublow is replaced by new incoming subflow if maximum subflow limit is reached. The priority for replacement is given to those subflow without any transaction.
    .PARAMETER Mptcpmaxsf
        Maximum number of subflow connections supported in established state per mptcp connection.
    .PARAMETER Mptcpmaxpendingsf
        Maximum number of subflow connections supported in pending join state per mptcp connection.
    .PARAMETER Mptcppendingjointhreshold
        Maximum system level pending join connections allowed.
    .PARAMETER Mptcprtostoswitchsf
        Number of RTO's at subflow level, after which MPCTP should start using other subflow.
    .PARAMETER Mptcpusebackupondss
        When enabled, if NS receives a DSS on a backup subflow, NS will start using that subflow to send data. And if disabled, NS will continue to transmit on current chosen subflow. In case there is some error on a subflow (like RTO's/RST etc.) then NS can choose a backup subflow irrespective of this tunable.
        Possible values = ENABLED, DISABLED
    .PARAMETER Tcpmaxretries
        Number of RTO's after which a connection should be freed.
    .PARAMETER Mptcpimmediatesfcloseonfin
        Allow subflows to close immediately on FIN before the DATA_FIN exchange is completed at mptcp level.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mptcpclosemptcpsessiononlastsfclose
        Allow to send DATA FIN or FAST CLOSE on mptcp connection while sending FIN or RST on the last subflow.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mptcpsendsfresetoption
        Allow MPTCP subflows to send TCP RST Reason (MP_TCPRST) Option while sending TCP RST.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mptcpfastcloseoption
        Allow to select option ACK or RESET to force the closure of an MPTCP connection abruptly.
        Possible values = ACK, RESET
    .PARAMETER Tcpfastopencookietimeout
        Timeout in seconds after which a new TFO Key is computed for generating TFO Cookie. If zero, the same key is used always. If timeout is less than 120seconds, NS defaults to 120seconds timeout.
    .PARAMETER Autosyncookietimeout
        Timeout for the server to function in syncookie mode after the synattack. This is valid if TCP syncookie is disabled on the profile and server acts in non syncookie mode by default.
    .PARAMETER Tcpfintimeout
        The amount of time in seconds, after which a TCP connnection in the TCP TIME-WAIT state is flushed.
    .PARAMETER Compacttcpoptionnoop
        If enabled, non-negotiated TCP options are removed from the received packet while proxying it. By default, non-negotiated TCP options would be replaced by NOPs in the proxied packets. This option is not applicable for Citrix ADC generated packets.
        Possible values = ENABLED, DISABLED
    .PARAMETER Delinkclientserveronrst
        If enabled, Delink client and server connection, when there is outstanding data to be sent to the other side.
        Possible values = ENABLED, DISABLED
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNstcpparam
        An example how to update nstcpparam configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNstcpparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstcpparam/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ws,

        [ValidateRange(0, 14)]
        [double]$Wsval,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Sack,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Learnvsvrmss,

        [ValidateRange(1, 255)]
        [double]$Maxburst,

        [ValidateRange(1, 44)]
        [double]$Initialcwnd,

        [ValidateRange(8190, 20971520)]
        [double]$Recvbuffsize,

        [ValidateRange(10, 300)]
        [double]$Delayedack,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Downstaterst,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Nagle,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Limitedpersist,

        [ValidateRange(0, 65535)]
        [double]$Oooqsize,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ackonpush,

        [ValidateRange(0, 1460)]
        [double]$Maxpktpermss,

        [ValidateRange(1, 100)]
        [int]$Pktperretx,

        [ValidateRange(10, 64000)]
        [int]$Minrto,

        [ValidateRange(1, 100)]
        [int]$Slowstartincr,

        [ValidateRange(1, 65535)]
        [double]$Maxdynserverprobes,

        [ValidateRange(256, 65535)]
        [double]$Synholdfastgiveup,

        [ValidateRange(1, 255)]
        [double]$Maxsynholdperprobe,

        [ValidateRange(256, 65535)]
        [double]$Maxsynhold,

        [ValidateRange(1, 1048576)]
        [double]$Msslearninterval,

        [ValidateRange(1, 1048576)]
        [double]$Msslearndelay,

        [double]$Maxtimewaitconn,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Kaprobeupdatelastactivity,

        [ValidateRange(100, 1048576)]
        [double]$Maxsynackretx,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Synattackdetection,

        [ValidateSet('NONE', 'HALFCLOSED_AND_IDLE', 'FIFO')]
        [string]$Connflushifnomem,

        [double]$Connflushthres,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Mptcpconcloseonpassivesf,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Mptcpchecksum,

        [ValidateRange(0, 31536000)]
        [double]$Mptcpsftimeout,

        [ValidateRange(0, 31536000)]
        [double]$Mptcpsfreplacetimeout,

        [ValidateRange(2, 6)]
        [double]$Mptcpmaxsf,

        [ValidateRange(0, 4)]
        [double]$Mptcpmaxpendingsf,

        [ValidateRange(0, 4294967294)]
        [double]$Mptcppendingjointhreshold,

        [ValidateRange(1, 6)]
        [double]$Mptcprtostoswitchsf,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Mptcpusebackupondss,

        [ValidateRange(1, 7)]
        [double]$Tcpmaxretries,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Mptcpimmediatesfcloseonfin,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Mptcpclosemptcpsessiononlastsfclose,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Mptcpsendsfresetoption,

        [ValidateSet('ACK', 'RESET')]
        [string]$Mptcpfastcloseoption,

        [ValidateRange(0, 31536000)]
        [double]$Tcpfastopencookietimeout,

        [ValidateRange(7, 65535)]
        [double]$Autosyncookietimeout,

        [ValidateRange(10, 240)]
        [double]$Tcpfintimeout,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Compacttcpoptionnoop,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Delinkclientserveronrst 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNstcpparam: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('ws') ) { $payload.Add('ws', $ws) }
            if ( $PSBoundParameters.ContainsKey('wsval') ) { $payload.Add('wsval', $wsval) }
            if ( $PSBoundParameters.ContainsKey('sack') ) { $payload.Add('sack', $sack) }
            if ( $PSBoundParameters.ContainsKey('learnvsvrmss') ) { $payload.Add('learnvsvrmss', $learnvsvrmss) }
            if ( $PSBoundParameters.ContainsKey('maxburst') ) { $payload.Add('maxburst', $maxburst) }
            if ( $PSBoundParameters.ContainsKey('initialcwnd') ) { $payload.Add('initialcwnd', $initialcwnd) }
            if ( $PSBoundParameters.ContainsKey('recvbuffsize') ) { $payload.Add('recvbuffsize', $recvbuffsize) }
            if ( $PSBoundParameters.ContainsKey('delayedack') ) { $payload.Add('delayedack', $delayedack) }
            if ( $PSBoundParameters.ContainsKey('downstaterst') ) { $payload.Add('downstaterst', $downstaterst) }
            if ( $PSBoundParameters.ContainsKey('nagle') ) { $payload.Add('nagle', $nagle) }
            if ( $PSBoundParameters.ContainsKey('limitedpersist') ) { $payload.Add('limitedpersist', $limitedpersist) }
            if ( $PSBoundParameters.ContainsKey('oooqsize') ) { $payload.Add('oooqsize', $oooqsize) }
            if ( $PSBoundParameters.ContainsKey('ackonpush') ) { $payload.Add('ackonpush', $ackonpush) }
            if ( $PSBoundParameters.ContainsKey('maxpktpermss') ) { $payload.Add('maxpktpermss', $maxpktpermss) }
            if ( $PSBoundParameters.ContainsKey('pktperretx') ) { $payload.Add('pktperretx', $pktperretx) }
            if ( $PSBoundParameters.ContainsKey('minrto') ) { $payload.Add('minrto', $minrto) }
            if ( $PSBoundParameters.ContainsKey('slowstartincr') ) { $payload.Add('slowstartincr', $slowstartincr) }
            if ( $PSBoundParameters.ContainsKey('maxdynserverprobes') ) { $payload.Add('maxdynserverprobes', $maxdynserverprobes) }
            if ( $PSBoundParameters.ContainsKey('synholdfastgiveup') ) { $payload.Add('synholdfastgiveup', $synholdfastgiveup) }
            if ( $PSBoundParameters.ContainsKey('maxsynholdperprobe') ) { $payload.Add('maxsynholdperprobe', $maxsynholdperprobe) }
            if ( $PSBoundParameters.ContainsKey('maxsynhold') ) { $payload.Add('maxsynhold', $maxsynhold) }
            if ( $PSBoundParameters.ContainsKey('msslearninterval') ) { $payload.Add('msslearninterval', $msslearninterval) }
            if ( $PSBoundParameters.ContainsKey('msslearndelay') ) { $payload.Add('msslearndelay', $msslearndelay) }
            if ( $PSBoundParameters.ContainsKey('maxtimewaitconn') ) { $payload.Add('maxtimewaitconn', $maxtimewaitconn) }
            if ( $PSBoundParameters.ContainsKey('kaprobeupdatelastactivity') ) { $payload.Add('kaprobeupdatelastactivity', $kaprobeupdatelastactivity) }
            if ( $PSBoundParameters.ContainsKey('maxsynackretx') ) { $payload.Add('maxsynackretx', $maxsynackretx) }
            if ( $PSBoundParameters.ContainsKey('synattackdetection') ) { $payload.Add('synattackdetection', $synattackdetection) }
            if ( $PSBoundParameters.ContainsKey('connflushifnomem') ) { $payload.Add('connflushifnomem', $connflushifnomem) }
            if ( $PSBoundParameters.ContainsKey('connflushthres') ) { $payload.Add('connflushthres', $connflushthres) }
            if ( $PSBoundParameters.ContainsKey('mptcpconcloseonpassivesf') ) { $payload.Add('mptcpconcloseonpassivesf', $mptcpconcloseonpassivesf) }
            if ( $PSBoundParameters.ContainsKey('mptcpchecksum') ) { $payload.Add('mptcpchecksum', $mptcpchecksum) }
            if ( $PSBoundParameters.ContainsKey('mptcpsftimeout') ) { $payload.Add('mptcpsftimeout', $mptcpsftimeout) }
            if ( $PSBoundParameters.ContainsKey('mptcpsfreplacetimeout') ) { $payload.Add('mptcpsfreplacetimeout', $mptcpsfreplacetimeout) }
            if ( $PSBoundParameters.ContainsKey('mptcpmaxsf') ) { $payload.Add('mptcpmaxsf', $mptcpmaxsf) }
            if ( $PSBoundParameters.ContainsKey('mptcpmaxpendingsf') ) { $payload.Add('mptcpmaxpendingsf', $mptcpmaxpendingsf) }
            if ( $PSBoundParameters.ContainsKey('mptcppendingjointhreshold') ) { $payload.Add('mptcppendingjointhreshold', $mptcppendingjointhreshold) }
            if ( $PSBoundParameters.ContainsKey('mptcprtostoswitchsf') ) { $payload.Add('mptcprtostoswitchsf', $mptcprtostoswitchsf) }
            if ( $PSBoundParameters.ContainsKey('mptcpusebackupondss') ) { $payload.Add('mptcpusebackupondss', $mptcpusebackupondss) }
            if ( $PSBoundParameters.ContainsKey('tcpmaxretries') ) { $payload.Add('tcpmaxretries', $tcpmaxretries) }
            if ( $PSBoundParameters.ContainsKey('mptcpimmediatesfcloseonfin') ) { $payload.Add('mptcpimmediatesfcloseonfin', $mptcpimmediatesfcloseonfin) }
            if ( $PSBoundParameters.ContainsKey('mptcpclosemptcpsessiononlastsfclose') ) { $payload.Add('mptcpclosemptcpsessiononlastsfclose', $mptcpclosemptcpsessiononlastsfclose) }
            if ( $PSBoundParameters.ContainsKey('mptcpsendsfresetoption') ) { $payload.Add('mptcpsendsfresetoption', $mptcpsendsfresetoption) }
            if ( $PSBoundParameters.ContainsKey('mptcpfastcloseoption') ) { $payload.Add('mptcpfastcloseoption', $mptcpfastcloseoption) }
            if ( $PSBoundParameters.ContainsKey('tcpfastopencookietimeout') ) { $payload.Add('tcpfastopencookietimeout', $tcpfastopencookietimeout) }
            if ( $PSBoundParameters.ContainsKey('autosyncookietimeout') ) { $payload.Add('autosyncookietimeout', $autosyncookietimeout) }
            if ( $PSBoundParameters.ContainsKey('tcpfintimeout') ) { $payload.Add('tcpfintimeout', $tcpfintimeout) }
            if ( $PSBoundParameters.ContainsKey('compacttcpoptionnoop') ) { $payload.Add('compacttcpoptionnoop', $compacttcpoptionnoop) }
            if ( $PSBoundParameters.ContainsKey('delinkclientserveronrst') ) { $payload.Add('delinkclientserveronrst', $delinkclientserveronrst) }
            if ( $PSCmdlet.ShouldProcess("nstcpparam", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nstcpparam -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNstcpparam: Finished"
    }
}

function Invoke-ADCUnsetNstcpparam {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for tcp parameters resource.
    .PARAMETER Ws
        Enable or disable window scaling.
        Possible values = ENABLED, DISABLED
    .PARAMETER Wsval
        Factor used to calculate the new window size.
        This argument is needed only when the window scaling is enabled.
    .PARAMETER Sack
        Enable or disable Selective ACKnowledgement (SACK).
        Possible values = ENABLED, DISABLED
    .PARAMETER Learnvsvrmss
        Enable or disable maximum segment size (MSS) learning for virtual servers.
        Possible values = ENABLED, DISABLED
    .PARAMETER Maxburst
        Maximum number of TCP segments allowed in a burst.
    .PARAMETER Initialcwnd
        Initial maximum upper limit on the number of TCP packets that can be outstanding on the TCP link to the server.
    .PARAMETER Recvbuffsize
        TCP Receive buffer size.
    .PARAMETER Delayedack
        Timeout for TCP delayed ACK, in milliseconds.
    .PARAMETER Downstaterst
        Flag to switch on RST on down services.
        Possible values = ENABLED, DISABLED
    .PARAMETER Nagle
        Enable or disable the Nagle algorithm on TCP connections.
        Possible values = ENABLED, DISABLED
    .PARAMETER Limitedpersist
        Limit the number of persist (zero window) probes.
        Possible values = ENABLED, DISABLED
    .PARAMETER Oooqsize
        Maximum size of out-of-order packets queue. A value of 0 means no limit.
    .PARAMETER Ackonpush
        Send immediate positive acknowledgement (ACK) on receipt of TCP packets with PUSH flag.
        Possible values = ENABLED, DISABLED
    .PARAMETER Maxpktpermss
        Maximum number of TCP packets allowed per maximum segment size (MSS).
    .PARAMETER Pktperretx
        Maximum limit on the number of packets that should be retransmitted on receiving a partial ACK.
    .PARAMETER Minrto
        Minimum retransmission timeout, in milliseconds, specified in 10-millisecond increments (value must yield a whole number if divided by 10).
    .PARAMETER Slowstartincr
        Multiplier that determines the rate at which slow start increases the size of the TCP transmission window after each acknowledgement of successful transmission.
    .PARAMETER Maxdynserverprobes
        Maximum number of probes that Citrix ADC can send out in 10 milliseconds, to dynamically learn a service. Citrix ADC probes for the existence of the origin in case of wildcard virtual server or services.
    .PARAMETER Synholdfastgiveup
        Maximum threshold. After crossing this threshold number of outstanding probes for origin, the Citrix ADC reduces the number of connection retries for probe connections.
    .PARAMETER Maxsynholdperprobe
        Limit the number of client connections (SYN) waiting for status of single probe. Any new SYN packets will be dropped.
    .PARAMETER Maxsynhold
        Limit the number of client connections (SYN) waiting for status of probe system wide. Any new SYN packets will be dropped.
    .PARAMETER Msslearninterval
        Duration, in seconds, to sample the Maximum Segment Size (MSS) of the services. The Citrix ADC determines the best MSS to set for the virtual server based on this sampling. The argument to enable maximum segment size (MSS) for virtual servers must be enabled.
    .PARAMETER Msslearndelay
        Frequency, in seconds, at which the virtual servers learn the Maximum segment size (MSS) from the services. The argument to enable maximum segment size (MSS) for virtual servers must be enabled.
    .PARAMETER Maxtimewaitconn
        Maximum number of connections to hold in the TCP TIME_WAIT state on a packet engine. New connections entering TIME_WAIT state are proactively cleaned up.
    .PARAMETER Kaprobeupdatelastactivity
        Update last activity for KA probes.
        Possible values = ENABLED, DISABLED
    .PARAMETER Maxsynackretx
        When 'syncookie' is disabled in the TCP profile that is bound to the virtual server or service, and the number of TCP SYN+ACK retransmission by Citrix ADC for that virtual server or service crosses this threshold, the Citrix ADC responds by using the TCP SYN-Cookie mechanism.
    .PARAMETER Synattackdetection
        Detect TCP SYN packet flood and send an SNMP trap.
        Possible values = ENABLED, DISABLED
    .PARAMETER Connflushifnomem
        Flush an existing connection if no memory can be obtained for new connection.
        HALF_CLOSED_AND_IDLE: Flush a connection that is closed by us but not by peer, or failing that, a connection that is past configured idle time. New connection fails if no such connection can be found.
        FIFO: If no half-closed or idle connection can be found, flush the oldest non-management connection, even if it is active. New connection fails if the oldest few connections are management connections.
        Note: If you enable this setting, you should also consider lowering the zombie timeout and half-close timeout, while setting the Citrix ADC timeout.
        See Also: connFlushThres argument below.
        Possible values = NONE, HALFCLOSED_AND_IDLE, FIFO
    .PARAMETER Connflushthres
        Flush an existing connection (as configured through -connFlushIfNoMem FIFO) if the system has more than specified number of connections, and a new connection is to be established. Note: This value may be rounded down to be a whole multiple of the number of packet engines running.
    .PARAMETER Mptcpconcloseonpassivesf
        Accept DATA_FIN/FAST_CLOSE on passive subflow.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mptcpchecksum
        Use MPTCP DSS checksum.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mptcpsftimeout
        The timeout value in seconds for idle mptcp subflows. If this timeout is not set, idle subflows are cleared after cltTimeout of vserver.
    .PARAMETER Mptcpsfreplacetimeout
        The minimum idle time value in seconds for idle mptcp subflows after which the sublow is replaced by new incoming subflow if maximum subflow limit is reached. The priority for replacement is given to those subflow without any transaction.
    .PARAMETER Mptcpmaxsf
        Maximum number of subflow connections supported in established state per mptcp connection.
    .PARAMETER Mptcpmaxpendingsf
        Maximum number of subflow connections supported in pending join state per mptcp connection.
    .PARAMETER Mptcppendingjointhreshold
        Maximum system level pending join connections allowed.
    .PARAMETER Mptcprtostoswitchsf
        Number of RTO's at subflow level, after which MPCTP should start using other subflow.
    .PARAMETER Mptcpusebackupondss
        When enabled, if NS receives a DSS on a backup subflow, NS will start using that subflow to send data. And if disabled, NS will continue to transmit on current chosen subflow. In case there is some error on a subflow (like RTO's/RST etc.) then NS can choose a backup subflow irrespective of this tunable.
        Possible values = ENABLED, DISABLED
    .PARAMETER Tcpmaxretries
        Number of RTO's after which a connection should be freed.
    .PARAMETER Mptcpimmediatesfcloseonfin
        Allow subflows to close immediately on FIN before the DATA_FIN exchange is completed at mptcp level.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mptcpclosemptcpsessiononlastsfclose
        Allow to send DATA FIN or FAST CLOSE on mptcp connection while sending FIN or RST on the last subflow.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mptcpsendsfresetoption
        Allow MPTCP subflows to send TCP RST Reason (MP_TCPRST) Option while sending TCP RST.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mptcpfastcloseoption
        Allow to select option ACK or RESET to force the closure of an MPTCP connection abruptly.
        Possible values = ACK, RESET
    .PARAMETER Tcpfastopencookietimeout
        Timeout in seconds after which a new TFO Key is computed for generating TFO Cookie. If zero, the same key is used always. If timeout is less than 120seconds, NS defaults to 120seconds timeout.
    .PARAMETER Autosyncookietimeout
        Timeout for the server to function in syncookie mode after the synattack. This is valid if TCP syncookie is disabled on the profile and server acts in non syncookie mode by default.
    .PARAMETER Tcpfintimeout
        The amount of time in seconds, after which a TCP connnection in the TCP TIME-WAIT state is flushed.
    .PARAMETER Compacttcpoptionnoop
        If enabled, non-negotiated TCP options are removed from the received packet while proxying it. By default, non-negotiated TCP options would be replaced by NOPs in the proxied packets. This option is not applicable for Citrix ADC generated packets.
        Possible values = ENABLED, DISABLED
    .PARAMETER Delinkclientserveronrst
        If enabled, Delink client and server connection, when there is outstanding data to be sent to the other side.
        Possible values = ENABLED, DISABLED
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNstcpparam
        An example how to unset nstcpparam configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNstcpparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstcpparam
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Boolean]$ws,

        [Boolean]$wsval,

        [Boolean]$sack,

        [Boolean]$learnvsvrmss,

        [Boolean]$maxburst,

        [Boolean]$initialcwnd,

        [Boolean]$recvbuffsize,

        [Boolean]$delayedack,

        [Boolean]$downstaterst,

        [Boolean]$nagle,

        [Boolean]$limitedpersist,

        [Boolean]$oooqsize,

        [Boolean]$ackonpush,

        [Boolean]$maxpktpermss,

        [Boolean]$pktperretx,

        [Boolean]$minrto,

        [Boolean]$slowstartincr,

        [Boolean]$maxdynserverprobes,

        [Boolean]$synholdfastgiveup,

        [Boolean]$maxsynholdperprobe,

        [Boolean]$maxsynhold,

        [Boolean]$msslearninterval,

        [Boolean]$msslearndelay,

        [Boolean]$maxtimewaitconn,

        [Boolean]$kaprobeupdatelastactivity,

        [Boolean]$maxsynackretx,

        [Boolean]$synattackdetection,

        [Boolean]$connflushifnomem,

        [Boolean]$connflushthres,

        [Boolean]$mptcpconcloseonpassivesf,

        [Boolean]$mptcpchecksum,

        [Boolean]$mptcpsftimeout,

        [Boolean]$mptcpsfreplacetimeout,

        [Boolean]$mptcpmaxsf,

        [Boolean]$mptcpmaxpendingsf,

        [Boolean]$mptcppendingjointhreshold,

        [Boolean]$mptcprtostoswitchsf,

        [Boolean]$mptcpusebackupondss,

        [Boolean]$tcpmaxretries,

        [Boolean]$mptcpimmediatesfcloseonfin,

        [Boolean]$mptcpclosemptcpsessiononlastsfclose,

        [Boolean]$mptcpsendsfresetoption,

        [Boolean]$mptcpfastcloseoption,

        [Boolean]$tcpfastopencookietimeout,

        [Boolean]$autosyncookietimeout,

        [Boolean]$tcpfintimeout,

        [Boolean]$compacttcpoptionnoop,

        [Boolean]$delinkclientserveronrst 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNstcpparam: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('ws') ) { $payload.Add('ws', $ws) }
            if ( $PSBoundParameters.ContainsKey('wsval') ) { $payload.Add('wsval', $wsval) }
            if ( $PSBoundParameters.ContainsKey('sack') ) { $payload.Add('sack', $sack) }
            if ( $PSBoundParameters.ContainsKey('learnvsvrmss') ) { $payload.Add('learnvsvrmss', $learnvsvrmss) }
            if ( $PSBoundParameters.ContainsKey('maxburst') ) { $payload.Add('maxburst', $maxburst) }
            if ( $PSBoundParameters.ContainsKey('initialcwnd') ) { $payload.Add('initialcwnd', $initialcwnd) }
            if ( $PSBoundParameters.ContainsKey('recvbuffsize') ) { $payload.Add('recvbuffsize', $recvbuffsize) }
            if ( $PSBoundParameters.ContainsKey('delayedack') ) { $payload.Add('delayedack', $delayedack) }
            if ( $PSBoundParameters.ContainsKey('downstaterst') ) { $payload.Add('downstaterst', $downstaterst) }
            if ( $PSBoundParameters.ContainsKey('nagle') ) { $payload.Add('nagle', $nagle) }
            if ( $PSBoundParameters.ContainsKey('limitedpersist') ) { $payload.Add('limitedpersist', $limitedpersist) }
            if ( $PSBoundParameters.ContainsKey('oooqsize') ) { $payload.Add('oooqsize', $oooqsize) }
            if ( $PSBoundParameters.ContainsKey('ackonpush') ) { $payload.Add('ackonpush', $ackonpush) }
            if ( $PSBoundParameters.ContainsKey('maxpktpermss') ) { $payload.Add('maxpktpermss', $maxpktpermss) }
            if ( $PSBoundParameters.ContainsKey('pktperretx') ) { $payload.Add('pktperretx', $pktperretx) }
            if ( $PSBoundParameters.ContainsKey('minrto') ) { $payload.Add('minrto', $minrto) }
            if ( $PSBoundParameters.ContainsKey('slowstartincr') ) { $payload.Add('slowstartincr', $slowstartincr) }
            if ( $PSBoundParameters.ContainsKey('maxdynserverprobes') ) { $payload.Add('maxdynserverprobes', $maxdynserverprobes) }
            if ( $PSBoundParameters.ContainsKey('synholdfastgiveup') ) { $payload.Add('synholdfastgiveup', $synholdfastgiveup) }
            if ( $PSBoundParameters.ContainsKey('maxsynholdperprobe') ) { $payload.Add('maxsynholdperprobe', $maxsynholdperprobe) }
            if ( $PSBoundParameters.ContainsKey('maxsynhold') ) { $payload.Add('maxsynhold', $maxsynhold) }
            if ( $PSBoundParameters.ContainsKey('msslearninterval') ) { $payload.Add('msslearninterval', $msslearninterval) }
            if ( $PSBoundParameters.ContainsKey('msslearndelay') ) { $payload.Add('msslearndelay', $msslearndelay) }
            if ( $PSBoundParameters.ContainsKey('maxtimewaitconn') ) { $payload.Add('maxtimewaitconn', $maxtimewaitconn) }
            if ( $PSBoundParameters.ContainsKey('kaprobeupdatelastactivity') ) { $payload.Add('kaprobeupdatelastactivity', $kaprobeupdatelastactivity) }
            if ( $PSBoundParameters.ContainsKey('maxsynackretx') ) { $payload.Add('maxsynackretx', $maxsynackretx) }
            if ( $PSBoundParameters.ContainsKey('synattackdetection') ) { $payload.Add('synattackdetection', $synattackdetection) }
            if ( $PSBoundParameters.ContainsKey('connflushifnomem') ) { $payload.Add('connflushifnomem', $connflushifnomem) }
            if ( $PSBoundParameters.ContainsKey('connflushthres') ) { $payload.Add('connflushthres', $connflushthres) }
            if ( $PSBoundParameters.ContainsKey('mptcpconcloseonpassivesf') ) { $payload.Add('mptcpconcloseonpassivesf', $mptcpconcloseonpassivesf) }
            if ( $PSBoundParameters.ContainsKey('mptcpchecksum') ) { $payload.Add('mptcpchecksum', $mptcpchecksum) }
            if ( $PSBoundParameters.ContainsKey('mptcpsftimeout') ) { $payload.Add('mptcpsftimeout', $mptcpsftimeout) }
            if ( $PSBoundParameters.ContainsKey('mptcpsfreplacetimeout') ) { $payload.Add('mptcpsfreplacetimeout', $mptcpsfreplacetimeout) }
            if ( $PSBoundParameters.ContainsKey('mptcpmaxsf') ) { $payload.Add('mptcpmaxsf', $mptcpmaxsf) }
            if ( $PSBoundParameters.ContainsKey('mptcpmaxpendingsf') ) { $payload.Add('mptcpmaxpendingsf', $mptcpmaxpendingsf) }
            if ( $PSBoundParameters.ContainsKey('mptcppendingjointhreshold') ) { $payload.Add('mptcppendingjointhreshold', $mptcppendingjointhreshold) }
            if ( $PSBoundParameters.ContainsKey('mptcprtostoswitchsf') ) { $payload.Add('mptcprtostoswitchsf', $mptcprtostoswitchsf) }
            if ( $PSBoundParameters.ContainsKey('mptcpusebackupondss') ) { $payload.Add('mptcpusebackupondss', $mptcpusebackupondss) }
            if ( $PSBoundParameters.ContainsKey('tcpmaxretries') ) { $payload.Add('tcpmaxretries', $tcpmaxretries) }
            if ( $PSBoundParameters.ContainsKey('mptcpimmediatesfcloseonfin') ) { $payload.Add('mptcpimmediatesfcloseonfin', $mptcpimmediatesfcloseonfin) }
            if ( $PSBoundParameters.ContainsKey('mptcpclosemptcpsessiononlastsfclose') ) { $payload.Add('mptcpclosemptcpsessiononlastsfclose', $mptcpclosemptcpsessiononlastsfclose) }
            if ( $PSBoundParameters.ContainsKey('mptcpsendsfresetoption') ) { $payload.Add('mptcpsendsfresetoption', $mptcpsendsfresetoption) }
            if ( $PSBoundParameters.ContainsKey('mptcpfastcloseoption') ) { $payload.Add('mptcpfastcloseoption', $mptcpfastcloseoption) }
            if ( $PSBoundParameters.ContainsKey('tcpfastopencookietimeout') ) { $payload.Add('tcpfastopencookietimeout', $tcpfastopencookietimeout) }
            if ( $PSBoundParameters.ContainsKey('autosyncookietimeout') ) { $payload.Add('autosyncookietimeout', $autosyncookietimeout) }
            if ( $PSBoundParameters.ContainsKey('tcpfintimeout') ) { $payload.Add('tcpfintimeout', $tcpfintimeout) }
            if ( $PSBoundParameters.ContainsKey('compacttcpoptionnoop') ) { $payload.Add('compacttcpoptionnoop', $compacttcpoptionnoop) }
            if ( $PSBoundParameters.ContainsKey('delinkclientserveronrst') ) { $payload.Add('delinkclientserveronrst', $delinkclientserveronrst) }
            if ( $PSCmdlet.ShouldProcess("nstcpparam", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nstcpparam -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNstcpparam: Finished"
    }
}

function Invoke-ADCGetNstcpparam {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for tcp parameters resource.
    .PARAMETER GetAll
        Retrieve all nstcpparam object(s).
    .PARAMETER Count
        If specified, the count of the nstcpparam object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstcpparam
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstcpparam -GetAll
        Get all nstcpparam data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstcpparam -name <string>
        Get nstcpparam object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstcpparam -Filter @{ 'name'='<value>' }
        Get nstcpparam data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNstcpparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstcpparam/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNstcpparam: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nstcpparam objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstcpparam -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nstcpparam objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstcpparam -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nstcpparam objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstcpparam -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nstcpparam configuration for property ''"

            } else {
                Write-Verbose "Retrieving nstcpparam configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstcpparam -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNstcpparam: Ended"
    }
}

function Invoke-ADCAddNstcpprofile {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for TCP profile resource.
    .PARAMETER Name
        Name for a TCP profile. Must begin with a letter, number, or the underscore \(_\) character. Other characters allowed, after the first character, are the hyphen \(-\), period \(.\), hash \(\#\), space \( \), at \(@\), colon \(:\), and equal \(=\) characters. The name of a TCP profile cannot be changed after it is created.
        CLI Users: If the name includes one or more spaces, enclose the name in double or single quotation marks \(for example, "my tcp profile" or 'my tcp profile'\).
    .PARAMETER Ws
        Enable or disable window scaling.
        Possible values = ENABLED, DISABLED
    .PARAMETER Sack
        Enable or disable Selective ACKnowledgement (SACK).
        Possible values = ENABLED, DISABLED
    .PARAMETER Wsval
        Factor used to calculate the new window size.
        This argument is needed only when window scaling is enabled.
    .PARAMETER Nagle
        Enable or disable the Nagle algorithm on TCP connections.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ackonpush
        Send immediate positive acknowledgement (ACK) on receipt of TCP packets with PUSH flag.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mss
        Maximum number of octets to allow in a TCP data segment.
    .PARAMETER Maxburst
        Maximum number of TCP segments allowed in a burst.
    .PARAMETER Initialcwnd
        Initial maximum upper limit on the number of TCP packets that can be outstanding on the TCP link to the server.
    .PARAMETER Delayedack
        Timeout for TCP delayed ACK, in milliseconds.
    .PARAMETER Oooqsize
        Maximum size of out-of-order packets queue. A value of 0 means no limit.
    .PARAMETER Maxpktpermss
        Maximum number of TCP packets allowed per maximum segment size (MSS).
    .PARAMETER Pktperretx
        Maximum limit on the number of packets that should be retransmitted on receiving a partial ACK.
    .PARAMETER Minrto
        Minimum retransmission timeout, in milliseconds, specified in 10-millisecond increments (value must yield a whole number if divided by 10).
    .PARAMETER Slowstartincr
        Multiplier that determines the rate at which slow start increases the size of the TCP transmission window after each acknowledgement of successful transmission.
    .PARAMETER Buffersize
        TCP buffering size, in bytes.
    .PARAMETER Syncookie
        Enable or disable the SYNCOOKIE mechanism for TCP handshake with clients. Disabling SYNCOOKIE prevents SYN attack protection on the Citrix ADC.
        Possible values = ENABLED, DISABLED
    .PARAMETER Kaprobeupdatelastactivity
        Update last activity for the connection after receiving keep-alive (KA) probes.
        Possible values = ENABLED, DISABLED
    .PARAMETER Flavor
        Set TCP congestion control algorithm.
        Possible values = Default, Westwood, BIC, CUBIC, Nile
    .PARAMETER Dynamicreceivebuffering
        Enable or disable dynamic receive buffering. When enabled, allows the receive buffer to be adjusted dynamically based on memory and network conditions.
        Note: The buffer size argument must be set for dynamic adjustments to take place.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ka
        Send periodic TCP keep-alive (KA) probes to check if peer is still up.
        Possible values = ENABLED, DISABLED
    .PARAMETER Kaconnidletime
        Duration, in seconds, for the connection to be idle, before sending a keep-alive (KA) probe.
    .PARAMETER Kamaxprobes
        Number of keep-alive (KA) probes to be sent when not acknowledged, before assuming the peer to be down.
    .PARAMETER Kaprobeinterval
        Time interval, in seconds, before the next keep-alive (KA) probe, if the peer does not respond.
    .PARAMETER Sendbuffsize
        TCP Send Buffer Size.
    .PARAMETER Mptcp
        Enable or disable Multipath TCP.
        Possible values = ENABLED, DISABLED
    .PARAMETER Establishclientconn
        Establishing Client Client connection on First data/ Final-ACK / Automatic.
        Possible values = AUTOMATIC, CONN_ESTABLISHED, ON_FIRST_DATA
    .PARAMETER Tcpsegoffload
        Offload TCP segmentation to the NIC. If set to AUTOMATIC, TCP segmentation will be offloaded to the NIC, if the NIC supports it.
        Possible values = AUTOMATIC, DISABLED
    .PARAMETER Rstwindowattenuate
        Enable or disable RST window attenuation to protect against spoofing. When enabled, will reply with corrective ACK when a sequence number is invalid.
        Possible values = ENABLED, DISABLED
    .PARAMETER Rstmaxack
        Enable or disable acceptance of RST that is out of window yet echoes highest ACK sequence number. Useful only in proxy mode.
        Possible values = ENABLED, DISABLED
    .PARAMETER Spoofsyndrop
        Enable or disable drop of invalid SYN packets to protect against spoofing. When disabled, established connections will be reset when a SYN packet is received.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ecn
        Enable or disable TCP Explicit Congestion Notification.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mptcpdropdataonpreestsf
        Enable or disable silently dropping the data on Pre-Established subflow. When enabled, DSS data packets are dropped silently instead of dropping the connection when data is received on pre established subflow.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mptcpfastopen
        Enable or disable Multipath TCP fastopen. When enabled, DSS data packets are accepted before receiving the third ack of SYN handshake.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mptcpsessiontimeout
        MPTCP session timeout in seconds. If this value is not set, idle MPTCP sessions are flushed after vserver's client idle timeout.
    .PARAMETER Timestamp
        Enable or Disable TCP Timestamp option (RFC 1323).
        Possible values = ENABLED, DISABLED
    .PARAMETER Dsack
        Enable or disable DSACK.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ackaggregation
        Enable or disable ACK Aggregation.
        Possible values = ENABLED, DISABLED
    .PARAMETER Frto
        Enable or disable FRTO (Forward RTO-Recovery).
        Possible values = ENABLED, DISABLED
    .PARAMETER Maxcwnd
        TCP Maximum Congestion Window.
    .PARAMETER Fack
        Enable or disable FACK (Forward ACK).
        Possible values = ENABLED, DISABLED
    .PARAMETER Tcpmode
        TCP Optimization modes TRANSPARENT / ENDPOINT.
        Possible values = TRANSPARENT, ENDPOINT
    .PARAMETER Tcpfastopen
        Enable or disable TCP Fastopen. When enabled, NS can receive or send Data in SYN or SYN-ACK packets.
        Possible values = ENABLED, DISABLED
    .PARAMETER Hystart
        Enable or disable CUBIC Hystart.
        Possible values = ENABLED, DISABLED
    .PARAMETER Dupackthresh
        TCP dupack threshold.
    .PARAMETER Burstratecontrol
        TCP Burst Rate Control DISABLED/FIXED/DYNAMIC. FIXED requires a TCP rate to be set.
        Possible values = DISABLED, FIXED, DYNAMIC
    .PARAMETER Tcprate
        TCP connection payload send rate in Kb/s.
    .PARAMETER Rateqmax
        Maximum connection queue size in bytes, when BurstRateControl is used.
    .PARAMETER Drophalfclosedconnontimeout
        Silently drop tcp half closed connections on idle timeout.
        Possible values = ENABLED, DISABLED
    .PARAMETER Dropestconnontimeout
        Silently drop tcp established connections on idle timeout.
        Possible values = ENABLED, DISABLED
    .PARAMETER Applyadaptivetcp
        Apply Adaptive TCP optimizations.
        Possible values = ENABLED, DISABLED
    .PARAMETER Tcpfastopencookiesize
        TCP FastOpen Cookie size. This accepts only even numbers. Odd number is trimmed down to nearest even number.
    .PARAMETER Taillossprobe
        TCP tail loss probe optimizations.
        Possible values = ENABLED, DISABLED
    .PARAMETER Clientiptcpoption
        Client IP in TCP options.
        Possible values = ENABLED, DISABLED
    .PARAMETER Clientiptcpoptionnumber
        ClientIP TCP Option number.
    .PARAMETER Mpcapablecbit
        Set C bit in MP-CAPABLE Syn-Ack sent by Citrix ADC.
        Possible values = ENABLED, DISABLED
    .PARAMETER PassThru
        Return details about the created nstcpprofile item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNstcpprofile -name <string>
        An example how to add nstcpprofile configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNstcpprofile
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstcpprofile/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateLength(1, 127)]
        [string]$Name,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ws = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Sack = 'DISABLED',

        [ValidateRange(0, 14)]
        [double]$Wsval = '4',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Nagle = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ackonpush = 'ENABLED',

        [ValidateRange(0, 9176)]
        [double]$Mss,

        [ValidateRange(1, 255)]
        [double]$Maxburst = '6',

        [ValidateRange(1, 44)]
        [double]$Initialcwnd = '4',

        [ValidateRange(10, 300)]
        [double]$Delayedack = '100',

        [ValidateRange(0, 65535)]
        [double]$Oooqsize = '64',

        [ValidateRange(0, 1460)]
        [double]$Maxpktpermss,

        [ValidateRange(1, 512)]
        [double]$Pktperretx = '1',

        [ValidateRange(10, 64000)]
        [double]$Minrto = '1000',

        [ValidateRange(1, 100)]
        [double]$Slowstartincr = '2',

        [ValidateRange(8190, 20971520)]
        [double]$Buffersize = '8190',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Syncookie = 'ENABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Kaprobeupdatelastactivity = 'ENABLED',

        [ValidateSet('Default', 'Westwood', 'BIC', 'CUBIC', 'Nile')]
        [string]$Flavor = 'Default',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Dynamicreceivebuffering = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ka = 'DISABLED',

        [ValidateRange(1, 4095)]
        [double]$Kaconnidletime,

        [ValidateRange(1, 254)]
        [double]$Kamaxprobes,

        [ValidateRange(1, 4095)]
        [double]$Kaprobeinterval,

        [ValidateRange(8190, 20971520)]
        [double]$Sendbuffsize = '8190',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Mptcp = 'DISABLED',

        [ValidateSet('AUTOMATIC', 'CONN_ESTABLISHED', 'ON_FIRST_DATA')]
        [string]$Establishclientconn = 'AUTOMATIC',

        [ValidateSet('AUTOMATIC', 'DISABLED')]
        [string]$Tcpsegoffload = 'AUTOMATIC',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Rstwindowattenuate = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Rstmaxack = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Spoofsyndrop = 'ENABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ecn = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Mptcpdropdataonpreestsf = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Mptcpfastopen = 'DISABLED',

        [ValidateRange(0, 86400)]
        [double]$Mptcpsessiontimeout = '0',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Timestamp = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Dsack = 'ENABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ackaggregation = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Frto = 'DISABLED',

        [ValidateRange(8190, 20971520)]
        [double]$Maxcwnd = '524288',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Fack = 'DISABLED',

        [ValidateSet('TRANSPARENT', 'ENDPOINT')]
        [string]$Tcpmode = 'TRANSPARENT',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Tcpfastopen = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Hystart = 'DISABLED',

        [ValidateRange(1, 15)]
        [double]$Dupackthresh = '3',

        [ValidateSet('DISABLED', 'FIXED', 'DYNAMIC')]
        [string]$Burstratecontrol = 'DISABLED',

        [ValidateRange(0, 10000000)]
        [double]$Tcprate = '0',

        [ValidateRange(0, 1000000000)]
        [double]$Rateqmax = '0',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Drophalfclosedconnontimeout = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Dropestconnontimeout = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Applyadaptivetcp = 'DISABLED',

        [ValidateRange(4, 16)]
        [double]$Tcpfastopencookiesize = '8',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Taillossprobe = 'DISABLED',

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Clientiptcpoption = 'DISABLED',

        [ValidateRange(1, 254)]
        [double]$Clientiptcpoptionnumber,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Mpcapablecbit = 'DISABLED',

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNstcpprofile: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('ws') ) { $payload.Add('ws', $ws) }
            if ( $PSBoundParameters.ContainsKey('sack') ) { $payload.Add('sack', $sack) }
            if ( $PSBoundParameters.ContainsKey('wsval') ) { $payload.Add('wsval', $wsval) }
            if ( $PSBoundParameters.ContainsKey('nagle') ) { $payload.Add('nagle', $nagle) }
            if ( $PSBoundParameters.ContainsKey('ackonpush') ) { $payload.Add('ackonpush', $ackonpush) }
            if ( $PSBoundParameters.ContainsKey('mss') ) { $payload.Add('mss', $mss) }
            if ( $PSBoundParameters.ContainsKey('maxburst') ) { $payload.Add('maxburst', $maxburst) }
            if ( $PSBoundParameters.ContainsKey('initialcwnd') ) { $payload.Add('initialcwnd', $initialcwnd) }
            if ( $PSBoundParameters.ContainsKey('delayedack') ) { $payload.Add('delayedack', $delayedack) }
            if ( $PSBoundParameters.ContainsKey('oooqsize') ) { $payload.Add('oooqsize', $oooqsize) }
            if ( $PSBoundParameters.ContainsKey('maxpktpermss') ) { $payload.Add('maxpktpermss', $maxpktpermss) }
            if ( $PSBoundParameters.ContainsKey('pktperretx') ) { $payload.Add('pktperretx', $pktperretx) }
            if ( $PSBoundParameters.ContainsKey('minrto') ) { $payload.Add('minrto', $minrto) }
            if ( $PSBoundParameters.ContainsKey('slowstartincr') ) { $payload.Add('slowstartincr', $slowstartincr) }
            if ( $PSBoundParameters.ContainsKey('buffersize') ) { $payload.Add('buffersize', $buffersize) }
            if ( $PSBoundParameters.ContainsKey('syncookie') ) { $payload.Add('syncookie', $syncookie) }
            if ( $PSBoundParameters.ContainsKey('kaprobeupdatelastactivity') ) { $payload.Add('kaprobeupdatelastactivity', $kaprobeupdatelastactivity) }
            if ( $PSBoundParameters.ContainsKey('flavor') ) { $payload.Add('flavor', $flavor) }
            if ( $PSBoundParameters.ContainsKey('dynamicreceivebuffering') ) { $payload.Add('dynamicreceivebuffering', $dynamicreceivebuffering) }
            if ( $PSBoundParameters.ContainsKey('ka') ) { $payload.Add('ka', $ka) }
            if ( $PSBoundParameters.ContainsKey('kaconnidletime') ) { $payload.Add('kaconnidletime', $kaconnidletime) }
            if ( $PSBoundParameters.ContainsKey('kamaxprobes') ) { $payload.Add('kamaxprobes', $kamaxprobes) }
            if ( $PSBoundParameters.ContainsKey('kaprobeinterval') ) { $payload.Add('kaprobeinterval', $kaprobeinterval) }
            if ( $PSBoundParameters.ContainsKey('sendbuffsize') ) { $payload.Add('sendbuffsize', $sendbuffsize) }
            if ( $PSBoundParameters.ContainsKey('mptcp') ) { $payload.Add('mptcp', $mptcp) }
            if ( $PSBoundParameters.ContainsKey('establishclientconn') ) { $payload.Add('establishclientconn', $establishclientconn) }
            if ( $PSBoundParameters.ContainsKey('tcpsegoffload') ) { $payload.Add('tcpsegoffload', $tcpsegoffload) }
            if ( $PSBoundParameters.ContainsKey('rstwindowattenuate') ) { $payload.Add('rstwindowattenuate', $rstwindowattenuate) }
            if ( $PSBoundParameters.ContainsKey('rstmaxack') ) { $payload.Add('rstmaxack', $rstmaxack) }
            if ( $PSBoundParameters.ContainsKey('spoofsyndrop') ) { $payload.Add('spoofsyndrop', $spoofsyndrop) }
            if ( $PSBoundParameters.ContainsKey('ecn') ) { $payload.Add('ecn', $ecn) }
            if ( $PSBoundParameters.ContainsKey('mptcpdropdataonpreestsf') ) { $payload.Add('mptcpdropdataonpreestsf', $mptcpdropdataonpreestsf) }
            if ( $PSBoundParameters.ContainsKey('mptcpfastopen') ) { $payload.Add('mptcpfastopen', $mptcpfastopen) }
            if ( $PSBoundParameters.ContainsKey('mptcpsessiontimeout') ) { $payload.Add('mptcpsessiontimeout', $mptcpsessiontimeout) }
            if ( $PSBoundParameters.ContainsKey('timestamp') ) { $payload.Add('timestamp', $timestamp) }
            if ( $PSBoundParameters.ContainsKey('dsack') ) { $payload.Add('dsack', $dsack) }
            if ( $PSBoundParameters.ContainsKey('ackaggregation') ) { $payload.Add('ackaggregation', $ackaggregation) }
            if ( $PSBoundParameters.ContainsKey('frto') ) { $payload.Add('frto', $frto) }
            if ( $PSBoundParameters.ContainsKey('maxcwnd') ) { $payload.Add('maxcwnd', $maxcwnd) }
            if ( $PSBoundParameters.ContainsKey('fack') ) { $payload.Add('fack', $fack) }
            if ( $PSBoundParameters.ContainsKey('tcpmode') ) { $payload.Add('tcpmode', $tcpmode) }
            if ( $PSBoundParameters.ContainsKey('tcpfastopen') ) { $payload.Add('tcpfastopen', $tcpfastopen) }
            if ( $PSBoundParameters.ContainsKey('hystart') ) { $payload.Add('hystart', $hystart) }
            if ( $PSBoundParameters.ContainsKey('dupackthresh') ) { $payload.Add('dupackthresh', $dupackthresh) }
            if ( $PSBoundParameters.ContainsKey('burstratecontrol') ) { $payload.Add('burstratecontrol', $burstratecontrol) }
            if ( $PSBoundParameters.ContainsKey('tcprate') ) { $payload.Add('tcprate', $tcprate) }
            if ( $PSBoundParameters.ContainsKey('rateqmax') ) { $payload.Add('rateqmax', $rateqmax) }
            if ( $PSBoundParameters.ContainsKey('drophalfclosedconnontimeout') ) { $payload.Add('drophalfclosedconnontimeout', $drophalfclosedconnontimeout) }
            if ( $PSBoundParameters.ContainsKey('dropestconnontimeout') ) { $payload.Add('dropestconnontimeout', $dropestconnontimeout) }
            if ( $PSBoundParameters.ContainsKey('applyadaptivetcp') ) { $payload.Add('applyadaptivetcp', $applyadaptivetcp) }
            if ( $PSBoundParameters.ContainsKey('tcpfastopencookiesize') ) { $payload.Add('tcpfastopencookiesize', $tcpfastopencookiesize) }
            if ( $PSBoundParameters.ContainsKey('taillossprobe') ) { $payload.Add('taillossprobe', $taillossprobe) }
            if ( $PSBoundParameters.ContainsKey('clientiptcpoption') ) { $payload.Add('clientiptcpoption', $clientiptcpoption) }
            if ( $PSBoundParameters.ContainsKey('clientiptcpoptionnumber') ) { $payload.Add('clientiptcpoptionnumber', $clientiptcpoptionnumber) }
            if ( $PSBoundParameters.ContainsKey('mpcapablecbit') ) { $payload.Add('mpcapablecbit', $mpcapablecbit) }
            if ( $PSCmdlet.ShouldProcess("nstcpprofile", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nstcpprofile -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNstcpprofile -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNstcpprofile: Finished"
    }
}

function Invoke-ADCDeleteNstcpprofile {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for TCP profile resource.
    .PARAMETER Name
        Name for a TCP profile. Must begin with a letter, number, or the underscore \(_\) character. Other characters allowed, after the first character, are the hyphen \(-\), period \(.\), hash \(\#\), space \( \), at \(@\), colon \(:\), and equal \(=\) characters. The name of a TCP profile cannot be changed after it is created.
        CLI Users: If the name includes one or more spaces, enclose the name in double or single quotation marks \(for example, "my tcp profile" or 'my tcp profile'\).
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNstcpprofile -Name <string>
        An example how to delete nstcpprofile configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNstcpprofile
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstcpprofile/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Name 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNstcpprofile: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$name", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nstcpprofile -NitroPath nitro/v1/config -Resource $name -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNstcpprofile: Finished"
    }
}

function Invoke-ADCUpdateNstcpprofile {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for TCP profile resource.
    .PARAMETER Name
        Name for a TCP profile. Must begin with a letter, number, or the underscore \(_\) character. Other characters allowed, after the first character, are the hyphen \(-\), period \(.\), hash \(\#\), space \( \), at \(@\), colon \(:\), and equal \(=\) characters. The name of a TCP profile cannot be changed after it is created.
        CLI Users: If the name includes one or more spaces, enclose the name in double or single quotation marks \(for example, "my tcp profile" or 'my tcp profile'\).
    .PARAMETER Ws
        Enable or disable window scaling.
        Possible values = ENABLED, DISABLED
    .PARAMETER Sack
        Enable or disable Selective ACKnowledgement (SACK).
        Possible values = ENABLED, DISABLED
    .PARAMETER Wsval
        Factor used to calculate the new window size.
        This argument is needed only when window scaling is enabled.
    .PARAMETER Nagle
        Enable or disable the Nagle algorithm on TCP connections.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ackonpush
        Send immediate positive acknowledgement (ACK) on receipt of TCP packets with PUSH flag.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mss
        Maximum number of octets to allow in a TCP data segment.
    .PARAMETER Maxburst
        Maximum number of TCP segments allowed in a burst.
    .PARAMETER Initialcwnd
        Initial maximum upper limit on the number of TCP packets that can be outstanding on the TCP link to the server.
    .PARAMETER Delayedack
        Timeout for TCP delayed ACK, in milliseconds.
    .PARAMETER Oooqsize
        Maximum size of out-of-order packets queue. A value of 0 means no limit.
    .PARAMETER Maxpktpermss
        Maximum number of TCP packets allowed per maximum segment size (MSS).
    .PARAMETER Pktperretx
        Maximum limit on the number of packets that should be retransmitted on receiving a partial ACK.
    .PARAMETER Minrto
        Minimum retransmission timeout, in milliseconds, specified in 10-millisecond increments (value must yield a whole number if divided by 10).
    .PARAMETER Slowstartincr
        Multiplier that determines the rate at which slow start increases the size of the TCP transmission window after each acknowledgement of successful transmission.
    .PARAMETER Buffersize
        TCP buffering size, in bytes.
    .PARAMETER Syncookie
        Enable or disable the SYNCOOKIE mechanism for TCP handshake with clients. Disabling SYNCOOKIE prevents SYN attack protection on the Citrix ADC.
        Possible values = ENABLED, DISABLED
    .PARAMETER Kaprobeupdatelastactivity
        Update last activity for the connection after receiving keep-alive (KA) probes.
        Possible values = ENABLED, DISABLED
    .PARAMETER Flavor
        Set TCP congestion control algorithm.
        Possible values = Default, Westwood, BIC, CUBIC, Nile
    .PARAMETER Dynamicreceivebuffering
        Enable or disable dynamic receive buffering. When enabled, allows the receive buffer to be adjusted dynamically based on memory and network conditions.
        Note: The buffer size argument must be set for dynamic adjustments to take place.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ka
        Send periodic TCP keep-alive (KA) probes to check if peer is still up.
        Possible values = ENABLED, DISABLED
    .PARAMETER Kaconnidletime
        Duration, in seconds, for the connection to be idle, before sending a keep-alive (KA) probe.
    .PARAMETER Kamaxprobes
        Number of keep-alive (KA) probes to be sent when not acknowledged, before assuming the peer to be down.
    .PARAMETER Kaprobeinterval
        Time interval, in seconds, before the next keep-alive (KA) probe, if the peer does not respond.
    .PARAMETER Sendbuffsize
        TCP Send Buffer Size.
    .PARAMETER Mptcp
        Enable or disable Multipath TCP.
        Possible values = ENABLED, DISABLED
    .PARAMETER Establishclientconn
        Establishing Client Client connection on First data/ Final-ACK / Automatic.
        Possible values = AUTOMATIC, CONN_ESTABLISHED, ON_FIRST_DATA
    .PARAMETER Tcpsegoffload
        Offload TCP segmentation to the NIC. If set to AUTOMATIC, TCP segmentation will be offloaded to the NIC, if the NIC supports it.
        Possible values = AUTOMATIC, DISABLED
    .PARAMETER Rstwindowattenuate
        Enable or disable RST window attenuation to protect against spoofing. When enabled, will reply with corrective ACK when a sequence number is invalid.
        Possible values = ENABLED, DISABLED
    .PARAMETER Rstmaxack
        Enable or disable acceptance of RST that is out of window yet echoes highest ACK sequence number. Useful only in proxy mode.
        Possible values = ENABLED, DISABLED
    .PARAMETER Spoofsyndrop
        Enable or disable drop of invalid SYN packets to protect against spoofing. When disabled, established connections will be reset when a SYN packet is received.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ecn
        Enable or disable TCP Explicit Congestion Notification.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mptcpdropdataonpreestsf
        Enable or disable silently dropping the data on Pre-Established subflow. When enabled, DSS data packets are dropped silently instead of dropping the connection when data is received on pre established subflow.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mptcpfastopen
        Enable or disable Multipath TCP fastopen. When enabled, DSS data packets are accepted before receiving the third ack of SYN handshake.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mptcpsessiontimeout
        MPTCP session timeout in seconds. If this value is not set, idle MPTCP sessions are flushed after vserver's client idle timeout.
    .PARAMETER Timestamp
        Enable or Disable TCP Timestamp option (RFC 1323).
        Possible values = ENABLED, DISABLED
    .PARAMETER Dsack
        Enable or disable DSACK.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ackaggregation
        Enable or disable ACK Aggregation.
        Possible values = ENABLED, DISABLED
    .PARAMETER Frto
        Enable or disable FRTO (Forward RTO-Recovery).
        Possible values = ENABLED, DISABLED
    .PARAMETER Maxcwnd
        TCP Maximum Congestion Window.
    .PARAMETER Fack
        Enable or disable FACK (Forward ACK).
        Possible values = ENABLED, DISABLED
    .PARAMETER Tcpmode
        TCP Optimization modes TRANSPARENT / ENDPOINT.
        Possible values = TRANSPARENT, ENDPOINT
    .PARAMETER Tcpfastopen
        Enable or disable TCP Fastopen. When enabled, NS can receive or send Data in SYN or SYN-ACK packets.
        Possible values = ENABLED, DISABLED
    .PARAMETER Hystart
        Enable or disable CUBIC Hystart.
        Possible values = ENABLED, DISABLED
    .PARAMETER Dupackthresh
        TCP dupack threshold.
    .PARAMETER Burstratecontrol
        TCP Burst Rate Control DISABLED/FIXED/DYNAMIC. FIXED requires a TCP rate to be set.
        Possible values = DISABLED, FIXED, DYNAMIC
    .PARAMETER Tcprate
        TCP connection payload send rate in Kb/s.
    .PARAMETER Rateqmax
        Maximum connection queue size in bytes, when BurstRateControl is used.
    .PARAMETER Drophalfclosedconnontimeout
        Silently drop tcp half closed connections on idle timeout.
        Possible values = ENABLED, DISABLED
    .PARAMETER Dropestconnontimeout
        Silently drop tcp established connections on idle timeout.
        Possible values = ENABLED, DISABLED
    .PARAMETER Applyadaptivetcp
        Apply Adaptive TCP optimizations.
        Possible values = ENABLED, DISABLED
    .PARAMETER Tcpfastopencookiesize
        TCP FastOpen Cookie size. This accepts only even numbers. Odd number is trimmed down to nearest even number.
    .PARAMETER Taillossprobe
        TCP tail loss probe optimizations.
        Possible values = ENABLED, DISABLED
    .PARAMETER Clientiptcpoption
        Client IP in TCP options.
        Possible values = ENABLED, DISABLED
    .PARAMETER Clientiptcpoptionnumber
        ClientIP TCP Option number.
    .PARAMETER Mpcapablecbit
        Set C bit in MP-CAPABLE Syn-Ack sent by Citrix ADC.
        Possible values = ENABLED, DISABLED
    .PARAMETER PassThru
        Return details about the created nstcpprofile item.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNstcpprofile -name <string>
        An example how to update nstcpprofile configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNstcpprofile
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstcpprofile/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateLength(1, 127)]
        [string]$Name,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ws,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Sack,

        [ValidateRange(0, 14)]
        [double]$Wsval,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Nagle,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ackonpush,

        [ValidateRange(0, 9176)]
        [double]$Mss,

        [ValidateRange(1, 255)]
        [double]$Maxburst,

        [ValidateRange(1, 44)]
        [double]$Initialcwnd,

        [ValidateRange(10, 300)]
        [double]$Delayedack,

        [ValidateRange(0, 65535)]
        [double]$Oooqsize,

        [ValidateRange(0, 1460)]
        [double]$Maxpktpermss,

        [ValidateRange(1, 512)]
        [double]$Pktperretx,

        [ValidateRange(10, 64000)]
        [double]$Minrto,

        [ValidateRange(1, 100)]
        [double]$Slowstartincr,

        [ValidateRange(8190, 20971520)]
        [double]$Buffersize,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Syncookie,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Kaprobeupdatelastactivity,

        [ValidateSet('Default', 'Westwood', 'BIC', 'CUBIC', 'Nile')]
        [string]$Flavor,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Dynamicreceivebuffering,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ka,

        [ValidateRange(1, 4095)]
        [double]$Kaconnidletime,

        [ValidateRange(1, 254)]
        [double]$Kamaxprobes,

        [ValidateRange(1, 4095)]
        [double]$Kaprobeinterval,

        [ValidateRange(8190, 20971520)]
        [double]$Sendbuffsize,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Mptcp,

        [ValidateSet('AUTOMATIC', 'CONN_ESTABLISHED', 'ON_FIRST_DATA')]
        [string]$Establishclientconn,

        [ValidateSet('AUTOMATIC', 'DISABLED')]
        [string]$Tcpsegoffload,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Rstwindowattenuate,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Rstmaxack,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Spoofsyndrop,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ecn,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Mptcpdropdataonpreestsf,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Mptcpfastopen,

        [ValidateRange(0, 86400)]
        [double]$Mptcpsessiontimeout,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Timestamp,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Dsack,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Ackaggregation,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Frto,

        [ValidateRange(8190, 20971520)]
        [double]$Maxcwnd,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Fack,

        [ValidateSet('TRANSPARENT', 'ENDPOINT')]
        [string]$Tcpmode,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Tcpfastopen,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Hystart,

        [ValidateRange(1, 15)]
        [double]$Dupackthresh,

        [ValidateSet('DISABLED', 'FIXED', 'DYNAMIC')]
        [string]$Burstratecontrol,

        [ValidateRange(0, 10000000)]
        [double]$Tcprate,

        [ValidateRange(0, 1000000000)]
        [double]$Rateqmax,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Drophalfclosedconnontimeout,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Dropestconnontimeout,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Applyadaptivetcp,

        [ValidateRange(4, 16)]
        [double]$Tcpfastopencookiesize,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Taillossprobe,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Clientiptcpoption,

        [ValidateRange(1, 254)]
        [double]$Clientiptcpoptionnumber,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Mpcapablecbit,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNstcpprofile: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('ws') ) { $payload.Add('ws', $ws) }
            if ( $PSBoundParameters.ContainsKey('sack') ) { $payload.Add('sack', $sack) }
            if ( $PSBoundParameters.ContainsKey('wsval') ) { $payload.Add('wsval', $wsval) }
            if ( $PSBoundParameters.ContainsKey('nagle') ) { $payload.Add('nagle', $nagle) }
            if ( $PSBoundParameters.ContainsKey('ackonpush') ) { $payload.Add('ackonpush', $ackonpush) }
            if ( $PSBoundParameters.ContainsKey('mss') ) { $payload.Add('mss', $mss) }
            if ( $PSBoundParameters.ContainsKey('maxburst') ) { $payload.Add('maxburst', $maxburst) }
            if ( $PSBoundParameters.ContainsKey('initialcwnd') ) { $payload.Add('initialcwnd', $initialcwnd) }
            if ( $PSBoundParameters.ContainsKey('delayedack') ) { $payload.Add('delayedack', $delayedack) }
            if ( $PSBoundParameters.ContainsKey('oooqsize') ) { $payload.Add('oooqsize', $oooqsize) }
            if ( $PSBoundParameters.ContainsKey('maxpktpermss') ) { $payload.Add('maxpktpermss', $maxpktpermss) }
            if ( $PSBoundParameters.ContainsKey('pktperretx') ) { $payload.Add('pktperretx', $pktperretx) }
            if ( $PSBoundParameters.ContainsKey('minrto') ) { $payload.Add('minrto', $minrto) }
            if ( $PSBoundParameters.ContainsKey('slowstartincr') ) { $payload.Add('slowstartincr', $slowstartincr) }
            if ( $PSBoundParameters.ContainsKey('buffersize') ) { $payload.Add('buffersize', $buffersize) }
            if ( $PSBoundParameters.ContainsKey('syncookie') ) { $payload.Add('syncookie', $syncookie) }
            if ( $PSBoundParameters.ContainsKey('kaprobeupdatelastactivity') ) { $payload.Add('kaprobeupdatelastactivity', $kaprobeupdatelastactivity) }
            if ( $PSBoundParameters.ContainsKey('flavor') ) { $payload.Add('flavor', $flavor) }
            if ( $PSBoundParameters.ContainsKey('dynamicreceivebuffering') ) { $payload.Add('dynamicreceivebuffering', $dynamicreceivebuffering) }
            if ( $PSBoundParameters.ContainsKey('ka') ) { $payload.Add('ka', $ka) }
            if ( $PSBoundParameters.ContainsKey('kaconnidletime') ) { $payload.Add('kaconnidletime', $kaconnidletime) }
            if ( $PSBoundParameters.ContainsKey('kamaxprobes') ) { $payload.Add('kamaxprobes', $kamaxprobes) }
            if ( $PSBoundParameters.ContainsKey('kaprobeinterval') ) { $payload.Add('kaprobeinterval', $kaprobeinterval) }
            if ( $PSBoundParameters.ContainsKey('sendbuffsize') ) { $payload.Add('sendbuffsize', $sendbuffsize) }
            if ( $PSBoundParameters.ContainsKey('mptcp') ) { $payload.Add('mptcp', $mptcp) }
            if ( $PSBoundParameters.ContainsKey('establishclientconn') ) { $payload.Add('establishclientconn', $establishclientconn) }
            if ( $PSBoundParameters.ContainsKey('tcpsegoffload') ) { $payload.Add('tcpsegoffload', $tcpsegoffload) }
            if ( $PSBoundParameters.ContainsKey('rstwindowattenuate') ) { $payload.Add('rstwindowattenuate', $rstwindowattenuate) }
            if ( $PSBoundParameters.ContainsKey('rstmaxack') ) { $payload.Add('rstmaxack', $rstmaxack) }
            if ( $PSBoundParameters.ContainsKey('spoofsyndrop') ) { $payload.Add('spoofsyndrop', $spoofsyndrop) }
            if ( $PSBoundParameters.ContainsKey('ecn') ) { $payload.Add('ecn', $ecn) }
            if ( $PSBoundParameters.ContainsKey('mptcpdropdataonpreestsf') ) { $payload.Add('mptcpdropdataonpreestsf', $mptcpdropdataonpreestsf) }
            if ( $PSBoundParameters.ContainsKey('mptcpfastopen') ) { $payload.Add('mptcpfastopen', $mptcpfastopen) }
            if ( $PSBoundParameters.ContainsKey('mptcpsessiontimeout') ) { $payload.Add('mptcpsessiontimeout', $mptcpsessiontimeout) }
            if ( $PSBoundParameters.ContainsKey('timestamp') ) { $payload.Add('timestamp', $timestamp) }
            if ( $PSBoundParameters.ContainsKey('dsack') ) { $payload.Add('dsack', $dsack) }
            if ( $PSBoundParameters.ContainsKey('ackaggregation') ) { $payload.Add('ackaggregation', $ackaggregation) }
            if ( $PSBoundParameters.ContainsKey('frto') ) { $payload.Add('frto', $frto) }
            if ( $PSBoundParameters.ContainsKey('maxcwnd') ) { $payload.Add('maxcwnd', $maxcwnd) }
            if ( $PSBoundParameters.ContainsKey('fack') ) { $payload.Add('fack', $fack) }
            if ( $PSBoundParameters.ContainsKey('tcpmode') ) { $payload.Add('tcpmode', $tcpmode) }
            if ( $PSBoundParameters.ContainsKey('tcpfastopen') ) { $payload.Add('tcpfastopen', $tcpfastopen) }
            if ( $PSBoundParameters.ContainsKey('hystart') ) { $payload.Add('hystart', $hystart) }
            if ( $PSBoundParameters.ContainsKey('dupackthresh') ) { $payload.Add('dupackthresh', $dupackthresh) }
            if ( $PSBoundParameters.ContainsKey('burstratecontrol') ) { $payload.Add('burstratecontrol', $burstratecontrol) }
            if ( $PSBoundParameters.ContainsKey('tcprate') ) { $payload.Add('tcprate', $tcprate) }
            if ( $PSBoundParameters.ContainsKey('rateqmax') ) { $payload.Add('rateqmax', $rateqmax) }
            if ( $PSBoundParameters.ContainsKey('drophalfclosedconnontimeout') ) { $payload.Add('drophalfclosedconnontimeout', $drophalfclosedconnontimeout) }
            if ( $PSBoundParameters.ContainsKey('dropestconnontimeout') ) { $payload.Add('dropestconnontimeout', $dropestconnontimeout) }
            if ( $PSBoundParameters.ContainsKey('applyadaptivetcp') ) { $payload.Add('applyadaptivetcp', $applyadaptivetcp) }
            if ( $PSBoundParameters.ContainsKey('tcpfastopencookiesize') ) { $payload.Add('tcpfastopencookiesize', $tcpfastopencookiesize) }
            if ( $PSBoundParameters.ContainsKey('taillossprobe') ) { $payload.Add('taillossprobe', $taillossprobe) }
            if ( $PSBoundParameters.ContainsKey('clientiptcpoption') ) { $payload.Add('clientiptcpoption', $clientiptcpoption) }
            if ( $PSBoundParameters.ContainsKey('clientiptcpoptionnumber') ) { $payload.Add('clientiptcpoptionnumber', $clientiptcpoptionnumber) }
            if ( $PSBoundParameters.ContainsKey('mpcapablecbit') ) { $payload.Add('mpcapablecbit', $mpcapablecbit) }
            if ( $PSCmdlet.ShouldProcess("nstcpprofile", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nstcpprofile -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNstcpprofile -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNstcpprofile: Finished"
    }
}

function Invoke-ADCUnsetNstcpprofile {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for TCP profile resource.
    .PARAMETER Name
        Name for a TCP profile. Must begin with a letter, number, or the underscore \(_\) character. Other characters allowed, after the first character, are the hyphen \(-\), period \(.\), hash \(\#\), space \( \), at \(@\), colon \(:\), and equal \(=\) characters. The name of a TCP profile cannot be changed after it is created.
        CLI Users: If the name includes one or more spaces, enclose the name in double or single quotation marks \(for example, "my tcp profile" or 'my tcp profile'\).
    .PARAMETER Ws
        Enable or disable window scaling.
        Possible values = ENABLED, DISABLED
    .PARAMETER Sack
        Enable or disable Selective ACKnowledgement (SACK).
        Possible values = ENABLED, DISABLED
    .PARAMETER Wsval
        Factor used to calculate the new window size.
        This argument is needed only when window scaling is enabled.
    .PARAMETER Nagle
        Enable or disable the Nagle algorithm on TCP connections.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ackonpush
        Send immediate positive acknowledgement (ACK) on receipt of TCP packets with PUSH flag.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mss
        Maximum number of octets to allow in a TCP data segment.
    .PARAMETER Maxburst
        Maximum number of TCP segments allowed in a burst.
    .PARAMETER Initialcwnd
        Initial maximum upper limit on the number of TCP packets that can be outstanding on the TCP link to the server.
    .PARAMETER Delayedack
        Timeout for TCP delayed ACK, in milliseconds.
    .PARAMETER Oooqsize
        Maximum size of out-of-order packets queue. A value of 0 means no limit.
    .PARAMETER Maxpktpermss
        Maximum number of TCP packets allowed per maximum segment size (MSS).
    .PARAMETER Pktperretx
        Maximum limit on the number of packets that should be retransmitted on receiving a partial ACK.
    .PARAMETER Minrto
        Minimum retransmission timeout, in milliseconds, specified in 10-millisecond increments (value must yield a whole number if divided by 10).
    .PARAMETER Slowstartincr
        Multiplier that determines the rate at which slow start increases the size of the TCP transmission window after each acknowledgement of successful transmission.
    .PARAMETER Buffersize
        TCP buffering size, in bytes.
    .PARAMETER Syncookie
        Enable or disable the SYNCOOKIE mechanism for TCP handshake with clients. Disabling SYNCOOKIE prevents SYN attack protection on the Citrix ADC.
        Possible values = ENABLED, DISABLED
    .PARAMETER Kaprobeupdatelastactivity
        Update last activity for the connection after receiving keep-alive (KA) probes.
        Possible values = ENABLED, DISABLED
    .PARAMETER Flavor
        Set TCP congestion control algorithm.
        Possible values = Default, Westwood, BIC, CUBIC, Nile
    .PARAMETER Dynamicreceivebuffering
        Enable or disable dynamic receive buffering. When enabled, allows the receive buffer to be adjusted dynamically based on memory and network conditions.
        Note: The buffer size argument must be set for dynamic adjustments to take place.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ka
        Send periodic TCP keep-alive (KA) probes to check if peer is still up.
        Possible values = ENABLED, DISABLED
    .PARAMETER Kamaxprobes
        Number of keep-alive (KA) probes to be sent when not acknowledged, before assuming the peer to be down.
    .PARAMETER Kaconnidletime
        Duration, in seconds, for the connection to be idle, before sending a keep-alive (KA) probe.
    .PARAMETER Kaprobeinterval
        Time interval, in seconds, before the next keep-alive (KA) probe, if the peer does not respond.
    .PARAMETER Sendbuffsize
        TCP Send Buffer Size.
    .PARAMETER Mptcp
        Enable or disable Multipath TCP.
        Possible values = ENABLED, DISABLED
    .PARAMETER Establishclientconn
        Establishing Client Client connection on First data/ Final-ACK / Automatic.
        Possible values = AUTOMATIC, CONN_ESTABLISHED, ON_FIRST_DATA
    .PARAMETER Tcpsegoffload
        Offload TCP segmentation to the NIC. If set to AUTOMATIC, TCP segmentation will be offloaded to the NIC, if the NIC supports it.
        Possible values = AUTOMATIC, DISABLED
    .PARAMETER Rstwindowattenuate
        Enable or disable RST window attenuation to protect against spoofing. When enabled, will reply with corrective ACK when a sequence number is invalid.
        Possible values = ENABLED, DISABLED
    .PARAMETER Rstmaxack
        Enable or disable acceptance of RST that is out of window yet echoes highest ACK sequence number. Useful only in proxy mode.
        Possible values = ENABLED, DISABLED
    .PARAMETER Spoofsyndrop
        Enable or disable drop of invalid SYN packets to protect against spoofing. When disabled, established connections will be reset when a SYN packet is received.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ecn
        Enable or disable TCP Explicit Congestion Notification.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mptcpdropdataonpreestsf
        Enable or disable silently dropping the data on Pre-Established subflow. When enabled, DSS data packets are dropped silently instead of dropping the connection when data is received on pre established subflow.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mptcpfastopen
        Enable or disable Multipath TCP fastopen. When enabled, DSS data packets are accepted before receiving the third ack of SYN handshake.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mptcpsessiontimeout
        MPTCP session timeout in seconds. If this value is not set, idle MPTCP sessions are flushed after vserver's client idle timeout.
    .PARAMETER Timestamp
        Enable or Disable TCP Timestamp option (RFC 1323).
        Possible values = ENABLED, DISABLED
    .PARAMETER Dsack
        Enable or disable DSACK.
        Possible values = ENABLED, DISABLED
    .PARAMETER Ackaggregation
        Enable or disable ACK Aggregation.
        Possible values = ENABLED, DISABLED
    .PARAMETER Frto
        Enable or disable FRTO (Forward RTO-Recovery).
        Possible values = ENABLED, DISABLED
    .PARAMETER Maxcwnd
        TCP Maximum Congestion Window.
    .PARAMETER Fack
        Enable or disable FACK (Forward ACK).
        Possible values = ENABLED, DISABLED
    .PARAMETER Tcpmode
        TCP Optimization modes TRANSPARENT / ENDPOINT.
        Possible values = TRANSPARENT, ENDPOINT
    .PARAMETER Tcpfastopen
        Enable or disable TCP Fastopen. When enabled, NS can receive or send Data in SYN or SYN-ACK packets.
        Possible values = ENABLED, DISABLED
    .PARAMETER Hystart
        Enable or disable CUBIC Hystart.
        Possible values = ENABLED, DISABLED
    .PARAMETER Dupackthresh
        TCP dupack threshold.
    .PARAMETER Burstratecontrol
        TCP Burst Rate Control DISABLED/FIXED/DYNAMIC. FIXED requires a TCP rate to be set.
        Possible values = DISABLED, FIXED, DYNAMIC
    .PARAMETER Tcprate
        TCP connection payload send rate in Kb/s.
    .PARAMETER Rateqmax
        Maximum connection queue size in bytes, when BurstRateControl is used.
    .PARAMETER Drophalfclosedconnontimeout
        Silently drop tcp half closed connections on idle timeout.
        Possible values = ENABLED, DISABLED
    .PARAMETER Dropestconnontimeout
        Silently drop tcp established connections on idle timeout.
        Possible values = ENABLED, DISABLED
    .PARAMETER Applyadaptivetcp
        Apply Adaptive TCP optimizations.
        Possible values = ENABLED, DISABLED
    .PARAMETER Clientiptcpoption
        Client IP in TCP options.
        Possible values = ENABLED, DISABLED
    .PARAMETER Mpcapablecbit
        Set C bit in MP-CAPABLE Syn-Ack sent by Citrix ADC.
        Possible values = ENABLED, DISABLED
    .PARAMETER Tcpfastopencookiesize
        TCP FastOpen Cookie size. This accepts only even numbers. Odd number is trimmed down to nearest even number.
    .PARAMETER Taillossprobe
        TCP tail loss probe optimizations.
        Possible values = ENABLED, DISABLED
    .PARAMETER Clientiptcpoptionnumber
        ClientIP TCP Option number.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNstcpprofile -name <string>
        An example how to unset nstcpprofile configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNstcpprofile
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstcpprofile
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateLength(1, 127)]
        [string]$Name,

        [Boolean]$ws,

        [Boolean]$sack,

        [Boolean]$wsval,

        [Boolean]$nagle,

        [Boolean]$ackonpush,

        [Boolean]$mss,

        [Boolean]$maxburst,

        [Boolean]$initialcwnd,

        [Boolean]$delayedack,

        [Boolean]$oooqsize,

        [Boolean]$maxpktpermss,

        [Boolean]$pktperretx,

        [Boolean]$minrto,

        [Boolean]$slowstartincr,

        [Boolean]$buffersize,

        [Boolean]$syncookie,

        [Boolean]$kaprobeupdatelastactivity,

        [Boolean]$flavor,

        [Boolean]$dynamicreceivebuffering,

        [Boolean]$ka,

        [Boolean]$kamaxprobes,

        [Boolean]$kaconnidletime,

        [Boolean]$kaprobeinterval,

        [Boolean]$sendbuffsize,

        [Boolean]$mptcp,

        [Boolean]$establishclientconn,

        [Boolean]$tcpsegoffload,

        [Boolean]$rstwindowattenuate,

        [Boolean]$rstmaxack,

        [Boolean]$spoofsyndrop,

        [Boolean]$ecn,

        [Boolean]$mptcpdropdataonpreestsf,

        [Boolean]$mptcpfastopen,

        [Boolean]$mptcpsessiontimeout,

        [Boolean]$timestamp,

        [Boolean]$dsack,

        [Boolean]$ackaggregation,

        [Boolean]$frto,

        [Boolean]$maxcwnd,

        [Boolean]$fack,

        [Boolean]$tcpmode,

        [Boolean]$tcpfastopen,

        [Boolean]$hystart,

        [Boolean]$dupackthresh,

        [Boolean]$burstratecontrol,

        [Boolean]$tcprate,

        [Boolean]$rateqmax,

        [Boolean]$drophalfclosedconnontimeout,

        [Boolean]$dropestconnontimeout,

        [Boolean]$applyadaptivetcp,

        [Boolean]$clientiptcpoption,

        [Boolean]$mpcapablecbit,

        [Boolean]$tcpfastopencookiesize,

        [Boolean]$taillossprobe,

        [Boolean]$clientiptcpoptionnumber 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNstcpprofile: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('ws') ) { $payload.Add('ws', $ws) }
            if ( $PSBoundParameters.ContainsKey('sack') ) { $payload.Add('sack', $sack) }
            if ( $PSBoundParameters.ContainsKey('wsval') ) { $payload.Add('wsval', $wsval) }
            if ( $PSBoundParameters.ContainsKey('nagle') ) { $payload.Add('nagle', $nagle) }
            if ( $PSBoundParameters.ContainsKey('ackonpush') ) { $payload.Add('ackonpush', $ackonpush) }
            if ( $PSBoundParameters.ContainsKey('mss') ) { $payload.Add('mss', $mss) }
            if ( $PSBoundParameters.ContainsKey('maxburst') ) { $payload.Add('maxburst', $maxburst) }
            if ( $PSBoundParameters.ContainsKey('initialcwnd') ) { $payload.Add('initialcwnd', $initialcwnd) }
            if ( $PSBoundParameters.ContainsKey('delayedack') ) { $payload.Add('delayedack', $delayedack) }
            if ( $PSBoundParameters.ContainsKey('oooqsize') ) { $payload.Add('oooqsize', $oooqsize) }
            if ( $PSBoundParameters.ContainsKey('maxpktpermss') ) { $payload.Add('maxpktpermss', $maxpktpermss) }
            if ( $PSBoundParameters.ContainsKey('pktperretx') ) { $payload.Add('pktperretx', $pktperretx) }
            if ( $PSBoundParameters.ContainsKey('minrto') ) { $payload.Add('minrto', $minrto) }
            if ( $PSBoundParameters.ContainsKey('slowstartincr') ) { $payload.Add('slowstartincr', $slowstartincr) }
            if ( $PSBoundParameters.ContainsKey('buffersize') ) { $payload.Add('buffersize', $buffersize) }
            if ( $PSBoundParameters.ContainsKey('syncookie') ) { $payload.Add('syncookie', $syncookie) }
            if ( $PSBoundParameters.ContainsKey('kaprobeupdatelastactivity') ) { $payload.Add('kaprobeupdatelastactivity', $kaprobeupdatelastactivity) }
            if ( $PSBoundParameters.ContainsKey('flavor') ) { $payload.Add('flavor', $flavor) }
            if ( $PSBoundParameters.ContainsKey('dynamicreceivebuffering') ) { $payload.Add('dynamicreceivebuffering', $dynamicreceivebuffering) }
            if ( $PSBoundParameters.ContainsKey('ka') ) { $payload.Add('ka', $ka) }
            if ( $PSBoundParameters.ContainsKey('kamaxprobes') ) { $payload.Add('kamaxprobes', $kamaxprobes) }
            if ( $PSBoundParameters.ContainsKey('kaconnidletime') ) { $payload.Add('kaconnidletime', $kaconnidletime) }
            if ( $PSBoundParameters.ContainsKey('kaprobeinterval') ) { $payload.Add('kaprobeinterval', $kaprobeinterval) }
            if ( $PSBoundParameters.ContainsKey('sendbuffsize') ) { $payload.Add('sendbuffsize', $sendbuffsize) }
            if ( $PSBoundParameters.ContainsKey('mptcp') ) { $payload.Add('mptcp', $mptcp) }
            if ( $PSBoundParameters.ContainsKey('establishclientconn') ) { $payload.Add('establishclientconn', $establishclientconn) }
            if ( $PSBoundParameters.ContainsKey('tcpsegoffload') ) { $payload.Add('tcpsegoffload', $tcpsegoffload) }
            if ( $PSBoundParameters.ContainsKey('rstwindowattenuate') ) { $payload.Add('rstwindowattenuate', $rstwindowattenuate) }
            if ( $PSBoundParameters.ContainsKey('rstmaxack') ) { $payload.Add('rstmaxack', $rstmaxack) }
            if ( $PSBoundParameters.ContainsKey('spoofsyndrop') ) { $payload.Add('spoofsyndrop', $spoofsyndrop) }
            if ( $PSBoundParameters.ContainsKey('ecn') ) { $payload.Add('ecn', $ecn) }
            if ( $PSBoundParameters.ContainsKey('mptcpdropdataonpreestsf') ) { $payload.Add('mptcpdropdataonpreestsf', $mptcpdropdataonpreestsf) }
            if ( $PSBoundParameters.ContainsKey('mptcpfastopen') ) { $payload.Add('mptcpfastopen', $mptcpfastopen) }
            if ( $PSBoundParameters.ContainsKey('mptcpsessiontimeout') ) { $payload.Add('mptcpsessiontimeout', $mptcpsessiontimeout) }
            if ( $PSBoundParameters.ContainsKey('timestamp') ) { $payload.Add('timestamp', $timestamp) }
            if ( $PSBoundParameters.ContainsKey('dsack') ) { $payload.Add('dsack', $dsack) }
            if ( $PSBoundParameters.ContainsKey('ackaggregation') ) { $payload.Add('ackaggregation', $ackaggregation) }
            if ( $PSBoundParameters.ContainsKey('frto') ) { $payload.Add('frto', $frto) }
            if ( $PSBoundParameters.ContainsKey('maxcwnd') ) { $payload.Add('maxcwnd', $maxcwnd) }
            if ( $PSBoundParameters.ContainsKey('fack') ) { $payload.Add('fack', $fack) }
            if ( $PSBoundParameters.ContainsKey('tcpmode') ) { $payload.Add('tcpmode', $tcpmode) }
            if ( $PSBoundParameters.ContainsKey('tcpfastopen') ) { $payload.Add('tcpfastopen', $tcpfastopen) }
            if ( $PSBoundParameters.ContainsKey('hystart') ) { $payload.Add('hystart', $hystart) }
            if ( $PSBoundParameters.ContainsKey('dupackthresh') ) { $payload.Add('dupackthresh', $dupackthresh) }
            if ( $PSBoundParameters.ContainsKey('burstratecontrol') ) { $payload.Add('burstratecontrol', $burstratecontrol) }
            if ( $PSBoundParameters.ContainsKey('tcprate') ) { $payload.Add('tcprate', $tcprate) }
            if ( $PSBoundParameters.ContainsKey('rateqmax') ) { $payload.Add('rateqmax', $rateqmax) }
            if ( $PSBoundParameters.ContainsKey('drophalfclosedconnontimeout') ) { $payload.Add('drophalfclosedconnontimeout', $drophalfclosedconnontimeout) }
            if ( $PSBoundParameters.ContainsKey('dropestconnontimeout') ) { $payload.Add('dropestconnontimeout', $dropestconnontimeout) }
            if ( $PSBoundParameters.ContainsKey('applyadaptivetcp') ) { $payload.Add('applyadaptivetcp', $applyadaptivetcp) }
            if ( $PSBoundParameters.ContainsKey('clientiptcpoption') ) { $payload.Add('clientiptcpoption', $clientiptcpoption) }
            if ( $PSBoundParameters.ContainsKey('mpcapablecbit') ) { $payload.Add('mpcapablecbit', $mpcapablecbit) }
            if ( $PSBoundParameters.ContainsKey('tcpfastopencookiesize') ) { $payload.Add('tcpfastopencookiesize', $tcpfastopencookiesize) }
            if ( $PSBoundParameters.ContainsKey('taillossprobe') ) { $payload.Add('taillossprobe', $taillossprobe) }
            if ( $PSBoundParameters.ContainsKey('clientiptcpoptionnumber') ) { $payload.Add('clientiptcpoptionnumber', $clientiptcpoptionnumber) }
            if ( $PSCmdlet.ShouldProcess("$name", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nstcpprofile -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNstcpprofile: Finished"
    }
}

function Invoke-ADCGetNstcpprofile {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for TCP profile resource.
    .PARAMETER Name
        Name for a TCP profile. Must begin with a letter, number, or the underscore \(_\) character. Other characters allowed, after the first character, are the hyphen \(-\), period \(.\), hash \(\#\), space \( \), at \(@\), colon \(:\), and equal \(=\) characters. The name of a TCP profile cannot be changed after it is created.
        CLI Users: If the name includes one or more spaces, enclose the name in double or single quotation marks \(for example, "my tcp profile" or 'my tcp profile'\).
    .PARAMETER GetAll
        Retrieve all nstcpprofile object(s).
    .PARAMETER Count
        If specified, the count of the nstcpprofile object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstcpprofile
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstcpprofile -GetAll
        Get all nstcpprofile data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstcpprofile -Count
        Get the number of nstcpprofile objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstcpprofile -name <string>
        Get nstcpprofile object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstcpprofile -Filter @{ 'name'='<value>' }
        Get nstcpprofile data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNstcpprofile
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstcpprofile/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateLength(1, 127)]
        [string]$Name,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNstcpprofile: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nstcpprofile objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstcpprofile -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nstcpprofile objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstcpprofile -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nstcpprofile objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstcpprofile -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nstcpprofile configuration for property 'name'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstcpprofile -NitroPath nitro/v1/config -Resource $name -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nstcpprofile configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstcpprofile -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNstcpprofile: Ended"
    }
}

function Invoke-ADCUpdateNstimeout {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for timeout resource.
    .PARAMETER Zombie
        Interval, in seconds, at which the Citrix ADC zombie cleanup process must run. This process cleans up inactive TCP connections.
    .PARAMETER Client
        Client idle timeout (in seconds). If zero, the service-type default value is taken when service is created.
    .PARAMETER Server
        Server idle timeout (in seconds). If zero, the service-type default value is taken when service is created.
    .PARAMETER Httpclient
        Global idle timeout, in seconds, for client connections of HTTP service type. This value is over ridden by the client timeout that is configured on individual entities.
    .PARAMETER Httpserver
        Global idle timeout, in seconds, for server connections of HTTP service type. This value is over ridden by the server timeout that is configured on individual entities.
    .PARAMETER Tcpclient
        Global idle timeout, in seconds, for non-HTTP client connections of TCP service type. This value is over ridden by the client timeout that is configured on individual entities.
    .PARAMETER Tcpserver
        Global idle timeout, in seconds, for non-HTTP server connections of TCP service type. This value is over ridden by the server timeout that is configured on entities.
    .PARAMETER Anyclient
        Global idle timeout, in seconds, for non-TCP client connections. This value is over ridden by the client timeout that is configured on individual entities.
    .PARAMETER Anyserver
        Global idle timeout, in seconds, for non TCP server connections. This value is over ridden by the server timeout that is configured on individual entities.
    .PARAMETER Anytcpclient
        Global idle timeout, in seconds, for TCP client connections. This value takes precedence over entity level timeout settings (vserver/service). This is applicable only to transport protocol TCP.
    .PARAMETER Anytcpserver
        Global idle timeout, in seconds, for TCP server connections. This value takes precedence over entity level timeout settings ( vserver/service). This is applicable only to transport protocol TCP.
    .PARAMETER Halfclose
        Idle timeout, in seconds, for connections that are in TCP half-closed state.
    .PARAMETER Nontcpzombie
        Interval at which the zombie clean-up process for non-TCP connections should run. Inactive IP NAT connections will be cleaned up.
    .PARAMETER Reducedfintimeout
        Alternative idle timeout, in seconds, for closed TCP NATPCB connections.
    .PARAMETER Reducedrsttimeout
        Timer interval, in seconds, for abruptly terminated TCP NATPCB connections.
    .PARAMETER Newconnidletimeout
        Timer interval, in seconds, for new TCP NATPCB connections on which no data was received.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNstimeout
        An example how to update nstimeout configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNstimeout
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstimeout/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateRange(1, 600)]
        [double]$Zombie,

        [ValidateRange(0, 18000)]
        [double]$Client,

        [ValidateRange(0, 18000)]
        [double]$Server,

        [ValidateRange(0, 18000)]
        [double]$Httpclient,

        [ValidateRange(0, 18000)]
        [double]$Httpserver,

        [ValidateRange(0, 18000)]
        [double]$Tcpclient,

        [ValidateRange(0, 18000)]
        [double]$Tcpserver,

        [ValidateRange(0, 31536000)]
        [double]$Anyclient,

        [ValidateRange(0, 31536000)]
        [double]$Anyserver,

        [ValidateRange(0, 31536000)]
        [double]$Anytcpclient,

        [ValidateRange(0, 31536000)]
        [double]$Anytcpserver,

        [ValidateRange(1, 600)]
        [double]$Halfclose,

        [ValidateRange(1, 600)]
        [double]$Nontcpzombie,

        [ValidateRange(1, 300)]
        [double]$Reducedfintimeout,

        [ValidateRange(0, 300)]
        [double]$Reducedrsttimeout,

        [ValidateRange(1, 120)]
        [double]$Newconnidletimeout 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNstimeout: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('zombie') ) { $payload.Add('zombie', $zombie) }
            if ( $PSBoundParameters.ContainsKey('client') ) { $payload.Add('client', $client) }
            if ( $PSBoundParameters.ContainsKey('server') ) { $payload.Add('server', $server) }
            if ( $PSBoundParameters.ContainsKey('httpclient') ) { $payload.Add('httpclient', $httpclient) }
            if ( $PSBoundParameters.ContainsKey('httpserver') ) { $payload.Add('httpserver', $httpserver) }
            if ( $PSBoundParameters.ContainsKey('tcpclient') ) { $payload.Add('tcpclient', $tcpclient) }
            if ( $PSBoundParameters.ContainsKey('tcpserver') ) { $payload.Add('tcpserver', $tcpserver) }
            if ( $PSBoundParameters.ContainsKey('anyclient') ) { $payload.Add('anyclient', $anyclient) }
            if ( $PSBoundParameters.ContainsKey('anyserver') ) { $payload.Add('anyserver', $anyserver) }
            if ( $PSBoundParameters.ContainsKey('anytcpclient') ) { $payload.Add('anytcpclient', $anytcpclient) }
            if ( $PSBoundParameters.ContainsKey('anytcpserver') ) { $payload.Add('anytcpserver', $anytcpserver) }
            if ( $PSBoundParameters.ContainsKey('halfclose') ) { $payload.Add('halfclose', $halfclose) }
            if ( $PSBoundParameters.ContainsKey('nontcpzombie') ) { $payload.Add('nontcpzombie', $nontcpzombie) }
            if ( $PSBoundParameters.ContainsKey('reducedfintimeout') ) { $payload.Add('reducedfintimeout', $reducedfintimeout) }
            if ( $PSBoundParameters.ContainsKey('reducedrsttimeout') ) { $payload.Add('reducedrsttimeout', $reducedrsttimeout) }
            if ( $PSBoundParameters.ContainsKey('newconnidletimeout') ) { $payload.Add('newconnidletimeout', $newconnidletimeout) }
            if ( $PSCmdlet.ShouldProcess("nstimeout", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nstimeout -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNstimeout: Finished"
    }
}

function Invoke-ADCUnsetNstimeout {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for timeout resource.
    .PARAMETER Zombie
        Interval, in seconds, at which the Citrix ADC zombie cleanup process must run. This process cleans up inactive TCP connections.
    .PARAMETER Client
        Client idle timeout (in seconds). If zero, the service-type default value is taken when service is created.
    .PARAMETER Server
        Server idle timeout (in seconds). If zero, the service-type default value is taken when service is created.
    .PARAMETER Httpclient
        Global idle timeout, in seconds, for client connections of HTTP service type. This value is over ridden by the client timeout that is configured on individual entities.
    .PARAMETER Httpserver
        Global idle timeout, in seconds, for server connections of HTTP service type. This value is over ridden by the server timeout that is configured on individual entities.
    .PARAMETER Tcpclient
        Global idle timeout, in seconds, for non-HTTP client connections of TCP service type. This value is over ridden by the client timeout that is configured on individual entities.
    .PARAMETER Tcpserver
        Global idle timeout, in seconds, for non-HTTP server connections of TCP service type. This value is over ridden by the server timeout that is configured on entities.
    .PARAMETER Anyclient
        Global idle timeout, in seconds, for non-TCP client connections. This value is over ridden by the client timeout that is configured on individual entities.
    .PARAMETER Anyserver
        Global idle timeout, in seconds, for non TCP server connections. This value is over ridden by the server timeout that is configured on individual entities.
    .PARAMETER Anytcpclient
        Global idle timeout, in seconds, for TCP client connections. This value takes precedence over entity level timeout settings (vserver/service). This is applicable only to transport protocol TCP.
    .PARAMETER Anytcpserver
        Global idle timeout, in seconds, for TCP server connections. This value takes precedence over entity level timeout settings ( vserver/service). This is applicable only to transport protocol TCP.
    .PARAMETER Halfclose
        Idle timeout, in seconds, for connections that are in TCP half-closed state.
    .PARAMETER Nontcpzombie
        Interval at which the zombie clean-up process for non-TCP connections should run. Inactive IP NAT connections will be cleaned up.
    .PARAMETER Reducedfintimeout
        Alternative idle timeout, in seconds, for closed TCP NATPCB connections.
    .PARAMETER Reducedrsttimeout
        Timer interval, in seconds, for abruptly terminated TCP NATPCB connections.
    .PARAMETER Newconnidletimeout
        Timer interval, in seconds, for new TCP NATPCB connections on which no data was received.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNstimeout
        An example how to unset nstimeout configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNstimeout
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstimeout
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Boolean]$zombie,

        [Boolean]$client,

        [Boolean]$server,

        [Boolean]$httpclient,

        [Boolean]$httpserver,

        [Boolean]$tcpclient,

        [Boolean]$tcpserver,

        [Boolean]$anyclient,

        [Boolean]$anyserver,

        [Boolean]$anytcpclient,

        [Boolean]$anytcpserver,

        [Boolean]$halfclose,

        [Boolean]$nontcpzombie,

        [Boolean]$reducedfintimeout,

        [Boolean]$reducedrsttimeout,

        [Boolean]$newconnidletimeout 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNstimeout: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('zombie') ) { $payload.Add('zombie', $zombie) }
            if ( $PSBoundParameters.ContainsKey('client') ) { $payload.Add('client', $client) }
            if ( $PSBoundParameters.ContainsKey('server') ) { $payload.Add('server', $server) }
            if ( $PSBoundParameters.ContainsKey('httpclient') ) { $payload.Add('httpclient', $httpclient) }
            if ( $PSBoundParameters.ContainsKey('httpserver') ) { $payload.Add('httpserver', $httpserver) }
            if ( $PSBoundParameters.ContainsKey('tcpclient') ) { $payload.Add('tcpclient', $tcpclient) }
            if ( $PSBoundParameters.ContainsKey('tcpserver') ) { $payload.Add('tcpserver', $tcpserver) }
            if ( $PSBoundParameters.ContainsKey('anyclient') ) { $payload.Add('anyclient', $anyclient) }
            if ( $PSBoundParameters.ContainsKey('anyserver') ) { $payload.Add('anyserver', $anyserver) }
            if ( $PSBoundParameters.ContainsKey('anytcpclient') ) { $payload.Add('anytcpclient', $anytcpclient) }
            if ( $PSBoundParameters.ContainsKey('anytcpserver') ) { $payload.Add('anytcpserver', $anytcpserver) }
            if ( $PSBoundParameters.ContainsKey('halfclose') ) { $payload.Add('halfclose', $halfclose) }
            if ( $PSBoundParameters.ContainsKey('nontcpzombie') ) { $payload.Add('nontcpzombie', $nontcpzombie) }
            if ( $PSBoundParameters.ContainsKey('reducedfintimeout') ) { $payload.Add('reducedfintimeout', $reducedfintimeout) }
            if ( $PSBoundParameters.ContainsKey('reducedrsttimeout') ) { $payload.Add('reducedrsttimeout', $reducedrsttimeout) }
            if ( $PSBoundParameters.ContainsKey('newconnidletimeout') ) { $payload.Add('newconnidletimeout', $newconnidletimeout) }
            if ( $PSCmdlet.ShouldProcess("nstimeout", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nstimeout -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNstimeout: Finished"
    }
}

function Invoke-ADCGetNstimeout {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for timeout resource.
    .PARAMETER GetAll
        Retrieve all nstimeout object(s).
    .PARAMETER Count
        If specified, the count of the nstimeout object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimeout
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimeout -GetAll
        Get all nstimeout data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimeout -name <string>
        Get nstimeout object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimeout -Filter @{ 'name'='<value>' }
        Get nstimeout data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNstimeout
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstimeout/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNstimeout: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nstimeout objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimeout -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nstimeout objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimeout -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nstimeout objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimeout -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nstimeout configuration for property ''"

            } else {
                Write-Verbose "Retrieving nstimeout configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimeout -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNstimeout: Ended"
    }
}

function Invoke-ADCAddNstimer {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for Timer resource.
    .PARAMETER Name
        Timer name.
    .PARAMETER Interval
        The frequency at which the policies bound to this timer are invoked. The minimum value is 20 msec. The maximum value is 20940 in seconds and 349 in minutes.
    .PARAMETER Unit
        Timer interval unit.
        Possible values = SEC, MIN
    .PARAMETER Comment
        Comments associated with this timer.
    .PARAMETER PassThru
        Return details about the created nstimer item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNstimer -name <string> -interval <int>
        An example how to add nstimer configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNstimer
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstimer/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [Parameter(Mandatory)]
        [ValidateRange(1, 20940000)]
        [int]$Interval = '5',

        [ValidateSet('SEC', 'MIN')]
        [string]$Unit = 'SEC',

        [string]$Comment,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNstimer: Starting"
    }
    process {
        try {
            $payload = @{ name = $name
                interval       = $interval
            }
            if ( $PSBoundParameters.ContainsKey('unit') ) { $payload.Add('unit', $unit) }
            if ( $PSBoundParameters.ContainsKey('comment') ) { $payload.Add('comment', $comment) }
            if ( $PSCmdlet.ShouldProcess("nstimer", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nstimer -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNstimer -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNstimer: Finished"
    }
}

function Invoke-ADCDeleteNstimer {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for Timer resource.
    .PARAMETER Name
        Timer name.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNstimer -Name <string>
        An example how to delete nstimer configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNstimer
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstimer/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Name 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNstimer: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$name", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nstimer -NitroPath nitro/v1/config -Resource $name -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNstimer: Finished"
    }
}

function Invoke-ADCUpdateNstimer {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for Timer resource.
    .PARAMETER Name
        Timer name.
    .PARAMETER Interval
        The frequency at which the policies bound to this timer are invoked. The minimum value is 20 msec. The maximum value is 20940 in seconds and 349 in minutes.
    .PARAMETER Unit
        Timer interval unit.
        Possible values = SEC, MIN
    .PARAMETER Comment
        Comments associated with this timer.
    .PARAMETER PassThru
        Return details about the created nstimer item.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNstimer -name <string>
        An example how to update nstimer configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNstimer
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstimer/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [ValidateRange(1, 20940000)]
        [int]$Interval,

        [ValidateSet('SEC', 'MIN')]
        [string]$Unit,

        [string]$Comment,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNstimer: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('interval') ) { $payload.Add('interval', $interval) }
            if ( $PSBoundParameters.ContainsKey('unit') ) { $payload.Add('unit', $unit) }
            if ( $PSBoundParameters.ContainsKey('comment') ) { $payload.Add('comment', $comment) }
            if ( $PSCmdlet.ShouldProcess("nstimer", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nstimer -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNstimer -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNstimer: Finished"
    }
}

function Invoke-ADCUnsetNstimer {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for Timer resource.
    .PARAMETER Name
        Timer name.
    .PARAMETER Interval
        The frequency at which the policies bound to this timer are invoked. The minimum value is 20 msec. The maximum value is 20940 in seconds and 349 in minutes.
    .PARAMETER Unit
        Timer interval unit.
        Possible values = SEC, MIN
    .PARAMETER Comment
        Comments associated with this timer.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNstimer -name <string>
        An example how to unset nstimer configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNstimer
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstimer
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [Boolean]$interval,

        [Boolean]$unit,

        [Boolean]$comment 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNstimer: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('interval') ) { $payload.Add('interval', $interval) }
            if ( $PSBoundParameters.ContainsKey('unit') ) { $payload.Add('unit', $unit) }
            if ( $PSBoundParameters.ContainsKey('comment') ) { $payload.Add('comment', $comment) }
            if ( $PSCmdlet.ShouldProcess("$name", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nstimer -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNstimer: Finished"
    }
}

function Invoke-ADCRenameNstimer {
    <#
    .SYNOPSIS
        Rename NS configuration Object.
    .DESCRIPTION
        Configuration for Timer resource.
    .PARAMETER Name
        Timer name.
    .PARAMETER Newname
        The new name of the timer.
    .PARAMETER PassThru
        Return details about the created nstimer item.
    .EXAMPLE
        PS C:\>Invoke-ADCRenameNstimer -name <string> -newname <string>
        An example how to rename nstimer configuration Object(s).
    .NOTES
        File Name : Invoke-ADCRenameNstimer
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstimer/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Newname,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCRenameNstimer: Starting"
    }
    process {
        try {
            $payload = @{ name = $name
                newname        = $newname
            }

            if ( $PSCmdlet.ShouldProcess("nstimer", "Rename NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nstimer -Action rename -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNstimer -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCRenameNstimer: Finished"
    }
}

function Invoke-ADCGetNstimer {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for Timer resource.
    .PARAMETER Name
        Timer name.
    .PARAMETER GetAll
        Retrieve all nstimer object(s).
    .PARAMETER Count
        If specified, the count of the nstimer object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimer
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimer -GetAll
        Get all nstimer data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimer -Count
        Get the number of nstimer objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimer -name <string>
        Get nstimer object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimer -Filter @{ 'name'='<value>' }
        Get nstimer data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNstimer
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstimer/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNstimer: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nstimer objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimer -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nstimer objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimer -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nstimer objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimer -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nstimer configuration for property 'name'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimer -NitroPath nitro/v1/config -Resource $name -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nstimer configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimer -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNstimer: Ended"
    }
}

function Invoke-ADCAddNstimerautoscalepolicybinding {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Binding object showing the autoscalepolicy that can be bound to nstimer.
    .PARAMETER Name
        Timer name.
    .PARAMETER Policyname
        The timer policy associated with the timer.
    .PARAMETER Priority
        Specifies the priority of the timer policy.
    .PARAMETER Gotopriorityexpression
        Expression specifying the priority of the next policy which will get evaluated if the current policy rule evaluates to TRUE.
    .PARAMETER Vserver
        Name of the vserver which provides the context for the rule in timer policy. When not specified it is treated as a Global Default context.
    .PARAMETER Samplesize
        Denotes the sample size. Sample size value of 'x' means that previous '(x - 1)' policy's rule evaluation results and the current evaluation result are present with the binding. For example, sample size of 10 means that there is a state of previous 9 policy evaluation results and also the current policy evaluation result.
    .PARAMETER Threshold
        Denotes the threshold. If the rule of the policy in the binding relation evaluates 'threshold size' number of times in 'sample size' to true, then the corresponding action is taken. Its value needs to be less than or equal to the sample size value.
    .PARAMETER PassThru
        Return details about the created nstimer_autoscalepolicy_binding item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNstimerautoscalepolicybinding -name <string> -policyname <string> -priority <double>
        An example how to add nstimer_autoscalepolicy_binding configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNstimerautoscalepolicybinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstimer_autoscalepolicy_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [Parameter(Mandatory)]
        [string]$Policyname,

        [Parameter(Mandatory)]
        [double]$Priority,

        [string]$Gotopriorityexpression,

        [string]$Vserver,

        [ValidateRange(1, 32)]
        [double]$Samplesize = '3',

        [ValidateRange(1, 32)]
        [double]$Threshold = '3',

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNstimerautoscalepolicybinding: Starting"
    }
    process {
        try {
            $payload = @{ name = $name
                policyname     = $policyname
                priority       = $priority
            }
            if ( $PSBoundParameters.ContainsKey('gotopriorityexpression') ) { $payload.Add('gotopriorityexpression', $gotopriorityexpression) }
            if ( $PSBoundParameters.ContainsKey('vserver') ) { $payload.Add('vserver', $vserver) }
            if ( $PSBoundParameters.ContainsKey('samplesize') ) { $payload.Add('samplesize', $samplesize) }
            if ( $PSBoundParameters.ContainsKey('threshold') ) { $payload.Add('threshold', $threshold) }
            if ( $PSCmdlet.ShouldProcess("nstimer_autoscalepolicy_binding", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nstimer_autoscalepolicy_binding -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNstimerautoscalepolicybinding -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNstimerautoscalepolicybinding: Finished"
    }
}

function Invoke-ADCDeleteNstimerautoscalepolicybinding {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Binding object showing the autoscalepolicy that can be bound to nstimer.
    .PARAMETER Name
        Timer name.
    .PARAMETER Policyname
        The timer policy associated with the timer.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNstimerautoscalepolicybinding -Name <string>
        An example how to delete nstimer_autoscalepolicy_binding configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNstimerautoscalepolicybinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstimer_autoscalepolicy_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Name,

        [string]$Policyname 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNstimerautoscalepolicybinding: Starting"
    }
    process {
        try {
            $arguments = @{ }
            if ( $PSBoundParameters.ContainsKey('Policyname') ) { $arguments.Add('policyname', $Policyname) }
            if ( $PSCmdlet.ShouldProcess("$name", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nstimer_autoscalepolicy_binding -NitroPath nitro/v1/config -Resource $name -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNstimerautoscalepolicybinding: Finished"
    }
}

function Invoke-ADCGetNstimerautoscalepolicybinding {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Binding object showing the autoscalepolicy that can be bound to nstimer.
    .PARAMETER Name
        Timer name.
    .PARAMETER GetAll
        Retrieve all nstimer_autoscalepolicy_binding object(s).
    .PARAMETER Count
        If specified, the count of the nstimer_autoscalepolicy_binding object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimerautoscalepolicybinding
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimerautoscalepolicybinding -GetAll
        Get all nstimer_autoscalepolicy_binding data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimerautoscalepolicybinding -Count
        Get the number of nstimer_autoscalepolicy_binding objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimerautoscalepolicybinding -name <string>
        Get nstimer_autoscalepolicy_binding object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimerautoscalepolicybinding -Filter @{ 'name'='<value>' }
        Get nstimer_autoscalepolicy_binding data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNstimerautoscalepolicybinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstimer_autoscalepolicy_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNstimerautoscalepolicybinding: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{  bulkbindings = 'yes' }
                Write-Verbose "Retrieving all nstimer_autoscalepolicy_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimer_autoscalepolicy_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nstimer_autoscalepolicy_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimer_autoscalepolicy_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nstimer_autoscalepolicy_binding objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimer_autoscalepolicy_binding -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nstimer_autoscalepolicy_binding configuration for property 'name'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimer_autoscalepolicy_binding -NitroPath nitro/v1/config -Resource $name -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nstimer_autoscalepolicy_binding configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimer_autoscalepolicy_binding -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNstimerautoscalepolicybinding: Ended"
    }
}

function Invoke-ADCGetNstimerbinding {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Binding object which returns the resources bound to nstimer.
    .PARAMETER Name
        Timer name.
    .PARAMETER GetAll
        Retrieve all nstimer_binding object(s).
    .PARAMETER Count
        If specified, the count of the nstimer_binding object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimerbinding
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimerbinding -GetAll
        Get all nstimer_binding data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimerbinding -name <string>
        Get nstimer_binding object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimerbinding -Filter @{ 'name'='<value>' }
        Get nstimer_binding data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNstimerbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstimer_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNstimerbinding: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{  bulkbindings = 'yes' }
                Write-Verbose "Retrieving all nstimer_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimer_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nstimer_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimer_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nstimer_binding objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimer_binding -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nstimer_binding configuration for property 'name'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimer_binding -NitroPath nitro/v1/config -Resource $name -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nstimer_binding configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimer_binding -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNstimerbinding: Ended"
    }
}

function Invoke-ADCGetNstimezone {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for 0 resource.
    .PARAMETER Value
        .
    .PARAMETER GetAll
        Retrieve all nstimezone object(s).
    .PARAMETER Count
        If specified, the count of the nstimezone object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimezone
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimezone -GetAll
        Get all nstimezone data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimezone -Count
        Get the number of nstimezone objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimezone -name <string>
        Get nstimezone object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstimezone -Filter @{ 'name'='<value>' }
        Get nstimezone data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNstimezone
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstimezone/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [string]$Value,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNstimezone: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nstimezone objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimezone -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nstimezone objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimezone -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nstimezone objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimezone -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nstimezone configuration for property 'value'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimezone -NitroPath nitro/v1/config -Resource $value -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nstimezone configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstimezone -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNstimezone: Ended"
    }
}

function Invoke-ADCAddNstrafficdomain {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for Traffic Domain resource.
    .PARAMETER Td
        Integer value that uniquely identifies a traffic domain.
    .PARAMETER Aliasname
        Name of traffic domain being added.
    .PARAMETER Vmac
        Associate the traffic domain with a VMAC address instead of with VLANs. The Citrix ADC then sends the VMAC address of the traffic domain in all responses to ARP queries for network entities in that domain. As a result, the ADC can segregate subsequent incoming traffic for this traffic domain on the basis of the destination MAC address, because the destination MAC address is the VMAC address of the traffic domain. After creating entities on a traffic domain, you can easily manage and monitor them by performing traffic domain level operations.
        Possible values = ENABLED, DISABLED
    .PARAMETER PassThru
        Return details about the created nstrafficdomain item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNstrafficdomain -td <double>
        An example how to add nstrafficdomain configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNstrafficdomain
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstrafficdomain/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateRange(1, 4094)]
        [double]$Td,

        [ValidateLength(1, 31)]
        [string]$Aliasname,

        [ValidateSet('ENABLED', 'DISABLED')]
        [string]$Vmac = 'DISABLED',

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNstrafficdomain: Starting"
    }
    process {
        try {
            $payload = @{ td = $td }
            if ( $PSBoundParameters.ContainsKey('aliasname') ) { $payload.Add('aliasname', $aliasname) }
            if ( $PSBoundParameters.ContainsKey('vmac') ) { $payload.Add('vmac', $vmac) }
            if ( $PSCmdlet.ShouldProcess("nstrafficdomain", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nstrafficdomain -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNstrafficdomain -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNstrafficdomain: Finished"
    }
}

function Invoke-ADCDeleteNstrafficdomain {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for Traffic Domain resource.
    .PARAMETER Td
        Integer value that uniquely identifies a traffic domain.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNstrafficdomain -Td <double>
        An example how to delete nstrafficdomain configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNstrafficdomain
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstrafficdomain/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [double]$Td 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNstrafficdomain: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$td", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nstrafficdomain -NitroPath nitro/v1/config -Resource $td -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNstrafficdomain: Finished"
    }
}

function Invoke-ADCClearNstrafficdomain {
    <#
    .SYNOPSIS
        Clear NS configuration Object.
    .DESCRIPTION
        Configuration for Traffic Domain resource.
    .PARAMETER Td
        Integer value that uniquely identifies a traffic domain.
    .EXAMPLE
        PS C:\>Invoke-ADCClearNstrafficdomain -td <double>
        An example how to clear nstrafficdomain configuration Object(s).
    .NOTES
        File Name : Invoke-ADCClearNstrafficdomain
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstrafficdomain/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateRange(1, 4094)]
        [double]$Td 

    )
    begin {
        Write-Verbose "Invoke-ADCClearNstrafficdomain: Starting"
    }
    process {
        try {
            $payload = @{ td = $td }

            if ( $PSCmdlet.ShouldProcess($Name, "Clear NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nstrafficdomain -Action clear -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCClearNstrafficdomain: Finished"
    }
}

function Invoke-ADCEnableNstrafficdomain {
    <#
    .SYNOPSIS
        Enable NS configuration Object.
    .DESCRIPTION
        Configuration for Traffic Domain resource.
    .PARAMETER Td
        Integer value that uniquely identifies a traffic domain.
    .EXAMPLE
        PS C:\>Invoke-ADCEnableNstrafficdomain -td <double>
        An example how to enable nstrafficdomain configuration Object(s).
    .NOTES
        File Name : Invoke-ADCEnableNstrafficdomain
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstrafficdomain/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateRange(1, 4094)]
        [double]$Td 

    )
    begin {
        Write-Verbose "Invoke-ADCEnableNstrafficdomain: Starting"
    }
    process {
        try {
            $payload = @{ td = $td }

            if ( $PSCmdlet.ShouldProcess($Name, "Enable NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nstrafficdomain -Action enable -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCEnableNstrafficdomain: Finished"
    }
}

function Invoke-ADCDisableNstrafficdomain {
    <#
    .SYNOPSIS
        Disable NS configuration Object.
    .DESCRIPTION
        Configuration for Traffic Domain resource.
    .PARAMETER Td
        Integer value that uniquely identifies a traffic domain.
    .EXAMPLE
        PS C:\>Invoke-ADCDisableNstrafficdomain -td <double>
        An example how to disable nstrafficdomain configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDisableNstrafficdomain
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstrafficdomain/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateRange(1, 4094)]
        [double]$Td 

    )
    begin {
        Write-Verbose "Invoke-ADCDisableNstrafficdomain: Starting"
    }
    process {
        try {
            $payload = @{ td = $td }

            if ( $PSCmdlet.ShouldProcess($Name, "Disable NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nstrafficdomain -Action disable -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDisableNstrafficdomain: Finished"
    }
}

function Invoke-ADCGetNstrafficdomain {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for Traffic Domain resource.
    .PARAMETER Td
        Integer value that uniquely identifies a traffic domain.
    .PARAMETER GetAll
        Retrieve all nstrafficdomain object(s).
    .PARAMETER Count
        If specified, the count of the nstrafficdomain object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomain
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomain -GetAll
        Get all nstrafficdomain data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomain -Count
        Get the number of nstrafficdomain objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomain -name <string>
        Get nstrafficdomain object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomain -Filter @{ 'name'='<value>' }
        Get nstrafficdomain data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNstrafficdomain
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstrafficdomain/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateRange(1, 4094)]
        [double]$Td,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNstrafficdomain: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nstrafficdomain objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nstrafficdomain objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nstrafficdomain objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nstrafficdomain configuration for property 'td'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain -NitroPath nitro/v1/config -Resource $td -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nstrafficdomain configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNstrafficdomain: Ended"
    }
}

function Invoke-ADCGetNstrafficdomainbinding {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Binding object which returns the resources bound to nstrafficdomain.
    .PARAMETER Td
        Integer value that uniquely identifies a traffic domain.
    .PARAMETER GetAll
        Retrieve all nstrafficdomain_binding object(s).
    .PARAMETER Count
        If specified, the count of the nstrafficdomain_binding object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomainbinding
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomainbinding -GetAll
        Get all nstrafficdomain_binding data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomainbinding -name <string>
        Get nstrafficdomain_binding object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomainbinding -Filter @{ 'name'='<value>' }
        Get nstrafficdomain_binding data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNstrafficdomainbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstrafficdomain_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateRange(1, 4094)]
        [double]$Td,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNstrafficdomainbinding: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{  bulkbindings = 'yes' }
                Write-Verbose "Retrieving all nstrafficdomain_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nstrafficdomain_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nstrafficdomain_binding objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain_binding -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nstrafficdomain_binding configuration for property 'td'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain_binding -NitroPath nitro/v1/config -Resource $td -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nstrafficdomain_binding configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain_binding -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNstrafficdomainbinding: Ended"
    }
}

function Invoke-ADCAddNstrafficdomainbridgegroupbinding {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Binding object showing the bridgegroup that can be bound to nstrafficdomain.
    .PARAMETER Td
        Integer value that uniquely identifies a traffic domain.
    .PARAMETER Bridgegroup
        ID of the configured bridge to bind to this traffic domain. More than one bridge group can be bound to a traffic domain, but the same bridge group cannot be a part of multiple traffic domains.
    .PARAMETER PassThru
        Return details about the created nstrafficdomain_bridgegroup_binding item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNstrafficdomainbridgegroupbinding -td <double>
        An example how to add nstrafficdomain_bridgegroup_binding configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNstrafficdomainbridgegroupbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstrafficdomain_bridgegroup_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateRange(1, 4094)]
        [double]$Td,

        [ValidateRange(1, 1000)]
        [double]$Bridgegroup,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNstrafficdomainbridgegroupbinding: Starting"
    }
    process {
        try {
            $payload = @{ td = $td }
            if ( $PSBoundParameters.ContainsKey('bridgegroup') ) { $payload.Add('bridgegroup', $bridgegroup) }
            if ( $PSCmdlet.ShouldProcess("nstrafficdomain_bridgegroup_binding", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nstrafficdomain_bridgegroup_binding -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNstrafficdomainbridgegroupbinding -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNstrafficdomainbridgegroupbinding: Finished"
    }
}

function Invoke-ADCDeleteNstrafficdomainbridgegroupbinding {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Binding object showing the bridgegroup that can be bound to nstrafficdomain.
    .PARAMETER Td
        Integer value that uniquely identifies a traffic domain.
    .PARAMETER Bridgegroup
        ID of the configured bridge to bind to this traffic domain. More than one bridge group can be bound to a traffic domain, but the same bridge group cannot be a part of multiple traffic domains.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNstrafficdomainbridgegroupbinding -Td <double>
        An example how to delete nstrafficdomain_bridgegroup_binding configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNstrafficdomainbridgegroupbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstrafficdomain_bridgegroup_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [double]$Td,

        [double]$Bridgegroup 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNstrafficdomainbridgegroupbinding: Starting"
    }
    process {
        try {
            $arguments = @{ }
            if ( $PSBoundParameters.ContainsKey('Bridgegroup') ) { $arguments.Add('bridgegroup', $Bridgegroup) }
            if ( $PSCmdlet.ShouldProcess("$td", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nstrafficdomain_bridgegroup_binding -NitroPath nitro/v1/config -Resource $td -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNstrafficdomainbridgegroupbinding: Finished"
    }
}

function Invoke-ADCGetNstrafficdomainbridgegroupbinding {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Binding object showing the bridgegroup that can be bound to nstrafficdomain.
    .PARAMETER Td
        Integer value that uniquely identifies a traffic domain.
    .PARAMETER GetAll
        Retrieve all nstrafficdomain_bridgegroup_binding object(s).
    .PARAMETER Count
        If specified, the count of the nstrafficdomain_bridgegroup_binding object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomainbridgegroupbinding
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomainbridgegroupbinding -GetAll
        Get all nstrafficdomain_bridgegroup_binding data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomainbridgegroupbinding -Count
        Get the number of nstrafficdomain_bridgegroup_binding objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomainbridgegroupbinding -name <string>
        Get nstrafficdomain_bridgegroup_binding object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomainbridgegroupbinding -Filter @{ 'name'='<value>' }
        Get nstrafficdomain_bridgegroup_binding data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNstrafficdomainbridgegroupbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstrafficdomain_bridgegroup_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateRange(1, 4094)]
        [double]$Td,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNstrafficdomainbridgegroupbinding: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{  bulkbindings = 'yes' }
                Write-Verbose "Retrieving all nstrafficdomain_bridgegroup_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain_bridgegroup_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nstrafficdomain_bridgegroup_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain_bridgegroup_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nstrafficdomain_bridgegroup_binding objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain_bridgegroup_binding -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nstrafficdomain_bridgegroup_binding configuration for property 'td'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain_bridgegroup_binding -NitroPath nitro/v1/config -Resource $td -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nstrafficdomain_bridgegroup_binding configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain_bridgegroup_binding -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNstrafficdomainbridgegroupbinding: Ended"
    }
}

function Invoke-ADCAddNstrafficdomainvlanbinding {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Binding object showing the vlan that can be bound to nstrafficdomain.
    .PARAMETER Td
        Integer value that uniquely identifies a traffic domain.
    .PARAMETER Vlan
        ID of the VLAN to bind to this traffic domain. More than one VLAN can be bound to a traffic domain, but the same VLAN cannot be a part of multiple traffic domains.
    .PARAMETER PassThru
        Return details about the created nstrafficdomain_vlan_binding item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNstrafficdomainvlanbinding -td <double>
        An example how to add nstrafficdomain_vlan_binding configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNstrafficdomainvlanbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstrafficdomain_vlan_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateRange(1, 4094)]
        [double]$Td,

        [ValidateRange(1, 4094)]
        [double]$Vlan,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNstrafficdomainvlanbinding: Starting"
    }
    process {
        try {
            $payload = @{ td = $td }
            if ( $PSBoundParameters.ContainsKey('vlan') ) { $payload.Add('vlan', $vlan) }
            if ( $PSCmdlet.ShouldProcess("nstrafficdomain_vlan_binding", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nstrafficdomain_vlan_binding -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNstrafficdomainvlanbinding -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNstrafficdomainvlanbinding: Finished"
    }
}

function Invoke-ADCDeleteNstrafficdomainvlanbinding {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Binding object showing the vlan that can be bound to nstrafficdomain.
    .PARAMETER Td
        Integer value that uniquely identifies a traffic domain.
    .PARAMETER Vlan
        ID of the VLAN to bind to this traffic domain. More than one VLAN can be bound to a traffic domain, but the same VLAN cannot be a part of multiple traffic domains.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNstrafficdomainvlanbinding -Td <double>
        An example how to delete nstrafficdomain_vlan_binding configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNstrafficdomainvlanbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstrafficdomain_vlan_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [double]$Td,

        [double]$Vlan 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNstrafficdomainvlanbinding: Starting"
    }
    process {
        try {
            $arguments = @{ }
            if ( $PSBoundParameters.ContainsKey('Vlan') ) { $arguments.Add('vlan', $Vlan) }
            if ( $PSCmdlet.ShouldProcess("$td", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nstrafficdomain_vlan_binding -NitroPath nitro/v1/config -Resource $td -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNstrafficdomainvlanbinding: Finished"
    }
}

function Invoke-ADCGetNstrafficdomainvlanbinding {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Binding object showing the vlan that can be bound to nstrafficdomain.
    .PARAMETER Td
        Integer value that uniquely identifies a traffic domain.
    .PARAMETER GetAll
        Retrieve all nstrafficdomain_vlan_binding object(s).
    .PARAMETER Count
        If specified, the count of the nstrafficdomain_vlan_binding object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomainvlanbinding
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomainvlanbinding -GetAll
        Get all nstrafficdomain_vlan_binding data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomainvlanbinding -Count
        Get the number of nstrafficdomain_vlan_binding objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomainvlanbinding -name <string>
        Get nstrafficdomain_vlan_binding object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomainvlanbinding -Filter @{ 'name'='<value>' }
        Get nstrafficdomain_vlan_binding data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNstrafficdomainvlanbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstrafficdomain_vlan_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateRange(1, 4094)]
        [double]$Td,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNstrafficdomainvlanbinding: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{  bulkbindings = 'yes' }
                Write-Verbose "Retrieving all nstrafficdomain_vlan_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain_vlan_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nstrafficdomain_vlan_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain_vlan_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nstrafficdomain_vlan_binding objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain_vlan_binding -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nstrafficdomain_vlan_binding configuration for property 'td'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain_vlan_binding -NitroPath nitro/v1/config -Resource $td -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nstrafficdomain_vlan_binding configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain_vlan_binding -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNstrafficdomainvlanbinding: Ended"
    }
}

function Invoke-ADCAddNstrafficdomainvxlanbinding {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Binding object showing the vxlan that can be bound to nstrafficdomain.
    .PARAMETER Td
        Integer value that uniquely identifies a traffic domain.
    .PARAMETER Vxlan
        ID of the VXLAN to bind to this traffic domain. More than one VXLAN can be bound to a traffic domain, but the same VXLAN cannot be a part of multiple traffic domains.
    .PARAMETER PassThru
        Return details about the created nstrafficdomain_vxlan_binding item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNstrafficdomainvxlanbinding -td <double>
        An example how to add nstrafficdomain_vxlan_binding configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNstrafficdomainvxlanbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstrafficdomain_vxlan_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateRange(1, 4094)]
        [double]$Td,

        [ValidateRange(1, 16777215)]
        [double]$Vxlan,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNstrafficdomainvxlanbinding: Starting"
    }
    process {
        try {
            $payload = @{ td = $td }
            if ( $PSBoundParameters.ContainsKey('vxlan') ) { $payload.Add('vxlan', $vxlan) }
            if ( $PSCmdlet.ShouldProcess("nstrafficdomain_vxlan_binding", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nstrafficdomain_vxlan_binding -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNstrafficdomainvxlanbinding -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNstrafficdomainvxlanbinding: Finished"
    }
}

function Invoke-ADCDeleteNstrafficdomainvxlanbinding {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Binding object showing the vxlan that can be bound to nstrafficdomain.
    .PARAMETER Td
        Integer value that uniquely identifies a traffic domain.
    .PARAMETER Vxlan
        ID of the VXLAN to bind to this traffic domain. More than one VXLAN can be bound to a traffic domain, but the same VXLAN cannot be a part of multiple traffic domains.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNstrafficdomainvxlanbinding -Td <double>
        An example how to delete nstrafficdomain_vxlan_binding configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNstrafficdomainvxlanbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstrafficdomain_vxlan_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [double]$Td,

        [double]$Vxlan 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNstrafficdomainvxlanbinding: Starting"
    }
    process {
        try {
            $arguments = @{ }
            if ( $PSBoundParameters.ContainsKey('Vxlan') ) { $arguments.Add('vxlan', $Vxlan) }
            if ( $PSCmdlet.ShouldProcess("$td", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nstrafficdomain_vxlan_binding -NitroPath nitro/v1/config -Resource $td -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNstrafficdomainvxlanbinding: Finished"
    }
}

function Invoke-ADCGetNstrafficdomainvxlanbinding {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Binding object showing the vxlan that can be bound to nstrafficdomain.
    .PARAMETER Td
        Integer value that uniquely identifies a traffic domain.
    .PARAMETER GetAll
        Retrieve all nstrafficdomain_vxlan_binding object(s).
    .PARAMETER Count
        If specified, the count of the nstrafficdomain_vxlan_binding object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomainvxlanbinding
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomainvxlanbinding -GetAll
        Get all nstrafficdomain_vxlan_binding data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomainvxlanbinding -Count
        Get the number of nstrafficdomain_vxlan_binding objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomainvxlanbinding -name <string>
        Get nstrafficdomain_vxlan_binding object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNstrafficdomainvxlanbinding -Filter @{ 'name'='<value>' }
        Get nstrafficdomain_vxlan_binding data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNstrafficdomainvxlanbinding
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nstrafficdomain_vxlan_binding/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateRange(1, 4094)]
        [double]$Td,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNstrafficdomainvxlanbinding: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{  bulkbindings = 'yes' }
                Write-Verbose "Retrieving all nstrafficdomain_vxlan_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain_vxlan_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nstrafficdomain_vxlan_binding objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain_vxlan_binding -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nstrafficdomain_vxlan_binding objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain_vxlan_binding -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nstrafficdomain_vxlan_binding configuration for property 'td'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain_vxlan_binding -NitroPath nitro/v1/config -Resource $td -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nstrafficdomain_vxlan_binding configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nstrafficdomain_vxlan_binding -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNstrafficdomainvxlanbinding: Ended"
    }
}

function Invoke-ADCAddNsvariable {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for variable resource.
    .PARAMETER Name
        Variable name. This follows the same syntax rules as other expression entity names:
        It must begin with an alpha character (A-Z or a-z) or an underscore (_).
        The rest of the characters must be alpha, numeric (0-9) or underscores.
        It cannot be re or xp (reserved for regular and XPath expressions).
        It cannot be an expression reserved word (e.g. SYS or HTTP).
        It cannot be used for an existing expression object (HTTP callout, patset, dataset, stringmap, or named expression).
    .PARAMETER Type
        Specification of the variable type; one of the following:
        ulong - singleton variable with an unsigned 64-bit value.
        text(value-max-size) - singleton variable with a text string value.
        map(text(key-max-size),ulong,max-entries) - map of text string keys to unsigned 64-bit values.
        map(text(key-max-size),text(value-max-size),max-entries) - map of text string keys to text string values.
        where
        value-max-size is a positive integer that is the maximum number of bytes in a text string value.
        key-max-size is a positive integer that is the maximum number of bytes in a text string key.
        max-entries is a positive integer that is the maximum number of entries in a map variable.
        For a global singleton text variable, value-max-size <= 64000.
        For a global map with ulong values, key-max-size <= 64000.
        For a global map with text values, key-max-size + value-max-size <= 64000.
        max-entries is a positive integer that is the maximum number of entries in a map variable. This has a theoretical maximum of 2^64-1, but in actual use will be much smaller, considering the memory available for use by the map.
        Example:
        map(text(10),text(20),100) specifies a map of text string keys (max size 10 bytes) to text string values (max size 20 bytes), with 100 max entries.
    .PARAMETER Scope
        Scope of the variable:
        global - (default) one set of values visible across all Packet Engines on a standalone Citrix ADC, an HA pair, or all nodes of a cluster
        transaction - one value for each request-response transaction (singleton variables only; no expiration).
        Possible values = global, transaction
    .PARAMETER Iffull
        Action to perform if an assignment to a map exceeds its configured max-entries:
        lru - (default) reuse the least recently used entry in the map.
        undef - force the assignment to return an undefined (Undef) result to the policy executing the assignment.
        Possible values = undef, lru
    .PARAMETER Ifvaluetoobig
        Action to perform if an value is assigned to a text variable that exceeds its configured max-size,
        or if a key is used that exceeds its configured max-size:
        truncate - (default) truncate the text string to the first max-size bytes and proceed.
        undef - force the assignment or expression evaluation to return an undefined (Undef) result to the policy executing the assignment or expression.
        Possible values = undef, truncate
    .PARAMETER Ifnovalue
        Action to perform if on a variable reference in an expression if the variable is single-valued and uninitialized
        or if the variable is a map and there is no value for the specified key:
        init - (default) initialize the single-value variable, or create a map entry for the key and the initial value,
        using the -init value or its default.
        undef - force the expression evaluation to return an undefined (Undef) result to the policy executing the expression.
        Possible values = undef, init
    .PARAMETER Init
        Initialization value for this variable, to which a singleton variable or map entry will be set if it is referenced before an assignment action has assigned it a value. If the singleton variable or map entry already has been assigned a value, setting this parameter will have no effect on that variable value. Default: 0 for ulong, NULL for text.
    .PARAMETER Expires
        Value expiration in seconds. If the value is not referenced within the expiration period it will be deleted. 0 (the default) means no expiration.
    .PARAMETER Comment
        Comments associated with this variable.
    .PARAMETER PassThru
        Return details about the created nsvariable item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNsvariable -name <string> -type <string>
        An example how to add nsvariable configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNsvariable
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsvariable/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Type,

        [ValidateSet('global', 'transaction')]
        [string]$Scope = 'global',

        [ValidateSet('undef', 'lru')]
        [string]$Iffull = 'lru',

        [ValidateSet('undef', 'truncate')]
        [string]$Ifvaluetoobig = 'truncate',

        [ValidateSet('undef', 'init')]
        [string]$Ifnovalue = 'init',

        [string]$Init,

        [ValidateRange(0, 31622400)]
        [double]$Expires,

        [string]$Comment,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNsvariable: Starting"
    }
    process {
        try {
            $payload = @{ name = $name
                type           = $type
            }
            if ( $PSBoundParameters.ContainsKey('scope') ) { $payload.Add('scope', $scope) }
            if ( $PSBoundParameters.ContainsKey('iffull') ) { $payload.Add('iffull', $iffull) }
            if ( $PSBoundParameters.ContainsKey('ifvaluetoobig') ) { $payload.Add('ifvaluetoobig', $ifvaluetoobig) }
            if ( $PSBoundParameters.ContainsKey('ifnovalue') ) { $payload.Add('ifnovalue', $ifnovalue) }
            if ( $PSBoundParameters.ContainsKey('init') ) { $payload.Add('init', $init) }
            if ( $PSBoundParameters.ContainsKey('expires') ) { $payload.Add('expires', $expires) }
            if ( $PSBoundParameters.ContainsKey('comment') ) { $payload.Add('comment', $comment) }
            if ( $PSCmdlet.ShouldProcess("nsvariable", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsvariable -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsvariable -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNsvariable: Finished"
    }
}

function Invoke-ADCUpdateNsvariable {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for variable resource.
    .PARAMETER Name
        Variable name. This follows the same syntax rules as other expression entity names:
        It must begin with an alpha character (A-Z or a-z) or an underscore (_).
        The rest of the characters must be alpha, numeric (0-9) or underscores.
        It cannot be re or xp (reserved for regular and XPath expressions).
        It cannot be an expression reserved word (e.g. SYS or HTTP).
        It cannot be used for an existing expression object (HTTP callout, patset, dataset, stringmap, or named expression).
    .PARAMETER Type
        Specification of the variable type; one of the following:
        ulong - singleton variable with an unsigned 64-bit value.
        text(value-max-size) - singleton variable with a text string value.
        map(text(key-max-size),ulong,max-entries) - map of text string keys to unsigned 64-bit values.
        map(text(key-max-size),text(value-max-size),max-entries) - map of text string keys to text string values.
        where
        value-max-size is a positive integer that is the maximum number of bytes in a text string value.
        key-max-size is a positive integer that is the maximum number of bytes in a text string key.
        max-entries is a positive integer that is the maximum number of entries in a map variable.
        For a global singleton text variable, value-max-size <= 64000.
        For a global map with ulong values, key-max-size <= 64000.
        For a global map with text values, key-max-size + value-max-size <= 64000.
        max-entries is a positive integer that is the maximum number of entries in a map variable. This has a theoretical maximum of 2^64-1, but in actual use will be much smaller, considering the memory available for use by the map.
        Example:
        map(text(10),text(20),100) specifies a map of text string keys (max size 10 bytes) to text string values (max size 20 bytes), with 100 max entries.
    .PARAMETER Iffull
        Action to perform if an assignment to a map exceeds its configured max-entries:
        lru - (default) reuse the least recently used entry in the map.
        undef - force the assignment to return an undefined (Undef) result to the policy executing the assignment.
        Possible values = undef, lru
    .PARAMETER Ifvaluetoobig
        Action to perform if an value is assigned to a text variable that exceeds its configured max-size,
        or if a key is used that exceeds its configured max-size:
        truncate - (default) truncate the text string to the first max-size bytes and proceed.
        undef - force the assignment or expression evaluation to return an undefined (Undef) result to the policy executing the assignment or expression.
        Possible values = undef, truncate
    .PARAMETER Ifnovalue
        Action to perform if on a variable reference in an expression if the variable is single-valued and uninitialized
        or if the variable is a map and there is no value for the specified key:
        init - (default) initialize the single-value variable, or create a map entry for the key and the initial value,
        using the -init value or its default.
        undef - force the expression evaluation to return an undefined (Undef) result to the policy executing the expression.
        Possible values = undef, init
    .PARAMETER Init
        Initialization value for this variable, to which a singleton variable or map entry will be set if it is referenced before an assignment action has assigned it a value. If the singleton variable or map entry already has been assigned a value, setting this parameter will have no effect on that variable value. Default: 0 for ulong, NULL for text.
    .PARAMETER Expires
        Value expiration in seconds. If the value is not referenced within the expiration period it will be deleted. 0 (the default) means no expiration.
    .PARAMETER Comment
        Comments associated with this variable.
    .PARAMETER PassThru
        Return details about the created nsvariable item.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsvariable -name <string>
        An example how to update nsvariable configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsvariable
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsvariable/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Type,

        [ValidateSet('undef', 'lru')]
        [string]$Iffull,

        [ValidateSet('undef', 'truncate')]
        [string]$Ifvaluetoobig,

        [ValidateSet('undef', 'init')]
        [string]$Ifnovalue,

        [string]$Init,

        [ValidateRange(0, 31622400)]
        [double]$Expires,

        [string]$Comment,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsvariable: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('type') ) { $payload.Add('type', $type) }
            if ( $PSBoundParameters.ContainsKey('iffull') ) { $payload.Add('iffull', $iffull) }
            if ( $PSBoundParameters.ContainsKey('ifvaluetoobig') ) { $payload.Add('ifvaluetoobig', $ifvaluetoobig) }
            if ( $PSBoundParameters.ContainsKey('ifnovalue') ) { $payload.Add('ifnovalue', $ifnovalue) }
            if ( $PSBoundParameters.ContainsKey('init') ) { $payload.Add('init', $init) }
            if ( $PSBoundParameters.ContainsKey('expires') ) { $payload.Add('expires', $expires) }
            if ( $PSBoundParameters.ContainsKey('comment') ) { $payload.Add('comment', $comment) }
            if ( $PSCmdlet.ShouldProcess("nsvariable", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsvariable -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsvariable -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsvariable: Finished"
    }
}

function Invoke-ADCUnsetNsvariable {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for variable resource.
    .PARAMETER Name
        Variable name. This follows the same syntax rules as other expression entity names:
        It must begin with an alpha character (A-Z or a-z) or an underscore (_).
        The rest of the characters must be alpha, numeric (0-9) or underscores.
        It cannot be re or xp (reserved for regular and XPath expressions).
        It cannot be an expression reserved word (e.g. SYS or HTTP).
        It cannot be used for an existing expression object (HTTP callout, patset, dataset, stringmap, or named expression).
    .PARAMETER Iffull
        Action to perform if an assignment to a map exceeds its configured max-entries:
        lru - (default) reuse the least recently used entry in the map.
        undef - force the assignment to return an undefined (Undef) result to the policy executing the assignment.
        Possible values = undef, lru
    .PARAMETER Ifvaluetoobig
        Action to perform if an value is assigned to a text variable that exceeds its configured max-size,
        or if a key is used that exceeds its configured max-size:
        truncate - (default) truncate the text string to the first max-size bytes and proceed.
        undef - force the assignment or expression evaluation to return an undefined (Undef) result to the policy executing the assignment or expression.
        Possible values = undef, truncate
    .PARAMETER Ifnovalue
        Action to perform if on a variable reference in an expression if the variable is single-valued and uninitialized
        or if the variable is a map and there is no value for the specified key:
        init - (default) initialize the single-value variable, or create a map entry for the key and the initial value,
        using the -init value or its default.
        undef - force the expression evaluation to return an undefined (Undef) result to the policy executing the expression.
        Possible values = undef, init
    .PARAMETER Init
        Initialization value for this variable, to which a singleton variable or map entry will be set if it is referenced before an assignment action has assigned it a value. If the singleton variable or map entry already has been assigned a value, setting this parameter will have no effect on that variable value. Default: 0 for ulong, NULL for text.
    .PARAMETER Expires
        Value expiration in seconds. If the value is not referenced within the expiration period it will be deleted. 0 (the default) means no expiration.
    .PARAMETER Comment
        Comments associated with this variable.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNsvariable -name <string>
        An example how to unset nsvariable configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNsvariable
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsvariable
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [Boolean]$iffull,

        [Boolean]$ifvaluetoobig,

        [Boolean]$ifnovalue,

        [Boolean]$init,

        [Boolean]$expires,

        [Boolean]$comment 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNsvariable: Starting"
    }
    process {
        try {
            $payload = @{ name = $name }
            if ( $PSBoundParameters.ContainsKey('iffull') ) { $payload.Add('iffull', $iffull) }
            if ( $PSBoundParameters.ContainsKey('ifvaluetoobig') ) { $payload.Add('ifvaluetoobig', $ifvaluetoobig) }
            if ( $PSBoundParameters.ContainsKey('ifnovalue') ) { $payload.Add('ifnovalue', $ifnovalue) }
            if ( $PSBoundParameters.ContainsKey('init') ) { $payload.Add('init', $init) }
            if ( $PSBoundParameters.ContainsKey('expires') ) { $payload.Add('expires', $expires) }
            if ( $PSBoundParameters.ContainsKey('comment') ) { $payload.Add('comment', $comment) }
            if ( $PSCmdlet.ShouldProcess("$name", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nsvariable -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNsvariable: Finished"
    }
}

function Invoke-ADCDeleteNsvariable {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for variable resource.
    .PARAMETER Name
        Variable name. This follows the same syntax rules as other expression entity names:
        It must begin with an alpha character (A-Z or a-z) or an underscore (_).
        The rest of the characters must be alpha, numeric (0-9) or underscores.
        It cannot be re or xp (reserved for regular and XPath expressions).
        It cannot be an expression reserved word (e.g. SYS or HTTP).
        It cannot be used for an existing expression object (HTTP callout, patset, dataset, stringmap, or named expression).
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNsvariable -Name <string>
        An example how to delete nsvariable configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNsvariable
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsvariable/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Name 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNsvariable: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$name", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nsvariable -NitroPath nitro/v1/config -Resource $name -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNsvariable: Finished"
    }
}

function Invoke-ADCGetNsvariable {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for variable resource.
    .PARAMETER Name
        Variable name. This follows the same syntax rules as other expression entity names:
        It must begin with an alpha character (A-Z or a-z) or an underscore (_).
        The rest of the characters must be alpha, numeric (0-9) or underscores.
        It cannot be re or xp (reserved for regular and XPath expressions).
        It cannot be an expression reserved word (e.g. SYS or HTTP).
        It cannot be used for an existing expression object (HTTP callout, patset, dataset, stringmap, or named expression).
    .PARAMETER GetAll
        Retrieve all nsvariable object(s).
    .PARAMETER Count
        If specified, the count of the nsvariable object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsvariable
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsvariable -GetAll
        Get all nsvariable data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsvariable -Count
        Get the number of nsvariable objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsvariable -name <string>
        Get nsvariable object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsvariable -Filter @{ 'name'='<value>' }
        Get nsvariable data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsvariable
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsvariable/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Name,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNsvariable: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsvariable objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsvariable -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsvariable objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsvariable -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsvariable objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsvariable -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsvariable configuration for property 'name'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsvariable -NitroPath nitro/v1/config -Resource $name -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nsvariable configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsvariable -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsvariable: Ended"
    }
}

function Invoke-ADCGetNsversion {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for version resource.
    .PARAMETER Installedversion
        Installed version.
    .PARAMETER GetAll
        Retrieve all nsversion object(s).
    .PARAMETER Count
        If specified, the count of the nsversion object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsversion
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsversion -GetAll
        Get all nsversion data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsversion -name <string>
        Get nsversion object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsversion -Filter @{ 'name'='<value>' }
        Get nsversion data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsversion
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsversion/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByArgument')]
        [boolean]$Installedversion,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNsversion: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsversion objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsversion -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsversion objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsversion -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsversion objects by arguments"
                $arguments = @{ } 
                if ( $PSBoundParameters.ContainsKey('installedversion') ) { $arguments.Add('installedversion', $installedversion) }
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsversion -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsversion configuration for property ''"

            } else {
                Write-Verbose "Retrieving nsversion configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsversion -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsversion: Ended"
    }
}

function Invoke-ADCUpdateNsvpxparam {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for "VPX" resource.
    .PARAMETER Masterclockcpu1
        This setting applicable in virtual appliances, to move master clock source cpu from management cpu cpu0 to cpu1 ie PE0.
        * There are 2 options for the behavior:
        1. YES - Allow the Virtual Appliance to move clock source to cpu1.
        2. NO - Virtual Appliance will use management cpu ie cpu0 for clock source default option is NO.
        Possible values = YES, NO
    .PARAMETER Cpuyield
        This setting applicable in virtual appliances, is to affect the cpu yield(relinquishing the cpu resources) in any hypervised environment.
        * There are 3 options for the behavior:
        1. YES - Allow the Virtual Appliance to yield its vCPUs periodically, if there is no data traffic.
        2. NO - Virtual Appliance will not yield the vCPU.
        3. DEFAULT - Restores the default behaviour, according to the license.
        * Its behavior in different scenarios:
        1. As this setting is node specific only, it will not be propagated to other nodes, when executed on Cluster(CLIP) and HA(Primary).
        2. In cluster setup, use '-ownerNode' to specify ID of the cluster node.
        3. This setting is a system wide implementation and not granular to vCPUs.
        4. No effect on the management PE.
        Possible values = DEFAULT, YES, NO
    .PARAMETER Ownernode
        ID of the cluster node for which you are setting the cpuyield. It can be configured only through the cluster IP address.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsvpxparam
        An example how to update nsvpxparam configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsvpxparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsvpxparam/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateSet('YES', 'NO')]
        [string]$Masterclockcpu1,

        [ValidateSet('DEFAULT', 'YES', 'NO')]
        [string]$Cpuyield,

        [ValidateRange(0, 31)]
        [double]$Ownernode 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsvpxparam: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('masterclockcpu1') ) { $payload.Add('masterclockcpu1', $masterclockcpu1) }
            if ( $PSBoundParameters.ContainsKey('cpuyield') ) { $payload.Add('cpuyield', $cpuyield) }
            if ( $PSBoundParameters.ContainsKey('ownernode') ) { $payload.Add('ownernode', $ownernode) }
            if ( $PSCmdlet.ShouldProcess("nsvpxparam", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsvpxparam -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsvpxparam: Finished"
    }
}

function Invoke-ADCUnsetNsvpxparam {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for "VPX" resource.
    .PARAMETER Masterclockcpu1
        This setting applicable in virtual appliances, to move master clock source cpu from management cpu cpu0 to cpu1 ie PE0.
        * There are 2 options for the behavior:
        1. YES - Allow the Virtual Appliance to move clock source to cpu1.
        2. NO - Virtual Appliance will use management cpu ie cpu0 for clock source default option is NO.
        Possible values = YES, NO
    .PARAMETER Cpuyield
        This setting applicable in virtual appliances, is to affect the cpu yield(relinquishing the cpu resources) in any hypervised environment.
        * There are 3 options for the behavior:
        1. YES - Allow the Virtual Appliance to yield its vCPUs periodically, if there is no data traffic.
        2. NO - Virtual Appliance will not yield the vCPU.
        3. DEFAULT - Restores the default behaviour, according to the license.
        * Its behavior in different scenarios:
        1. As this setting is node specific only, it will not be propagated to other nodes, when executed on Cluster(CLIP) and HA(Primary).
        2. In cluster setup, use '-ownerNode' to specify ID of the cluster node.
        3. This setting is a system wide implementation and not granular to vCPUs.
        4. No effect on the management PE.
        Possible values = DEFAULT, YES, NO
    .PARAMETER Ownernode
        ID of the cluster node for which you are setting the cpuyield. It can be configured only through the cluster IP address.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNsvpxparam
        An example how to unset nsvpxparam configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNsvpxparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsvpxparam
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Boolean]$masterclockcpu1,

        [Boolean]$cpuyield,

        [Boolean]$ownernode 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNsvpxparam: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('masterclockcpu1') ) { $payload.Add('masterclockcpu1', $masterclockcpu1) }
            if ( $PSBoundParameters.ContainsKey('cpuyield') ) { $payload.Add('cpuyield', $cpuyield) }
            if ( $PSBoundParameters.ContainsKey('ownernode') ) { $payload.Add('ownernode', $ownernode) }
            if ( $PSCmdlet.ShouldProcess("nsvpxparam", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nsvpxparam -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNsvpxparam: Finished"
    }
}

function Invoke-ADCGetNsvpxparam {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for "VPX" resource.
    .PARAMETER GetAll
        Retrieve all nsvpxparam object(s).
    .PARAMETER Count
        If specified, the count of the nsvpxparam object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsvpxparam
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsvpxparam -GetAll
        Get all nsvpxparam data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsvpxparam -Count
        Get the number of nsvpxparam objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsvpxparam -name <string>
        Get nsvpxparam object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsvpxparam -Filter @{ 'name'='<value>' }
        Get nsvpxparam data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsvpxparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsvpxparam/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNsvpxparam: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsvpxparam objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsvpxparam -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsvpxparam objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsvpxparam -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsvpxparam objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsvpxparam -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsvpxparam configuration for property ''"

            } else {
                Write-Verbose "Retrieving nsvpxparam configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsvpxparam -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsvpxparam: Ended"
    }
}

function Invoke-ADCUpdateNsweblogparam {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for Web log parameters resource.
    .PARAMETER Buffersizemb
        Buffer size, in MB, allocated for log transaction data on the system. The maximum value is limited to the memory available on the system.
    .PARAMETER Customreqhdrs
        Name(s) of HTTP request headers whose values should be exported by the Web Logging feature.
    .PARAMETER Customrsphdrs
        Name(s) of HTTP response headers whose values should be exported by the Web Logging feature.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsweblogparam
        An example how to update nsweblogparam configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsweblogparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsweblogparam/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateRange(1, 4294967294)]
        [double]$Buffersizemb,

        [ValidateScript({ $_.Length -gt 1 })]
        [string[]]$Customreqhdrs,

        [ValidateScript({ $_.Length -gt 1 })]
        [string[]]$Customrsphdrs 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsweblogparam: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('buffersizemb') ) { $payload.Add('buffersizemb', $buffersizemb) }
            if ( $PSBoundParameters.ContainsKey('customreqhdrs') ) { $payload.Add('customreqhdrs', $customreqhdrs) }
            if ( $PSBoundParameters.ContainsKey('customrsphdrs') ) { $payload.Add('customrsphdrs', $customrsphdrs) }
            if ( $PSCmdlet.ShouldProcess("nsweblogparam", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsweblogparam -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsweblogparam: Finished"
    }
}

function Invoke-ADCUnsetNsweblogparam {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for Web log parameters resource.
    .PARAMETER Buffersizemb
        Buffer size, in MB, allocated for log transaction data on the system. The maximum value is limited to the memory available on the system.
    .PARAMETER Customreqhdrs
        Name(s) of HTTP request headers whose values should be exported by the Web Logging feature.
    .PARAMETER Customrsphdrs
        Name(s) of HTTP response headers whose values should be exported by the Web Logging feature.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNsweblogparam
        An example how to unset nsweblogparam configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNsweblogparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsweblogparam
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Boolean]$buffersizemb,

        [Boolean]$customreqhdrs,

        [Boolean]$customrsphdrs 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNsweblogparam: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('buffersizemb') ) { $payload.Add('buffersizemb', $buffersizemb) }
            if ( $PSBoundParameters.ContainsKey('customreqhdrs') ) { $payload.Add('customreqhdrs', $customreqhdrs) }
            if ( $PSBoundParameters.ContainsKey('customrsphdrs') ) { $payload.Add('customrsphdrs', $customrsphdrs) }
            if ( $PSCmdlet.ShouldProcess("nsweblogparam", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nsweblogparam -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNsweblogparam: Finished"
    }
}

function Invoke-ADCGetNsweblogparam {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for Web log parameters resource.
    .PARAMETER GetAll
        Retrieve all nsweblogparam object(s).
    .PARAMETER Count
        If specified, the count of the nsweblogparam object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsweblogparam
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsweblogparam -GetAll
        Get all nsweblogparam data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsweblogparam -name <string>
        Get nsweblogparam object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsweblogparam -Filter @{ 'name'='<value>' }
        Get nsweblogparam data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsweblogparam
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsweblogparam/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll
    )
    begin {
        Write-Verbose "Invoke-ADCGetNsweblogparam: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsweblogparam objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsweblogparam -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsweblogparam objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsweblogparam -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsweblogparam objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsweblogparam -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsweblogparam configuration for property ''"

            } else {
                Write-Verbose "Retrieving nsweblogparam configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsweblogparam -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsweblogparam: Ended"
    }
}

function Invoke-ADCAddNsxmlnamespace {
    <#
    .SYNOPSIS
        Add NS configuration Object.
    .DESCRIPTION
        Configuration for XML namespace resource.
    .PARAMETER Prefix
        XML prefix.
    .PARAMETER Namespace
        Expanded namespace for which the XML prefix is provided.
    .PARAMETER Description
        Description for the prefix.
    .PARAMETER PassThru
        Return details about the created nsxmlnamespace item.
    .EXAMPLE
        PS C:\>Invoke-ADCAddNsxmlnamespace -prefix <string> -Namespace <string>
        An example how to add nsxmlnamespace configuration Object(s).
    .NOTES
        File Name : Invoke-ADCAddNsxmlnamespace
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsxmlnamespace/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Prefix,

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Namespace,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Description,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCAddNsxmlnamespace: Starting"
    }
    process {
        try {
            $payload = @{ prefix = $prefix
                Namespace        = $Namespace
            }
            if ( $PSBoundParameters.ContainsKey('description') ) { $payload.Add('description', $description) }
            if ( $PSCmdlet.ShouldProcess("nsxmlnamespace", "Add NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type nsxmlnamespace -Payload $payload -GetWarning
                #HTTP Status Code on Success: 201 Created
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsxmlnamespace -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCAddNsxmlnamespace: Finished"
    }
}

function Invoke-ADCDeleteNsxmlnamespace {
    <#
    .SYNOPSIS
        Delete NS configuration Object.
    .DESCRIPTION
        Configuration for XML namespace resource.
    .PARAMETER Prefix
        XML prefix.
    .EXAMPLE
        PS C:\>Invoke-ADCDeleteNsxmlnamespace -Prefix <string>
        An example how to delete nsxmlnamespace configuration Object(s).
    .NOTES
        File Name : Invoke-ADCDeleteNsxmlnamespace
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsxmlnamespace/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [string]$Prefix 
    )
    begin {
        Write-Verbose "Invoke-ADCDeleteNsxmlnamespace: Starting"
    }
    process {
        try {
            $arguments = @{ }

            if ( $PSCmdlet.ShouldProcess("$prefix", "Delete NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method DELETE -Type nsxmlnamespace -NitroPath nitro/v1/config -Resource $prefix -Arguments $arguments
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCDeleteNsxmlnamespace: Finished"
    }
}

function Invoke-ADCUpdateNsxmlnamespace {
    <#
    .SYNOPSIS
        Update NS configuration Object.
    .DESCRIPTION
        Configuration for XML namespace resource.
    .PARAMETER Prefix
        XML prefix.
    .PARAMETER Namespace
        Expanded namespace for which the XML prefix is provided.
    .PARAMETER Description
        Description for the prefix.
    .PARAMETER PassThru
        Return details about the created nsxmlnamespace item.
    .EXAMPLE
        PS C:\>Invoke-ADCUpdateNsxmlnamespace -prefix <string>
        An example how to update nsxmlnamespace configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUpdateNsxmlnamespace
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsxmlnamespace/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(Mandatory)]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Prefix,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Namespace,

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Description,

        [Switch]$PassThru 
    )
    begin {
        Write-Verbose "Invoke-ADCUpdateNsxmlnamespace: Starting"
    }
    process {
        try {
            $payload = @{ prefix = $prefix }
            if ( $PSBoundParameters.ContainsKey('Namespace') ) { $payload.Add('Namespace', $Namespace) }
            if ( $PSBoundParameters.ContainsKey('description') ) { $payload.Add('description', $description) }
            if ( $PSCmdlet.ShouldProcess("nsxmlnamespace", "Update NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method PUT -NitroPath nitro/v1/config -Type nsxmlnamespace -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                if ( $PSBoundParameters.ContainsKey('PassThru') ) {
                    Write-Output (Invoke-ADCGetNsxmlnamespace -Filter $payload)
                } else {
                    Write-Output $result
                }
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUpdateNsxmlnamespace: Finished"
    }
}

function Invoke-ADCUnsetNsxmlnamespace {
    <#
    .SYNOPSIS
        Unset NS configuration Object.
    .DESCRIPTION
        Configuration for XML namespace resource.
    .PARAMETER Prefix
        XML prefix.
    .PARAMETER Namespace
        Expanded namespace for which the XML prefix is provided.
    .PARAMETER Description
        Description for the prefix.
    .EXAMPLE
        PS C:\>Invoke-ADCUnsetNsxmlnamespace -prefix <string>
        An example how to unset nsxmlnamespace configuration Object(s).
    .NOTES
        File Name : Invoke-ADCUnsetNsxmlnamespace
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsxmlnamespace
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Prefix,

        [Boolean]$Namespace,

        [Boolean]$description 
    )
    begin {
        Write-Verbose "Invoke-ADCUnsetNsxmlnamespace: Starting"
    }
    process {
        try {
            $payload = @{ prefix = $prefix }
            if ( $PSBoundParameters.ContainsKey('Namespace') ) { $payload.Add('Namespace', $Namespace) }
            if ( $PSBoundParameters.ContainsKey('description') ) { $payload.Add('description', $description) }
            if ( $PSCmdlet.ShouldProcess("$prefix", "Unset NS configuration Object") ) {
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -Type nsxmlnamespace -NitroPath nitro/v1/config -Action unset -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $response
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCUnsetNsxmlnamespace: Finished"
    }
}

function Invoke-ADCGetNsxmlnamespace {
    <#
    .SYNOPSIS
        Get NS configuration object(s).
    .DESCRIPTION
        Configuration for XML namespace resource.
    .PARAMETER Prefix
        XML prefix.
    .PARAMETER GetAll
        Retrieve all nsxmlnamespace object(s).
    .PARAMETER Count
        If specified, the count of the nsxmlnamespace object(s) will be returned.
    .PARAMETER Filter
        Specify a filter.
        -Filter @{ 'name'='<value>' }
    .PARAMETER ViewSummary
        When specified, only a summary of information is returned.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsxmlnamespace
        Get data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsxmlnamespace -GetAll
        Get all nsxmlnamespace data.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsxmlnamespace -Count
        Get the number of nsxmlnamespace objects.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsxmlnamespace -name <string>
        Get nsxmlnamespace object by specifying for example the name.
    .EXAMPLE
        PS C:\>Invoke-ADCGetNsxmlnamespace -Filter @{ 'name'='<value>' }
        Get nsxmlnamespace data with a filter.
    .NOTES
        File Name : Invoke-ADCGetNsxmlnamespace
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/nsxmlnamespace/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(DefaultParameterSetName = "GetAll")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [Parameter(ParameterSetName = 'GetByResource')]
        [ValidateScript({ $_.Length -gt 1 })]
        [string]$Prefix,

        [Parameter(ParameterSetName = 'Count', Mandatory)]
        [Switch]$Count,
            
        [hashtable]$Filter = @{ },

        [Parameter(ParameterSetName = 'GetAll')]
        [Switch]$GetAll,

        [Parameter(ParameterSetName = 'GetAll')]
        [Parameter(ParameterSetName = 'Get')]
        [Switch]$ViewSummary

    )
    begin {
        Write-Verbose "Invoke-ADCGetNsxmlnamespace: Beginning"
    }
    process {
        try {
            if ( $PsCmdlet.ParameterSetName -eq 'GetAll' ) {
                $query = @{ }
                Write-Verbose "Retrieving all nsxmlnamespace objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsxmlnamespace -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'Count' ) {
                if ( $PSBoundParameters.ContainsKey('Count') ) { $query = @{ 'count' = 'yes' } }
                Write-Verbose "Retrieving total count for nsxmlnamespace objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsxmlnamespace -NitroPath nitro/v1/config -Query $query -Summary:$ViewSummary -Filter $Filter -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByArgument' ) {
                Write-Verbose "Retrieving nsxmlnamespace objects by arguments"
                $arguments = @{ } 
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsxmlnamespace -NitroPath nitro/v1/config -Arguments $arguments -GetWarning
            } elseif ( $PsCmdlet.ParameterSetName -eq 'GetByResource' ) {
                Write-Verbose "Retrieving nsxmlnamespace configuration for property 'prefix'"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsxmlnamespace -NitroPath nitro/v1/config -Resource $prefix -Summary:$ViewSummary -Filter $Filter -GetWarning
            } else {
                Write-Verbose "Retrieving nsxmlnamespace configuration objects"
                $response = Invoke-ADCNitroApi -ADCSession $ADCSession -Method GET -Type nsxmlnamespace -NitroPath nitro/v1/config -Summary:$ViewSummary -Query $query -Filter $Filter -GetWarning
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            $response = $null
        }
        Write-Output $response
    }
    end {
        Write-Verbose "Invoke-ADCGetNsxmlnamespace: Ended"
    }
}

function Invoke-ADCReboot {
    <#
    .SYNOPSIS
        Reboot NS configuration Object.
    .DESCRIPTION
        Configuration for 0 resource.
    .PARAMETER Warm
        Restarts the Citrix ADC software without rebooting the underlying operating system. The session terminates and you must log on to the appliance after it has restarted.
        Note: This argument is required only for nCore appliances. Classic appliances ignore this argument.
    .EXAMPLE
        PS C:\>Invoke-ADCReboot
        An example how to reboot reboot configuration Object(s).
    .NOTES
        File Name : Invoke-ADCReboot
        Version : v2210.2317
        Author : John Billekens
        Reference : https://developer-docs.citrix.com/projects/citrix-adc-nitro-api-reference/en/latest/configuration/ns/reboot/
        Requires : PowerShell v5.1 and up
                    ADC 13.x and up.
                    ADC 12 and lower may work, not guaranteed.
    .LINK
        https://blog.j81.nl
    #>

    [CmdletBinding(SupportsShouldProcess = $true, ConfirmImpact = "Low")]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingUserNameAndPasswordParams', '')]
    [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSUseBOMForUnicodeEncodedFile', '')]
    param(
        [Parameter(DontShow)]
        [Object]$ADCSession = (Get-ADCSession),

        [boolean]$Warm 

    )
    begin {
        Write-Verbose "Invoke-ADCReboot: Starting"
    }
    process {
        try {
            $payload = @{ }
            if ( $PSBoundParameters.ContainsKey('warm') ) { $payload.Add('warm', $warm) }
            if ( $PSCmdlet.ShouldProcess($Name, "Reboot NS configuration Object") ) {
                $result = Invoke-ADCNitroApi -ADCSession $ADCSession -Method POST -NitroPath nitro/v1/config -Type reboot -Payload $payload -GetWarning
                #HTTP Status Code on Success: 200 OK
                #HTTP Status Code on Failure: 4xx <string> (for general HTTP errors) or 5xx <string> (for NetScaler-specific errors). The response payload provides details of the error
                Write-Output $result
            }
        } catch {
            Write-Verbose "ERROR: $($_.Exception.Message)"
            throw $_
        }
    }
    end {
        Write-Verbose "Invoke-ADCReboot: Finished"
    }
}

# SIG # Begin signature block
# MIITYgYJKoZIhvcNAQcCoIITUzCCE08CAQExDzANBglghkgBZQMEAgEFADB5Bgor
# BgEEAYI3AgEEoGswaTA0BgorBgEEAYI3AgEeMCYCAwEAAAQQH8w7YFlLCE63JNLG
# KX7zUQIBAAIBAAIBAAIBAAIBADAxMA0GCWCGSAFlAwQCAQUABCDuL+vqo7FBm0LI
# 6W5a4gnEr+t4kckPlnMzC1QGhSDGFKCCEHUwggTzMIID26ADAgECAhAsJ03zZBC0
# i/247uUvWN5TMA0GCSqGSIb3DQEBCwUAMHwxCzAJBgNVBAYTAkdCMRswGQYDVQQI
# ExJHcmVhdGVyIE1hbmNoZXN0ZXIxEDAOBgNVBAcTB1NhbGZvcmQxGDAWBgNVBAoT
# D1NlY3RpZ28gTGltaXRlZDEkMCIGA1UEAxMbU2VjdGlnbyBSU0EgQ29kZSBTaWdu
# aW5nIENBMB4XDTIxMDUwNTAwMDAwMFoXDTI0MDUwNDIzNTk1OVowWzELMAkGA1UE
# BhMCTkwxEjAQBgNVBAcMCVZlbGRob3ZlbjEbMBkGA1UECgwSSm9oYW5uZXMgQmls
# bGVrZW5zMRswGQYDVQQDDBJKb2hhbm5lcyBCaWxsZWtlbnMwggEiMA0GCSqGSIb3
# DQEBAQUAA4IBDwAwggEKAoIBAQCsfgRG81keOHalHfCUgxOa1Qy4VNOnGxB8SL8e
# rjP9SfcF13McP7F1HGka5Be495pTZ+duGbaQMNozwg/5Dg9IRJEeBabeSSJJCbZo
# SNpmUu7NNRRfidQxlPC81LxTVHxJ7In0MEfCVm7rWcri28MRCAuafqOfSE+hyb1Z
# /tKyCyQ5RUq3kjs/CF+VfMHsJn6ZT63YqewRkwHuc7UogTTZKjhPJ9prGLTer8UX
# UgvsGRbvhYZXIEuy+bmx/iJ1yRl1kX4nj6gUYzlhemOnlSDD66YOrkLDhXPMXLym
# AN7h0/W5Bo//R5itgvdGBkXkWCKRASnq/9PTcoxW6mwtgU8xAgMBAAGjggGQMIIB
# jDAfBgNVHSMEGDAWgBQO4TqoUzox1Yq+wbutZxoDha00DjAdBgNVHQ4EFgQUZWMy
# gC0i1u2NZ1msk2Mm5nJm5AswDgYDVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAw
# EwYDVR0lBAwwCgYIKwYBBQUHAwMwEQYJYIZIAYb4QgEBBAQDAgQQMEoGA1UdIARD
# MEEwNQYMKwYBBAGyMQECAQMCMCUwIwYIKwYBBQUHAgEWF2h0dHBzOi8vc2VjdGln
# by5jb20vQ1BTMAgGBmeBDAEEATBDBgNVHR8EPDA6MDigNqA0hjJodHRwOi8vY3Js
# LnNlY3RpZ28uY29tL1NlY3RpZ29SU0FDb2RlU2lnbmluZ0NBLmNybDBzBggrBgEF
# BQcBAQRnMGUwPgYIKwYBBQUHMAKGMmh0dHA6Ly9jcnQuc2VjdGlnby5jb20vU2Vj
# dGlnb1JTQUNvZGVTaWduaW5nQ0EuY3J0MCMGCCsGAQUFBzABhhdodHRwOi8vb2Nz
# cC5zZWN0aWdvLmNvbTANBgkqhkiG9w0BAQsFAAOCAQEARjv9ieRocb1DXRWm3XtY
# jjuSRjlvkoPd9wS6DNfsGlSU42BFd9LCKSyRREZVu8FDq7dN0PhD4bBTT+k6AgrY
# KG6f/8yUponOdxskv850SjN2S2FeVuR20pqActMrpd1+GCylG8mj8RGjdrLQ3QuX
# qYKS68WJ39WWYdVB/8Ftajir5p6sAfwHErLhbJS6WwmYjGI/9SekossvU8mZjZwo
# Gbu+fjZhPc4PhjbEh0ABSsPMfGjQQsg5zLFjg/P+cS6hgYI7qctToo0TexGe32DY
# fFWHrHuBErW2qXEJvzSqM5OtLRD06a4lH5ZkhojhMOX9S8xDs/ArDKgX1j1Xm4Tu
# DjCCBYEwggRpoAMCAQICEDlyRDr5IrdR19NsEN0xNZUwDQYJKoZIhvcNAQEMBQAw
# ezELMAkGA1UEBhMCR0IxGzAZBgNVBAgMEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G
# A1UEBwwHU2FsZm9yZDEaMBgGA1UECgwRQ29tb2RvIENBIExpbWl0ZWQxITAfBgNV
# BAMMGEFBQSBDZXJ0aWZpY2F0ZSBTZXJ2aWNlczAeFw0xOTAzMTIwMDAwMDBaFw0y
# ODEyMzEyMzU5NTlaMIGIMQswCQYDVQQGEwJVUzETMBEGA1UECBMKTmV3IEplcnNl
# eTEUMBIGA1UEBxMLSmVyc2V5IENpdHkxHjAcBgNVBAoTFVRoZSBVU0VSVFJVU1Qg
# TmV0d29yazEuMCwGA1UEAxMlVVNFUlRydXN0IFJTQSBDZXJ0aWZpY2F0aW9uIEF1
# dGhvcml0eTCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIBAIASZRc2DsPb
# CLPQrFcNdu3NJ9NMrVCDYeKqIE0JLWQJ3M6Jn8w9qez2z8Hc8dOx1ns3KBErR9o5
# xrw6GbRfpr19naNjQrZ28qk7K5H44m/Q7BYgkAk+4uh0yRi0kdRiZNt/owbxiBhq
# kCI8vP4T8IcUe/bkH47U5FHGEWdGCFHLhhRUP7wz/n5snP8WnRi9UY41pqdmyHJn
# 2yFmsdSbeAPAUDrozPDcvJ5M/q8FljUfV1q3/875PbcstvZU3cjnEjpNrkyKt1ya
# tLcgPcp/IjSufjtoZgFE5wFORlObM2D3lL5TN5BzQ/Myw1Pv26r+dE5px2uMYJPe
# xMcM3+EyrsyTO1F4lWeL7j1W/gzQaQ8bD/MlJmszbfduR/pzQ+V+DqVmsSl8MoRj
# VYnEDcGTVDAZE6zTfTen6106bDVc20HXEtqpSQvf2ICKCZNijrVmzyWIzYS4sT+k
# OQ/ZAp7rEkyVfPNrBaleFoPMuGfi6BOdzFuC00yz7Vv/3uVzrCM7LQC/NVV0CUnY
# SVgaf5I25lGSDvMmfRxNF7zJ7EMm0L9BX0CpRET0medXh55QH1dUqD79dGMvsVBl
# CeZYQi5DGky08CVHWfoEHpPUJkZKUIGy3r54t/xnFeHJV4QeD2PW6WK61l9VLupc
# xigIBCU5uA4rqfJMlxwHPw1S9e3vL4IPAgMBAAGjgfIwge8wHwYDVR0jBBgwFoAU
# oBEKIz6W8Qfs4q8p74Klf9AwpLQwHQYDVR0OBBYEFFN5v1qqK0rPVIDh2JvAnfKy
# A2bLMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MBEGA1UdIAQKMAgw
# BgYEVR0gADBDBgNVHR8EPDA6MDigNqA0hjJodHRwOi8vY3JsLmNvbW9kb2NhLmNv
# bS9BQUFDZXJ0aWZpY2F0ZVNlcnZpY2VzLmNybDA0BggrBgEFBQcBAQQoMCYwJAYI
# KwYBBQUHMAGGGGh0dHA6Ly9vY3NwLmNvbW9kb2NhLmNvbTANBgkqhkiG9w0BAQwF
# AAOCAQEAGIdR3HQhPZyK4Ce3M9AuzOzw5steEd4ib5t1jp5y/uTW/qofnJYt7wNK
# fq70jW9yPEM7wD/ruN9cqqnGrvL82O6je0P2hjZ8FODN9Pc//t64tIrwkZb+/UNk
# fv3M0gGhfX34GRnJQisTv1iLuqSiZgR2iJFODIkUzqJNyTKzuugUGrxx8VvwQQuY
# AAoiAxDlDLH5zZI3Ge078eQ6tvlFEyZ1r7uq7z97dzvSxAKRPRkA0xdcOds/exgN
# Rc2ThZYvXd9ZFk8/Ub3VRRg/7UqO6AZhdCMWtQ1QcydER38QXYkqa4UxFMToqWpM
# gLxqeM+4f452cpkMnf7XkQgWoaNflTCCBfUwggPdoAMCAQICEB2iSDBvmyYY0ILg
# ln0z02owDQYJKoZIhvcNAQEMBQAwgYgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpO
# ZXcgSmVyc2V5MRQwEgYDVQQHEwtKZXJzZXkgQ2l0eTEeMBwGA1UEChMVVGhlIFVT
# RVJUUlVTVCBOZXR3b3JrMS4wLAYDVQQDEyVVU0VSVHJ1c3QgUlNBIENlcnRpZmlj
# YXRpb24gQXV0aG9yaXR5MB4XDTE4MTEwMjAwMDAwMFoXDTMwMTIzMTIzNTk1OVow
# fDELMAkGA1UEBhMCR0IxGzAZBgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4G
# A1UEBxMHU2FsZm9yZDEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMSQwIgYDVQQD
# ExtTZWN0aWdvIFJTQSBDb2RlIFNpZ25pbmcgQ0EwggEiMA0GCSqGSIb3DQEBAQUA
# A4IBDwAwggEKAoIBAQCGIo0yhXoYn0nwli9jCB4t3HyfFM/jJrYlZilAhlRGdDFi
# xRDtsocnppnLlTDAVvWkdcapDlBipVGREGrgS2Ku/fD4GKyn/+4uMyD6DBmJqGx7
# rQDDYaHcaWVtH24nlteXUYam9CflfGqLlR5bYNV+1xaSnAAvaPeX7Wpyvjg7Y96P
# v25MQV0SIAhZ6DnNj9LWzwa0VwW2TqE+V2sfmLzEYtYbC43HZhtKn52BxHJAteJf
# 7wtF/6POF6YtVbC3sLxUap28jVZTxvC6eVBJLPcDuf4vZTXyIuosB69G2flGHNyM
# fHEo8/6nxhTdVZFuihEN3wYklX0Pp6F8OtqGNWHTAgMBAAGjggFkMIIBYDAfBgNV
# HSMEGDAWgBRTeb9aqitKz1SA4dibwJ3ysgNmyzAdBgNVHQ4EFgQUDuE6qFM6MdWK
# vsG7rWcaA4WtNA4wDgYDVR0PAQH/BAQDAgGGMBIGA1UdEwEB/wQIMAYBAf8CAQAw
# HQYDVR0lBBYwFAYIKwYBBQUHAwMGCCsGAQUFBwMIMBEGA1UdIAQKMAgwBgYEVR0g
# ADBQBgNVHR8ESTBHMEWgQ6BBhj9odHRwOi8vY3JsLnVzZXJ0cnVzdC5jb20vVVNF
# UlRydXN0UlNBQ2VydGlmaWNhdGlvbkF1dGhvcml0eS5jcmwwdgYIKwYBBQUHAQEE
# ajBoMD8GCCsGAQUFBzAChjNodHRwOi8vY3J0LnVzZXJ0cnVzdC5jb20vVVNFUlRy
# dXN0UlNBQWRkVHJ1c3RDQS5jcnQwJQYIKwYBBQUHMAGGGWh0dHA6Ly9vY3NwLnVz
# ZXJ0cnVzdC5jb20wDQYJKoZIhvcNAQEMBQADggIBAE1jUO1HNEphpNveaiqMm/EA
# AB4dYns61zLC9rPgY7P7YQCImhttEAcET7646ol4IusPRuzzRl5ARokS9At3Wpwq
# QTr81vTr5/cVlTPDoYMot94v5JT3hTODLUpASL+awk9KsY8k9LOBN9O3ZLCmI2pZ
# aFJCX/8E6+F0ZXkI9amT3mtxQJmWunjxucjiwwgWsatjWsgVgG10Xkp1fqW4w2y1
# z99KeYdcx0BNYzX2MNPPtQoOCwR/oEuuu6Ol0IQAkz5TXTSlADVpbL6fICUQDRn7
# UJBhvjmPeo5N9p8OHv4HURJmgyYZSJXOSsnBf/M6BZv5b9+If8AjntIeQ3pFMcGc
# TanwWbJZGehqjSkEAnd8S0vNcL46slVaeD68u28DECV3FTSK+TbMQ5Lkuk/xYpMo
# JVcp+1EZx6ElQGqEV8aynbG8HArafGd+fS7pKEwYfsR7MUFxmksp7As9V1DSyt39
# ngVR5UR43QHesXWYDVQk/fBO4+L4g71yuss9Ou7wXheSaG3IYfmm8SoKC6W59J7u
# mDIFhZ7r+YMp08Ysfb06dy6LN0KgaoLtO0qqlBCk4Q34F8W2WnkzGJLjtXX4oemO
# CiUe5B7xn1qHI/+fpFGe+zmAEc3btcSnqIBv5VPU4OOiwtJbGvoyJi1qV3AcPKRY
# LqPzW0sH3DJZ84enGm1YMYICQzCCAj8CAQEwgZAwfDELMAkGA1UEBhMCR0IxGzAZ
# BgNVBAgTEkdyZWF0ZXIgTWFuY2hlc3RlcjEQMA4GA1UEBxMHU2FsZm9yZDEYMBYG
# A1UEChMPU2VjdGlnbyBMaW1pdGVkMSQwIgYDVQQDExtTZWN0aWdvIFJTQSBDb2Rl
# IFNpZ25pbmcgQ0ECECwnTfNkELSL/bju5S9Y3lMwDQYJYIZIAWUDBAIBBQCggYQw
# GAYKKwYBBAGCNwIBDDEKMAigAoAAoQKAADAZBgkqhkiG9w0BCQMxDAYKKwYBBAGC
# NwIBBDAcBgorBgEEAYI3AgELMQ4wDAYKKwYBBAGCNwIBFTAvBgkqhkiG9w0BCQQx
# IgQg5wgs6vaFMmYe/pnOCjsajkDON25rayb+RLm0Xqe1l4QwDQYJKoZIhvcNAQEB
# BQAEggEAp7RRLuuT2BULloHBpEJu7DrAxw1iB4r+seIdLJPX5fQfQ4MmbzDCSiqR
# AUd3M7VG5sUPRZ2JpWGNqv7uP0dxJL1auiNoAz7mz7AU8GAbSYjL4t0SnO/k60+i
# 0yty9G+FGFcfQx9ZF7lerL62dcEU5JQlfbv/2viQ2ZdjU1JbppCjwbGs+t919fvV
# ZG4AalTZTlvIqLRJG6ShjItCQ4tm18vdLkXH+CyktlUrDGT7DSYrol91loBARqjq
# IKURENZHFEUEHsJwLN6juu+uO6kls2iI0gM/UDyk1iIRQfA++goIW22s1qPJKfd6
# hXLCph9DA7C38WWrDIr4TMX7o5XHlg==
# SIG # End signature block