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
 * Amazon ElastiCache is a web service that makes it easier to set up, operate, and scale a
19
 * distributed cache in the cloud.
20
 *
21
 * With Amazon ElastiCache, customers gain all of the benefits of a high-performance, in-memory
22
 * cache with far less of the administrative burden of launching and managing a distributed cache.
23
 * The service makes set-up, scaling, and cluster failure handling much simpler than in a
24
 * self-managed cache deployment.
25
 *
26
 * In addition, through integration with Amazon CloudWatch, customers get enhanced visibility into
27
 * the key performance statistics associated with their cache and can receive alarms if a part of
28
 * their cache runs hot.
29
 *
30
 * @version 2012.01.16
31
 * @license See the included NOTICE.md file for complete information.
32
 * @copyright See the included NOTICE.md file for complete information.
33
 * @link http://aws.amazon.com/elasticache/ AWS ElastiCache
34
 * @link http://aws.amazon.com/elasticache/documentation/ AWS ElastiCache documentation
35
 */
36
class AmazonElastiCache extends CFRuntime
37
{
38
	/*%******************************************************************************************%*/
39
	// CLASS CONSTANTS
40
 
41
	/**
42
	 * Specify the queue URL for the United States East (Northern Virginia) Region.
43
	 */
44
	const REGION_US_E1 = 'elasticache.us-east-1.amazonaws.com';
45
 
46
	/**
47
	 * Specify the queue URL for the United States East (Northern Virginia) Region.
48
	 */
49
	const REGION_VIRGINIA = self::REGION_US_E1;
50
 
51
	/**
52
	 * Specify the queue URL for the United States West (Northern California) Region.
53
	 */
54
	const REGION_US_W1 = 'elasticache.us-west-1.amazonaws.com';
55
 
56
	/**
57
	 * Specify the queue URL for the United States West (Northern California) Region.
58
	 */
59
	const REGION_CALIFORNIA = self::REGION_US_W1;
60
 
61
	/**
62
	 * Specify the queue URL for the Europe West (Ireland) Region.
63
	 */
64
	const REGION_EU_W1 = 'elasticache.eu-west-1.amazonaws.com';
65
 
66
	/**
67
	 * Specify the queue URL for the Europe West (Ireland) Region.
68
	 */
69
	const REGION_IRELAND = self::REGION_EU_W1;
70
 
71
	/**
72
	 * Specify the queue URL for the Asia Pacific Southeast (Singapore) Region.
73
	 */
74
	const REGION_APAC_SE1 = 'elasticache.ap-southeast-1.amazonaws.com';
75
 
76
	/**
77
	 * Specify the queue URL for the Asia Pacific Southeast (Singapore) Region.
78
	 */
79
	const REGION_SINGAPORE = self::REGION_APAC_SE1;
80
 
81
	/**
82
	 * Specify the queue URL for the Asia Pacific Northeast (Tokyo) Region.
83
	 */
84
	const REGION_APAC_NE1 = 'elasticache.ap-northeast-1.amazonaws.com';
85
 
86
	/**
87
	 * Specify the queue URL for the Asia Pacific Northeast (Tokyo) Region.
88
	 */
89
	const REGION_TOKYO = self::REGION_APAC_NE1;
90
 
91
	/**
92
	 * Default service endpoint.
93
	 */
94
	const DEFAULT_URL = self::REGION_US_E1;
95
 
96
 
97
	/*%******************************************************************************************%*/
98
	// CONSTRUCTOR
99
 
100
	/**
101
	 * Constructs a new instance of <AmazonElastiCache>.
102
	 *
103
	 * @param array $options (Optional) An associative array of parameters that can have the following keys: <ul>
104
	 * 	<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>
105
	 * 	<li><code>credentials</code> - <code>string</code> - Optional - The name of the credential set to use for authentication.</li>
106
	 * 	<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>
107
	 * 	<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>
108
	 * 	<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>
109
	 * 	<li><code>token</code> - <code>string</code> - Optional - An AWS session token.</li></ul>
110
	 * @return void
111
	 */
112
	public function __construct(array $options = array())
113
	{
114
		$this->api_version = '2011-07-15';
115
		$this->hostname = self::DEFAULT_URL;
116
		$this->auth_class = 'AuthV2Query';
117
 
118
		return parent::__construct($options);
119
	}
120
 
121
 
122
	/*%******************************************************************************************%*/
123
	// SETTERS
124
 
125
	/**
126
	 * This allows you to explicitly sets the region for the service to use.
127
	 *
128
	 * @param string $region (Required) The region to explicitly set. Available options are <REGION_US_E1>, <REGION_US_W1>, <REGION_EU_W1>, <REGION_APAC_SE1>, <REGION_APAC_NE1>.
129
	 * @return $this A reference to the current instance.
130
	 */
131
	public function set_region($region)
132
	{
133
		// @codeCoverageIgnoreStart
134
		$this->set_hostname($region);
135
		return $this;
136
		// @codeCoverageIgnoreEnd
137
	}
138
 
139
 
140
	/*%******************************************************************************************%*/
141
	// SERVICE METHODS
142
 
143
	/**
144
	 * Authorizes ingress to a CacheSecurityGroup using EC2 Security Groups as authorization
145
	 * (therefore the application using the cache must be running on EC2 clusters). This API requires
146
	 * the following parameters: EC2SecurityGroupName and EC2SecurityGroupOwnerId.
147
	 *
148
	 * <p class="note">
149
	 * You cannot authorize ingress from an EC2 security group in one Region to an Amazon Cache
150
	 * Cluster in another.
151
	 * </p>
152
	 *
153
	 * @param string $cache_security_group_name (Required) The name of the Cache Security Group to authorize.
154
	 * @param string $ec2_security_group_name (Required) Name of the EC2 Security Group to include in the authorization.
155
	 * @param string $ec2_security_group_owner_id (Required) AWS Account Number of the owner of the security group specified in the EC2SecurityGroupName parameter. The AWS Access Key ID is not an acceptable value.
156
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
157
	 * 	<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>
158
	 * 	<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>
159
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
160
	 */
161
	public function authorize_cache_security_group_ingress($cache_security_group_name, $ec2_security_group_name, $ec2_security_group_owner_id, $opt = null)
162
	{
163
		if (!$opt) $opt = array();
164
		$opt['CacheSecurityGroupName'] = $cache_security_group_name;
165
		$opt['EC2SecurityGroupName'] = $ec2_security_group_name;
166
		$opt['EC2SecurityGroupOwnerId'] = $ec2_security_group_owner_id;
167
 
168
		return $this->authenticate('AuthorizeCacheSecurityGroupIngress', $opt);
169
	}
170
 
171
	/**
172
	 * Creates a new Cache Cluster.
173
	 *
174
	 * @param string $cache_cluster_id (Required) The Cache Cluster identifier. This parameter is stored as a lowercase string. Constraints:<ul><li>Must contain from 1 to 20 alphanumeric characters or hyphens.</li><li>First character must be a letter.</li><li>Cannot end with a hyphen or contain two consecutive hyphens.</li></ul>Example: <code>mycachecluster</code>
175
	 * @param integer $num_cache_nodes (Required) The number of Cache Nodes the Cache Cluster should have.
176
	 * @param string $cache_node_type (Required) The compute and memory capacity of nodes in a Cache Cluster. Valid values: <code>cache.m1.large | cache.m1.xlarge | cache.m2.xlarge | cache.m2.2xlarge | cache.m2.4xlarge | cache.c1.xlarge</code>
177
	 * @param string $engine (Required) The name of the cache engine to be used for this Cache Cluster. <p class="note">Currently, <em>memcached</em> is the only cache engine supported by the service.</p>
178
	 * @param string|array $cache_security_group_names (Required) A list of Cache Security Group Names to associate with this Cache Cluster. Pass a string for a single value, or an indexed array for multiple values.
179
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
180
	 * 	<li><code>EngineVersion</code> - <code>string</code> - Optional - The version of the cache engine to be used for this cluster.</li>
181
	 * 	<li><code>CacheParameterGroupName</code> - <code>string</code> - Optional - The name of the cache parameter group to associate with this Cache cluster. If this argument is omitted, the default CacheParameterGroup for the specified engine will be used.</li>
182
	 * 	<li><code>PreferredAvailabilityZone</code> - <code>string</code> - Optional - The EC2 Availability Zone that the Cache Cluster will be created in. In normal use, all CacheNodes belonging to a CacheCluster are placed in the preferred availability zone. In rare circumstances, some of the CacheNodes might temporarily be in a different availability zone. Default: System chosen (random) availability zone.</li>
183
	 * 	<li><code>PreferredMaintenanceWindow</code> - <code>string</code> - Optional - The weekly time range (in UTC) during which system maintenance can occur. Example: <code>sun:05:00-sun:09:00</code></li>
184
	 * 	<li><code>Port</code> - <code>integer</code> - Optional - The port number on which each of the Cache Nodes will accept connections.</li>
185
	 * 	<li><code>NotificationTopicArn</code> - <code>string</code> - Optional - The Amazon Resource Name (ARN) of the Amazon Simple Notification Service (SNS) topic to which notifications will be sent. <p class="note">The Amazon SNS topic owner must be the same as the Cache Cluster owner.</p></li>
186
	 * 	<li><code>AutoMinorVersionUpgrade</code> - <code>boolean</code> - Optional - Indicates that minor engine upgrades will be applied automatically to the Cache Cluster during the maintenance window. Default: <code>true</code></li>
187
	 * 	<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>
188
	 * 	<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>
189
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
190
	 */
191
	public function create_cache_cluster($cache_cluster_id, $num_cache_nodes, $cache_node_type, $engine, $cache_security_group_names, $opt = null)
192
	{
193
		if (!$opt) $opt = array();
194
		$opt['CacheClusterId'] = $cache_cluster_id;
195
		$opt['NumCacheNodes'] = $num_cache_nodes;
196
		$opt['CacheNodeType'] = $cache_node_type;
197
		$opt['Engine'] = $engine;
198
 
199
		// Required list (non-map)
200
		$opt = array_merge($opt, CFComplexType::map(array(
201
			'CacheSecurityGroupNames' => (is_array($cache_security_group_names) ? $cache_security_group_names : array($cache_security_group_names))
202
		), 'member'));
203
 
204
		return $this->authenticate('CreateCacheCluster', $opt);
205
	}
206
 
207
	/**
208
	 * Creates a new Cache Parameter Group. Cache Parameter groups control the parameters for a Cache
209
	 * Cluster.
210
	 *
211
	 * @param string $cache_parameter_group_name (Required) The name of the Cache Parameter Group.
212
	 * @param string $cache_parameter_group_family (Required) The name of the Cache Parameter Group Family the Cache Parameter Group can be used with. <p class="note">Currently, <em>memcached1.4</em> is the only cache parameter group family supported by the service.</p>
213
	 * @param string $description (Required) The description for the Cache Parameter Group.
214
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
215
	 * 	<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>
216
	 * 	<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>
217
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
218
	 */
219
	public function create_cache_parameter_group($cache_parameter_group_name, $cache_parameter_group_family, $description, $opt = null)
220
	{
221
		if (!$opt) $opt = array();
222
		$opt['CacheParameterGroupName'] = $cache_parameter_group_name;
223
		$opt['CacheParameterGroupFamily'] = $cache_parameter_group_family;
224
		$opt['Description'] = $description;
225
 
226
		return $this->authenticate('CreateCacheParameterGroup', $opt);
227
	}
228
 
229
	/**
230
	 * Creates a new Cache Security Group. Cache Security groups control access to one or more Cache
231
	 * Clusters.
232
	 *
233
	 * @param string $cache_security_group_name (Required) The name for the Cache Security Group. This value is stored as a lowercase string. Constraints: Must contain no more than 255 alphanumeric characters. Must not be "Default". Example: <code>mysecuritygroup</code>
234
	 * @param string $description (Required) The description for the Cache Security Group.
235
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
236
	 * 	<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>
237
	 * 	<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>
238
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
239
	 */
240
	public function create_cache_security_group($cache_security_group_name, $description, $opt = null)
241
	{
242
		if (!$opt) $opt = array();
243
		$opt['CacheSecurityGroupName'] = $cache_security_group_name;
244
		$opt['Description'] = $description;
245
 
246
		return $this->authenticate('CreateCacheSecurityGroup', $opt);
247
	}
248
 
249
	/**
250
	 * Deletes a previously provisioned Cache Cluster. A successful response from the web service
251
	 * indicates the request was received correctly. This action cannot be canceled or reverted.
252
	 * DeleteCacheCluster deletes all associated Cache Nodes, node endpoints and the Cache Cluster
253
	 * itself.
254
	 *
255
	 * @param string $cache_cluster_id (Required) The Cache Cluster identifier for the Cache Cluster to be deleted. This parameter isn't case sensitive.
256
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
257
	 * 	<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>
258
	 * 	<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>
259
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
260
	 */
261
	public function delete_cache_cluster($cache_cluster_id, $opt = null)
262
	{
263
		if (!$opt) $opt = array();
264
		$opt['CacheClusterId'] = $cache_cluster_id;
265
 
266
		return $this->authenticate('DeleteCacheCluster', $opt);
267
	}
268
 
269
	/**
270
	 * Deletes the specified CacheParameterGroup. The CacheParameterGroup cannot be deleted if it is
271
	 * associated with any cache clusters.
272
	 *
273
	 * @param string $cache_parameter_group_name (Required) The name of the Cache Parameter Group to delete. <p class="note">The specified cache security group must not be associated with any Cache clusters.</p>
274
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
275
	 * 	<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>
276
	 * 	<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>
277
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
278
	 */
279
	public function delete_cache_parameter_group($cache_parameter_group_name, $opt = null)
280
	{
281
		if (!$opt) $opt = array();
282
		$opt['CacheParameterGroupName'] = $cache_parameter_group_name;
283
 
284
		return $this->authenticate('DeleteCacheParameterGroup', $opt);
285
	}
286
 
287
	/**
288
	 * Deletes a Cache Security Group.
289
	 *
290
	 * <p class="note">
291
	 * The specified Cache Security Group must not be associated with any Cache Clusters.
292
	 * </p>
293
	 *
294
	 * @param string $cache_security_group_name (Required) The name of the Cache Security Group to delete. <p class="note">You cannot delete the default security group.</p>
295
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
296
	 * 	<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>
297
	 * 	<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>
298
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
299
	 */
300
	public function delete_cache_security_group($cache_security_group_name, $opt = null)
301
	{
302
		if (!$opt) $opt = array();
303
		$opt['CacheSecurityGroupName'] = $cache_security_group_name;
304
 
305
		return $this->authenticate('DeleteCacheSecurityGroup', $opt);
306
	}
307
 
308
	/**
309
	 * Returns information about all provisioned Cache Clusters if no Cache Cluster identifier is
310
	 * specified, or about a specific Cache Cluster if a Cache Cluster identifier is supplied.
311
	 *
312
	 * Cluster information will be returned by default. An optional <em>ShowDetails</em> flag can be
313
	 * used to retrieve detailed information about the Cache Nodes associated with the Cache Cluster.
314
	 * Details include the DNS address and port for the Cache Node endpoint.
315
	 *
316
	 * If the cluster is in the CREATING state, only cluster level information will be displayed until
317
	 * all of the nodes are successfully provisioned.
318
	 *
319
	 * If the cluster is in the DELETING state, only cluster level information will be displayed.
320
	 *
321
	 * While adding Cache Nodes, node endpoint information and creation time for the additional nodes
322
	 * will not be displayed until they are completely provisioned. The cluster lifecycle tells the
323
	 * customer when new nodes are AVAILABLE.
324
	 *
325
	 * While removing existing Cache Nodes from an cluster, endpoint information for the removed nodes
326
	 * will not be displayed.
327
	 *
328
	 * DescribeCacheClusters supports pagination.
329
	 *
330
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
331
	 * 	<li><code>CacheClusterId</code> - <code>string</code> - Optional - The user-supplied cluster identifier. If this parameter is specified, only information about that specific Cache Cluster is returned. This parameter isn't case sensitive.</li>
332
	 * 	<li><code>MaxRecords</code> - <code>integer</code> - Optional - The maximum number of records to include in the response. If more records exist than the specified <em>MaxRecords</em> value, a marker is included in the response so that the remaining results may be retrieved. Default: 100 Constraints: minimum 20, maximum 100</li>
333
	 * 	<li><code>Marker</code> - <code>string</code> - Optional - An optional marker provided in the previous DescribeCacheClusters request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by <em>MaxRecords</em>.</li>
334
	 * 	<li><code>ShowCacheNodeInfo</code> - <code>boolean</code> - Optional - An optional flag that can be included in the DescribeCacheCluster request to retrieve Cache Nodes information.</li>
335
	 * 	<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>
336
	 * 	<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>
337
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
338
	 */
339
	public function describe_cache_clusters($opt = null)
340
	{
341
		if (!$opt) $opt = array();
342
 
343
		return $this->authenticate('DescribeCacheClusters', $opt);
344
	}
345
 
346
	/**
347
	 * Returns a list of CacheParameterGroup descriptions. If a CacheParameterGroupName is specified,
348
	 * the list will contain only the descriptions of the specified CacheParameterGroup.
349
	 *
350
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
351
	 * 	<li><code>CacheParameterGroupName</code> - <code>string</code> - Optional - The name of a specific cache parameter group to return details for.</li>
352
	 * 	<li><code>MaxRecords</code> - <code>integer</code> - Optional - The maximum number of records to include in the response. If more records exist than the specified <em>MaxRecords</em> value, a marker is included in the response so that the remaining results may be retrieved.</li>
353
	 * 	<li><code>Marker</code> - <code>string</code> - Optional - An optional marker provided in the previous DescribeCacheParameterGroups request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by <em>MaxRecords</em>.</li>
354
	 * 	<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>
355
	 * 	<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>
356
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
357
	 */
358
	public function describe_cache_parameter_groups($opt = null)
359
	{
360
		if (!$opt) $opt = array();
361
 
362
		return $this->authenticate('DescribeCacheParameterGroups', $opt);
363
	}
364
 
365
	/**
366
	 * Returns the detailed parameter list for a particular CacheParameterGroup.
367
	 *
368
	 * @param string $cache_parameter_group_name (Required) The name of a specific cache parameter group to return details for.
369
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
370
	 * 	<li><code>Source</code> - <code>string</code> - Optional - The parameter types to return. Valid values: <code>user</code> | <code>system</code> | <code>engine-default</code></li>
371
	 * 	<li><code>MaxRecords</code> - <code>integer</code> - Optional - The maximum number of records to include in the response. If more records exist than the specified <em>MaxRecords</em> value, a marker is included in the response so that the remaining results may be retrieved.</li>
372
	 * 	<li><code>Marker</code> - <code>string</code> - Optional - An optional marker provided in the previous DescribeCacheClusters request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by <em>MaxRecords</em>.</li>
373
	 * 	<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>
374
	 * 	<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>
375
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
376
	 */
377
	public function describe_cache_parameters($cache_parameter_group_name, $opt = null)
378
	{
379
		if (!$opt) $opt = array();
380
		$opt['CacheParameterGroupName'] = $cache_parameter_group_name;
381
 
382
		return $this->authenticate('DescribeCacheParameters', $opt);
383
	}
384
 
385
	/**
386
	 * Returns a list of CacheSecurityGroup descriptions. If a CacheSecurityGroupName is specified,
387
	 * the list will contain only the description of the specified CacheSecurityGroup.
388
	 *
389
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
390
	 * 	<li><code>CacheSecurityGroupName</code> - <code>string</code> - Optional - The name of the Cache Security Group to return details for.</li>
391
	 * 	<li><code>MaxRecords</code> - <code>integer</code> - Optional - The maximum number of records to include in the response. If more records exist than the specified <em>MaxRecords</em> value, a marker is included in the response so that the remaining results may be retrieved. Default: 100 Constraints: minimum 20, maximum 100</li>
392
	 * 	<li><code>Marker</code> - <code>string</code> - Optional - An optional marker provided in the previous DescribeCacheClusters request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by <em>MaxRecords</em>.</li>
393
	 * 	<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>
394
	 * 	<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>
395
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
396
	 */
397
	public function describe_cache_security_groups($opt = null)
398
	{
399
		if (!$opt) $opt = array();
400
 
401
		return $this->authenticate('DescribeCacheSecurityGroups', $opt);
402
	}
403
 
404
	/**
405
	 * Returns the default engine and system parameter information for the specified cache engine.
406
	 *
407
	 * @param string $cache_parameter_group_family (Required) The name of the Cache Parameter Group Family. <p class="note">Currently, <em>memcached1.4</em> is the only cache parameter group family supported by the service.</p>
408
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
409
	 * 	<li><code>MaxRecords</code> - <code>integer</code> - Optional - The maximum number of records to include in the response. If more records exist than the specified <em>MaxRecords</em> value, a marker is included in the response so that the remaining results may be retrieved.</li>
410
	 * 	<li><code>Marker</code> - <code>string</code> - Optional - An optional marker provided in the previous DescribeCacheClusters request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by <em>MaxRecords</em>.</li>
411
	 * 	<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>
412
	 * 	<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>
413
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
414
	 */
415
	public function describe_engine_default_parameters($cache_parameter_group_family, $opt = null)
416
	{
417
		if (!$opt) $opt = array();
418
		$opt['CacheParameterGroupFamily'] = $cache_parameter_group_family;
419
 
420
		return $this->authenticate('DescribeEngineDefaultParameters', $opt);
421
	}
422
 
423
	/**
424
	 * Returns events related to Cache Clusters, Cache Security Groups, and Cache Parameter Groups for
425
	 * the past 14 days. Events specific to a particular Cache Cluster, Cache Security Group, or Cache
426
	 * Parameter Group can be obtained by providing the name as a parameter. By default, the past hour
427
	 * of events are returned.
428
	 *
429
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
430
	 * 	<li><code>SourceIdentifier</code> - <code>string</code> - Optional - The identifier of the event source for which events will be returned. If not specified, then all sources are included in the response.</li>
431
	 * 	<li><code>SourceType</code> - <code>string</code> - Optional - The event source to retrieve events for. If no value is specified, all events are returned. [Allowed values: <code>cache-cluster</code>, <code>cache-parameter-group</code>, <code>cache-security-group</code>]</li>
432
	 * 	<li><code>StartTime</code> - <code>string</code> - Optional - The beginning of the time interval to retrieve events for, specified in ISO 8601 format. May be passed as a number of seconds since UNIX Epoch, or any string compatible with <php:strtotime()>.</li>
433
	 * 	<li><code>EndTime</code> - <code>string</code> - Optional - The end of the time interval for which to retrieve events, specified in ISO 8601 format. May be passed as a number of seconds since UNIX Epoch, or any string compatible with <php:strtotime()>.</li>
434
	 * 	<li><code>Duration</code> - <code>integer</code> - Optional - The number of minutes to retrieve events for.</li>
435
	 * 	<li><code>MaxRecords</code> - <code>integer</code> - Optional - The maximum number of records to include in the response. If more records exist than the specified <em>MaxRecords</em> value, a marker is included in the response so that the remaining results may be retrieved.</li>
436
	 * 	<li><code>Marker</code> - <code>string</code> - Optional - An optional marker provided in the previous DescribeCacheClusters request. If this parameter is specified, the response includes only records beyond the marker, up to the value specified by <em>MaxRecords</em>.</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 describe_events($opt = null)
442
	{
443
		if (!$opt) $opt = array();
444
 
445
		// Optional DateTime
446
		if (isset($opt['StartTime']))
447
		{
448
			$opt['StartTime'] = $this->util->convert_date_to_iso8601($opt['StartTime']);
449
		}
450
 
451
		// Optional DateTime
452
		if (isset($opt['EndTime']))
453
		{
454
			$opt['EndTime'] = $this->util->convert_date_to_iso8601($opt['EndTime']);
455
		}
456
 
457
		return $this->authenticate('DescribeEvents', $opt);
458
	}
459
 
460
	/**
461
	 * Modifies the Cache Cluster settings. You can change one or more Cache Cluster configuration
462
	 * parameters by specifying the parameters and the new values in the request.
463
	 *
464
	 * @param string $cache_cluster_id (Required) The Cache Cluster identifier. This value is stored as a lowercase string.
465
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
466
	 * 	<li><code>NumCacheNodes</code> - <code>integer</code> - Optional - The number of Cache Nodes the Cache Cluster should have. If NumCacheNodes is greater than the existing number of Cache Nodes, Cache Nodes will be added. If NumCacheNodes is less than the existing number of Cache Nodes, Cache Nodes will be removed. When removing Cache Nodes, the Ids of the specific Cache Nodes to be removed must be supplied using the CacheNodeIdsToRemove parameter.</li>
467
	 * 	<li><code>CacheNodeIdsToRemove</code> - <code>string|array</code> - Optional - The list of Cache Node IDs to be removed. This parameter is only valid when NumCacheNodes is less than the existing number of Cache Nodes. The number of Cache Node Ids supplied in this parameter must match the difference between the existing number of Cache Nodes in the cluster and the new NumCacheNodes requested. Pass a string for a single value, or an indexed array for multiple values.</li>
468
	 * 	<li><code>CacheSecurityGroupNames</code> - <code>string|array</code> - Optional - A list of Cache Security Group Names to authorize on this Cache Cluster. This change is asynchronously applied as soon as possible. Constraints: Must contain no more than 255 alphanumeric characters. Must not be "Default". Pass a string for a single value, or an indexed array for multiple values.</li>
469
	 * 	<li><code>PreferredMaintenanceWindow</code> - <code>string</code> - Optional - The weekly time range (in UTC) during which system maintenance can occur, which may result in an outage. This change is made immediately. If moving this window to the current time, there must be at least 120 minutes between the current time and end of the window to ensure pending changes are applied.</li>
470
	 * 	<li><code>NotificationTopicArn</code> - <code>string</code> - Optional - The Amazon Resource Name (ARN) of the SNS topic to which notifications will be sent. <p class="note">The SNS topic owner must be same as the Cache Cluster owner.</p></li>
471
	 * 	<li><code>CacheParameterGroupName</code> - <code>string</code> - Optional - The name of the Cache Parameter Group to apply to this Cache Cluster. This change is asynchronously applied as soon as possible for parameters when the <em>ApplyImmediately</em> parameter is specified as <em>true</em> for this request.</li>
472
	 * 	<li><code>NotificationTopicStatus</code> - <code>string</code> - Optional - The status of the Amazon SNS notification topic. The value can be <em>active</em> or <em>inactive</em>. Notifications are sent only if the status is <em>active</em>.</li>
473
	 * 	<li><code>ApplyImmediately</code> - <code>boolean</code> - Optional - Specifies whether or not the modifications in this request and any pending modifications are asynchronously applied as soon as possible, regardless of the <em>PreferredMaintenanceWindow</em> setting for the Cache Cluster. If this parameter is passed as <code>false</code>, changes to the Cache Cluster are applied on the next maintenance reboot, or the next failure reboot, whichever occurs first. Default: <code>false</code></li>
474
	 * 	<li><code>EngineVersion</code> - <code>string</code> - Optional - The version of the cache engine to upgrade this cluster to.</li>
475
	 * 	<li><code>AutoMinorVersionUpgrade</code> - <code>boolean</code> - Optional - Indicates that minor engine upgrades will be applied automatically to the Cache Cluster during the maintenance window. Default: <code>true</code></li>
476
	 * 	<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>
477
	 * 	<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>
478
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
479
	 */
480
	public function modify_cache_cluster($cache_cluster_id, $opt = null)
481
	{
482
		if (!$opt) $opt = array();
483
		$opt['CacheClusterId'] = $cache_cluster_id;
484
 
485
		// Optional list (non-map)
486
		if (isset($opt['CacheNodeIdsToRemove']))
487
		{
488
			$opt = array_merge($opt, CFComplexType::map(array(
489
				'CacheNodeIdsToRemove' => (is_array($opt['CacheNodeIdsToRemove']) ? $opt['CacheNodeIdsToRemove'] : array($opt['CacheNodeIdsToRemove']))
490
			), 'member'));
491
			unset($opt['CacheNodeIdsToRemove']);
492
		}
493
 
494
		// Optional list (non-map)
495
		if (isset($opt['CacheSecurityGroupNames']))
496
		{
497
			$opt = array_merge($opt, CFComplexType::map(array(
498
				'CacheSecurityGroupNames' => (is_array($opt['CacheSecurityGroupNames']) ? $opt['CacheSecurityGroupNames'] : array($opt['CacheSecurityGroupNames']))
499
			), 'member'));
500
			unset($opt['CacheSecurityGroupNames']);
501
		}
502
 
503
		return $this->authenticate('ModifyCacheCluster', $opt);
504
	}
505
 
506
	/**
507
	 * Modifies the parameters of a CacheParameterGroup. To modify more than one parameter, submit a
508
	 * list of ParameterName and ParameterValue parameters. A maximum of 20 parameters can be modified
509
	 * in a single request.
510
	 *
511
	 * @param string $cache_parameter_group_name (Required) The name of the cache parameter group to modify.
512
	 * @param array $parameter_name_values (Required) An array of parameter names and values for the parameter update. At least one parameter name and value must be supplied; subsequent arguments are optional. A maximum of 20 parameters may be modified in a single request. <ul>
513
	 * 	<li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
514
	 * 		<li><code>ParameterName</code> - <code>string</code> - Optional - Specifies the name of the parameter.</li>
515
	 * 		<li><code>ParameterValue</code> - <code>string</code> - Optional - Specifies the value of the parameter.</li>
516
	 * 	</ul></li>
517
	 * </ul>
518
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
519
	 * 	<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>
520
	 * 	<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>
521
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
522
	 */
523
	public function modify_cache_parameter_group($cache_parameter_group_name, $parameter_name_values, $opt = null)
524
	{
525
		if (!$opt) $opt = array();
526
		$opt['CacheParameterGroupName'] = $cache_parameter_group_name;
527
 
528
		// Required list + map
529
		$opt = array_merge($opt, CFComplexType::map(array(
530
			'ParameterNameValues' => (is_array($parameter_name_values) ? $parameter_name_values : array($parameter_name_values))
531
		), 'member'));
532
 
533
		return $this->authenticate('ModifyCacheParameterGroup', $opt);
534
	}
535
 
536
	/**
537
	 * Reboots some (or all) of the cache cluster nodes within a previously provisioned ElastiCache
538
	 * cluster. This API results in the application of modified CacheParameterGroup parameters to the
539
	 * cache cluster. This action is taken as soon as possible, and results in a momentary outage to
540
	 * the cache cluster during which the cache cluster status is set to rebooting. During that
541
	 * momentary outage, the contents of the cache (for each cache cluster node being rebooted) are
542
	 * lost. A CacheCluster event is created when the reboot is completed.
543
	 *
544
	 * @param string $cache_cluster_id (Required) The Cache Cluster identifier. This parameter is stored as a lowercase string.
545
	 * @param string|array $cache_node_ids_to_reboot (Required) A list of Cache Cluster Node Ids to reboot. To reboot an entire cache cluster, specify all cache cluster node Ids. Pass a string for a single value, or an indexed array for multiple values.
546
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
547
	 * 	<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>
548
	 * 	<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>
549
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
550
	 */
551
	public function reboot_cache_cluster($cache_cluster_id, $cache_node_ids_to_reboot, $opt = null)
552
	{
553
		if (!$opt) $opt = array();
554
		$opt['CacheClusterId'] = $cache_cluster_id;
555
 
556
		// Required list (non-map)
557
		$opt = array_merge($opt, CFComplexType::map(array(
558
			'CacheNodeIdsToReboot' => (is_array($cache_node_ids_to_reboot) ? $cache_node_ids_to_reboot : array($cache_node_ids_to_reboot))
559
		), 'member'));
560
 
561
		return $this->authenticate('RebootCacheCluster', $opt);
562
	}
563
 
564
	/**
565
	 * Modifies the parameters of a CacheParameterGroup to the engine or system default value. To
566
	 * reset specific parameters submit a list of the parameter names. To reset the entire
567
	 * CacheParameterGroup, specify the CacheParameterGroup name and ResetAllParameters parameters.
568
	 *
569
	 * @param string $cache_parameter_group_name (Required) The name of the Cache Parameter Group.
570
	 * @param array $parameter_name_values (Required) An array of parameter names which should be reset. If not resetting the entire CacheParameterGroup, at least one parameter name must be supplied. <ul>
571
	 * 	<li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
572
	 * 		<li><code>ParameterName</code> - <code>string</code> - Optional - Specifies the name of the parameter.</li>
573
	 * 		<li><code>ParameterValue</code> - <code>string</code> - Optional - Specifies the value of the parameter.</li>
574
	 * 	</ul></li>
575
	 * </ul>
576
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
577
	 * 	<li><code>ResetAllParameters</code> - <code>boolean</code> - Optional - Specifies whether (<em>true</em>) or not (<em>false</em>) to reset all parameters in the Cache Parameter Group to default values.</li>
578
	 * 	<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>
579
	 * 	<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>
580
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
581
	 */
582
	public function reset_cache_parameter_group($cache_parameter_group_name, $parameter_name_values, $opt = null)
583
	{
584
		if (!$opt) $opt = array();
585
		$opt['CacheParameterGroupName'] = $cache_parameter_group_name;
586
 
587
		// Required list + map
588
		$opt = array_merge($opt, CFComplexType::map(array(
589
			'ParameterNameValues' => (is_array($parameter_name_values) ? $parameter_name_values : array($parameter_name_values))
590
		), 'member'));
591
 
592
		return $this->authenticate('ResetCacheParameterGroup', $opt);
593
	}
594
 
595
	/**
596
	 * Revokes ingress from a CacheSecurityGroup for previously authorized EC2 Security Groups.
597
	 *
598
	 * @param string $cache_security_group_name (Required) The name of the Cache Security Group to revoke ingress from.
599
	 * @param string $ec2_security_group_name (Required) The name of the EC2 Security Group to revoke access from.
600
	 * @param string $ec2_security_group_owner_id (Required) The AWS Account Number of the owner of the security group specified in the <em>EC2SecurityGroupName</em> parameter. The AWS Access Key ID is not an acceptable value.
601
	 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
602
	 * 	<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>
603
	 * 	<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>
604
	 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
605
	 */
606
	public function revoke_cache_security_group_ingress($cache_security_group_name, $ec2_security_group_name, $ec2_security_group_owner_id, $opt = null)
607
	{
608
		if (!$opt) $opt = array();
609
		$opt['CacheSecurityGroupName'] = $cache_security_group_name;
610
		$opt['EC2SecurityGroupName'] = $ec2_security_group_name;
611
		$opt['EC2SecurityGroupOwnerId'] = $ec2_security_group_owner_id;
612
 
613
		return $this->authenticate('RevokeCacheSecurityGroupIngress', $opt);
614
	}
615
}
616
 
617
 
618
/*%******************************************************************************************%*/
619
// EXCEPTIONS
620
 
621
class ElastiCache_Exception extends Exception {}