aws-sdk 2.0.1 → 2.0.5

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 (251) hide show
  1. package/.eslintrc +20 -0
  2. package/.gitignore +10 -0
  3. package/.travis.yml +20 -0
  4. package/.yardopts +20 -0
  5. package/.yardopts_guide +21 -0
  6. package/Gemfile +16 -0
  7. package/Gemfile.lock +34 -0
  8. package/README.md +5 -6
  9. package/Rakefile +14 -0
  10. package/UPGRADING.md +9 -4
  11. package/configuration.sample +5 -0
  12. package/dist/BUNDLE_LICENSE.txt +96 -0
  13. package/dist/aws-sdk.js +9594 -0
  14. package/dist/aws-sdk.min.js +21 -0
  15. package/dist-tools/.eslintrc +10 -0
  16. package/dist-tools/browser-builder.js +142 -0
  17. package/dist-tools/strategies/cache.js +68 -0
  18. package/dist-tools/strategies/default.js +165 -0
  19. package/dist-tools/test/browser-builder.mocha.spec.coffee +182 -0
  20. package/dist-tools/test/helpers.coffee +16 -0
  21. package/doc-src/guide/browser-building.md +93 -0
  22. package/doc-src/guide/browser-configuring-wif.md +287 -0
  23. package/doc-src/guide/browser-configuring.md +218 -0
  24. package/doc-src/guide/browser-examples.md +220 -0
  25. package/doc-src/guide/browser-intro.md +46 -0
  26. package/doc-src/guide/browser-making-requests.md +279 -0
  27. package/doc-src/guide/browser-services.md +75 -0
  28. package/doc-src/guide/index.md +41 -0
  29. package/doc-src/guide/node-configuring.md +272 -0
  30. package/doc-src/guide/node-examples.md +341 -0
  31. package/doc-src/guide/node-intro.md +32 -0
  32. package/doc-src/guide/node-making-requests.md +309 -0
  33. package/doc-src/guide/node-services.md +159 -0
  34. package/doc-src/templates/api-versions/model_documentor.rb +366 -0
  35. package/doc-src/templates/api-versions/plugin.rb +230 -0
  36. package/doc-src/templates/api-versions/templates/default/class/html/setup.rb +9 -0
  37. package/doc-src/templates/api-versions/templates/default/class/html/waiter_details_list.erb +7 -0
  38. package/doc-src/templates/api-versions/templates/default/class/html/waiter_summary.erb +7 -0
  39. package/doc-src/templates/api-versions/templates/default/docstring/html/experimental.erb +4 -0
  40. package/doc-src/templates/api-versions/templates/default/docstring/setup.rb +9 -0
  41. package/doc-src/templates/api-versions/templates/default/fulldoc/html/css/common.css +6 -0
  42. package/doc-src/templates/api-versions/templates/default/fulldoc/html/setup.rb +62 -0
  43. package/doc-src/templates/api-versions/templates/default/layout/html/services.erb +10 -0
  44. package/doc-src/templates/api-versions/templates/default/layout/html/setup.rb +28 -0
  45. package/doc-src/templates/api-versions/templates/default/module/html/box_info.erb +45 -0
  46. package/doc-src/templates/api-versions/templates/default/module/html/children.erb +8 -0
  47. package/doc-src/templates/api-versions/templates/default/tags/setup.rb +3 -0
  48. package/doc-src/templates/api-versions/templates/default/waiter_details/html/method_signature.erb +3 -0
  49. package/doc-src/templates/api-versions/templates/default/waiter_details/html/setup.rb +5 -0
  50. package/doc-src/templates/default/layout/html/footer.erb +31 -0
  51. package/doc-src/templates/default/layout/html/layout.erb +23 -0
  52. package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/css/highlight.github.css +127 -0
  53. package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/css/style.css +1192 -0
  54. package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/img/logo.png +0 -0
  55. package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/app.js +33 -0
  56. package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/highlight.pack.js +27 -0
  57. package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/sphinx/AUTHORS +55 -0
  58. package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/sphinx/LICENSE +25 -0
  59. package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/sphinx/doctools.js +247 -0
  60. package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/sphinx/file.png +0 -0
  61. package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/sphinx/searchtools.js +568 -0
  62. package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/underscore.js +23 -0
  63. package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/search.erb +29 -0
  64. package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/search_index.erb +1 -0
  65. package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/setup.rb +75 -0
  66. package/doc-src/templates/flasky_sphinx_guide/layout/html/layout.erb +93 -0
  67. package/doc-src/templates/flasky_sphinx_guide/layout/html/setup.rb +9 -0
  68. package/doc-src/templates/flasky_sphinx_guide/layout/html/sidebar.erb +45 -0
  69. package/doc-src/templates/flasky_sphinx_guide/onefile/html/layout.erb +51 -0
  70. package/doc-src/templates/flasky_sphinx_guide/onefile/html/setup.rb +1 -0
  71. package/eslint-rules/no-require-in-service.js +10 -0
  72. package/features/autoscaling/autoscaling.feature +21 -0
  73. package/features/autoscaling/step_definitions/autoscaling.js +49 -0
  74. package/features/cloudformation/cloudformation.feature +22 -0
  75. package/features/cloudformation/step_definitions/cloudformation.js +26 -0
  76. package/features/cloudfront/cloudfront.feature +28 -0
  77. package/features/cloudfront/step_definitions/cloudfront-latest.js +54 -0
  78. package/features/cloudfront/step_definitions/cloudfront.js +21 -0
  79. package/features/cloudsearch/cloudsearch.feature +34 -0
  80. package/features/cloudsearch/step_definitions/cloudsearch.js +42 -0
  81. package/features/cloudtrail/cloudtrail.feature +17 -0
  82. package/features/cloudtrail/step_definitions/cloudtrail.js +14 -0
  83. package/features/cloudwatch/cloudwatch.feature +15 -0
  84. package/features/cloudwatch/step_definitions/cloudwatch.js +48 -0
  85. package/features/datapipeline/datapipeline.feature +23 -0
  86. package/features/datapipeline/step_definitions/datapipeline.js +79 -0
  87. package/features/directconnect/directconnect.feature +20 -0
  88. package/features/directconnect/step_definitions/directconnect.js +44 -0
  89. package/features/dynamodb/crc32.feature +18 -0
  90. package/features/dynamodb/step_definitions/dynamodb.js +154 -0
  91. package/features/dynamodb/tables.feature +50 -0
  92. package/features/ec2/ec2.feature +28 -0
  93. package/features/ec2/step_definitions/ec2.js +65 -0
  94. package/features/elasticache/elasticache.feature +20 -0
  95. package/features/elasticache/step_definitions/elasticache.js +34 -0
  96. package/features/elasticbeanstalk/elasticbeanstalk.feature +22 -0
  97. package/features/elasticbeanstalk/step_definitions/elasticbeanstalk.js +38 -0
  98. package/features/elastictranscoder/elastictranscoder.feature +24 -0
  99. package/features/elastictranscoder/step_definitions/elastictranscoder.js +56 -0
  100. package/features/elb/elb.feature +19 -0
  101. package/features/elb/step_definitions/elb.js +37 -0
  102. package/features/emr/emr.feature +16 -0
  103. package/features/emr/step_definitions/emr.js +45 -0
  104. package/features/extra/assertions.js +29 -0
  105. package/features/extra/dummy.feature +0 -0
  106. package/features/extra/fixtures/testfile.txt +1 -0
  107. package/features/extra/helpers.js +113 -0
  108. package/features/extra/hooks.js +107 -0
  109. package/features/extra/world.js +12 -0
  110. package/features/glacier/glacier.feature +47 -0
  111. package/features/glacier/step_definitions/glacier.js +112 -0
  112. package/features/iam/iam.feature +24 -0
  113. package/features/iam/step_definitions/iam.js +66 -0
  114. package/features/importexport/importexport.feature +53 -0
  115. package/features/importexport/step_definitions/importexport.js +42 -0
  116. package/features/kinesis/kinesis.feature +9 -0
  117. package/features/kinesis/step_definitions/kinesis.js +10 -0
  118. package/features/opsworks/opsworks.feature +26 -0
  119. package/features/opsworks/step_definitions/opsworks.js +42 -0
  120. package/features/rds/rds.feature +32 -0
  121. package/features/rds/step_definitions/rds.js +72 -0
  122. package/features/redshift/redshift.feature +20 -0
  123. package/features/redshift/step_definitions/redshift.js +33 -0
  124. package/features/route53/route53.feature +41 -0
  125. package/features/route53/step_definitions/route53.js +97 -0
  126. package/features/s3/buckets.feature +40 -0
  127. package/features/s3/objects.feature +122 -0
  128. package/features/s3/step_definitions/buckets.js +136 -0
  129. package/features/s3/step_definitions/hooks.js +39 -0
  130. package/features/s3/step_definitions/objects.js +204 -0
  131. package/features/s3/step_definitions/proxy.js +44 -0
  132. package/features/ses/ses.feature +20 -0
  133. package/features/ses/step_definitions/ses.js +22 -0
  134. package/features/simpledb/simpledb.feature +29 -0
  135. package/features/simpledb/step_definitions/simpledb.js +46 -0
  136. package/features/sns/sns.feature +15 -0
  137. package/features/sns/step_definitions/sns.js +33 -0
  138. package/features/sqs/messages.feature +21 -0
  139. package/features/sqs/queues.feature +18 -0
  140. package/features/sqs/step_definitions/messages.js +46 -0
  141. package/features/sqs/step_definitions/queues.js +33 -0
  142. package/features/sqs/step_definitions/sqs.js +7 -0
  143. package/features/storagegateway/step_definitions/storagegateway.js +16 -0
  144. package/features/storagegateway/storagegateway.feature +13 -0
  145. package/features/sts/step_definitions/sts.js +35 -0
  146. package/features/sts/sts.feature +29 -0
  147. package/features/support/step_definitions/support.js +35 -0
  148. package/features/support/support.feature +18 -0
  149. package/features/swf/step_definitions/swf.js +38 -0
  150. package/features/swf/swf.feature +15 -0
  151. package/index.js +2 -0
  152. package/lib/core.js +2 -2
  153. package/lib/credentials/shared_ini_file_credentials.js +0 -1
  154. package/lib/event_listeners.js +13 -1
  155. package/lib/http/node.js +19 -30
  156. package/lib/model/resource_waiter.js +0 -4
  157. package/lib/model/shape.js +2 -1
  158. package/lib/protocol/rest_xml.js +1 -1
  159. package/lib/region_config.js +31 -0
  160. package/lib/region_config.json +56 -0
  161. package/lib/request.js +37 -45
  162. package/lib/sequential_executor.js +17 -34
  163. package/lib/service.js +17 -44
  164. package/lib/services/cloudsearchdomain.js +69 -0
  165. package/lib/services/route53.js +0 -12
  166. package/lib/services/s3.js +3 -19
  167. package/lib/signers/v4.js +2 -1
  168. package/lib/util.js +28 -3
  169. package/package.json +3 -3
  170. package/scripts/console +11 -3
  171. package/scripts/coverage +126 -0
  172. package/tasks/apis.rake +122 -0
  173. package/tasks/browser.rake +89 -0
  174. package/tasks/docs.rake +36 -0
  175. package/tasks/lib/cucumber_generator.rb +40 -0
  176. package/tasks/util.rake +33 -0
  177. package/test/browser/js/jasmine-1.3.1.js +2600 -0
  178. package/test/browser/js/jasmine-html.js +681 -0
  179. package/test/browser/runner.html +109 -0
  180. package/test/browser/runner.js +92 -0
  181. package/test/browser/sample/appinfo.sample.js +15 -0
  182. package/test/browser/sample/console.html +429 -0
  183. package/test/browser/sample/css/smoothness/images/animated-overlay.gif +0 -0
  184. package/test/browser/sample/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  185. package/test/browser/sample/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  186. package/test/browser/sample/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  187. package/test/browser/sample/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  188. package/test/browser/sample/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  189. package/test/browser/sample/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  190. package/test/browser/sample/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  191. package/test/browser/sample/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  192. package/test/browser/sample/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
  193. package/test/browser/sample/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  194. package/test/browser/sample/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
  195. package/test/browser/sample/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
  196. package/test/browser/sample/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  197. package/test/browser/sample/css/smoothness/jquery-ui-1.10.1.custom.css +1175 -0
  198. package/test/browser/sample/css/smoothness/jquery-ui-1.10.1.custom.min.css +5 -0
  199. package/test/browser/sample/img/loading.gif +0 -0
  200. package/test/browser/sample/js/jquery-1.9.1.js +9597 -0
  201. package/test/browser/sample/js/jquery-ui-1.10.1.custom.js +14903 -0
  202. package/test/browser/sample/js/jquery-ui-1.10.1.custom.min.js +6 -0
  203. package/test/browser/sample/s3upload.html +111 -0
  204. package/test/browser.spec.coffee +207 -0
  205. package/test/config.spec.coffee +202 -0
  206. package/test/credential_provider_chain.spec.coffee +90 -0
  207. package/test/credentials.spec.coffee +452 -0
  208. package/test/endpoint.spec.coffee +80 -0
  209. package/test/event_listeners.spec.coffee +493 -0
  210. package/test/helpers.coffee +150 -0
  211. package/test/http_request.spec.coffee +55 -0
  212. package/test/json/builder.spec.coffee +129 -0
  213. package/test/json/parser.spec.coffee +108 -0
  214. package/test/metadata_service.spec.coffee +54 -0
  215. package/test/model/api.spec.coffee +67 -0
  216. package/test/model/shape.spec.coffee +23 -0
  217. package/test/node_http_client.spec.coffee +40 -0
  218. package/test/param_validator.spec.coffee +456 -0
  219. package/test/protocol/json.spec.coffee +167 -0
  220. package/test/protocol/query.spec.coffee +191 -0
  221. package/test/protocol/rest.spec.coffee +237 -0
  222. package/test/protocol/rest_json.spec.coffee +255 -0
  223. package/test/protocol/rest_xml.spec.coffee +329 -0
  224. package/test/query/query_param_serializer.spec.coffee +327 -0
  225. package/test/region_config.spec.coffee +50 -0
  226. package/test/request.spec.coffee +316 -0
  227. package/test/resource_waiter.spec.coffee +89 -0
  228. package/test/response.spec.coffee +81 -0
  229. package/test/sequential_executor.spec.coffee +118 -0
  230. package/test/service.spec.coffee +230 -0
  231. package/test/services/cloudfront.spec.coffee +44 -0
  232. package/test/services/cloudsearchdomain.spec.coffee +23 -0
  233. package/test/services/dynamodb.spec.coffee +32 -0
  234. package/test/services/ec2.spec.coffee +78 -0
  235. package/test/services/elastictranscoder.spec.coffee +43 -0
  236. package/test/services/glacier.spec.coffee +61 -0
  237. package/test/services/rds.spec.coffee +38 -0
  238. package/test/services/route53.spec.coffee +77 -0
  239. package/test/services/s3.spec.coffee +538 -0
  240. package/test/services/simpledb.spec.coffee +12 -0
  241. package/test/services/sqs.spec.coffee +130 -0
  242. package/test/services/sts.spec.coffee +72 -0
  243. package/test/services/swf.spec.coffee +6 -0
  244. package/test/signers/presign.spec.coffee +36 -0
  245. package/test/signers/s3.spec.coffee +297 -0
  246. package/test/signers/v2.spec.coffee +68 -0
  247. package/test/signers/v4.spec.coffee +135 -0
  248. package/test/util.spec.coffee +510 -0
  249. package/test/xml/builder.spec.coffee +529 -0
  250. package/test/xml/parser.spec.coffee +587 -0
  251. package/lib/services/simpledb.js +0 -15
