Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/*
3
 * Copyright 2010-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License").
6
 * You may not use this file except in compliance with the License.
7
 * A copy of the License is located at
8
 *
9
 *  http://aws.amazon.com/apache2.0
10
 *
11
 * or in the "license" file accompanying this file. This file is distributed
12
 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13
 * express or implied. See the License for the specific language governing
14
 * permissions and limitations under the License.
15
 */
16
 
17
/**
18
 * Elastic Load Balancing is a cost-effective and easy to use web service to help you improve
19
 * availability and scalability of your application. It makes it easy for you to distribute
20
 * application loads between two or more EC2 instances. Elastic Load Balancing enables
21
 * availability through redundancy and supports traffic growth of your application.
22
 *
23
 * @version 2012.01.16
24
 * @license See the included NOTICE.md file for complete information.
25
 * @copyright See the included NOTICE.md file for complete information.
26
 * @link http://aws.amazon.com/elasticloadbalancing/ Elastic Load Balancing
27
 * @link http://aws.amazon.com/elasticloadbalancing/documentation/ Elastic Load Balancing documentation
28
 */
29
class AmazonELB extends CFRuntime
30
{
31
	/*%******************************************************************************************%*/
32
	// CLASS CONSTANTS
33
 
34
	/**
35
	 * Specify the queue URL for the United States East (Northern Virginia) Region.
36
	 */
37
	const REGION_US_E1 = 'elasticloadbalancing.us-east-1.amazonaws.com';
38
 
39
	/**
40
	 * Specify the queue URL for the United States East (Northern Virginia) Region.
41
	 */
42
	const REGION_VIRGINIA = self::REGION_US_E1;
43
 
44
	/**
45
	 * Specify the queue URL for the United States West (Northern California) Region.
46
	 */
47
	const REGION_US_W1 = 'elasticloadbalancing.us-west-1.amazonaws.com';
48
 
49
	/**
50
	 * Specify the queue URL for the United States West (Northern California) Region.
51
	 */
52
	const REGION_CALIFORNIA = self::REGION_US_W1;
53
 
54
	/**
55
	 * Specify the queue URL for the United States West (Oregon) Region.
56
	 */
57
	const REGION_US_W2 = 'elasticloadbalancing.us-west-2.amazonaws.com';
58
 
59
	/**
60
	 * Specify the queue URL for the United States West (Oregon) Region.
61
	 */
62
	const REGION_OREGON = self::REGION_US_W2;
63
 
64
	/**
65
	 * Specify the queue URL for the Europe West (Ireland) Region.
66
	 */
67
	const REGION_EU_W1 = 'elasticloadbalancing.eu-west-1.amazonaws.com';
68
 
69
	/**
70
	 * Specify the queue URL for the Europe West (Ireland) Region.
71
	 */
72
	const REGION_IRELAND = self::REGION_EU_W1;
73
 
74
	/**
75
	 * Specify the queue URL for the Asia Pacific Southeast (Singapore) Region.
76
	 */
77
	const REGION_APAC_SE1 = 'elasticloadbalancing.ap-southeast-1.amazonaws.com';
78
 
79
	/**
80
	 * Specify the queue URL for the Asia Pacific Southeast (Singapore) Region.
81
	 */
82
	const REGION_SINGAPORE = self::REGION_APAC_SE1;
83
 
84
	/**
85
	 * Specify the queue URL for the Asia Pacific Northeast (Tokyo) Region.
86
	 */
87
	const REGION_APAC_NE1 = 'elasticloadbalancing.ap-northeast-1.amazonaws.com';
88
 
89
	/**
90
	 * Specify the queue URL for the Asia Pacific Northeast (Tokyo) Region.
91
	 */
92
	const REGION_TOKYO = self::REGION_APAC_NE1;
93
 
94
	/**
95
	 * Specify the queue URL for the South America (Sao Paulo) Region.
96
	 */
97
	const REGION_SA_E1 = 'elasticloadbalancing.sa-east-1.amazonaws.com';
98
 
99
	/**
100
	 * Specify the queue URL for the South America (Sao Paulo) Region.
101
	 */
102
	const REGION_SAO_PAULO = self::REGION_SA_E1;
103
 
104
	/**
105
	 * Default service endpoint.
106
	 */
107
	const DEFAULT_URL = self::REGION_US_E1;
108
 
109
 
110
	/*%******************************************************************************************%*/
111
	// CONSTRUCTOR
112
 
113
	/**
114
	 * Constructs a new instance of <AmazonELB>.
115
	 *
116
	 * @param array $options (Optional) An associative array of parameters that can have the following keys: <ul>
117
	 * 	<li><code>certificate_authority</code> - <code>boolean</code> - Optional - Determines which Cerificate Authority file to use. A value of boolean <code>false</code> will use the Certificate Authority file available on the system. A value of boolean <code>true</code> will use the Certificate Authority provided by the SDK. Passing a file system path to a Certificate Authority file (chmodded to <code>0755</code>) will use that. Leave this set to <code>false</code> if you're not sure.</li>
118
	 * 	<li><code>credentials</code> - <code>string</code> - Optional - The name of the credential set to use for authentication.</li>
119
	 * 	<li><code>default_cache_config</code> - <code>string</code> - Optional - This option allows a preferred storage type to be configured for long-term caching. This can be changed later using the <set_cache_config()> method. Valid values are: <code>apc</code>, <code>xcache</code>, or a file system path such as <code>./cache</code> or <code>/tmp/cache/</code>.</li>
120
	 * 	<li><code>key</code> - <code>string</code> - Optional - Your AWS key, or a session key. If blank, the default credential set will be used.</li>
121
	 * 	<li><code>secret</code> - <code>string</code> - Optional - Your AWS secret key, or a session secret key. If blank, the default credential set will be used.</li>
122
	 * 	<li><code>token</code> - <code>string</code> - Optional - An AWS session token.</li></ul>
123
	 * @return void
124
	 */
125
	public function __construct(array $options = array())
126
	{
127
		$this->api_version = '2011-11-15';
128
		$this->hostname = self::DEFAULT_URL;
129
		$this->auth_class = 'AuthV2Query';
130
 
131
		return parent::__construct($options);
132
	}
133
 
134
 
135
	/*%******************************************************************************************%*/
136
	// SETTERS
137
 
138
	/**
139
	 * This allows you to explicitly sets the region for the service to use.
140
	 *
141
	 * @param string $region (Required) The region to explicitly set. Available options are <REGION_US_E1>, <REGION_US_W1>, <REGION_US_W2>, <REGION_EU_W1>, <REGION_APAC_SE1>, <REGION_APAC_NE1>, <REGION_SA_E1>.
142
	 * @return $this A reference to the current instance.
143
	 */
144
	public function set_region($region)
145
	{
146
		// @codeCoverageIgnoreStart
147
		$this->set_hostname($region);
148
		return $this;
149
		// @codeCoverageIgnoreEnd
150
	}
151
 
152
 
153
	/*%******************************************************************************************%*/
154
	// SERVICE METHODS
155
 
156
	/**
157
	 * Associates one or more security groups with your LoadBalancer in VPC. The provided security
158
	 * group IDs will override any currently applied security groups.
159
	 *
160
	 * @param string $load_balancer_name (Required) The name associated with the LoadBalancer. The name must be unique within the client AWS account.
161
	 * @param string|array $security_groups (Required) A list of security group IDs to associate with your LoadBalancer in VPC. The security group IDs must be provided as the ID and not the security group name (For example, sg-1234). Pass a string for a single value, or an indexed array for multiple values.
162
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
163
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
164
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
165
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
166
	 */
167
	public function apply_security_groups_to_load_balancer($load_balancer_name, $security_groups, $opt = null)
168
	{
169
		if (!$opt) $opt = array();
170
		$opt['LoadBalancerName'] = $load_balancer_name;
171
 
172
		// Required list (non-map)
173
		$opt = array_merge($opt, CFComplexType::map(array(
174
			'SecurityGroups' => (is_array($security_groups) ? $security_groups : array($security_groups))
175
		), 'member'));
176
 
177
		return $this->authenticate('ApplySecurityGroupsToLoadBalancer', $opt);
178
	}
179
 
180
	/**
181
	 * Adds one or more subnets to the set of configured subnets in the VPC for the LoadBalancer.
182
	 *
183
	 * The Loadbalancers evenly distribute requests across all of the registered subnets.
184
	 *
185
	 * @param string $load_balancer_name (Required) The name associated with the LoadBalancer. The name must be unique within the client AWS account.
186
	 * @param string|array $subnets (Required) A list of subnet IDs to add for the LoadBalancer. Pass a string for a single value, or an indexed array for multiple values.
187
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
188
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
189
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
190
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
191
	 */
192
	public function attach_load_balancer_to_subnets($load_balancer_name, $subnets, $opt = null)
193
	{
194
		if (!$opt) $opt = array();
195
		$opt['LoadBalancerName'] = $load_balancer_name;
196
 
197
		// Required list (non-map)
198
		$opt = array_merge($opt, CFComplexType::map(array(
199
			'Subnets' => (is_array($subnets) ? $subnets : array($subnets))
200
		), 'member'));
201
 
202
		return $this->authenticate('AttachLoadBalancerToSubnets', $opt);
203
	}
204
 
205
	/**
206
	 * Enables the client to define an application healthcheck for the instances.
207
	 *
208
	 * @param string $load_balancer_name (Required) The mnemonic name associated with the LoadBalancer. This name must be unique within the client AWS account.
209
	 * @param array $health_check (Required) A structure containing the configuration information for the new healthcheck. <ul>
210
	 * 	<li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
211
	 * 		<li><code>Target</code> - <code>string</code> - Required - Specifies the instance being checked. The protocol is either TCP, HTTP, HTTPS, or SSL. The range of valid ports is one (1) through 65535. <p class="note">TCP is the default, specified as a TCP: port pair, for example "TCP:5000". In this case a healthcheck simply attempts to open a TCP connection to the instance on the specified port. Failure to connect within the configured timeout is considered unhealthy. SSL is also specified as SSL: port pair, for example, SSL:5000. For HTTP or HTTPS protocol, the situation is different. You have to include a ping path in the string. HTTP is specified as a HTTP:port;/;PathToPing; grouping, for example "HTTP:80/weather/us/wa/seattle". In this case, a HTTP GET request is issued to the instance on the given port and path. Any answer other than "200 OK" within the timeout period is considered unhealthy. The total length of the HTTP ping target needs to be 1024 16-bit Unicode characters or less.</p></li>
212
	 * 		<li><code>Interval</code> - <code>integer</code> - Required - Specifies the approximate interval, in seconds, between health checks of an individual instance.</li>
213
	 * 		<li><code>Timeout</code> - <code>integer</code> - Required - Specifies the amount of time, in seconds, during which no response means a failed health probe. <p class="note">This value must be less than the <em>Interval</em> value.</p></li>
214
	 * 		<li><code>UnhealthyThreshold</code> - <code>integer</code> - Required - Specifies the number of consecutive health probe failures required before moving the instance to the <em>Unhealthy</em> state.</li>
215
	 * 		<li><code>HealthyThreshold</code> - <code>integer</code> - Required - Specifies the number of consecutive health probe successes required before moving the instance to the <em>Healthy</em> state.</li>
216
	 * 	</ul></li>
217
	 * </ul>
218
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
219
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
220
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
221
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
222
	 */
223
	public function configure_health_check($load_balancer_name, $health_check, $opt = null)
224
	{
225
		if (!$opt) $opt = array();
226
		$opt['LoadBalancerName'] = $load_balancer_name;
227
 
228
		// Required map (non-list)
229
		$opt = array_merge($opt, CFComplexType::map(array(
230
			'HealthCheck' => (is_array($health_check) ? $health_check : array($health_check))
231
		), 'member'));
232
 
233
		return $this->authenticate('ConfigureHealthCheck', $opt);
234
	}
235
 
236
	/**
237
	 * Generates a stickiness policy with sticky session lifetimes that follow that of an
238
	 * application-generated cookie. This policy can be associated only with HTTP/HTTPS listeners.
239
	 *
240
	 * This policy is similar to the policy created by CreateLBCookieStickinessPolicy, except that the
241
	 * lifetime of the special Elastic Load Balancing cookie follows the lifetime of the
242
	 * application-generated cookie specified in the policy configuration. The LoadBalancer only
243
	 * inserts a new stickiness cookie when the application response includes a new application
244
	 * cookie.
245
	 *
246
	 * If the application cookie is explicitly removed or expires, the session stops being sticky
247
	 * until a new application cookie is issued.
248
	 *
249
	 * <p class="note">
250
	 * An application client must receive and send two cookies: the application-generated cookie and
251
	 * the special Elastic Load Balancing cookie named <code>AWSELB</code>. This is the default
252
	 * behavior for many common web browsers.
253
	 * </p>
254
	 *
255
	 * @param string $load_balancer_name (Required) The name associated with the LoadBalancer. The name must be unique within the client AWS account.
256
	 * @param string $policy_name (Required) The name of the policy being created. The name must be unique within the set of policies for this LoadBalancer.
257
	 * @param string $cookie_name (Required) Name of the application cookie used for stickiness.
258
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
259
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
260
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
261
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
262
	 */
263
	public function create_app_cookie_stickiness_policy($load_balancer_name, $policy_name, $cookie_name, $opt = null)
264
	{
265
		if (!$opt) $opt = array();
266
		$opt['LoadBalancerName'] = $load_balancer_name;
267
		$opt['PolicyName'] = $policy_name;
268
		$opt['CookieName'] = $cookie_name;
269
 
270
		return $this->authenticate('CreateAppCookieStickinessPolicy', $opt);
271
	}
272
 
273
	/**
274
	 * Generates a stickiness policy with sticky session lifetimes controlled by the lifetime of the
275
	 * browser (user-agent) or a specified expiration period. This policy can be associated only with
276
	 * HTTP/HTTPS listeners.
277
	 *
278
	 * When a LoadBalancer implements this policy, the LoadBalancer uses a special cookie to track the
279
	 * backend server instance for each request. When the LoadBalancer receives a request, it first
280
	 * checks to see if this cookie is present in the request. If so, the LoadBalancer sends the
281
	 * request to the application server specified in the cookie. If not, the LoadBalancer sends the
282
	 * request to a server that is chosen based on the existing load balancing algorithm.
283
	 *
284
	 * A cookie is inserted into the response for binding subsequent requests from the same user to
285
	 * that server. The validity of the cookie is based on the cookie expiration time, which is
286
	 * specified in the policy configuration.
287
	 *
288
	 * @param string $load_balancer_name (Required) The name associated with the LoadBalancer. The name must be unique within the client AWS account.
289
	 * @param string $policy_name (Required) The name of the policy being created. The name must be unique within the set of policies for this LoadBalancer.
290
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
291
	 * 	<li><code>CookieExpirationPeriod</code> - <code>long</code> - Optional - The time period in seconds after which the cookie should be considered stale. Not specifying this parameter indicates that the sticky session will last for the duration of the browser session.</li>
292
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
293
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
294
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
295
	 */
296
	public function create_lb_cookie_stickiness_policy($load_balancer_name, $policy_name, $opt = null)
297
	{
298
		if (!$opt) $opt = array();
299
		$opt['LoadBalancerName'] = $load_balancer_name;
300
		$opt['PolicyName'] = $policy_name;
301
 
302
		return $this->authenticate('CreateLBCookieStickinessPolicy', $opt);
303
	}
304
 
305
	/**
306
	 * Creates a new LoadBalancer.
307
	 *
308
	 * After the call has completed successfully, a new LoadBalancer is created; however, it will not
309
	 * be usable until at least one instance has been registered. When the LoadBalancer creation is
310
	 * completed, the client can check whether or not it is usable by using the DescribeInstanceHealth
311
	 * API. The LoadBalancer is usable as soon as any registered instance is <em>InService</em>.
312
	 *
313
	 * <p class="note">
314
	 * Currently, the client's quota of LoadBalancers is limited to ten per Region.
315
	 * </p>
316
	 * <p class="note"></p>
317
	 * LoadBalancer DNS names vary depending on the Region they're created in. For LoadBalancers
318
	 * created in the United States, the DNS name ends with:
319
	 *
320
	 * <ul>
321
	 * 	<li><em>us-east-1.elb.amazonaws.com</em> (for the US Standard Region)</li>
322
	 * 	<li><em>us-west-1.elb.amazonaws.com</em> (for the Northern California Region)</li>
323
	 * </ul>
324
	 *
325
	 * For LoadBalancers created in the EU (Ireland) Region, the DNS name ends with:
326
	 *
327
	 * <ul>
328
	 * 	<li><em>eu-west-1.elb.amazonaws.com</em></li>
329
	 * </ul>
330
	 *
331
	 * @param string $load_balancer_name (Required) The name associated with the LoadBalancer. The name must be unique within your set of LoadBalancers.
332
	 * @param array $listeners (Required) A list of the following tuples: LoadBalancerPort, InstancePort, and Protocol. <ul>
333
	 * 	<li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
334
	 * 		<li><code>Protocol</code> - <code>string</code> - Required - Specifies the LoadBalancer transport protocol to use for routing - HTTP, HTTPS, TCP or SSL. This property cannot be modified for the life of the LoadBalancer.</li>
335
	 * 		<li><code>LoadBalancerPort</code> - <code>integer</code> - Required - Specifies the external LoadBalancer port number. This property cannot be modified for the life of the LoadBalancer.</li>
336
	 * 		<li><code>InstanceProtocol</code> - <code>string</code> - Optional - Specifies the protocol to use for routing traffic to back-end instances - HTTP, HTTPS, TCP, or SSL. This property cannot be modified for the life of the LoadBalancer. <p class="note">If the front-end protocol is HTTP or HTTPS, <code>InstanceProtocol</code> has to be at the same protocol layer, i.e., HTTP or HTTPS. Likewise, if the front-end protocol is TCP or SSL, InstanceProtocol has to be TCP or SSL.</p> <p class="note">If there is another listener with the same <code>InstancePort</code> whose <code>InstanceProtocol</code> is secure, i.e., HTTPS or SSL, the listener's <code>InstanceProtocol</code> has to be secure, i.e., HTTPS or SSL. If there is another listener with the same <code>InstancePort</code> whose <code>InstanceProtocol</code> is HTTP or TCP, the listener's <code>InstanceProtocol</code> must be either HTTP or TCP.</p></li>
337
	 * 		<li><code>InstancePort</code> - <code>integer</code> - Required - Specifies the TCP port on which the instance server is listening. This property cannot be modified for the life of the LoadBalancer.</li>
338
	 * 		<li><code>SSLCertificateId</code> - <code>string</code> - Optional - The ARN string of the server certificate. To get the ARN of the server certificate, call the AWS Identity and Access Management <a href="http://docs.amazonwebservices.com/IAM/latest/APIReference/index.html?API_UploadServerCertificate.html">UploadServerCertificate</a> API.</li>
339
	 * 	</ul></li>
340
	 * </ul>
341
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
342
	 * 	<li><code>AvailabilityZones</code> - <code>string|array</code> - Optional - A list of Availability Zones. At least one Availability Zone must be specified. Specified Availability Zones must be in the same EC2 Region as the LoadBalancer. Traffic will be equally distributed across all zones. This list can be modified after the creation of the LoadBalancer. Pass a string for a single value, or an indexed array for multiple values.</li>
343
	 * 	<li><code>Subnets</code> - <code>string|array</code> - Optional - A list of subnet IDs in your VPC to attach to your LoadBalancer. Pass a string for a single value, or an indexed array for multiple values.</li>
344
	 * 	<li><code>SecurityGroups</code> - <code>string|array</code> - Optional - The security groups assigned to your LoadBalancer within your VPC. Pass a string for a single value, or an indexed array for multiple values.</li>
345
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
346
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
347
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
348
	 */
349
	public function create_load_balancer($load_balancer_name, $listeners, $opt = null)
350
	{
351
		if (!$opt) $opt = array();
352
		$opt['LoadBalancerName'] = $load_balancer_name;
353
 
354
		// Required list + map
355
		$opt = array_merge($opt, CFComplexType::map(array(
356
			'Listeners' => (is_array($listeners) ? $listeners : array($listeners))
357
		), 'member'));
358
 
359
		// Optional list (non-map)
360
		if (isset($opt['AvailabilityZones']))
361
		{
362
			$opt = array_merge($opt, CFComplexType::map(array(
363
				'AvailabilityZones' => (is_array($opt['AvailabilityZones']) ? $opt['AvailabilityZones'] : array($opt['AvailabilityZones']))
364
			), 'member'));
365
			unset($opt['AvailabilityZones']);
366
		}
367
 
368
		// Optional list (non-map)
369
		if (isset($opt['Subnets']))
370
		{
371
			$opt = array_merge($opt, CFComplexType::map(array(
372
				'Subnets' => (is_array($opt['Subnets']) ? $opt['Subnets'] : array($opt['Subnets']))
373
			), 'member'));
374
			unset($opt['Subnets']);
375
		}
376
 
377
		// Optional list (non-map)
378
		if (isset($opt['SecurityGroups']))
379
		{
380
			$opt = array_merge($opt, CFComplexType::map(array(
381
				'SecurityGroups' => (is_array($opt['SecurityGroups']) ? $opt['SecurityGroups'] : array($opt['SecurityGroups']))
382
			), 'member'));
383
			unset($opt['SecurityGroups']);
384
		}
385
 
386
		return $this->authenticate('CreateLoadBalancer', $opt);
387
	}
388
 
389
	/**
390
	 * Creates one or more listeners on a LoadBalancer for the specified port. If a listener with the
391
	 * given port does not already exist, it will be created; otherwise, the properties of the new
392
	 * listener must match the properties of the existing listener.
393
	 *
394
	 * @param string $load_balancer_name (Required) The name of the new LoadBalancer. The name must be unique within your AWS account.
395
	 * @param array $listeners (Required) A list of <code>LoadBalancerPort</code>, <code>InstancePort</code>, <code>Protocol</code>, and <code>SSLCertificateId</code> items. <ul>
396
	 * 	<li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
397
	 * 		<li><code>Protocol</code> - <code>string</code> - Required - Specifies the LoadBalancer transport protocol to use for routing - HTTP, HTTPS, TCP or SSL. This property cannot be modified for the life of the LoadBalancer.</li>
398
	 * 		<li><code>LoadBalancerPort</code> - <code>integer</code> - Required - Specifies the external LoadBalancer port number. This property cannot be modified for the life of the LoadBalancer.</li>
399
	 * 		<li><code>InstanceProtocol</code> - <code>string</code> - Optional - Specifies the protocol to use for routing traffic to back-end instances - HTTP, HTTPS, TCP, or SSL. This property cannot be modified for the life of the LoadBalancer. <p class="note">If the front-end protocol is HTTP or HTTPS, <code>InstanceProtocol</code> has to be at the same protocol layer, i.e., HTTP or HTTPS. Likewise, if the front-end protocol is TCP or SSL, InstanceProtocol has to be TCP or SSL.</p> <p class="note">If there is another listener with the same <code>InstancePort</code> whose <code>InstanceProtocol</code> is secure, i.e., HTTPS or SSL, the listener's <code>InstanceProtocol</code> has to be secure, i.e., HTTPS or SSL. If there is another listener with the same <code>InstancePort</code> whose <code>InstanceProtocol</code> is HTTP or TCP, the listener's <code>InstanceProtocol</code> must be either HTTP or TCP.</p></li>
400
	 * 		<li><code>InstancePort</code> - <code>integer</code> - Required - Specifies the TCP port on which the instance server is listening. This property cannot be modified for the life of the LoadBalancer.</li>
401
	 * 		<li><code>SSLCertificateId</code> - <code>string</code> - Optional - The ARN string of the server certificate. To get the ARN of the server certificate, call the AWS Identity and Access Management <a href="http://docs.amazonwebservices.com/IAM/latest/APIReference/index.html?API_UploadServerCertificate.html">UploadServerCertificate</a> API.</li>
402
	 * 	</ul></li>
403
	 * </ul>
404
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
405
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
406
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
407
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
408
	 */
409
	public function create_load_balancer_listeners($load_balancer_name, $listeners, $opt = null)
410
	{
411
		if (!$opt) $opt = array();
412
		$opt['LoadBalancerName'] = $load_balancer_name;
413
 
414
		// Required list + map
415
		$opt = array_merge($opt, CFComplexType::map(array(
416
			'Listeners' => (is_array($listeners) ? $listeners : array($listeners))
417
		), 'member'));
418
 
419
		return $this->authenticate('CreateLoadBalancerListeners', $opt);
420
	}
421
 
422
	/**
423
	 * Creates a new policy that contains the necessary attributes depending on the policy type.
424
	 * Policies are settings that are saved for your Elastic LoadBalancer and that can be applied to
425
	 * the front-end listener, or the back-end application server, depending on your policy type.
426
	 *
427
	 * @param string $load_balancer_name (Required) The name associated with the LoadBalancer for which the policy is being created. This name must be unique within the client AWS account.
428
	 * @param string $policy_name (Required) The name of the LoadBalancer policy being created. The name must be unique within the set of policies for this LoadBalancer.
429
	 * @param string $policy_type_name (Required) The name of the base policy type being used to create this policy. To get the list of policy types, use the <code>DescribeLoadBalancerPolicyTypes</code> action.
430
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
431
	 * 	<li><code>PolicyAttributes</code> - <code>array</code> - Optional - A list of attributes associated with the policy being created. <ul>
432
	 * 		<li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
433
	 * 			<li><code>AttributeName</code> - <code>string</code> - Optional - The name of the attribute associated with the policy.</li>
434
	 * 			<li><code>AttributeValue</code> - <code>string</code> - Optional - The value of the attribute associated with the policy.</li>
435
	 * 		</ul></li>
436
	 * 	</ul></li>
437
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
438
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
439
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
440
	 */
441
	public function create_load_balancer_policy($load_balancer_name, $policy_name, $policy_type_name, $opt = null)
442
	{
443
		if (!$opt) $opt = array();
444
		$opt['LoadBalancerName'] = $load_balancer_name;
445
		$opt['PolicyName'] = $policy_name;
446
		$opt['PolicyTypeName'] = $policy_type_name;
447
 
448
		// Optional list + map
449
		if (isset($opt['PolicyAttributes']))
450
		{
451
			$opt = array_merge($opt, CFComplexType::map(array(
452
				'PolicyAttributes' => $opt['PolicyAttributes']
453
			), 'member'));
454
			unset($opt['PolicyAttributes']);
455
		}
456
 
457
		return $this->authenticate('CreateLoadBalancerPolicy', $opt);
458
	}
459
 
460
	/**
461
	 * Deletes the specified LoadBalancer.
462
	 *
463
	 * If attempting to recreate the LoadBalancer, the client must reconfigure all the settings. The
464
	 * DNS name associated with a deleted LoadBalancer will no longer be usable. Once deleted, the
465
	 * name and associated DNS record of the LoadBalancer no longer exist and traffic sent to any of
466
	 * its IP addresses will no longer be delivered to client instances. The client will not receive
467
	 * the same DNS name even if a new LoadBalancer with same LoadBalancerName is created.
468
	 *
469
	 * To successfully call this API, the client must provide the same account credentials as were
470
	 * used to create the LoadBalancer.
471
	 *
472
	 * <p class="note">
473
	 * By design, if the LoadBalancer does not exist or has already been deleted, DeleteLoadBalancer
474
	 * still succeeds.
475
	 * </p>
476
	 *
477
	 * @param string $load_balancer_name (Required) The name associated with the LoadBalancer. The name must be unique within the client AWS account.
478
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
479
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
480
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
481
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
482
	 */
483
	public function delete_load_balancer($load_balancer_name, $opt = null)
484
	{
485
		if (!$opt) $opt = array();
486
		$opt['LoadBalancerName'] = $load_balancer_name;
487
 
488
		return $this->authenticate('DeleteLoadBalancer', $opt);
489
	}
490
 
491
	/**
492
	 * Deletes listeners from the LoadBalancer for the specified port.
493
	 *
494
	 * @param string $load_balancer_name (Required) The mnemonic name associated with the LoadBalancer.
495
	 * @param integer $load_balancer_ports (Required) The client port number(s) of the LoadBalancerListener(s) to be removed.
496
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
497
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
498
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
499
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
500
	 */
501
	public function delete_load_balancer_listeners($load_balancer_name, $load_balancer_ports, $opt = null)
502
	{
503
		if (!$opt) $opt = array();
504
		$opt['LoadBalancerName'] = $load_balancer_name;
505
 
506
		// Required list (non-map)
507
		$opt = array_merge($opt, CFComplexType::map(array(
508
			'LoadBalancerPorts' => (is_array($load_balancer_ports) ? $load_balancer_ports : array($load_balancer_ports))
509
		), 'member'));
510
 
511
		return $this->authenticate('DeleteLoadBalancerListeners', $opt);
512
	}
513
 
514
	/**
515
	 * Deletes a policy from the LoadBalancer. The specified policy must not be enabled for any
516
	 * listeners.
517
	 *
518
	 * @param string $load_balancer_name (Required) The mnemonic name associated with the LoadBalancer. The name must be unique within your AWS account.
519
	 * @param string $policy_name (Required) The mnemonic name for the policy being deleted.
520
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
521
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
522
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
523
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
524
	 */
525
	public function delete_load_balancer_policy($load_balancer_name, $policy_name, $opt = null)
526
	{
527
		if (!$opt) $opt = array();
528
		$opt['LoadBalancerName'] = $load_balancer_name;
529
		$opt['PolicyName'] = $policy_name;
530
 
531
		return $this->authenticate('DeleteLoadBalancerPolicy', $opt);
532
	}
533
 
534
	/**
535
	 * Deregisters instances from the LoadBalancer. Once the instance is deregistered, it will stop
536
	 * receiving traffic from the LoadBalancer.
537
	 *
538
	 * In order to successfully call this API, the same account credentials as those used to create
539
	 * the LoadBalancer must be provided.
540
	 *
541
	 * @param string $load_balancer_name (Required) The name associated with the LoadBalancer. The name must be unique within the client AWS account.
542
	 * @param array $instances (Required) A list of EC2 instance IDs consisting of all instances to be deregistered. <ul>
543
	 * 	<li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
544
	 * 		<li><code>InstanceId</code> - <code>string</code> - Optional - Provides an EC2 instance ID.</li>
545
	 * 	</ul></li>
546
	 * </ul>
547
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
548
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
549
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
550
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
551
	 */
552
	public function deregister_instances_from_load_balancer($load_balancer_name, $instances, $opt = null)
553
	{
554
		if (!$opt) $opt = array();
555
		$opt['LoadBalancerName'] = $load_balancer_name;
556
 
557
		// Required list + map
558
		$opt = array_merge($opt, CFComplexType::map(array(
559
			'Instances' => (is_array($instances) ? $instances : array($instances))
560
		), 'member'));
561
 
562
		return $this->authenticate('DeregisterInstancesFromLoadBalancer', $opt);
563
	}
564
 
565
	/**
566
	 * Returns the current state of the instances of the specified LoadBalancer. If no instances are
567
	 * specified, the state of all the instances for the LoadBalancer is returned.
568
	 *
569
	 * <p class="note">
570
	 * The client must have created the specified input LoadBalancer in order to retrieve this
571
	 * information; the client must provide the same account credentials as those that were used to
572
	 * create the LoadBalancer.
573
	 * </p>
574
	 *
575
	 * @param string $load_balancer_name (Required) The name associated with the LoadBalancer. The name must be unique within the client AWS account.
576
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
577
	 * 	<li><code>Instances</code> - <code>array</code> - Optional - A list of instance IDs whose states are being queried. <ul>
578
	 * 		<li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
579
	 * 			<li><code>InstanceId</code> - <code>string</code> - Optional - Provides an EC2 instance ID.</li>
580
	 * 		</ul></li>
581
	 * 	</ul></li>
582
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
583
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
584
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
585
	 */
586
	public function describe_instance_health($load_balancer_name, $opt = null)
587
	{
588
		if (!$opt) $opt = array();
589
		$opt['LoadBalancerName'] = $load_balancer_name;
590
 
591
		// Optional list + map
592
		if (isset($opt['Instances']))
593
		{
594
			$opt = array_merge($opt, CFComplexType::map(array(
595
				'Instances' => $opt['Instances']
596
			), 'member'));
597
			unset($opt['Instances']);
598
		}
599
 
600
		return $this->authenticate('DescribeInstanceHealth', $opt);
601
	}
602
 
603
	/**
604
	 * Returns detailed descriptions of the policies. If you specify a LoadBalancer name, the
605
	 * operation returns either the descriptions of the specified policies, or descriptions of all the
606
	 * policies created for the LoadBalancer. If you don't specify a LoadBalancer name, the operation
607
	 * returns descriptions of the specified sample policies, or descriptions of all the sample
608
	 * policies. The names of the sample policies have the <code>ELBSample-</code> prefix.
609
	 *
610
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
611
	 * 	<li><code>LoadBalancerName</code> - <code>string</code> - Optional - The mnemonic name associated with the LoadBalancer. If no name is specified, the operation returns the attributes of either all the sample policies pre-defined by Elastic Load Balancing or the specified sample polices.</li>
612
	 * 	<li><code>PolicyNames</code> - <code>string|array</code> - Optional - The names of LoadBalancer policies you've created or Elastic Load Balancing sample policy names. Pass a string for a single value, or an indexed array for multiple values.</li>
613
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
614
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
615
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
616
	 */
617
	public function describe_load_balancer_policies($opt = null)
618
	{
619
		if (!$opt) $opt = array();
620
 
621
		// Optional list (non-map)
622
		if (isset($opt['PolicyNames']))
623
		{
624
			$opt = array_merge($opt, CFComplexType::map(array(
625
				'PolicyNames' => (is_array($opt['PolicyNames']) ? $opt['PolicyNames'] : array($opt['PolicyNames']))
626
			), 'member'));
627
			unset($opt['PolicyNames']);
628
		}
629
 
630
		return $this->authenticate('DescribeLoadBalancerPolicies', $opt);
631
	}
632
 
633
	/**
634
	 * Returns meta-information on the specified LoadBalancer policies defined by the Elastic Load
635
	 * Balancing service. The policy types that are returned from this action can be used in a
636
	 * <code>CreateLoadBalancerPolicy</code> action to instantiate specific policy configurations that
637
	 * will be applied to an Elastic LoadBalancer.
638
	 *
639
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
640
	 * 	<li><code>PolicyTypeNames</code> - <code>string|array</code> - Optional - Specifies the name of the policy types. If no names are specified, returns the description of all the policy types defined by Elastic Load Balancing service. Pass a string for a single value, or an indexed array for multiple values.</li>
641
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
642
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
643
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
644
	 */
645
	public function describe_load_balancer_policy_types($opt = null)
646
	{
647
		if (!$opt) $opt = array();
648
 
649
		// Optional list (non-map)
650
		if (isset($opt['PolicyTypeNames']))
651
		{
652
			$opt = array_merge($opt, CFComplexType::map(array(
653
				'PolicyTypeNames' => (is_array($opt['PolicyTypeNames']) ? $opt['PolicyTypeNames'] : array($opt['PolicyTypeNames']))
654
			), 'member'));
655
			unset($opt['PolicyTypeNames']);
656
		}
657
 
658
		return $this->authenticate('DescribeLoadBalancerPolicyTypes', $opt);
659
	}
660
 
661
	/**
662
	 * Returns detailed configuration information for the specified LoadBalancers. If no LoadBalancers
663
	 * are specified, the operation returns configuration information for all LoadBalancers created by
664
	 * the caller.
665
	 *
666
	 * <p class="note">
667
	 * The client must have created the specified input LoadBalancers in order to retrieve this
668
	 * information; the client must provide the same account credentials as those that were used to
669
	 * create the LoadBalancer.
670
	 * </p>
671
	 *
672
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
673
	 * 	<li><code>LoadBalancerNames</code> - <code>string|array</code> - Optional - A list of names associated with the LoadBalancers at creation time. Pass a string for a single value, or an indexed array for multiple values.</li>
674
	 * 	<li><code>Marker</code> - <code>string</code> - Optional - </li>
675
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
676
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
677
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
678
	 */
679
	public function describe_load_balancers($opt = null)
680
	{
681
		if (!$opt) $opt = array();
682
 
683
		// Optional list (non-map)
684
		if (isset($opt['LoadBalancerNames']))
685
		{
686
			$opt = array_merge($opt, CFComplexType::map(array(
687
				'LoadBalancerNames' => (is_array($opt['LoadBalancerNames']) ? $opt['LoadBalancerNames'] : array($opt['LoadBalancerNames']))
688
			), 'member'));
689
			unset($opt['LoadBalancerNames']);
690
		}
691
 
692
		return $this->authenticate('DescribeLoadBalancers', $opt);
693
	}
694
 
695
	/**
696
	 * Removes subnets from the set of configured subnets in the VPC for the LoadBalancer.
697
	 *
698
	 * After a subnet is removed all of the EndPoints registered with the LoadBalancer that are in the
699
	 * removed subnet will go into the <em>OutOfService</em> state. When a subnet is removed, the
700
	 * LoadBalancer will balance the traffic among the remaining routable subnets for the
701
	 * LoadBalancer.
702
	 *
703
	 * @param string $load_balancer_name (Required) The name associated with the LoadBalancer to be detached. The name must be unique within the client AWS account.
704
	 * @param string|array $subnets (Required) A list of subnet IDs to remove from the set of configured subnets for the LoadBalancer. Pass a string for a single value, or an indexed array for multiple values.
705
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
706
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
707
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
708
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
709
	 */
710
	public function detach_load_balancer_from_subnets($load_balancer_name, $subnets, $opt = null)
711
	{
712
		if (!$opt) $opt = array();
713
		$opt['LoadBalancerName'] = $load_balancer_name;
714
 
715
		// Required list (non-map)
716
		$opt = array_merge($opt, CFComplexType::map(array(
717
			'Subnets' => (is_array($subnets) ? $subnets : array($subnets))
718
		), 'member'));
719
 
720
		return $this->authenticate('DetachLoadBalancerFromSubnets', $opt);
721
	}
722
 
723
	/**
724
	 * Removes the specified EC2 Availability Zones from the set of configured Availability Zones for
725
	 * the LoadBalancer.
726
	 *
727
	 * There must be at least one Availability Zone registered with a LoadBalancer at all times. A
728
	 * client cannot remove all the Availability Zones from a LoadBalancer. Once an Availability Zone
729
	 * is removed, all the instances registered with the LoadBalancer that are in the removed
730
	 * Availability Zone go into the OutOfService state. Upon Availability Zone removal, the
731
	 * LoadBalancer attempts to equally balance the traffic among its remaining usable Availability
732
	 * Zones. Trying to remove an Availability Zone that was not associated with the LoadBalancer does
733
	 * nothing.
734
	 *
735
	 * <p class="note">
736
	 * In order for this call to be successful, the client must have created the LoadBalancer. The
737
	 * client must provide the same account credentials as those that were used to create the
738
	 * LoadBalancer.
739
	 * </p>
740
	 *
741
	 * @param string $load_balancer_name (Required) The name associated with the LoadBalancer. The name must be unique within the client AWS account.
742
	 * @param string|array $availability_zones (Required) A list of Availability Zones to be removed from the LoadBalancer. <p class="note">There must be at least one Availability Zone registered with a LoadBalancer at all times. The client cannot remove all the Availability Zones from a LoadBalancer. Specified Availability Zones must be in the same Region.</p> Pass a string for a single value, or an indexed array for multiple values.
743
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
744
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
745
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
746
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
747
	 */
748
	public function disable_availability_zones_for_load_balancer($load_balancer_name, $availability_zones, $opt = null)
749
	{
750
		if (!$opt) $opt = array();
751
		$opt['LoadBalancerName'] = $load_balancer_name;
752
 
753
		// Required list (non-map)
754
		$opt = array_merge($opt, CFComplexType::map(array(
755
			'AvailabilityZones' => (is_array($availability_zones) ? $availability_zones : array($availability_zones))
756
		), 'member'));
757
 
758
		return $this->authenticate('DisableAvailabilityZonesForLoadBalancer', $opt);
759
	}
760
 
761
	/**
762
	 * Adds one or more EC2 Availability Zones to the LoadBalancer.
763
	 *
764
	 * The LoadBalancer evenly distributes requests across all its registered Availability Zones that
765
	 * contain instances. As a result, the client must ensure that its LoadBalancer is appropriately
766
	 * scaled for each registered Availability Zone.
767
	 *
768
	 * <p class="note">
769
	 * The new EC2 Availability Zones to be added must be in the same EC2 Region as the Availability
770
	 * Zones for which the LoadBalancer was created.
771
	 * </p>
772
	 *
773
	 * @param string $load_balancer_name (Required) The name associated with the LoadBalancer. The name must be unique within the client AWS account.
774
	 * @param string|array $availability_zones (Required) A list of new Availability Zones for the LoadBalancer. Each Availability Zone must be in the same Region as the LoadBalancer. Pass a string for a single value, or an indexed array for multiple values.
775
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
776
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
777
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
778
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
779
	 */
780
	public function enable_availability_zones_for_load_balancer($load_balancer_name, $availability_zones, $opt = null)
781
	{
782
		if (!$opt) $opt = array();
783
		$opt['LoadBalancerName'] = $load_balancer_name;
784
 
785
		// Required list (non-map)
786
		$opt = array_merge($opt, CFComplexType::map(array(
787
			'AvailabilityZones' => (is_array($availability_zones) ? $availability_zones : array($availability_zones))
788
		), 'member'));
789
 
790
		return $this->authenticate('EnableAvailabilityZonesForLoadBalancer', $opt);
791
	}
792
 
793
	/**
794
	 * Adds new instances to the LoadBalancer.
795
	 *
796
	 * Once the instance is registered, it starts receiving traffic and requests from the
797
	 * LoadBalancer. Any instance that is not in any of the Availability Zones registered for the
798
	 * LoadBalancer will be moved to the <em>OutOfService</em> state. It will move to the
799
	 * <em>InService</em> state when the Availability Zone is added to the LoadBalancer.
800
	 *
801
	 * <p class="note">
802
	 * In order for this call to be successful, the client must have created the LoadBalancer. The
803
	 * client must provide the same account credentials as those that were used to create the
804
	 * LoadBalancer.
805
	 * </p>
806
	 * <p class="note">
807
	 * Completion of this API does not guarantee that operation has completed. Rather, it means that
808
	 * the request has been registered and the changes will happen shortly.
809
	 * </p>
810
	 *
811
	 * @param string $load_balancer_name (Required) The name associated with the LoadBalancer. The name must be unique within the client AWS account.
812
	 * @param array $instances (Required) A list of instances IDs that should be registered with the LoadBalancer. <ul>
813
	 * 	<li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
814
	 * 		<li><code>InstanceId</code> - <code>string</code> - Optional - Provides an EC2 instance ID.</li>
815
	 * 	</ul></li>
816
	 * </ul>
817
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
818
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
819
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
820
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
821
	 */
822
	public function register_instances_with_load_balancer($load_balancer_name, $instances, $opt = null)
823
	{
824
		if (!$opt) $opt = array();
825
		$opt['LoadBalancerName'] = $load_balancer_name;
826
 
827
		// Required list + map
828
		$opt = array_merge($opt, CFComplexType::map(array(
829
			'Instances' => (is_array($instances) ? $instances : array($instances))
830
		), 'member'));
831
 
832
		return $this->authenticate('RegisterInstancesWithLoadBalancer', $opt);
833
	}
834
 
835
	/**
836
	 * Sets the certificate that terminates the specified listener's SSL connections. The specified
837
	 * certificate replaces any prior certificate that was used on the same LoadBalancer and port.
838
	 *
839
	 * @param string $load_balancer_name (Required) The name of the the LoadBalancer.
840
	 * @param integer $load_balancer_port (Required) The port that uses the specified SSL certificate.
841
	 * @param string $ssl_certificate_id (Required) The ID of the SSL certificate chain to use. For more information on SSL certificates, see <a href="http://docs.amazonwebservices.com/IAM/latest/UserGuide/ManagingServerCerts.html">Managing Server Certificates</a> in the AWS Identity and Access Management documentation.
842
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
843
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
844
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
845
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
846
	 */
847
	public function set_load_balancer_listener_ssl_certificate($load_balancer_name, $load_balancer_port, $ssl_certificate_id, $opt = null)
848
	{
849
		if (!$opt) $opt = array();
850
		$opt['LoadBalancerName'] = $load_balancer_name;
851
		$opt['LoadBalancerPort'] = $load_balancer_port;
852
		$opt['SSLCertificateId'] = $ssl_certificate_id;
853
 
854
		return $this->authenticate('SetLoadBalancerListenerSSLCertificate', $opt);
855
	}
856
 
857
	/**
858
	 * Replaces the current set of policies associated with a port on which the back-end server is
859
	 * listening with a new set of policies. After the policies have been created using
860
	 * <code>CreateLoadBalancerPolicy</code>, they can be applied here as a list. At this time, only
861
	 * the back-end server authentication policy type can be applied to the back-end ports; this
862
	 * policy type is composed of multiple public key policies.
863
	 *
864
	 * @param string $load_balancer_name (Required) The mnemonic name associated with the LoadBalancer. This name must be unique within the client AWS account.
865
	 * @param integer $instance_port (Required) The port number associated with the back-end server.
866
	 * @param string|array $policy_names (Required) List of policy names to be set. If the list is empty, then all current polices are removed from the back-end server. Pass a string for a single value, or an indexed array for multiple values.
867
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
868
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
869
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
870
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
871
	 */
872
	public function set_load_balancer_policies_for_backend_server($load_balancer_name, $instance_port, $policy_names, $opt = null)
873
	{
874
		if (!$opt) $opt = array();
875
		$opt['LoadBalancerName'] = $load_balancer_name;
876
		$opt['InstancePort'] = $instance_port;
877
 
878
		// Required list (non-map)
879
		$opt = array_merge($opt, CFComplexType::map(array(
880
			'PolicyNames' => (is_array($policy_names) ? $policy_names : array($policy_names))
881
		), 'member'));
882
 
883
		return $this->authenticate('SetLoadBalancerPoliciesForBackendServer', $opt);
884
	}
885
 
886
	/**
887
	 * Associates, updates, or disables a policy with a listener on the LoadBalancer. You can
888
	 * associate multiple policies with a listener.
889
	 *
890
	 * @param string $load_balancer_name (Required) The name associated with the LoadBalancer. The name must be unique within the client AWS account.
891
	 * @param integer $load_balancer_port (Required) The external port of the LoadBalancer with which this policy applies to.
892
	 * @param string|array $policy_names (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.
893
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
894
	 * 	<li><code>curlopts</code> - <code>array</code> - Optional - A set of values to pass directly into <code>curl_setopt()</code>, where the key is a pre-defined <code>CURLOPT_*</code> constant.</li>
895
	 * 	<li><code>returnCurlHandle</code> - <code>boolean</code> - 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.</li></ul>
896
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
897
	 */
898
	public function set_load_balancer_policies_of_listener($load_balancer_name, $load_balancer_port, $policy_names, $opt = null)
899
	{
900
		if (!$opt) $opt = array();
901
		$opt['LoadBalancerName'] = $load_balancer_name;
902
		$opt['LoadBalancerPort'] = $load_balancer_port;
903
 
904
		// Required list (non-map)
905
		$opt = array_merge($opt, CFComplexType::map(array(
906
			'PolicyNames' => (is_array($policy_names) ? $policy_names : array($policy_names))
907
		), 'member'));
908
 
909
		return $this->authenticate('SetLoadBalancerPoliciesOfListener', $opt);
910
	}
911
}
912
 
913
 
914
/*%******************************************************************************************%*/
915
// EXCEPTIONS
916
 
917
class ELB_Exception extends Exception {}