Private/Set-ADCResponderPolicyTovServer.ps1
function Set-ADCResponderPolicyTovServer { <# .SYNOPSIS Binds a Responder Policy to a vServer. .DESCRIPTION Binds a Responder Policy to a vServer. .PARAMETER Session The Citrix ADC Session to execute the function against. .PARAMETER vServerName The vServer to bind the policy to. .PARAMETER ResponderPolicyName The Responder Policy Name. .PARAMETER Priority The Priority. .PARAMETER BindPoint The BindPoint. .NOTES Creation Date: 20/06/2018 .CHANGE CONTROL Name Version Date Change Detail David Brett 1.0 04/07/2018 Function Creation .EXAMPLE Set-ADCResponderPolicyTovServer -vServerName "vsvr_storefront_80" -ResponderPolicyName "res_pol_http_to_https" -Priority 100 -BindPoint "RESPONSE" -Verbose #> [CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Medium')] Param ( $Session = $script:session, [parameter(Mandatory = $true, ValueFromPipeline = $true, ValueFromPipelineByPropertyName)] [string[]]$vServerName = (Read-Host -Prompt 'Enter vServer Name'), [string[]]$ResponderPolicyName = (Read-Host -Prompt 'Enter Responder Policy Name'), [string[]]$Priority = (Read-Host -Prompt 'Enter Priority'), [string[]]$BindPoint = (Read-Host -Prompt 'Enter Bind Point') ) begin { $PayLoad = @{ name = "$vServerName" policyname = "$ResponderPolicyName" priority = "$Priority" bindpoint = "$BindPoint" } } process { try { if ($Force -or $PSCmdlet.ShouldProcess("ShouldProcess?")) { Invoke-ADCRestAPI -Session $Session -Method PUT -Type "lbvserver_responderpolicy_binding" -Payload $PayLoad write-verbose "Responder Policy ($ResponderPolicyName) bound to vServer ($vServerName) with the priority of ($Priority) at bind point ($BindPoint)" } } catch { write-verbose "Responder Policy ($ResponderPolicyName) could not be bound to vServer ($vServerName) with the priority of ($Priority) at bind point ($BindPoint)" } } end { } } |