@@ -0,0 +1,33 @@
1
+ module.exports = function() {
2
+ this.Before("@sns", function (callback) {
3
+ this.service = new this.AWS.SNS();
4
+ callback();
5
+ });
6
+
7
+ this.Given(/^I create an SNS topic with name "([^"]*)"$/, function(name, callback) {
8
+ var world = this;
9
+ this.request(null, 'createTopic', {Name: name}, callback, function (resp) {
10
+ world.topicArn = resp.data.TopicArn;
11
+ });
12
+ });
13
+
14
+ this.Given(/^I list the SNS topics$/, function(callback) {
15
+ this.request(null, 'listTopics', {}, callback);
16
+ });
17
+
18
+ this.Then(/^the list should contain the topic ARN$/, function(callback) {
19
+ var arn = this.topicArn;
20
+ this.assert.contains(this.data.Topics, function(topic) {
21
+ return topic.TopicArn === arn;
22
+ });
23
+ callback();
24
+ });
25
+
26
+ this.Then(/^I delete the SNS topic$/, function(callback) {
27
+ this.request(null, 'deleteTopic', {TopicArn: this.topicArn}, callback);
28
+ });
29
+
30
+ this.Given(/^I get SNS topic attributes with an invalid ARN$/, function(callback) {
31
+ this.request(null, 'getTopicAttributes', {TopicArn:'INVALID'}, callback, false);
32
+ });
33
+ };
@@ -0,0 +1,21 @@
1
+ # language: en
2
+ @sqs @messages
3
+ Feature: SQS Messages
4
+
5
+ I want to be able to send and process messages.
6
+
7
+ Scenario: Send an SQS message
8
+ Given I create a queue with the prefix name "aws-js-sdk"
9
+ When I send the message "HELLO"
10
+ Then the result should include a message ID
11
+ And the result should have an MD5 digest of "eb61eead90e3b899c6bcbe27ac581660"
12
+ And I should eventually be able to receive "HELLO" from the queue
13
+ Then I delete the SQS queue
14
+
15
+ Scenario: Binary payloads
16
+ Given I create a queue with the prefix name "aws-js-sdk"
17
+ When I send the message "HELLO" with a binary attribute
18
+ Then the result should include a message ID
19
+ And the result should have an MD5 digest of "eb61eead90e3b899c6bcbe27ac581660"
20
+ And I should eventually be able to receive "HELLO" from the queue with a binary attribute
21
+ Then I delete the SQS queue
@@ -0,0 +1,18 @@
1
+ # language: en
2
+ @sqs @queues
3
+ Feature: SQS Queues
4
+
5
+ I want to be able to create, list and delete queues.
6
+
7
+ Scenario: Creating and deleting queues
8
+ Given I create a queue with the prefix name "aws-js-sdk"
9
+ And I create a queue with the prefix name "aws-js-sdk"
10
+ Then list queues should eventually return the queue urls
11
+ Then I delete the SQS queue
12
+ Then I delete the SQS queue
13
+
14
+ Scenario: Making a queue request across regions
15
+ Given I have a "SQS" service in the "us-west-1" region
16
+ And I create a queue with the prefix name "aws-js-sdk"
17
+ When I have a "SQS" service in the "us-east-1" region
18
+ Then I delete the SQS queue
@@ -0,0 +1,46 @@
1
+ module.exports = function () {
2
+
3
+ this.When(/^I send the message "([^"]*)"$/, function(message, callback) {
4
+ this.request(null, 'sendMessage', {QueueUrl:this.queueUrl,MessageBody:message}, callback);
5
+ });
6
+
7
+ this.Then(/^the result should include a message ID$/, function(callback) {
8
+ this.assert.compare(this.data.MessageId.length, '>', 0);
9
+ callback();
10
+ });
11
+
12
+ this.Then(/^the result should have an MD5 digest of "([^"]*)"$/, function(digest, callback) {
13
+ this.assert.equal(this.data.MD5OfMessageBody, digest);
14
+ callback();
15
+ });
16
+
17
+ this.Then(/^I should eventually be able to receive "([^"]*)" from the queue$/, function(message, callback) {
18
+ this.eventually(callback, function (next) {
19
+ next.condition = function() {
20
+ return this.data.Messages[0].Body === message;
21
+ };
22
+ this.request(null, 'receiveMessage', {QueueUrl:this.queueUrl}, next);
23
+ });
24
+ });
25
+
26
+ this.When(/^I send the message "([^"]*)" with a binary attribute$/, function (message, callback) {
27
+ var params = {
28
+ QueueUrl: this.queueUrl,
29
+ MessageBody: message,
30
+ MessageAttributes: {
31
+ binary: { DataType: 'Binary', BinaryValue: new Buffer([1,2,3]) }
32
+ }
33
+ };
34
+ this.request(null, 'sendMessage', params, callback);
35
+ });
36
+
37
+ this.Then(/^I should eventually be able to receive "([^"]*)" from the queue with a binary attribute$/, function (message, callback) {
38
+ this.eventually(callback, function (next) {
39
+ next.condition = function() {
40
+ return this.data.Messages[0].MessageAttributes.binary.BinaryValue.toString() === '\u0001\u0002\u0003';
41
+ };
42
+ var params = {QueueUrl:this.queueUrl,MessageAttributeNames:['binary']};
43
+ this.request(null, 'receiveMessage', params, next);
44
+ });
45
+ });
46
+ };
@@ -0,0 +1,33 @@
1
+ module.exports = function () {
2
+
3
+ this.Given(/^I create a queue with the prefix name "([^"]*)"$/, function(prefix, callback) {
4
+ var name = this.uniqueName(prefix);
5
+ this.request(null, 'createQueue', { QueueName: name }, callback, function() {
6
+ this.queueUrl = this.data.QueueUrl;
7
+ this.createdQueues.push(this.queueUrl);
8
+ });
9
+ });
10
+
11
+ this.Then(/^list queues should eventually return the queue urls$/, function(callback) {
12
+ this.eventually(callback, function (next) {
13
+ next.condition = function() {
14
+ var matchingCount = 0;
15
+ for (var i = 0; i < this.createdQueues.length; ++i) {
16
+ for (var j = 0; j < this.data.QueueUrls.length; ++j) {
17
+ if (this.createdQueues[i] == this.data.QueueUrls[j]) {
18
+ matchingCount++;
19
+ }
20
+ }
21
+ }
22
+ return matchingCount == this.createdQueues.length;
23
+ };
24
+ this.request(null, 'listQueues', {}, next);
25
+ }, { maxTime: 60 });
26
+ });
27
+
28
+ this.Then(/^I delete the SQS queue$/, function (callback) {
29
+ var url = this.createdQueues.pop();
30
+ this.request(null, 'deleteQueue', { QueueUrl: url }, callback);
31
+ });
32
+
33
+ };
@@ -0,0 +1,7 @@
1
+ module.exports = function() {
2
+ this.Before("@sqs", function (callback) {
3
+ this.service = new this.AWS.SQS({region: 'us-east-1'});
4
+ this.createdQueues = [];
5
+ callback();
6
+ });
7
+ };
@@ -0,0 +1,16 @@
1
+ module.exports = function() {
2
+ this.Before("@storagegateway", function (callback) {
3
+ this.service = new this.AWS.StorageGateway();
4
+ callback();
5
+ });
6
+
7
+ this.When(/^I try to activate a Storage Gateway$/, function(callback) {
8
+ var params = {
9
+ ActivationKey: 'INVALIDKEY',
10
+ GatewayName: this.uniqueName('aws-sdk-js'),
11
+ GatewayTimezone: 'GMT-5:00',
12
+ GatewayRegion: 'us-east-1'
13
+ };
14
+ this.request(null, 'activateGateway', params, callback, false);
15
+ });
16
+ };
@@ -0,0 +1,13 @@
1
+ # language: en
2
+ @storagegateway
3
+ Feature: AWS Storage Gateway
4
+
5
+ I want to use AWS Storage Gateway
6
+
7
+ Scenario: Activating a Gateway
8
+ When I try to activate a Storage Gateway
9
+ Then the error code should be "InvalidGatewayRequestException"
10
+ Then the error message should be:
11
+ """
12
+ The specified activation key was not found.
13
+ """
@@ -0,0 +1,35 @@
1
+ module.exports = function() {
2
+ this.Before("@sts", function (callback) {
3
+ this.service = new this.AWS.STS();
4
+ callback();
5
+ });
6
+
7
+ this.Given(/^I get an STS session token with a duration of (\d+) seconds$/, function(duration, callback) {
8
+ this.request(null, 'getSessionToken', {DurationSeconds:parseInt(duration)}, callback, false);
9
+ });
10
+
11
+ this.Then(/^the result should contain an access key ID and secret access key$/, function(callback) {
12
+ this.assert.compare(this.data.Credentials.AccessKeyId.length, '>', 0);
13
+ this.assert.compare(this.data.Credentials.SecretAccessKey.length, '>', 0);
14
+ callback();
15
+ });
16
+
17
+ this.Then(/^the TTL on the session token credentials should be less than (\d+)$/, function(duration, callback) {
18
+ var ttl = this.data.Credentials.Expiration.getTime();
19
+ ttl = (ttl - new Date().getTime()) / 1000;
20
+ this.assert.compare(ttl, '<', duration);
21
+ callback();
22
+ });
23
+
24
+ this.Given(/^I try to assume role with web identity$/, function(callback) {
25
+ var params = {RoleArn: 'arn:aws:iam::123456789:role/WebIdentity', RoleSessionName: 'name', WebIdentityToken: 'token'};
26
+ this.request(null, 'assumeRoleWithWebIdentity', params, callback, false);
27
+ });
28
+
29
+ this.Given(/^I try to assume role with SAML$/, function(callback) {
30
+ var arn = 'arn:aws:iam::123456789:role/Role';
31
+ var token = 'TOKENVALUETOKENVALUETOKENVALUETOKENVALUE';
32
+ var params = {RoleArn: arn, PrincipalArn: arn, SAMLAssertion: token};
33
+ this.request(null, 'assumeRoleWithSAML', params, callback, false);
34
+ });
35
+ };
@@ -0,0 +1,29 @@
1
+ # language: en
2
+ @sts
3
+ Feature: AWS Security Token Service
4
+
5
+ I want to use AWS Security Token Service
6
+
7
+ @requiresakid
8
+ Scenario: Get a session token
9
+ Given I get an STS session token with a duration of 900 seconds
10
+ Then the result should contain an access key ID and secret access key
11
+ And the TTL on the session token credentials should be less than 900
12
+
13
+ Scenario: Web Identity Federation
14
+ Given I try to assume role with web identity
15
+ Then the error message should equal:
16
+ """
17
+ Not authorized to perform sts:AssumeRoleWithWebIdentity
18
+ """
19
+
20
+ Scenario: SAML Support
21
+ Given I try to assume role with SAML
22
+ Then the error message should equal:
23
+ """
24
+ Not authorized to perform sts:AssumeRoleWithSAML
25
+ """
26
+
27
+ Scenario: Error handling
28
+ Given I get an STS session token with a duration of 60 seconds
29
+ Then the error code should be "ValidationError"
@@ -0,0 +1,35 @@
1
+ module.exports = function() {
2
+ this.Before("@support", function (callback) {
3
+ this.service = new this.AWS.Support();
4
+ callback();
5
+ });
6
+
7
+ this.Given(/^I describe Support services$/, function(callback) {
8
+ this.request(null, 'describeServices', {}, callback);
9
+ });
10
+
11
+ this.Then(/^the Supported services list should contain a service with code "([^"]*)"$/, function(code, callback) {
12
+ this.assert.contains(this.data.services, function (svc) {
13
+ return svc.code == code;
14
+ });
15
+ callback();
16
+ });
17
+
18
+ this.Then(/^the Supported services list should contain a service with name "([^"]*)"$/, function(name, callback) {
19
+ this.assert.contains(this.data.services, function (svc) {
20
+ return svc.name == name;
21
+ });
22
+ callback();
23
+ });
24
+
25
+ this.Given(/^I create a case with an invalid category$/, function(callback) {
26
+ var params = {
27
+ subject: "Subject",
28
+ serviceCode: "INVALID-CODE",
29
+ categoryCode: "INVALID-CATEGORY",
30
+ communicationBody: "Communication"
31
+ };
32
+
33
+ this.request(null, 'createCase', params, callback, false);
34
+ });
35
+ };
@@ -0,0 +1,18 @@
1
+ # language: en
2
+ @support
3
+ Feature: AWS Support
4
+
5
+ I want to use AWS Support
6
+
7
+ Scenario: Describe Services
8
+ Given I describe Support services
9
+ Then the Supported services list should contain a service with code "amazon-dynamodb"
10
+ And the Supported services list should contain a service with name "DynamoDB"
11
+
12
+ Scenario: Error handling
13
+ Given I create a case with an invalid category
14
+ Then the error code should be "ValidationException"
15
+ And the error message should contain:
16
+ """
17
+ 1 validation error detected: Value 'INVALID-CODE' at 'serviceCode' failed to satisfy constraint
18
+ """
@@ -0,0 +1,38 @@
1
+ module.exports = function() {
2
+ this.Before("@swf", function (callback) {
3
+ this.service = new this.AWS.SWF();
4
+ callback();
5
+ });
6
+
7
+ this.Given(/^I register a SWF domain with prefix "([^"]*)"$/, function(prefix, callback) {
8
+ this.swfDomain = prefix + '-' + new Date().getTime();
9
+ var params = {name:this.swfDomain, workflowExecutionRetentionPeriodInDays:'7'};
10
+ this.request(null, 'registerDomain', params, callback, false);
11
+ });
12
+
13
+ this.Given(/^I list SWF domains with status "([^"]*)"$/, function(status, callback) {
14
+ if (this.error.name === 'LimitExceededFault') return callback();
15
+ this.request(null, 'listDomains', {registrationStatus: status}, callback);
16
+ });
17
+
18
+ this.Then(/^the SWF domain should be in the list$/, function(callback) {
19
+ if (this.error.name === 'LimitExceededFault') return callback();
20
+
21
+ var items = {};
22
+ this.data.domainInfos.forEach(function (info) {
23
+ items[info.name] = info;
24
+ });
25
+ this.assert.ok(items[this.swfDomain]);
26
+ callback();
27
+ });
28
+
29
+ this.Then(/^I delete the SWF domain$/, function(callback) {
30
+ if (this.error.name === 'LimitExceededFault') return callback();
31
+ this.request(null, 'deprecateDomain', {name: this.swfDomain}, callback);
32
+ });
33
+
34
+ this.Given(/^I try to create a SWF domain with an empty name$/, function(callback) {
35
+ var params = {name: '', workflowExecutionRetentionPeriodInDays:'7'};
36
+ this.request(null, 'registerDomain', params, callback, false);
37
+ });
38
+ };
@@ -0,0 +1,15 @@
1
+ # language: en
2
+ @swf
3
+ Feature: Amazon Simple Workflow Service
4
+
5
+ I want to use Amazon Simple Workflow Service
6
+
7
+ Scenario: Domains
8
+ Given I register a SWF domain with prefix "aws-js-sdk-integration"
9
+ And I list SWF domains with status "REGISTERED"
10
+ Then the SWF domain should be in the list
11
+ And I delete the SWF domain
12
+
13
+ Scenario: Error handling
14
+ Given I try to create a SWF domain with an empty name
15
+ Then the error code should be "ValidationException"
package/index.js ADDED
@@ -0,0 +1,2 @@
1
+ // Convenience file to require the SDK from the root of the repository
2
+ module.exports = require('./lib/aws');
package/lib/core.js CHANGED
@@ -8,7 +8,7 @@ var AWS = { util: require('./util') };
8
8
  * @!macro [new] nobrowser
