aws-sdk 1.2.5 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (278) hide show
  1. data/NOTICE.txt +1 -1
  2. data/lib/aws-sdk.rb +1 -1
  3. data/lib/aws.rb +1 -1
  4. data/lib/aws/api_config/EC2-2011-02-28.yml +1 -1
  5. data/lib/aws/api_config/ELB-2011-08-15.yml +1 -1
  6. data/lib/aws/api_config/IAM-2010-07-15.yml +1 -1
  7. data/lib/aws/api_config/SNS-2010-03-31.yml +1 -1
  8. data/lib/aws/api_config/{SQS-2009-02-01.yml → SQS-2011-10-01.yml} +117 -3
  9. data/lib/aws/api_config/STS-2011-06-15.yml +1 -1
  10. data/lib/aws/api_config/SimpleDB-2009-04-15.yml +1 -1
  11. data/lib/aws/api_config/SimpleEmailService-2010-12-01.yml +1 -1
  12. data/lib/aws/core.rb +4 -3
  13. data/lib/aws/core/api_config.rb +1 -1
  14. data/lib/aws/core/async_handle.rb +1 -1
  15. data/lib/aws/core/authorize_v2.rb +1 -1
  16. data/lib/aws/core/authorize_v3.rb +1 -1
  17. data/lib/aws/core/authorize_with_session_token.rb +1 -1
  18. data/lib/aws/core/autoloader.rb +1 -1
  19. data/lib/aws/core/cacheable.rb +1 -1
  20. data/lib/aws/core/client.rb +1 -1
  21. data/lib/aws/core/client_logging.rb +7 -5
  22. data/lib/aws/core/collection.rb +1 -1
  23. data/lib/aws/core/collection/batchable.rb +1 -1
  24. data/lib/aws/core/collection/limitable.rb +1 -1
  25. data/lib/aws/core/collection/simple.rb +1 -1
  26. data/lib/aws/core/configuration.rb +1 -1
  27. data/lib/aws/core/configured_client_methods.rb +1 -1
  28. data/lib/aws/core/configured_grammars.rb +1 -1
  29. data/lib/aws/core/configured_option_grammars.rb +1 -1
  30. data/lib/aws/core/configured_xml_grammars.rb +1 -1
  31. data/lib/aws/core/default_signer.rb +1 -1
  32. data/lib/aws/core/http/curb_handler.rb +1 -1
  33. data/lib/aws/core/http/handler.rb +1 -1
  34. data/lib/aws/core/http/httparty_handler.rb +1 -1
  35. data/lib/aws/core/http/net_http_handler.rb +1 -1
  36. data/lib/aws/core/http/request.rb +5 -14
  37. data/lib/aws/core/http/response.rb +1 -1
  38. data/lib/aws/core/ignore_result_element.rb +1 -1
  39. data/lib/aws/core/indifferent_hash.rb +1 -1
  40. data/lib/aws/core/inflection.rb +1 -1
  41. data/lib/aws/core/lazy_error_classes.rb +1 -1
  42. data/lib/aws/core/meta_utils.rb +1 -1
  43. data/lib/aws/core/model.rb +1 -1
  44. data/lib/aws/core/naming.rb +1 -1
  45. data/lib/aws/core/option_grammar.rb +81 -1
  46. data/lib/aws/core/page_result.rb +1 -1
  47. data/lib/aws/core/policy.rb +1 -1
  48. data/lib/aws/core/resource.rb +1 -1
  49. data/lib/aws/core/resource_cache.rb +1 -1
  50. data/lib/aws/core/response.rb +1 -1
  51. data/lib/aws/core/response_cache.rb +1 -1
  52. data/lib/aws/core/service_interface.rb +1 -1
  53. data/lib/aws/core/uri_escape.rb +1 -1
  54. data/lib/aws/core/xml_grammar.rb +1 -1
  55. data/lib/aws/ec2.rb +1 -1
  56. data/lib/aws/ec2/attachment.rb +1 -1
  57. data/lib/aws/ec2/attachment_collection.rb +1 -1
  58. data/lib/aws/ec2/availability_zone.rb +1 -1
  59. data/lib/aws/ec2/availability_zone_collection.rb +1 -1
  60. data/lib/aws/ec2/block_device_mappings.rb +1 -1
  61. data/lib/aws/ec2/client.rb +1 -1
  62. data/lib/aws/ec2/client/xml.rb +1 -1
  63. data/lib/aws/ec2/collection.rb +1 -1
  64. data/lib/aws/ec2/config.rb +1 -1
  65. data/lib/aws/ec2/config_transform.rb +1 -1
  66. data/lib/aws/ec2/elastic_ip.rb +1 -1
  67. data/lib/aws/ec2/elastic_ip_collection.rb +1 -1
  68. data/lib/aws/ec2/errors.rb +1 -1
  69. data/lib/aws/ec2/filtered_collection.rb +1 -1
  70. data/lib/aws/ec2/has_permissions.rb +1 -1
  71. data/lib/aws/ec2/image.rb +1 -1
  72. data/lib/aws/ec2/image_collection.rb +1 -1
  73. data/lib/aws/ec2/instance.rb +2 -1
  74. data/lib/aws/ec2/instance_collection.rb +1 -1
  75. data/lib/aws/ec2/key_pair.rb +1 -1
  76. data/lib/aws/ec2/key_pair_collection.rb +1 -1
  77. data/lib/aws/ec2/permission_collection.rb +1 -1
  78. data/lib/aws/ec2/region.rb +1 -1
  79. data/lib/aws/ec2/region_collection.rb +1 -1
  80. data/lib/aws/ec2/request.rb +1 -1
  81. data/lib/aws/ec2/reserved_instances.rb +1 -1
  82. data/lib/aws/ec2/reserved_instances_collection.rb +1 -1
  83. data/lib/aws/ec2/reserved_instances_offering.rb +1 -1
  84. data/lib/aws/ec2/reserved_instances_offering_collection.rb +1 -1
  85. data/lib/aws/ec2/resource.rb +1 -1
  86. data/lib/aws/ec2/resource_tag_collection.rb +1 -1
  87. data/lib/aws/ec2/security_group.rb +2 -2
  88. data/lib/aws/ec2/security_group/egress_ip_permission_collection.rb +1 -1
  89. data/lib/aws/ec2/security_group/ingress_ip_permission_collection.rb +1 -1
  90. data/lib/aws/ec2/security_group/ip_permission.rb +1 -1
  91. data/lib/aws/ec2/security_group_collection.rb +1 -1
  92. data/lib/aws/ec2/snapshot.rb +1 -1
  93. data/lib/aws/ec2/snapshot_collection.rb +1 -1
  94. data/lib/aws/ec2/tag.rb +1 -1
  95. data/lib/aws/ec2/tag_collection.rb +1 -1
  96. data/lib/aws/ec2/tagged_collection.rb +1 -1
  97. data/lib/aws/ec2/tagged_item.rb +1 -1
  98. data/lib/aws/ec2/volume.rb +1 -1
  99. data/lib/aws/ec2/volume_collection.rb +1 -1
  100. data/lib/aws/elb.rb +1 -1
  101. data/lib/aws/elb/availability_zone_collection.rb +1 -1
  102. data/lib/aws/elb/backend_server_policy_collection.rb +1 -1
  103. data/lib/aws/elb/client.rb +1 -1
  104. data/lib/aws/elb/client/xml.rb +1 -1
  105. data/lib/aws/elb/config.rb +1 -1
  106. data/lib/aws/elb/errors.rb +1 -1
  107. data/lib/aws/elb/instance_collection.rb +1 -1
  108. data/lib/aws/elb/listener.rb +1 -1
  109. data/lib/aws/elb/listener_collection.rb +1 -1
  110. data/lib/aws/elb/listener_opts.rb +1 -1
  111. data/lib/aws/elb/listener_spec.rb +1 -1
  112. data/lib/aws/elb/load_balancer.rb +1 -1
  113. data/lib/aws/elb/load_balancer_collection.rb +1 -1
  114. data/lib/aws/elb/load_balancer_policy.rb +1 -1
  115. data/lib/aws/elb/load_balancer_policy_collection.rb +1 -1
  116. data/lib/aws/elb/request.rb +1 -1
  117. data/lib/aws/errors.rb +1 -1
  118. data/lib/aws/iam.rb +1 -1
  119. data/lib/aws/iam/access_key.rb +1 -1
  120. data/lib/aws/iam/access_key_collection.rb +1 -1
  121. data/lib/aws/iam/account_alias_collection.rb +1 -1
  122. data/lib/aws/iam/client.rb +1 -1
  123. data/lib/aws/iam/client/xml.rb +1 -1
  124. data/lib/aws/iam/collection.rb +1 -1
  125. data/lib/aws/iam/config.rb +1 -1
  126. data/lib/aws/iam/errors.rb +1 -1
  127. data/lib/aws/iam/group.rb +1 -1
  128. data/lib/aws/iam/group_collection.rb +1 -1
  129. data/lib/aws/iam/group_policy_collection.rb +1 -1
  130. data/lib/aws/iam/group_user_collection.rb +1 -1
  131. data/lib/aws/iam/login_profile.rb +1 -1
  132. data/lib/aws/iam/mfa_device.rb +1 -1
  133. data/lib/aws/iam/mfa_device_collection.rb +1 -1
  134. data/lib/aws/iam/policy.rb +1 -1
  135. data/lib/aws/iam/policy_collection.rb +1 -1
  136. data/lib/aws/iam/request.rb +1 -1
  137. data/lib/aws/iam/resource.rb +1 -1
  138. data/lib/aws/iam/server_certificate.rb +1 -1
  139. data/lib/aws/iam/server_certificate_collection.rb +1 -1
  140. data/lib/aws/iam/signing_certificate.rb +1 -1
  141. data/lib/aws/iam/signing_certificate_collection.rb +1 -1
  142. data/lib/aws/iam/user.rb +1 -1
  143. data/lib/aws/iam/user_collection.rb +1 -1
  144. data/lib/aws/iam/user_group_collection.rb +1 -1
  145. data/lib/aws/iam/user_policy.rb +1 -1
  146. data/lib/aws/iam/user_policy_collection.rb +1 -1
  147. data/lib/aws/rails.rb +1 -1
  148. data/lib/aws/record.rb +1 -1
  149. data/lib/aws/record/attribute.rb +1 -1
  150. data/lib/aws/record/attribute_macros.rb +1 -1
  151. data/lib/aws/record/attributes/boolean.rb +1 -1
  152. data/lib/aws/record/attributes/date.rb +1 -1
  153. data/lib/aws/record/attributes/datetime.rb +1 -1
  154. data/lib/aws/record/attributes/float.rb +1 -1
  155. data/lib/aws/record/attributes/integer.rb +1 -1
  156. data/lib/aws/record/attributes/sortable_float.rb +1 -1
  157. data/lib/aws/record/attributes/sortable_integer.rb +1 -1
  158. data/lib/aws/record/attributes/string.rb +1 -1
  159. data/lib/aws/record/base.rb +1 -1
  160. data/lib/aws/record/conversion.rb +1 -1
  161. data/lib/aws/record/dirty_tracking.rb +1 -1
  162. data/lib/aws/record/errors.rb +1 -1
  163. data/lib/aws/record/exceptions.rb +1 -1
  164. data/lib/aws/record/finder_methods.rb +1 -1
  165. data/lib/aws/record/naming.rb +1 -1
  166. data/lib/aws/record/optimistic_locking.rb +1 -1
  167. data/lib/aws/record/scope.rb +1 -1
  168. data/lib/aws/record/scopes.rb +1 -1
  169. data/lib/aws/record/validations.rb +1 -1
  170. data/lib/aws/record/validator.rb +1 -1
  171. data/lib/aws/record/validators/acceptance.rb +1 -1
  172. data/lib/aws/record/validators/block.rb +1 -1
  173. data/lib/aws/record/validators/confirmation.rb +1 -1
  174. data/lib/aws/record/validators/count.rb +1 -1
  175. data/lib/aws/record/validators/exclusion.rb +1 -1
  176. data/lib/aws/record/validators/format.rb +1 -1
  177. data/lib/aws/record/validators/inclusion.rb +1 -1
  178. data/lib/aws/record/validators/length.rb +1 -1
  179. data/lib/aws/record/validators/method.rb +1 -1
  180. data/lib/aws/record/validators/numericality.rb +1 -1
  181. data/lib/aws/record/validators/presence.rb +1 -1
  182. data/lib/aws/s3.rb +1 -1
  183. data/lib/aws/s3/access_control_list.rb +1 -1
  184. data/lib/aws/s3/acl_object.rb +1 -1
  185. data/lib/aws/s3/bucket.rb +1 -1
  186. data/lib/aws/s3/bucket_collection.rb +1 -1
  187. data/lib/aws/s3/bucket_version_collection.rb +1 -1
  188. data/lib/aws/s3/client.rb +1 -1
  189. data/lib/aws/s3/client/xml.rb +1 -1
  190. data/lib/aws/s3/config.rb +1 -1
  191. data/lib/aws/s3/data_options.rb +1 -1
  192. data/lib/aws/s3/errors.rb +1 -1
  193. data/lib/aws/s3/multipart_upload.rb +1 -1
  194. data/lib/aws/s3/multipart_upload_collection.rb +1 -1
  195. data/lib/aws/s3/object_collection.rb +1 -1
  196. data/lib/aws/s3/object_metadata.rb +1 -1
  197. data/lib/aws/s3/object_upload_collection.rb +1 -1
  198. data/lib/aws/s3/object_version.rb +1 -1
  199. data/lib/aws/s3/object_version_collection.rb +1 -1
  200. data/lib/aws/s3/paginated_collection.rb +1 -1
  201. data/lib/aws/s3/policy.rb +1 -1
  202. data/lib/aws/s3/prefix_and_delimiter_collection.rb +1 -1
  203. data/lib/aws/s3/prefixed_collection.rb +1 -1
  204. data/lib/aws/s3/presigned_post.rb +1 -1
  205. data/lib/aws/s3/request.rb +1 -1
  206. data/lib/aws/s3/s3_object.rb +1 -1
  207. data/lib/aws/s3/tree.rb +1 -1
  208. data/lib/aws/s3/tree/branch_node.rb +1 -1
  209. data/lib/aws/s3/tree/child_collection.rb +1 -1
  210. data/lib/aws/s3/tree/leaf_node.rb +1 -1
  211. data/lib/aws/s3/tree/node.rb +1 -1
  212. data/lib/aws/s3/tree/parent.rb +1 -1
  213. data/lib/aws/s3/uploaded_part.rb +1 -1
  214. data/lib/aws/s3/uploaded_part_collection.rb +1 -1
  215. data/lib/aws/simple_db.rb +1 -1
  216. data/lib/aws/simple_db/attribute.rb +1 -1
  217. data/lib/aws/simple_db/attribute_collection.rb +1 -1
  218. data/lib/aws/simple_db/client.rb +1 -1
  219. data/lib/aws/simple_db/client/options.rb +1 -1
  220. data/lib/aws/simple_db/client/xml.rb +1 -1
  221. data/lib/aws/simple_db/config.rb +1 -1
  222. data/lib/aws/simple_db/consistent_read_option.rb +1 -1
  223. data/lib/aws/simple_db/delete_attributes.rb +1 -1
  224. data/lib/aws/simple_db/domain.rb +1 -1
  225. data/lib/aws/simple_db/domain_collection.rb +1 -1
  226. data/lib/aws/simple_db/domain_metadata.rb +1 -1
  227. data/lib/aws/simple_db/errors.rb +1 -1
  228. data/lib/aws/simple_db/expect_condition_option.rb +1 -1
  229. data/lib/aws/simple_db/item.rb +1 -1
  230. data/lib/aws/simple_db/item_collection.rb +1 -1
  231. data/lib/aws/simple_db/item_data.rb +1 -1
  232. data/lib/aws/simple_db/put_attributes.rb +1 -1
  233. data/lib/aws/simple_db/request.rb +1 -1
  234. data/lib/aws/simple_email_service.rb +1 -1
  235. data/lib/aws/simple_email_service/client.rb +1 -1
  236. data/lib/aws/simple_email_service/client/xml.rb +1 -1
  237. data/lib/aws/simple_email_service/config.rb +1 -1
  238. data/lib/aws/simple_email_service/email_address_collection.rb +1 -1
  239. data/lib/aws/simple_email_service/errors.rb +1 -1
  240. data/lib/aws/simple_email_service/quotas.rb +1 -1
  241. data/lib/aws/simple_email_service/request.rb +1 -1
  242. data/lib/aws/sns.rb +1 -1
  243. data/lib/aws/sns/client.rb +1 -1
  244. data/lib/aws/sns/client/xml.rb +1 -1
  245. data/lib/aws/sns/config.rb +1 -1
  246. data/lib/aws/sns/errors.rb +1 -1
  247. data/lib/aws/sns/policy.rb +1 -1
  248. data/lib/aws/sns/request.rb +1 -1
  249. data/lib/aws/sns/subscription.rb +1 -1
  250. data/lib/aws/sns/subscription_collection.rb +1 -1
  251. data/lib/aws/sns/topic.rb +1 -1
  252. data/lib/aws/sns/topic_collection.rb +1 -1
  253. data/lib/aws/sns/topic_subscription_collection.rb +1 -1
  254. data/lib/aws/sqs.rb +1 -1
  255. data/lib/aws/sqs/client.rb +2 -2
  256. data/lib/aws/sqs/client/xml.rb +1 -1
  257. data/lib/aws/sqs/config.rb +1 -1
  258. data/lib/aws/sqs/errors.rb +78 -2
  259. data/lib/aws/sqs/policy.rb +1 -1
  260. data/lib/aws/sqs/queue.rb +230 -5
  261. data/lib/aws/sqs/queue_collection.rb +84 -18
  262. data/lib/aws/sqs/received_message.rb +2 -3
  263. data/lib/aws/sqs/received_sns_message.rb +1 -1
  264. data/lib/aws/sqs/request.rb +1 -1
  265. data/lib/aws/sts.rb +1 -1
  266. data/lib/aws/sts/client.rb +1 -1
  267. data/lib/aws/sts/client/xml.rb +1 -1
  268. data/lib/aws/sts/config.rb +1 -1
  269. data/lib/aws/sts/errors.rb +1 -1
  270. data/lib/aws/sts/federated_session.rb +1 -1
  271. data/lib/aws/sts/policy.rb +1 -1
  272. data/lib/aws/sts/request.rb +1 -1
  273. data/lib/aws/sts/session.rb +1 -1
  274. data/lib/net/http/connection_pool.rb +1 -1
  275. data/lib/net/http/connection_pool/connection.rb +1 -1
  276. data/lib/net/http/connection_pool/session.rb +1 -1
  277. data/rails/init.rb +1 -1
  278. metadata +17 -44
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -23,7 +23,7 @@ module AWS
23
23
 
