r101225 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101224‎ | r101225 | r101226 >
Date:22:27, 28 October 2011
Author:reedy
Status:deferred
Tags:
Comment:
aws-sdk 1.4.5
Modified paths:
  • /trunk/extensions/OpenStackManager/aws-sdk/_docs/CHANGELOG.md (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/sdk.class.php (modified) (history)
  • /trunk/extensions/OpenStackManager/aws-sdk/services/sqs.class.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenStackManager/aws-sdk/services/sqs.class.php
@@ -15,76 +15,61 @@
1616 */
1717
1818 /**
 19+ * Amazon Simple Queue Service (Amazon SQS) offers a reliable, highly scalable, hosted queue for
 20+ * storing messages as they travel between computers. By using Amazon SQS, developers can simply
 21+ * move data between distributed components of their applications that perform different tasks,
 22+ * without losing messages or requiring each component to be always available. Amazon SQS makes it
 23+ * easy to build an automated workflow, working in close conjunction with the Amazon Elastic
 24+ * Compute Cloud (Amazon EC2) and the other AWS infrastructure web services.
1925 *
 26+ * Amazon SQS works by exposing Amazon's web-scale messaging infrastructure as a web service. Any
 27+ * computer on the Internet can add or read messages without any installed software or special
 28+ * firewall configurations. Components of applications using Amazon SQS can run independently, and
 29+ * do not need to be on the same network, developed with the same technologies, or running at the
 30+ * same time.
2031 *
21 - * Amazon Simple Queue Service (Amazon SQS) offers a reliable, highly scalable, hosted queue for storing messages as they travel between
22 - * computers. By using Amazon SQS, developers can simply move data between distributed components of their applications that perform different
23 - * tasks, without losing messages or requiring each component to be always available. Amazon SQS makes it easy to build an automated workflow,
24 - * working in close conjunction with the Amazon Elastic Compute Cloud (Amazon EC2) and the other AWS infrastructure web services.
25 - *
26 - * Amazon SQS works by exposing Amazon's web-scale messaging infrastructure as a web service. Any computer on the Internet can add or read
27 - * messages without any installed software or special firewall configurations. Components of applications using Amazon SQS can run
28 - * independently, and do not need to be on the same network, developed with the same technologies, or running at the same time.
29 - *
3032 * Visit <a href="http://aws.amazon.com/sqs/">http://aws.amazon.com/sqs/</a> for more information.
3133 *
32 - * @version Thu Sep 01 21:24:22 PDT 2011
 34+ * @version 2011.10.20
3335 * @license See the included NOTICE.md file for complete information.
3436 * @copyright See the included NOTICE.md file for complete information.
35 - * @link http://aws.amazon.com/sqs/Amazon Simple Queue Service
36 - * @link http://aws.amazon.com/documentation/sqs/Amazon Simple Queue Service documentation
 37+ * @link http://aws.amazon.com/sqs/ Amazon Simple Queue Service
 38+ * @link http://aws.amazon.com/sqs/documentation/ Amazon Simple Queue Service documentation
3739 */
3840 class AmazonSQS extends CFRuntime
3941 {
40 -
4142 /*%******************************************************************************************%*/
4243 // CLASS CONSTANTS
4344
4445 /**
45 - * Specify the default queue URL.
 46+ * Specify the queue URL for the United States East (Northern Virginia) Region.
4647 */
47 - const DEFAULT_URL = 'sqs.us-east-1.amazonaws.com';
 48+ const REGION_US_E1 = 'sqs.us-east-1.amazonaws.com';
4849
4950 /**
50 - * Specify the queue URL for the US-East (Northern Virginia) Region.
 51+ * Specify the queue URL for the United States West (Northern California) Region.
5152 */
52 - const REGION_US_E1 = self::DEFAULT_URL;
53 -
54 - /**
55 - * Specify the queue URL for the US-West (Northern California) Region.
56 - */
5753 const REGION_US_W1 = 'sqs.us-west-1.amazonaws.com';
5854
5955 /**
60 - * Specify the queue URL for the EU (Ireland) Region.
 56+ * Specify the queue URL for the Europe West (Ireland) Region.
6157 */
6258 const REGION_EU_W1 = 'sqs.eu-west-1.amazonaws.com';
6359
6460 /**
65 - * Specify the queue URL for the Asia Pacific (Singapore) Region.
 61+ * Specify the queue URL for the Asia Pacific Southeast (Singapore) Region.
6662 */
6763 const REGION_APAC_SE1 = 'sqs.ap-southeast-1.amazonaws.com';
6864
6965 /**
70 - * Specify the queue URL for the Asia Pacific (Japan) Region.
 66+ * Specify the queue URL for the Asia Pacific Northeast (Tokyo) Region.
7167 */
7268 const REGION_APAC_NE1 = 'sqs.ap-northeast-1.amazonaws.com';
7369
74 -
75 - /*%******************************************************************************************%*/
76 - // SETTERS
77 -
7870 /**
79 - * This allows you to explicitly sets the region for the service to use.
80 - *
81 - * @param string $region (Required) The region to use for subsequent Amazon S3 operations. [Allowed values: `AmazonSQS::REGION_US_E1 `, `AmazonSQS::REGION_US_W1`, `AmazonSQS::REGION_EU_W1`, `AmazonSQS::REGION_APAC_SE1`]
82 - * @return $this A reference to the current instance.
 71+ * Default service endpoint.
8372 */
84 - public function set_region($region)
85 - {
86 - $this->set_hostname($region);
87 - return $this;
88 - }
 73+ const DEFAULT_URL = self::REGION_US_E1;
8974
9075
9176 /*%******************************************************************************************%*/
@@ -166,7 +151,7 @@
167152 */
168153 public function __construct($key = null, $secret_key = null, $token = null)
169154 {
170 - $this->api_version = '2009-02-01';
 155+ $this->api_version = '2011-10-01';
171156 $this->hostname = self::DEFAULT_URL;
172157
173158 if (!$key && !defined('AWS_KEY'))
@@ -193,73 +178,96 @@
194179
195180
196181 /*%******************************************************************************************%*/
197 - // SERVICE METHODS
 182+ // SETTERS
198183
199184 /**
 185+ * This allows you to explicitly sets the region for the service to use.
200186 *
201 - * Returns a list of your queues.
202 - *
203 - * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
204 - * <li><code>QueueNamePrefix</code> - <code>string</code> - Optional - A string to use for filtering the list results. Only those queues whose name begins with the specified string are returned. </li>
205 - * <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>
206 - * <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>
207 - * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
 187+ * @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>.
 188+ * @return $this A reference to the current instance.
208189 */
209 - public function list_queues($opt = null)
 190+ public function set_region($region)
210191 {
211 - if (!$opt) $opt = array();
212 -
213 - return $this->authenticate('ListQueues', $opt, $this->hostname);
 192+ $this->set_hostname($region);
 193+ return $this;
214194 }
215195
 196+
 197+ /*%******************************************************************************************%*/
 198+ // SERVICE METHODS
 199+
216200 /**
 201+ * The AddPermission action adds a permission to a queue for a specific <a href=
 202+ * "http://docs.amazonwebservices.com/AWSSimpleQueueService/latest/APIReference/Glossary.html#d0e3892">
 203+ * principal</a>. This allows for sharing access to the queue.
217204 *
218 - * Sets an attribute of a queue. Currently, you can set only the <code>VisibilityTimeout</code> attribute for a queue.
 205+ * When you create a queue, you have full control access rights for the queue. Only you (as owner
 206+ * of the queue) can grant or deny permissions to the queue. For more information about these
 207+ * permissions, see <a href=
 208+ * "http://docs.amazonwebservices.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/?acp-overview.html">
 209+ * Shared Queues</a> in the Amazon SQS Developer Guide.
219210 *
 211+ * <code>AddPermission</code> writes an SQS-generated policy. If you want to write your own
 212+ * policy, use SetQueueAttributes to upload your policy. For more information about writing your
 213+ * own policy, see <a href=
 214+ * "http://docs.amazonwebservices.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/?AccessPolicyLanguage.html">
 215+ * Appendix: The Access Policy Language</a> in the Amazon SQS Developer Guide.
 216+ *
220217 * @param string $queue_url (Required) The URL of the SQS queue to take action on.
221 - * @param array $attribute (Required) A list of attributes to set. <ul>
222 - * <li><code>x</code> - <code>array</code> - This represents a simple array index. <ul>
223 - * <li><code>Name</code> - <code>string</code> - Optional - The name of the queue attribute to set a custom value for. [Allowed values: <code>Policy</code>, <code>VisibilityTimeout</code>, <code>MaximumMessageSize</code>, <code>MessageRetentionPeriod</code>, <code>ApproximateNumberOfMessages</code>, <code>ApproximateNumberOfMessagesNotVisible</code>, <code>CreatedTimestamp</code>, <code>LastModifiedTimestamp</code>]</li>
224 - * <li><code>Value</code> - <code>string</code> - Optional - The custom value to assign for the matching attribute key. </li>
225 - * </ul></li>
226 - * </ul>
 218+ * @param string $label (Required) The unique identification of the permission you're setting (e.g., <code>AliceSendMessage</code>). Constraints: Maximum 80 characters; alphanumeric characters, hyphens (-), and underscores (_) are allowed.
 219+ * @param string|array $aws_account_id (Required) The AWS account number of the <a href="http://docs.amazonwebservices.com/AWSSimpleQueueService/latest/APIReference/Glossary.html">principal</a> who will be given permission. The principal must have an AWS account, but does not need to be signed up for Amazon SQS. Pass a string for a single value, or an indexed array for multiple values.
 220+ * @param string|array $action_name (Required) The action the client wants to allow for the specified principal. Pass a string for a single value, or an indexed array for multiple values.
227221 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
228222 * <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>
229223 * <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>
230224 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
231225 */
232 - public function set_queue_attributes($queue_url, $attribute, $opt = null)
 226+ public function add_permission($queue_url, $label, $aws_account_id, $action_name, $opt = null)
233227 {
234228 if (!$opt) $opt = array();
 229+ $opt['Label'] = $label;
235230
236 - // Required parameter
 231+ // Required list (non-map)
237232 $opt = array_merge($opt, CFComplexType::map(array(
238 - 'Attribute' => (is_array($attribute) ? $attribute : array($attribute))
 233+ 'AWSAccountId' => (is_array($aws_account_id) ? $aws_account_id : array($aws_account_id))
239234 )));
240235
241 - return $this->authenticate('SetQueueAttributes', $opt, $queue_url);
 236+ // Required list (non-map)
 237+ $opt = array_merge($opt, CFComplexType::map(array(
 238+ 'ActionName' => (is_array($action_name) ? $action_name : array($action_name))
 239+ )));
 240+
 241+ return $this->authenticate('AddPermission', $opt, $queue_url);
242242 }
243243
244244 /**
 245+ * The <code>ChangeMessageVisibility</code> action changes the visibility timeout of a specified
 246+ * message in a queue to a new value. The maximum allowed timeout value you can set the value to
 247+ * is 12 hours. This means you can't extend the timeout of a message in an existing queue to more
 248+ * than a total visibility timeout of 12 hours. (For more information visibility timeout, see
 249+ * <a href=
 250+ * "http://docs.amazonwebservices.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html">
 251+ * Visibility Timeout</a> in the Amazon SQS Developer Guide.)
245252 *
246 - * The <code>ChangeMessageVisibility</code> action changes the visibility timeout of a specified message in a queue to a new value. The maximum
247 - * allowed timeout value you can set the value to is 12 hours. This means you can't extend the timeout of a message in an existing queue to
248 - * more than a total visibility timeout of 12 hours. (For more information visibility timeout, see <a
249 - * href="http://docs.amazonwebservices.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/AboutVT.html">Visibility Timeout</a> in the Amazon
250 - * SQS Developer Guide.)
 253+ * For example, let's say you have a message and its default message visibility timeout is 30
 254+ * minutes. You could call <code>ChangeMessageVisiblity</code> with a value of two hours and the
 255+ * effective timeout would be two hours and 30 minutes. When that time comes near you could again
 256+ * extend the time out by calling ChangeMessageVisiblity, but this time the maximum allowed
 257+ * timeout would be 9 hours and 30 minutes.
251258 *
252 - * For example, let's say you have a message and its default message visibility timeout is 30 minutes. You could call
253 - * <code>ChangeMessageVisiblity</code> with a value of two hours and the effective timeout would be two hours and 30 minutes. When that time
254 - * comes near you could again extend the time out by calling ChangeMessageVisiblity, but this time the maximum allowed timeout would be 9 hours
255 - * and 30 minutes.
 259+ * <p class="important">
 260+ * If you attempt to set the <code>VisibilityTimeout</code> to an amount more than the maximum
 261+ * time left, Amazon SQS returns an error. It will not automatically recalculate and increase the
 262+ * timeout to the maximum time remaining.
 263+ * </p>
 264+ * <p class="important">
 265+ * Unlike with a queue, when you change the visibility timeout for a specific message, that
 266+ * timeout value is applied immediately but is not saved in memory for that message. If you don't
 267+ * delete a message after it is received, the visibility timeout for the message the next time it
 268+ * is received reverts to the original timeout value, not the value you set with the
 269+ * ChangeMessageVisibility action.
 270+ * </p>
256271 *
257 - * If you attempt to set the <code>VisibilityTimeout</code> to an amount more than the maximum time left, Amazon SQS returns an error. It will
258 - * not automatically recalculate and increase the timeout to the maximum time remaining.
259 - *
260 - * Unlike with a queue, when you change the visibility timeout for a specific message, that timeout value is applied immediately but is not
261 - * saved in memory for that message. If you don't delete a message after it is received, the visibility timeout for the message the next time
262 - * it is received reverts to the original timeout value, not the value you set with the ChangeMessageVisibility action.
263 - *
264272 * @param string $queue_url (Required) The URL of the SQS queue to take action on.
265273 * @param string $receipt_handle (Required) The receipt handle associated with the message whose visibility timeout should be changed.
266274 * @param integer $visibility_timeout (Required) The new value (in seconds) for the message's visibility timeout.
@@ -278,18 +286,56 @@
279287 }
280288
281289 /**
 290+ * This is a batch version of <code>ChangeMessageVisibility</code>. It takes multiple receipt
 291+ * handles and performs the operation on each of the them. The result of the operation on each
 292+ * message is reported individually in the response.
282293 *
283 - * The <code>CreateQueue</code> action creates a new queue, or returns the URL of an existing one. When you request <code>CreateQueue</code>,
284 - * you provide a name for the queue. To successfully create a new queue, you must provide a name that is unique within the scope of your own
285 - * queues. If you provide the name of an existing queue, a new queue isn't created and an error isn't returned. Instead, the request succeeds
286 - * and the queue URL for the existing queue is returned.
 294+ * @param string $queue_url (Required) The URL of the SQS queue to take action on.
 295+ * @param array $change_message_visibility_batch_request_entry (Required) A list of receipt handles of the messages for which the visibility timeout must be changed. <ul>
 296+ * <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
 297+ * <li><code>Id</code> - <code>string</code> - Required - An identifier for this particular receipt handle. This is used to communicate the result. Note that the <code>Id</code> s of a batch request need to be unique within the request.</li>
 298+ * <li><code>ReceiptHandle</code> - <code>string</code> - Required - A receipt handle.</li>
 299+ * <li><code>VisibilityTimeout</code> - <code>integer</code> - Optional - The new value (in seconds) for the message's visibility timeout.</li>
 300+ * </ul></li>
 301+ * </ul>
 302+ * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
 303+ * <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>
 304+ * <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>
 305+ * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
 306+ */
 307+ public function change_message_visibility_batch($queue_url, $change_message_visibility_batch_request_entry, $opt = null)
 308+ {
 309+ if (!$opt) $opt = array();
 310+
 311+ // Required list + map
 312+ $opt = array_merge($opt, CFComplexType::map(array(
 313+ 'ChangeMessageVisibilityBatchRequestEntry' => (is_array($change_message_visibility_batch_request_entry) ? $change_message_visibility_batch_request_entry : array($change_message_visibility_batch_request_entry))
 314+ )));
 315+
 316+ return $this->authenticate('ChangeMessageVisibilityBatch', $opt, $queue_url);
 317+ }
 318+
 319+ /**
 320+ * The <code>CreateQueue</code> action creates a new queue, or returns the URL of an existing one.
 321+ * When you request <code>CreateQueue</code>, you provide a name for the queue. To successfully
 322+ * create a new queue, you must provide a name that is unique within the scope of your own queues.
287323 *
288 - * If you provide a value for <code>DefaultVisibilityTimeout</code> that is different from the value for the existing queue, you receive an
289 - * error.
 324+ * You may pass one or more attributes in the request. If you do not provide a value for any
 325+ * attribute, the queue will have the default value for that attribute. Permitted attributes are
 326+ * the same that can be set using <code>SetQueueAttributes</code>.
290327 *
 328+ * If you provide the name of an existing queue, a new queue isn't created. If the values of
 329+ * attributes provided with the request match up with those on the existing queue, the queue URL
 330+ * is returned. Otherwise, a <code>QueueNameExists</code> error is returned.
 331+ *
291332 * @param string $queue_name (Required) The name for the queue to be created.
292333 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
293 - * <li><code>DefaultVisibilityTimeout</code> - <code>integer</code> - Optional - The visibility timeout (in seconds) to use for the created queue. </li>
 334+ * <li><code>Attribute</code> - <code>array</code> - Optional - A map of attributes with their corresponding values. <ul>
 335+ * <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
 336+ * <li><code>Name</code> - <code>string</code> - Optional - The name of a queue attribute. [Allowed values: <code>Policy</code>, <code>VisibilityTimeout</code>, <code>MaximumMessageSize</code>, <code>MessageRetentionPeriod</code>, <code>ApproximateNumberOfMessages</code>, <code>ApproximateNumberOfMessagesNotVisible</code>, <code>CreatedTimestamp</code>, <code>LastModifiedTimestamp</code>, <code>QueueArn</code>, <code>ApproximateNumberOfMessagesDelayed</code>, <code>DelaySeconds</code>]</li>
 337+ * <li><code>Value</code> - <code>string</code> - Optional - The value of a queue attribute.</li>
 338+ * </ul></li>
 339+ * </ul></li>
294340 * <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>
295341 * <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>
296342 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
@@ -299,46 +345,128 @@
300346 if (!$opt) $opt = array();
301347 $opt['QueueName'] = $queue_name;
302348
 349+ // Optional map (non-list)
 350+ if (isset($opt['Attribute']))
 351+ {
 352+ $opt = array_merge($opt, CFComplexType::map(array(
 353+ 'Attribute' => $opt['Attribute']
 354+ )));
 355+ unset($opt['Attribute']);
 356+ }
 357+
303358 return $this->authenticate('CreateQueue', $opt, $this->hostname);
304359 }
305360
306361 /**
 362+ * The <code>DeleteMessage</code> action unconditionally removes the specified message from the
 363+ * specified queue. Even if the message is locked by another reader due to the visibility timeout
 364+ * setting, it is still deleted from the queue.
307365 *
308 - * The <code>RemovePermission</code> action revokes any permissions in the queue policy that matches the specified <code>Label</code>
309 - * parameter. Only the owner of the queue can remove permissions.
 366+ * @param string $queue_url (Required) The URL of the SQS queue to take action on.
 367+ * @param string $receipt_handle (Required) The receipt handle associated with the message to delete.
 368+ * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
 369+ * <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>
 370+ * <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>
 371+ * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
 372+ */
 373+ public function delete_message($queue_url, $receipt_handle, $opt = null)
 374+ {
 375+ if (!$opt) $opt = array();
 376+ $opt['ReceiptHandle'] = $receipt_handle;
 377+
 378+ return $this->authenticate('DeleteMessage', $opt, $queue_url);
 379+ }
 380+
 381+ /**
 382+ * This is a batch version of <code>DeleteMessage</code>. It takes multiple receipt handles and
 383+ * deletes each one of the messages. The result of the delete operation on each message is
 384+ * reported individually in the response.
310385 *
311386 * @param string $queue_url (Required) The URL of the SQS queue to take action on.
312 - * @param string $label (Required) The identfication of the permission to remove. This is the label added with the AddPermission operation.
 387+ * @param array $delete_message_batch_request_entry (Required) A list of receipt handles for the messages to be deleted. <ul>
 388+ * <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
 389+ * <li><code>Id</code> - <code>string</code> - Required - An identifier for this particular receipt handle. This is used to communicate the result. Note that the <code>Id</code> s of a batch request need to be unique within the request.</li>
 390+ * <li><code>ReceiptHandle</code> - <code>string</code> - Required - A receipt handle.</li>
 391+ * </ul></li>
 392+ * </ul>
313393 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
314394 * <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>
315395 * <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>
316396 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
317397 */
318 - public function remove_permission($queue_url, $label, $opt = null)
 398+ public function delete_message_batch($queue_url, $delete_message_batch_request_entry, $opt = null)
319399 {
320400 if (!$opt) $opt = array();
321 - $opt['Label'] = $label;
322401
323 - return $this->authenticate('RemovePermission', $opt, $queue_url);
 402+ // Required list + map
 403+ $opt = array_merge($opt, CFComplexType::map(array(
 404+ 'DeleteMessageBatchRequestEntry' => (is_array($delete_message_batch_request_entry) ? $delete_message_batch_request_entry : array($delete_message_batch_request_entry))
 405+ )));
 406+
 407+ return $this->authenticate('DeleteMessageBatch', $opt, $queue_url);
324408 }
325409
326410 /**
 411+ * This action unconditionally deletes the queue specified by the queue URL. Use this operation
 412+ * WITH CARE! The queue is deleted even if it is NOT empty.
327413 *
328 - * Gets one or all attributes of a queue. Queues currently have two attributes you can get: <code>ApproximateNumberOfMessages</code> and
329 - * <code>VisibilityTimeout</code>.
 414+ * Once a queue has been deleted, the queue name is unavailable for use with new queues for 60
 415+ * seconds.
330416 *
331417 * @param string $queue_url (Required) The URL of the SQS queue to take action on.
332418 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
333 - * <li><code>AttributeName</code> - <code>string|array</code> - Optional - A list of attributes to retrieve information for. Pass a string for a single value, or an indexed array for multiple values. </li>
334419 * <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>
335420 * <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>
336421 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
337422 */
 423+ public function delete_queue($queue_url, $opt = null)
 424+ {
 425+ if (!$opt) $opt = array();
 426+
 427+ return $this->authenticate('DeleteQueue', $opt, $queue_url);
 428+ }
 429+
 430+ /**
 431+ * Gets attributes for the specified queue. The following attributes are supported:
 432+ *
 433+ * <ul>
 434+ * <li><code>All</code> - returns all values.</li>
 435+ * <li><code>ApproximateNumberOfMessages</code> - returns the approximate number of visible
 436+ * messages in a queue. For more information, see Resources Required to Process Messages in
 437+ * the Amazon SQS Developer Guide.</li>
 438+ * <li><code>ApproximateNumberOfMessagesNotVisible</code> - returns the approximate number of
 439+ * messages that are not timed-out and not deleted. For more information, see Resources
 440+ * Required to Process Messages in the Amazon SQS Developer Guide.</li>
 441+ * <li><code>VisibilityTimeout</code> - returns the visibility timeout for the queue. For more
 442+ * information about visibility timeout, see Visibility Timeout in the Amazon SQS Developer
 443+ * Guide.</li>
 444+ * <li><code>CreatedTimestamp</code> - returns the time when the queue was created (epoch time in
 445+ * seconds).</li>
 446+ * <li><code>LastModifiedTimestamp</code> - returns the time when the queue was last changed
 447+ * (epoch time in seconds).</li>
 448+ * <li><code>Policy</code> - returns the queue's policy.</li>
 449+ * <li><code>MaximumMessageSize</code> - returns the limit of how many bytes a message can contain
 450+ * before Amazon SQS rejects it.</li>
 451+ * <li><code>MessageRetentionPeriod</code> - returns the number of seconds Amazon SQS retains a
 452+ * message.</li>
 453+ * <li><code>QueueArn</code> - returns the queue's Amazon resource name (ARN).</li>
 454+ * <li><code>ApproximateNumberOfMessagesDelayed</code> - returns the approximate number of
 455+ * messages that are pending to be added to the queue.</li>
 456+ * <li><code>DelaySeconds</code> - returns the default delay on the queue in seconds.</li>
 457+ * </ul>
 458+ *
 459+ * @param string $queue_url (Required) The URL of the SQS queue to take action on.
 460+ * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
 461+ * <li><code>AttributeName</code> - <code>string|array</code> - Optional - A list of attributes to retrieve information for. Pass a string for a single value, or an indexed array for multiple values.</li>
 462+ * <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>
 463+ * <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>
 464+ * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
 465+ */
338466 public function get_queue_attributes($queue_url, $opt = null)
339467 {
340468 if (!$opt) $opt = array();
341469
342 - // Optional parameter
 470+ // Optional list (non-map)
343471 if (isset($opt['AttributeName']))
344472 {
345473 $opt = array_merge($opt, CFComplexType::map(array(
@@ -351,95 +479,99 @@
352480 }
353481
354482 /**
 483+ * The <code>GetQueueUrl</code> action returns the URL of an existing queue.
355484 *
356 - * The AddPermission action adds a permission to a queue for a specific <a
357 - * href="http://docs.amazonwebservices.com/AWSSimpleQueueService/latest/APIReference/Glossary.html#d0e3892">principal</a>. This allows for
358 - * sharing access to the queue.
359 - *
360 - * When you create a queue, you have full control access rights for the queue. Only you (as owner of the queue) can grant or deny permissions
361 - * to the queue. For more information about these permissions, see <a
362 - * href="http://docs.amazonwebservices.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/?acp-overview.html">Shared Queues</a> in the Amazon
363 - * SQS Developer Guide.
364 - *
365 - * <code>AddPermission</code> writes an SQS-generated policy. If you want to write your own policy, use SetQueueAttributes to upload your
366 - * policy. For more information about writing your own policy, see <a
367 - * href="http://docs.amazonwebservices.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/?AccessPolicyLanguage.html">Appendix: The Access
368 - * Policy Language</a> in the Amazon SQS Developer Guide.
369 - *
370 - * @param string $queue_url (Required) The URL of the SQS queue to take action on.
371 - * @param string $label (Required) The unique identification of the permission you're setting (e.g., <code>AliceSendMessage</code>). Constraints: Maximum 80 characters; alphanumeric characters, hyphens (-), and underscores (_) are allowed.
372 - * @param string|array $account_id (Required) The AWS account number of the principal who will be given permission. The principal must have an AWS account, but does not need to be signed up for Amazon SQS. Pass a string for a single value, or an indexed array for multiple values.
373 - * @param string|array $action_name (Required) The action the client wants to allow for the specified principal. Pass a string for a single value, or an indexed array for multiple values.
 485+ * @param string $queue_name (Required) The name of the queue whose URL must be fetched.
374486 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
 487+ * <li><code>QueueOwnerAWSAccountId</code> - <code>string</code> - Optional - The AWS account number of the queue's owner.</li>
375488 * <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>
376489 * <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>
377490 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
378491 */
379 - public function add_permission($queue_url, $label, $account_id, $action_name, $opt = null)
 492+ public function get_queue_url($queue_name, $opt = null)
380493 {
381494 if (!$opt) $opt = array();
382 - $opt['Label'] = $label;
 495+ $opt['QueueName'] = $queue_name;
383496
384 - // Required parameter
385 - $opt = array_merge($opt, CFComplexType::map(array(
386 - 'AWSAccountId' => (is_array($account_id) ? $account_id : array($account_id))
387 - )));
 497+ return $this->authenticate('GetQueueUrl', $opt, $this->hostname);
 498+ }
388499
389 - // Required parameter
390 - $opt = array_merge($opt, CFComplexType::map(array(
391 - 'ActionName' => (is_array($action_name) ? $action_name : array($action_name))
392 - )));
 500+ /**
 501+ * Returns a list of your queues.
 502+ *
 503+ * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
 504+ * <li><code>QueueNamePrefix</code> - <code>string</code> - Optional - A string to use for filtering the list results. Only those queues whose name begins with the specified string are returned.</li>
 505+ * <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>
 506+ * <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>
 507+ * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
 508+ */
 509+ public function list_queues($opt = null)
 510+ {
 511+ if (!$opt) $opt = array();
393512
394 - return $this->authenticate('AddPermission', $opt, $queue_url);
 513+ return $this->authenticate('ListQueues', $opt, $this->hostname);
395514 }
396515
397516 /**
 517+ * Retrieves one or more messages from the specified queue, including the message body and message
 518+ * ID of each message. Messages returned by this action stay in the queue until you delete them.
 519+ * However, once a message is returned to a <code>ReceiveMessage</code> request, it is not
 520+ * returned on subsequent <code>ReceiveMessage</code> requests for the duration of the
 521+ * <code>VisibilityTimeout</code>. If you do not specify a <code>VisibilityTimeout</code> in the
 522+ * request, the overall visibility timeout for the queue is used for the returned messages.
398523 *
399 - * This action unconditionally deletes the queue specified by the queue URL. Use this operation WITH CARE! The queue is deleted even if it is
400 - * NOT empty.
401 - *
402 - * Once a queue has been deleted, the queue name is unavailable for use with new queues for 60 seconds.
403 - *
404524 * @param string $queue_url (Required) The URL of the SQS queue to take action on.
405525 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
 526+ * <li><code>AttributeName</code> - <code>string|array</code> - Optional - A list of attributes to retrieve information for. Pass a string for a single value, or an indexed array for multiple values.</li>
 527+ * <li><code>MaxNumberOfMessages</code> - <code>integer</code> - Optional - The maximum number of messages to return. Amazon SQS never returns more messages than this value but may return fewer. All of the messages are not necessarily returned.</li>
 528+ * <li><code>VisibilityTimeout</code> - <code>integer</code> - Optional - The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a <code>ReceiveMessage</code> request.</li>
406529 * <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>
407530 * <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>
408531 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
409532 */
410 - public function delete_queue($queue_url, $opt = null)
 533+ public function receive_message($queue_url, $opt = null)
411534 {
412535 if (!$opt) $opt = array();
413536
414 - return $this->authenticate('DeleteQueue', $opt, $queue_url);
 537+ // Optional list (non-map)
 538+ if (isset($opt['AttributeName']))
 539+ {
 540+ $opt = array_merge($opt, CFComplexType::map(array(
 541+ 'AttributeName' => (is_array($opt['AttributeName']) ? $opt['AttributeName'] : array($opt['AttributeName']))
 542+ )));
 543+ unset($opt['AttributeName']);
 544+ }
 545+
 546+ return $this->authenticate('ReceiveMessage', $opt, $queue_url);
415547 }
416548
417549 /**
 550+ * The <code>RemovePermission</code> action revokes any permissions in the queue policy that
 551+ * matches the specified <code>Label</code> parameter. Only the owner of the queue can remove
 552+ * permissions.
418553 *
419 - * The <code>DeleteMessage</code> action unconditionally removes the specified message from the specified queue. Even if the message is locked
420 - * by another reader due to the visibility timeout setting, it is still deleted from the queue.
421 - *
422554 * @param string $queue_url (Required) The URL of the SQS queue to take action on.
423 - * @param string $receipt_handle (Required) The receipt handle associated with the message to delete.
 555+ * @param string $label (Required) The identification of the permission to remove. This is the label added with the <code>AddPermission</code> operation.
424556 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
425557 * <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>
426558 * <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>
427559 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
428560 */
429 - public function delete_message($queue_url, $receipt_handle, $opt = null)
 561+ public function remove_permission($queue_url, $label, $opt = null)
430562 {
431563 if (!$opt) $opt = array();
432 - $opt['ReceiptHandle'] = $receipt_handle;
 564+ $opt['Label'] = $label;
433565
434 - return $this->authenticate('DeleteMessage', $opt, $queue_url);
 566+ return $this->authenticate('RemovePermission', $opt, $queue_url);
435567 }
436568
437569 /**
438 - *
439570 * The <code>SendMessage</code> action delivers a message to the specified queue.
440571 *
441572 * @param string $queue_url (Required) The URL of the SQS queue to take action on.
442573 * @param string $message_body (Required) The message to send.
443574 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
 575+ * <li><code>DelaySeconds</code> - <code>integer</code> - Optional - The number of seconds the message has to be delayed.</li>
444576 * <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>
445577 * <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>
446578 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
@@ -453,35 +585,61 @@
454586 }
455587
456588 /**
 589+ * This is a batch version of <code>SendMessage</code>. It takes multiple messages and adds each
 590+ * of them to the queue. The result of each add operation is reported individually in the
 591+ * response.
457592 *
458 - * Retrieves one or more messages from the specified queue, including the message body and message ID of each message. Messages returned by
459 - * this action stay in the queue until you delete them. However, once a message is returned to a <code>ReceiveMessage</code> request, it is not
460 - * returned on subsequent <code>ReceiveMessage</code> requests for the duration of the <code>VisibilityTimeout</code>. If you do not specify a
461 - * <code>VisibilityTimeout</code> in the request, the overall visibility timeout for the queue is used for the returned messages.
 593+ * @param string $queue_url (Required) The URL of the SQS queue to take action on.
 594+ * @param array $send_message_batch_request_entry (Required) A list of <code>SendMessageBatchRequestEntry</code> s. <ul>
 595+ * <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
 596+ * <li><code>Id</code> - <code>string</code> - Required - An identifier for the message in this batch. This is used to communicate the result. Note that the the <code>Id</code> s of a batch request need to be unique within the request.</li>
 597+ * <li><code>MessageBody</code> - <code>string</code> - Required - Body of the message.</li>
 598+ * <li><code>DelaySeconds</code> - <code>integer</code> - Optional - The number of seconds for which the message has to be delayed.</li>
 599+ * </ul></li>
 600+ * </ul>
 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 send_message_batch($queue_url, $send_message_batch_request_entry, $opt = null)
 607+ {
 608+ if (!$opt) $opt = array();
 609+
 610+ // Required list + map
 611+ $opt = array_merge($opt, CFComplexType::map(array(
 612+ 'SendMessageBatchRequestEntry' => (is_array($send_message_batch_request_entry) ? $send_message_batch_request_entry : array($send_message_batch_request_entry))
 613+ )));
 614+
 615+ return $this->authenticate('SendMessageBatch', $opt, $queue_url);
 616+ }
 617+
 618+ /**
 619+ * Sets an attribute of a queue. The set of attributes that can be set are - DelaySeconds,
 620+ * MessageRetentionPeriod, MaximumMessageSize, VisibilityTimeout and Policy.
462621 *
463622 * @param string $queue_url (Required) The URL of the SQS queue to take action on.
 623+ * @param array $attribute (Required) A map of attributes to set. <ul>
 624+ * <li><code>x</code> - <code>array</code> - Optional - This represents a simple array index. <ul>
 625+ * <li><code>Name</code> - <code>string</code> - Optional - The name of a queue attribute. [Allowed values: <code>Policy</code>, <code>VisibilityTimeout</code>, <code>MaximumMessageSize</code>, <code>MessageRetentionPeriod</code>, <code>ApproximateNumberOfMessages</code>, <code>ApproximateNumberOfMessagesNotVisible</code>, <code>CreatedTimestamp</code>, <code>LastModifiedTimestamp</code>, <code>QueueArn</code>, <code>ApproximateNumberOfMessagesDelayed</code>, <code>DelaySeconds</code>]</li>
 626+ * <li><code>Value</code> - <code>string</code> - Optional - The value of a queue attribute.</li>
 627+ * </ul></li>
 628+ * </ul>
464629 * @param array $opt (Optional) An associative array of parameters that can have the following keys: <ul>
465 - * <li><code>AttributeName</code> - <code>string|array</code> - Optional - A list of attributes to retrieve information for. Pass a string for a single value, or an indexed array for multiple values. </li>
466 - * <li><code>MaxNumberOfMessages</code> - <code>integer</code> - Optional - The maximum number of messages to return. Amazon SQS never returns more messages than this value but may return fewer. All of the messages are not necessarily returned. </li>
467 - * <li><code>VisibilityTimeout</code> - <code>integer</code> - Optional - The duration (in seconds) that the received messages are hidden from subsequent retrieve requests after being retrieved by a <code>ReceiveMessage</code> request. </li>
468630 * <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>
469631 * <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>
470632 * @return CFResponse A <CFResponse> object containing a parsed HTTP response.
471633 */
472 - public function receive_message($queue_url, $opt = null)
 634+ public function set_queue_attributes($queue_url, $attribute, $opt = null)
473635 {
474636 if (!$opt) $opt = array();
475637
476 - // Optional parameter
477 - if (isset($opt['AttributeName']))
478 - {
479 - $opt = array_merge($opt, CFComplexType::map(array(
480 - 'AttributeName' => (is_array($opt['AttributeName']) ? $opt['AttributeName'] : array($opt['AttributeName']))
481 - )));
482 - unset($opt['AttributeName']);
483 - }
 638+ // Required list + map
 639+ $opt = array_merge($opt, CFComplexType::map(array(
 640+ 'Attribute' => (is_array($attribute) ? $attribute : array($attribute))
 641+ )));
484642
485 - return $this->authenticate('ReceiveMessage', $opt, $queue_url);
 643+ return $this->authenticate('SetQueueAttributes', $opt, $queue_url);
486644 }
487645 }
488646
@@ -489,7 +647,4 @@
490648 /*%******************************************************************************************%*/
491649 // EXCEPTIONS
492650
493 -/**
494 - * Default SQS Exception.
495 - */
496 -class SQS_Exception extends Exception {}
\ No newline at end of file
 651+class SQS_Exception extends Exception {}
Index: trunk/extensions/OpenStackManager/aws-sdk/_docs/CHANGELOG.md
@@ -1,3 +1,15 @@
 2+# Changelog: 1.4.5 "Weiss"
 3+<http://finalfantasy.wikia.com/wiki/Weiss>
 4+
 5+Launched Friday, October 21, 2011
 6+
 7+## Service Classes
 8+### AmazonSQS
 9+* **New:** Support for delayed queues and batch operations has been added to the SDK.
 10+
 11+
 12+----
 13+
214 # Changelog: 1.4.4 "Vaan"
315 <http://finalfantasy.wikia.com/wiki/Vaan>
416
Index: trunk/extensions/OpenStackManager/aws-sdk/sdk.class.php
@@ -125,9 +125,9 @@
126126 // INTERMEDIARY CONSTANTS
127127
128128 define('CFRUNTIME_NAME', 'aws-sdk-php');
129 -define('CFRUNTIME_VERSION', '1.4.4');
 129+define('CFRUNTIME_VERSION', '1.4.5');
130130 // define('CFRUNTIME_BUILD', gmdate('YmdHis', filemtime(__FILE__))); // @todo: Hardcode for release.
131 -define('CFRUNTIME_BUILD', '20111012191027');
 131+define('CFRUNTIME_BUILD', '20111021191027');
132132 define('CFRUNTIME_USERAGENT', CFRUNTIME_NAME . '/' . CFRUNTIME_VERSION . ' PHP/' . PHP_VERSION . ' ' . str_replace(' ', '_', php_uname('s')) . '/' . str_replace(' ', '_', php_uname('r')) . ' Arch/' . php_uname('m') . ' SAPI/' . php_sapi_name() . ' Integer/' . PHP_INT_MAX . ' Build/' . CFRUNTIME_BUILD . __aws_sdk_ua_callback());
133133
134134

Status & tagging log