Private/Add-ADCResponderAction.ps1

function Add-ADCResponderAction {
    <#
.SYNOPSIS
    Adds a Responder Action to the Citrix ADC.
.DESCRIPTION
    Adds a Responder Action to the Citrix ADC.
.PARAMETER Session
    The Citrix ADC Session to execute the function against.
.PARAMETER ResponderActionName
    The Responder Action Name.
.PARAMETER ResponderActionType
    The Responder Action Type.
.PARAMETER ResponderActionTarget
    The Responder Action Target.
.NOTES
    Creation Date: 20/06/2018
.CHANGE CONTROL
    Name Version Date Change Detail
    David Brett 1.0 04/07/2018 Function Creation
.EXAMPLE
    Add-ADCResponderAction -ResponderActionName "res_act_http_to_https" -ResponderActionType "redirect" -ResponderActionTarget ""https://""" + HTTP.REQ.HOSTNAME.HTTP_URL_SAFE + HTTP.REQ.URL.PATH_AND_QUERY.HTTP_URL_SAFE" -Verbose
#>


    [CmdletBinding()]
    Param (
        $Session = $script:session,
        [parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName)]
        [string[]]$ResponderActionName = (Read-Host -Prompt 'Enter Responder Action Name'),
        [string[]]$ResponderActionType = (Read-Host -Prompt 'Enter Responder Action Type'),
        [string[]]$ResponderActionTarget = (Read-Host -Prompt 'Enter Responder Action Target')
    )

    begin {
        $PayLoad = @{
            name   = "$ResponderActionName"
            type   = "$ResponderActionType"
            target = "$ResponderActionTarget"
        }
    }

    process {
        try {
            Invoke-ADCRestAPI -Session $Session -Method POST -Type "responderaction" -Payload $PayLoad -Action Add
            write-verbose "Responder Action ($ResponderActionName) added to the Citrix ADC of type ($ResponderActionType) with the target of ($ResponderActionTarget)"
        }
        catch {
            write-verbose "Responder Action ($ResponderActionName) could not be added to the Citrix ADC of type ($ResponderActionType) with the target of ($ResponderActionTarget)"
        }
    }

    end {
    }
    
}