24
24
  include Core::ConfiguredClientMethods
25
25
 
26
- API_VERSION = '2009-02-01'
26
+ API_VERSION = '2011-10-01'
27
27
 
28
28
  # @private
29
29
  REQUEST_CLASS = SQS::Request
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -14,17 +14,93 @@
14
14
  module AWS
15
15
  class SQS
16
16
 
17
- # @private
18
17
  module Errors
19
18
 
19
+ # @private
20
20
  BASE_ERROR_GRAMMAR = Client::XML::BaseError
21
21
 
22
22
  include Core::LazyErrorClasses
23
23
 
24
+ # @private
24
25
  def self.error_class(code)
25
26
  super(code.sub(/^AWS\.SimpleQueueService\./, ''))
26
27
  end
27
28
 
29
+ # Raised when one or more messages fail to delete during a
30
+ # batch delete operation.
31
+ #
32
+ # See {#failures} for a complete list of failures.
33
+ #
34
+ class BatchDeleteError < StandardError
35
+
36
+ def initialize failures
37
+ @failures = failures
38
+ super("Failed to delete #{failures.size} messages")
39
+ end
40
+
41
+ # @return [Array<Hash>] Returns a list of hashes. Each hash
42
+ # contains information about one message that failed to delete.
43
+ # Hash keys include:
44
+ #
45
+ # * +:error_code+
46
+ # * +:error_message+
47
+ # * +:sender_fault+
48
+ # * +:receipt_handle+
49
+ #
50
+ attr_reader :failures
51
+
52
+ end
53
+
54
+ # Raised from a batch change message visibility call when one or more
55
+ # of the updates fail.
56
+ #
57
+ # See {#failures} for a complete list of failures.
58
+ #
59
+ class BatchChangeVisibilityError < StandardError
60
+
61
+ def initialize failures
62
+ @failures = failures
63
+ super("Failed to change visibility for #{failures.size} messages")
64
+ end
65
+
66
+ # @return [Array<Hash>] Returns a list of hashes. Each hash
67
+ # contains information about one message that failed to change
68
+ # visibility. Hash keys include:
69
+ #
70
+ # * +:error_code+
71
+ # * +:error_message+
72
+ # * +:sender_fault+
73
+ # * +:receipt_handle+
74
+ #
75
+ attr_reader :failures
76
+
77
+ end
78
+
79
+ class BatchSendError < StandardError
80
+
81
+ def initialize sent, failures
82
+ @sent = sent
83
+ @failures = failures
84
+ super("Failed to send #{failures.size} messages")
85
+ end
86
+
87
+ # @return [Array<SentMessage>] Returns a list of {SentMessage}
88
+ # objects.
89
+ attr_reader :sent
90
+
91
+ # @return [Array<Hash>] Returns a list of hashes. Each hash
92
+ # contains information about one message that failed to change
93
+ # visibility. Hash keys include:
94
+ #
95
+ # * +:error_code+
96
+ # * +:error_message+
97
+ # * +:sender_fault+
98
+ # * +:receipt_handle+
99
+ #
100
+ attr_reader :failures
101
+
102
+ end
103
+
28
104
  end
