set_load_balancer_policies_of_listener ( $load_balancer_name, $load_balancer_port, $policy_names, $opt )

Associates, updates, or disables a policy with a listener on the LoadBalancer. You can associate multiple policies with a listener.

Access

public

Parameters

Parameter

Type

Required

Description

$load_balancer_name

string

Required

The name associated with the LoadBalancer. The name must be unique within the client AWS account.

$load_balancer_port

integer

Required

The external port of the LoadBalancer with which this policy applies to.

$policy_names

string
array

Required

List of policies to be associated with the listener. Currently this list can have at most one policy. If the list is empty, the current policy is removed from the listener. Pass a string for a single value, or an indexed array for multiple values.

$opt

array

Optional

An associative array of parameters that can have the following keys:

  • curlopts - array - Optional - A set of values to pass directly into curl_setopt(), where the key is a pre-defined CURLOPT_* constant.
  • returnCurlHandle - boolean - Optional - A private toggle specifying that the cURL handle be returned rather than actually completing the request. This toggle is useful for manually managed batch requests.

Returns

Type

Description

CFResponse

A CFResponse object containing a parsed HTTP response.

Examples

Assign a policy to a load balancer listener.

To assign a policy to a load balancer, you must:

  1. Create a policy using either create_app_cookie_stickiness_policy() or create_lb_cookie_stickiness_policy().
  2. Assign the policy to the load balancer with set_load_balancer_policies_of_listener().
  3. Remove them with delete_load_balancer_policy().
$elb = new AmazonELB();

$response = $elb->set_load_balancer_policies_of_listener('my-load-balancer', 80, 'lb-cookie-policy');

// Success?
var_dump($response->isOK());
Result:
bool(true)

Related Methods

Source

Method defined in services/elb.class.php | Toggle source view (13 lines) | View on GitHub

public function set_load_balancer_policies_of_listener($load_balancer_name, $load_balancer_port, $policy_names, $opt = null)
{
    if (!$opt) $opt = array();
    $opt['LoadBalancerName'] = $load_balancer_name;
    $opt['LoadBalancerPort'] = $load_balancer_port;
    
    // Required list (non-map)
    $opt = array_merge($opt, CFComplexType::map(array(
        'PolicyNames' => (is_array($policy_names) ? $policy_names : array($policy_names))
    ), 'member'));

    return $this->authenticate('SetLoadBalancerPoliciesOfListener', $opt);
}

Copyright © 2010–2013 Amazon Web Services, LLC


Feedback