9
9
  * @note This feature is not supported in the browser environment of the SDK.
10
10
  */
11
- var _hidden = {}; _hidden = {}; // hack to parse macro
11
+ var _hidden = {}; _hidden.toString(); // hack to parse macro
12
12
 
13
13
  module.exports = AWS;
14
14
 
@@ -17,7 +17,7 @@ AWS.util.update(AWS, {
17
17
  /**
18
18
  * @constant
19
19
  */
20
- VERSION: '2.0.0',
20
+ VERSION: '2.0.5',
21
21
 
22
22
  /**
23
23
  * @api private
@@ -1,6 +1,5 @@
1
1
  var AWS = require('../core');
2
2
  var path = require('path');
3
- var fs = require('fs');
4
3
 
5
4
  /**
6
5
  * Represents credentials loaded from shared credentials file
@@ -66,6 +66,7 @@ AWS.EventListeners = {
66
66
  Core: new SequentialExecutor().addNamedListeners(function(add, addAsync) {
67
67
  addAsync('VALIDATE_CREDENTIALS', 'validate',
68
68
  function VALIDATE_CREDENTIALS(req, done) {
69
+ if (!req.service.api.signatureVersion) return done(); // none
69
70
  req.service.config.getCredentials(function(err) {
70
71
  if (err) {
71
72
  req.response.err = AWS.util.error(err,
@@ -76,7 +77,7 @@ AWS.EventListeners = {
76
77
  });
77
78
 
78
79
  add('VALIDATE_REGION', 'validate', function VALIDATE_REGION(req) {
79
- if (!req.service.config.region && !req.service.hasGlobalEndpoint()) {
80
+ if (!req.service.config.region && !req.service.isGlobalEndpoint) {
80
81
  req.response.error = AWS.util.error(new Error(),
81
82
  {code: 'SigningError', message: 'Missing region in config'});
82
83
  }
@@ -98,6 +99,17 @@ AWS.EventListeners = {
98
99
  req.httpRequest.headers['Host'] = req.httpRequest.endpoint.host;
99
100
  });
100
101
 
102
+ add('RESTART', 'restart', function RESTART(req) {
103
+ var err = this.response.error;
104
+ if (!err || !err.retryable) return;
105
+
106
+ if (this.response.retryCount < this.service.config.maxRetries) {
107
+ this.response.retryCount++;
108
+ } else {
109
+ this.response.error = null;
110
+ }
111
+ });
112
+
101
113
  addAsync('SIGN', 'sign', function SIGN(req, done) {
102
114
  if (!req.service.api.signatureVersion) return done(); // none
103
115
 
package/lib/http/node.js CHANGED
@@ -2,7 +2,6 @@ var AWS = require('../core');
2
2
  var Stream = AWS.util.nodeRequire('stream').Stream;
3
3
  var WritableStream = AWS.util.nodeRequire('stream').Writable;
4
4
  var ReadableStream = AWS.util.nodeRequire('stream').Readable;
5
- var Agent = require('agentkeepalive');
6
5
  require('../http');
7
6
 
8
7
  /**
@@ -10,6 +9,7 @@ require('../http');
10
9
  */
11
10
  AWS.NodeHttpClient = AWS.util.inherit({
12
11
  handleRequest: function handleRequest(httpRequest, httpOptions, callback, errCallback) {
12
+ var cbAlreadyCalled = false;
13
13
  var endpoint = httpRequest.endpoint;
14
14
  var pathPrefix = '';
15
15
  if (!httpOptions) httpOptions = {};
@@ -31,8 +31,8 @@ AWS.NodeHttpClient = AWS.util.inherit({
31
31
  path: pathPrefix + httpRequest.path
32
32
  };
33
33
 
34
- if (!httpOptions.agent) {
35
- options.agent = useSSL ? this.httpsAgent() : this.httpAgent();
34
+ if (useSSL && !httpOptions.agent) {
35
+ options.agent = this.sslAgent();
36
36
  }
37
37
 
38
38
  AWS.util.update(options, httpOptions);
@@ -40,26 +40,27 @@ AWS.NodeHttpClient = AWS.util.inherit({
40
40
  delete options.timeout; // timeout isn't an HTTP option
41
41
 
42
42
  var stream = http.request(options, function (httpResp) {
43
+ if (cbAlreadyCalled) return; cbAlreadyCalled = true;
44
+
43
45
  callback(httpResp);
44
46
  httpResp.emit('headers', httpResp.statusCode, httpResp.headers);
45
47
  });
46
48
  httpRequest.stream = stream; // attach stream to httpRequest
47
49
 
48
50
  // timeout support
49
- stream.setTimeout(httpOptions.timeout || 0);
50
- stream.once('timeout', function() {
51
+ stream.setTimeout(httpOptions.timeout || 0, function() {
52
+ if (cbAlreadyCalled) return; cbAlreadyCalled = true;
53
+
51
54
  var msg = 'Connection timed out after ' + httpOptions.timeout + 'ms';
52
55
  errCallback(AWS.util.error(new Error(msg), {code: 'TimeoutError'}));
53
-
54
- // HACK - abort the connection without tripping our error handler
55
- // since we already raised our TimeoutError. Otherwise the connection
56
- // comes back with ECONNRESET, which is not a helpful error message
57
- stream.removeListener('error', errCallback);
58
- stream.on('error', function() { });
59
56
  stream.abort();
60
57
  });
61
58
 
62
- stream.on('error', errCallback);
59
+ stream.on('error', function() {
60
+ if (cbAlreadyCalled) return; cbAlreadyCalled = true;
61
+ errCallback.apply(this, arguments);
62
+ });
63
+
63
64
  this.writeBody(stream, httpRequest);
64
65
  return stream;
65
66
  },
@@ -81,34 +82,22 @@ AWS.NodeHttpClient = AWS.util.inherit({
81
82
  }
82
83
  },
83
84
 
84
- httpsAgent: function httpsAgent() {
85
+ sslAgent: function sslAgent() {
86
+ var https = require('https');
87
+
85
88
  if (!AWS.NodeHttpClient.sslAgent) {
86
- AWS.NodeHttpClient.sslAgent = new Agent.HttpsAgent({
87
- rejectUnauthorized: true
88
- });
89
+ AWS.NodeHttpClient.sslAgent = new https.Agent({rejectUnauthorized: true});
90
+ AWS.NodeHttpClient.sslAgent.setMaxListeners(0);
89
91
 
90
92
  // delegate maxSockets to globalAgent
91
93
  Object.defineProperty(AWS.NodeHttpClient.sslAgent, 'maxSockets', {
92
94
  enumerable: true,
93
- get: function() { return require('https').globalAgent.maxSockets; }
95
+ get: function() { return https.globalAgent.maxSockets; }
94
96
  });
95
97
  }
96
98
  return AWS.NodeHttpClient.sslAgent;
97
99
  },
98
100
 
99
- httpAgent: function httpAgent() {
100
- if (!AWS.NodeHttpClient.httpAgent) {
101
- AWS.NodeHttpClient.httpAgent = new Agent({rejectUnauthorized: true});
102
-
103
- // delegate maxSockets to globalAgent
104
- Object.defineProperty(AWS.NodeHttpClient.httpAgent, 'maxSockets', {
105
- enumerable: true,
106
- get: function() { return require('http').globalAgent.maxSockets; }
107
- });
108
- }
109
- return AWS.NodeHttpClient.httpAgent;
110
- },
111
-
112
101
  progressStream: function progressStream(stream, httpRequest) {
113
102
  var numBytes = 0;
114
103
  var totalBytes = httpRequest.headers['Content-Length'];
@@ -1,9 +1,5 @@
1
- var Shape = require('./shape');
2
- var StructureShape = Shape.shapes.StructureShape;
3
-
4
1
  var util = require('../util');
5
2
  var property = util.property;
6
- var memoizedProperty = util.memoizedProperty;
7
3
 
8
4
  function ResourceWaiter(name, waiter, options) {
9
5
  options = options || {};
@@ -243,7 +243,8 @@ function TimestampShape(shape) {
243
243
  this.toType = function(value) {
244
244
  if (value === null || value === undefined) return null;
245
245
  if (typeof value.toUTCString === 'function') return value;
246
- return typeof value === 'string' ? util.date.parseTimestamp(value) : null;
246
+ return typeof value === 'string' || typeof value === 'number' ?
247
+ util.date.parseTimestamp(value) : null;
247
248
  };
248
249
 
249
250
  this.toWireFormat = function(value) {
@@ -65,7 +65,7 @@ function extractData(resp) {
65
65
  resp.data[payload] = body;
66
66
  } else if (payloadMember.type === 'structure') {
67
67
  parser = new AWS.XML.Parser();
68
- resp.data = parser.parse(body.toString(), payloadMember);
68
+ util.update(resp.data, parser.parse(body.toString(), payloadMember));
69
69
  } else {
70
70
  resp.data[payload] = body.toString();
71
71
  }
@@ -0,0 +1,31 @@
1
+ var util = require('./util');
2
+ var config = require('./region_config.json');
3
+
4
+ function regionConfig(service) {
5
+ var sId = service.serviceIdentifier || '';
6
+ var sRegion = service.config.region || '';
7
+ var finalConfig = {};
8
+
9
+ config.forEach(function(item) {
10
+ (item.regions || []).forEach(function(region) {
11
+ if (sRegion.match(new RegExp('^' + region.replace('*', '.*') + '$'))) {
12
+ (item.serviceConfigs || []).forEach(function(svcConfig) {
13
+ (svcConfig.services || []).forEach(function(svcName) {
14
+ if (sId.match(new RegExp('^' + svcName.replace('*', '.*') + '$'))) {
15
+ util.update(finalConfig, svcConfig.config);
16
+ service.isGlobalEndpoint = !!svcConfig.globalEndpoint;
17
+ }
18
+ });
19
+ });
20
+ }
21
+ });
22
+ });
23
+
24
+ util.each(finalConfig, function(key, value) {
25
+ if (service.config[key] === undefined || service.config[key] === null) {
26
+ service.config[key] = value;
27
+ }
28
+ });
29
+ }
30
+
31
+ module.exports = regionConfig;
@@ -0,0 +1,56 @@
1
+ [
2
+ {
3
+ "regions": ["*"],
4
+ "serviceConfigs": [
5
+ {
6
+ "services": ["*"],
7
+ "config": {
8
+ "endpoint": "{service}.{region}.amazonaws.com"
9
+ }
10
+ },
11
+ {
12
+ "services": ["cloudfront", "iam", "importexport", "sts"],
13
+ "config": {
14
+ "endpoint": "{service}.amazonaws.com"
15
+ },
16
+ "globalEndpoint": true
17
+ },
18
+ {
19
+ "services": ["s3"],
20
+ "config": {
21
+ "endpoint": "{service}-{region}.amazonaws.com"
22
+ }
23
+ },
24
+ {
25
+ "services": ["route53"],
26
+ "config": {
27
+ "endpoint": "https://{service}.amazonaws.com"
28
+ },
29
+ "globalEndpoint": true
30
+ }
31
+ ]
32
+ },
33
+ {
34
+ "regions": ["us-east-1"],
35
+ "serviceConfigs": [
36
+ {
37
+ "services": ["s3", "simpledb"],
38
+ "config": {
39
+ "endpoint": "{service}.amazonaws.com"
40
+ }
41
+ }
42
+ ]
43
+ },
44
+ {
45
+ "regions": ["cn-*"],
46
+ "serviceConfigs": [
47
+ {
48
+ "services": ["*"],
49
+ "config": {
50
+ "endpoint": "{service}.{region}.amazonaws.com.cn",
51
+ "signatureVersion": "v4"
52
+ }
53
+ }
54
+ ]
55
+ }
56
+ ]