29
105
  end
30
106
  end
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -1,4 +1,4 @@
1
- # Copyright 2011 Amazon.com, Inc. or its affiliates. All Rights Reserved.
1
+ # Copyright 2011-2012 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
2
  #
3
3
  # Licensed under the Apache License, Version 2.0 (the "License"). You
4
4
  # may not use this file except in compliance with the License. A copy of
@@ -91,14 +91,30 @@ module AWS
91
91
  # * #xE000 to #xFFFD
92
92
  # * #x10000 to #x10FFFF
93
93
  #
94
+ # @param [Hash] options
95
+ #
96
+ # @option options [Integer] :delay_seconds The number of seconds to
97
+ # delay the message. The message will become available for
98
+ # processing after the delay time has passed.
99
+ # If you don't specify a value, the default value for the
100
+ # queue applies. Should be from 0 to 900 (15 mins).
101
+ #
94
102
  # @return [SentMessage] An object containing information about
95
103
  # the message that was sent.
96
- def send_message(body)
97
- resp = client.send_message(:queue_url => url, :message_body => body)
104
+ #
105
+ def send_message body, options = {}
106
+
107
+ client_opts = options.dup
108
+ client_opts[:queue_url] = url
109
+ client_opts[:message_body] = body
110
+
111
+ response = client.send_message(client_opts)
112
+
98
113
  msg = SentMessage.new
99
- msg.message_id = resp.message_id
100
- msg.md5 = resp.md5_of_message_body
114
+ msg.message_id = response.message_id
115
+ msg.md5 = response.md5_of_message_body
101
116
  msg
117
+
102
118
  end
103
119
 
104
120
  # Retrieves one or more messages. When a block is given, each
@@ -342,6 +358,23 @@ module AWS
342
358
  period
343
359
  end
344
360
 
361
+ # @return [Integer] Gets the current default delay for messages sent
362
+ # to the queue.
363
+ def delay_seconds
364
+ get_attribute("DelaySeconds").to_i
365
+ end
366
+
367
+ # Sets the default delay for messages sent to the queue.
368
+ # @param [Integer] seconds How many seconds a message will be delayed.
369
+ def delay_seconds= seconds
370
+ set_attribute("DelaySeconds", seconds.to_s)
371
+ end
372
+
373
+ # @return [Integer] Returns an approximate count of messages delayed.
374
+ def approximate_number_of_messages_delayed
375
+ get_attribute("ApproximateNumberOfMessagesDelayed").to_i
376
+ end
377
+
345
378
  # @return [String] The queue's Amazon resource name (ARN).
346
379
  def arn
347
380
  @arn ||= get_attribute("QueueArn")
@@ -401,6 +434,7 @@ module AWS
401
434
  # string when it received #to_json.
402
435
  #
403
436
  # @return [nil]
437
+ #
404
438
  def policy= policy
405
439
  policy_string = case policy
406
440
  when nil, '' then ''
@@ -411,6 +445,176 @@ module AWS
411
445
  nil
412
446
  end
413
447
 
448
+ # Sends a batch of up to 10 messages in a single request.
449
+ #
450
+ # queue.send_messages('message-1', 'message-2')
451
+ #
452
+ # You can also set an optional delay for all of the messages:
453
+ #
454
+ # # delay all messages 1 hour
455
+ # queue.batch_send_message(msg1, msg2, :delay_seconds => 3600)
456
+ #
457
+ # If you need to set a custom delay for each message you can pass
458
+ # hashes:
459
+ #
460
+ # messages = []
461
+ # messages << { :message_body => 'msg1', :delay_seconds => 60 }
462
+ # messages << { :message_body => 'msg2', :delay_seconds => 30 }
463
+ #
464
+ # queue.batch_send_message(messages)
465
+ #
466
+ # @param [String,Hash] messages A list of messages. Each message
467
+ # should be a string, or a hash with a +:message_body+,
468
+ # and optionally +:delay_seconds+.
469
+ #
470
+ # @raise [Errors::BatchSendError] Raises this error when one or more
471
+ # of the messages failed to send, but others did. On the raised
472
+ # object you can access a list of the messages that failed, and
473
+ # a list of messages that succeeded.
474
+ #
475
+ # @return [Array<SentMessage>] Returns an array of sent message objects.
476
+ # Each object responds to #message_id and #md5_of_message_body.
477
+ # The message id is generated by Amazon SQS.
478
+ #
479
+ def batch_send *messages
480
+
481
+ entries = messages.flatten
482
+
483
+ unless entries.first.is_a?(Hash)
484
+ options = entries.last.is_a?(Hash) ? entries.pop : {}
485
+ entries = entries.collect{|msg| { :message_body => msg } }
486
+ if delay = options[:delay_seconds]
487
+ entries.each {|entry| entry[:delay_seconds] = delay }
488
+ end
489
+ end
490
+
491
+ entries.each_with_index {|entry,n| entry[:id] = n.to_s }
492
+
493
+ client_opts = {}
494
+ client_opts[:queue_url] = url
495
+ client_opts[:entries] = entries
496
+
497
+ response = client.send_message_batch(client_opts)
498
+
499
+ failed = batch_failures(entries, response)
500
+
501
+ sent = response.successful.collect do |sent|
502
+ msg = SentMessage.new
503
+ msg.message_id = sent.message_id
504
+ msg.md5 = sent.md5_of_message_body
505
+ msg
506
+ end
507
+
508
+ raise Errors::BatchSendError.new(sent, failed) unless failed.empty?
509
+
510
+ sent
511
+
512
+ end
513
+
514
+ # @param [ReceivedMessage,String] message A list of up to 10 messages
515
+ # to delete. Each message should be a {ReceivedMessage} object
516
+ # or a received message handle (string).
517
+ #
518
+ # @raise [Errors::BatchDeleteSend] Raised when one or more of the
519
+ # messages failed to delete. The raised error has a list
520
+ # of the failures.
521
+ #
522
+ # @return [nil]
523
+ #
524
+ def batch_delete *messages
525
+
526
+ entries = []
527
+ messages.flatten.each_with_index do |msg,n|
528
+ handle = msg.is_a?(ReceivedMessage) ? msg.handle : msg
529
+ entries << { :id => n.to_s, :receipt_handle => handle }
530
+ end
531
+
532
+ response = client.delete_message_batch(
533
+ :queue_url => url, :entries => entries)
534
+
535
+ failures = batch_failures(entries, response)
536
+
537
+ raise Errors::BatchDeleteError.new(failures) unless failures.empty?
538
+
539
+ nil
540
+
541
+ end
542
+
543
+ # @overload batch_change_message_visibility(visibility_timeout, *messages)
544
+ #
545
+ # Accepts a single +:visibility_timeout+ value and a list of
546
+ # messages ({ReceivedMessage} objects or receipt handle strings).
547
+ # This form of the method is useful when you want to set the same
548
+ # timeout value for each message.
549
+ #
550
+ # queue.bacth_change_message_visibility(10, messages)
551
+ #
552
+ # @param [Integer] visibility_timeout The new value for the message's
553
+ # visibility timeout (in seconds).
554
+ #
555
+ # @param [ReceivedMessage,String] message A list of up to 10 messages
556
+ # to change the visibility timeout for.
557
+ #
558
+ # @raise [BatchChangeVisibilityError] Raises this error when one
559
+ # or more of the messages failed the visibility update.
560
+ #
561
+ # @return [nil]
562
+ #
563
+ # @overload batch_change_message_visibility(*messages_with_timeouts)
564
+ #
565
+ # Accepts a list of hashes. Each hash should provide the visibility
566
+ # timeout and message (a {ReceivedMessage} object or the recipt handle
567
+ # string).
568
+ #
569
+ # Use this form when each message needs a different visiblity timeout.
570
+ #
571
+ # messages = []
572
+ # messages << { :message => 'handle1', :visibility_timeout => 5 }
573
+ # messages << { :message => 'handle2', :visibility_timeout => 10 }
574
+ #
575
+ # queue.bacth_change_message_visibility(*messages)
576
+ #
577
+ # @param [Hash] message A list hashes, each with a +:visibility_timeout+
578
+ # and a +:message+.
579
+ #
580
+ # @raise [BatchChangeVisibilityError] Raises this error when one
581
+ # or more of the messages failed the visibility update.
582
+ #
583
+ # @return [nil]
584
+ #
585
+ def batch_change_visibility *args
586
+
587
+ args = args.flatten
588
+
589
+ if args.first.is_a?(Integer)
590
+ timeout = args.shift
591
+ messages = args.collect{|m| [m, timeout] }
592
+ else
593
+ messages = args.collect{|m| [m[:message], m[:visibility_timeout]] }
594
+ end
595
+
596
+ entries = []
597
+ messages.each do |msg,timeout|
598
+ handle = msg.is_a?(ReceivedMessage) ? msg.handle : msg
599
+ entries << {
600
+ :id => entries.size.to_s,
601
+ :receipt_handle => handle,
602
+ :visibility_timeout => timeout,
603
+ }
604
+ end
605
+
606
+ response = client.change_message_visibility_batch(
607
+ :queue_url => url, :entries => entries)
608
+
609
+ failures = batch_failures(entries, response)
610
+
611
+ raise Errors::BatchChangeVisibilityError.new(failures) unless
612
+ failures.empty?
613
+
614
+ nil
615
+
616
+ end
617
+
414
618
  # @return [Boolean] Returns true if the other queue has the same
415
619
  # url.
416
620
  def ==(other)
@@ -423,6 +627,27 @@ module AWS
423
627
  "<#{self.class}:#{url}>"
424
628
  end
425
629
 
630
+ protected
631
+ def batch_failures entries, response
632
+ response.failed.inject([]) do |failures, failure|
633
+
634
+ entry = entries.find{|e| e[:id] == failure.id }
635
+
636
+ details = {
637
+ :error_code => failure.code,
638
+ :error_message => failure.message,
639
+ :sender_fault => failure.sender_fault?,
640
+ }
641
+
642
+ if handle = entry[:receipt_handle]
643
+ details[:receipt_handle] = handle
644
+ end
645
+
646
+ failures << details
647
+
648
+ end
649
+ end
650
+
426
651
  # @private
427
652
  protected
428
653
  def hit_timeout?(got_first, last_message_at, opts)