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.
- package/.eslintrc +20 -0
- package/.gitignore +10 -0
- package/.travis.yml +20 -0
- package/.yardopts +20 -0
- package/.yardopts_guide +21 -0
- package/Gemfile +16 -0
- package/Gemfile.lock +34 -0
- package/README.md +5 -6
- package/Rakefile +14 -0
- package/UPGRADING.md +9 -4
- package/configuration.sample +5 -0
- package/dist/BUNDLE_LICENSE.txt +96 -0
- package/dist/aws-sdk.js +9594 -0
- package/dist/aws-sdk.min.js +21 -0
- package/dist-tools/.eslintrc +10 -0
- package/dist-tools/browser-builder.js +142 -0
- package/dist-tools/strategies/cache.js +68 -0
- package/dist-tools/strategies/default.js +165 -0
- package/dist-tools/test/browser-builder.mocha.spec.coffee +182 -0
- package/dist-tools/test/helpers.coffee +16 -0
- package/doc-src/guide/browser-building.md +93 -0
- package/doc-src/guide/browser-configuring-wif.md +287 -0
- package/doc-src/guide/browser-configuring.md +218 -0
- package/doc-src/guide/browser-examples.md +220 -0
- package/doc-src/guide/browser-intro.md +46 -0
- package/doc-src/guide/browser-making-requests.md +279 -0
- package/doc-src/guide/browser-services.md +75 -0
- package/doc-src/guide/index.md +41 -0
- package/doc-src/guide/node-configuring.md +272 -0
- package/doc-src/guide/node-examples.md +341 -0
- package/doc-src/guide/node-intro.md +32 -0
- package/doc-src/guide/node-making-requests.md +309 -0
- package/doc-src/guide/node-services.md +159 -0
- package/doc-src/templates/api-versions/model_documentor.rb +366 -0
- package/doc-src/templates/api-versions/plugin.rb +230 -0
- package/doc-src/templates/api-versions/templates/default/class/html/setup.rb +9 -0
- package/doc-src/templates/api-versions/templates/default/class/html/waiter_details_list.erb +7 -0
- package/doc-src/templates/api-versions/templates/default/class/html/waiter_summary.erb +7 -0
- package/doc-src/templates/api-versions/templates/default/docstring/html/experimental.erb +4 -0
- package/doc-src/templates/api-versions/templates/default/docstring/setup.rb +9 -0
- package/doc-src/templates/api-versions/templates/default/fulldoc/html/css/common.css +6 -0
- package/doc-src/templates/api-versions/templates/default/fulldoc/html/setup.rb +62 -0
- package/doc-src/templates/api-versions/templates/default/layout/html/services.erb +10 -0
- package/doc-src/templates/api-versions/templates/default/layout/html/setup.rb +28 -0
- package/doc-src/templates/api-versions/templates/default/module/html/box_info.erb +45 -0
- package/doc-src/templates/api-versions/templates/default/module/html/children.erb +8 -0
- package/doc-src/templates/api-versions/templates/default/tags/setup.rb +3 -0
- package/doc-src/templates/api-versions/templates/default/waiter_details/html/method_signature.erb +3 -0
- package/doc-src/templates/api-versions/templates/default/waiter_details/html/setup.rb +5 -0
- package/doc-src/templates/default/layout/html/footer.erb +31 -0
- package/doc-src/templates/default/layout/html/layout.erb +23 -0
- package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/css/highlight.github.css +127 -0
- package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/css/style.css +1192 -0
- package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/img/logo.png +0 -0
- package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/app.js +33 -0
- package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/highlight.pack.js +27 -0
- package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/sphinx/AUTHORS +55 -0
- package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/sphinx/LICENSE +25 -0
- package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/sphinx/doctools.js +247 -0
- package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/sphinx/file.png +0 -0
- package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/sphinx/searchtools.js +568 -0
- package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/js/underscore.js +23 -0
- package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/search.erb +29 -0
- package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/search_index.erb +1 -0
- package/doc-src/templates/flasky_sphinx_guide/fulldoc/html/setup.rb +75 -0
- package/doc-src/templates/flasky_sphinx_guide/layout/html/layout.erb +93 -0
- package/doc-src/templates/flasky_sphinx_guide/layout/html/setup.rb +9 -0
- package/doc-src/templates/flasky_sphinx_guide/layout/html/sidebar.erb +45 -0
- package/doc-src/templates/flasky_sphinx_guide/onefile/html/layout.erb +51 -0
- package/doc-src/templates/flasky_sphinx_guide/onefile/html/setup.rb +1 -0
- package/eslint-rules/no-require-in-service.js +10 -0
- package/features/autoscaling/autoscaling.feature +21 -0
- package/features/autoscaling/step_definitions/autoscaling.js +49 -0
- package/features/cloudformation/cloudformation.feature +22 -0
- package/features/cloudformation/step_definitions/cloudformation.js +26 -0
- package/features/cloudfront/cloudfront.feature +28 -0
- package/features/cloudfront/step_definitions/cloudfront-latest.js +54 -0
- package/features/cloudfront/step_definitions/cloudfront.js +21 -0
- package/features/cloudsearch/cloudsearch.feature +34 -0
- package/features/cloudsearch/step_definitions/cloudsearch.js +42 -0
- package/features/cloudtrail/cloudtrail.feature +17 -0
- package/features/cloudtrail/step_definitions/cloudtrail.js +14 -0
- package/features/cloudwatch/cloudwatch.feature +15 -0
- package/features/cloudwatch/step_definitions/cloudwatch.js +48 -0
- package/features/datapipeline/datapipeline.feature +23 -0
- package/features/datapipeline/step_definitions/datapipeline.js +79 -0
- package/features/directconnect/directconnect.feature +20 -0
- package/features/directconnect/step_definitions/directconnect.js +44 -0
- package/features/dynamodb/crc32.feature +18 -0
- package/features/dynamodb/step_definitions/dynamodb.js +154 -0
- package/features/dynamodb/tables.feature +50 -0
- package/features/ec2/ec2.feature +28 -0
- package/features/ec2/step_definitions/ec2.js +65 -0
- package/features/elasticache/elasticache.feature +20 -0
- package/features/elasticache/step_definitions/elasticache.js +34 -0
- package/features/elasticbeanstalk/elasticbeanstalk.feature +22 -0
- package/features/elasticbeanstalk/step_definitions/elasticbeanstalk.js +38 -0
- package/features/elastictranscoder/elastictranscoder.feature +24 -0
- package/features/elastictranscoder/step_definitions/elastictranscoder.js +56 -0
- package/features/elb/elb.feature +19 -0
- package/features/elb/step_definitions/elb.js +37 -0
- package/features/emr/emr.feature +16 -0
- package/features/emr/step_definitions/emr.js +45 -0
- package/features/extra/assertions.js +29 -0
- package/features/extra/dummy.feature +0 -0
- package/features/extra/fixtures/testfile.txt +1 -0
- package/features/extra/helpers.js +113 -0
- package/features/extra/hooks.js +107 -0
- package/features/extra/world.js +12 -0
- package/features/glacier/glacier.feature +47 -0
- package/features/glacier/step_definitions/glacier.js +112 -0
- package/features/iam/iam.feature +24 -0
- package/features/iam/step_definitions/iam.js +66 -0
- package/features/importexport/importexport.feature +53 -0
- package/features/importexport/step_definitions/importexport.js +42 -0
- package/features/kinesis/kinesis.feature +9 -0
- package/features/kinesis/step_definitions/kinesis.js +10 -0
- package/features/opsworks/opsworks.feature +26 -0
- package/features/opsworks/step_definitions/opsworks.js +42 -0
- package/features/rds/rds.feature +32 -0
- package/features/rds/step_definitions/rds.js +72 -0
- package/features/redshift/redshift.feature +20 -0
- package/features/redshift/step_definitions/redshift.js +33 -0
- package/features/route53/route53.feature +41 -0
- package/features/route53/step_definitions/route53.js +97 -0
- package/features/s3/buckets.feature +40 -0
- package/features/s3/objects.feature +122 -0
- package/features/s3/step_definitions/buckets.js +136 -0
- package/features/s3/step_definitions/hooks.js +39 -0
- package/features/s3/step_definitions/objects.js +204 -0
- package/features/s3/step_definitions/proxy.js +44 -0
- package/features/ses/ses.feature +20 -0
- package/features/ses/step_definitions/ses.js +22 -0
- package/features/simpledb/simpledb.feature +29 -0
- package/features/simpledb/step_definitions/simpledb.js +46 -0
- package/features/sns/sns.feature +15 -0
- package/features/sns/step_definitions/sns.js +33 -0
- package/features/sqs/messages.feature +21 -0
- package/features/sqs/queues.feature +18 -0
- package/features/sqs/step_definitions/messages.js +46 -0
- package/features/sqs/step_definitions/queues.js +33 -0
- package/features/sqs/step_definitions/sqs.js +7 -0
- package/features/storagegateway/step_definitions/storagegateway.js +16 -0
- package/features/storagegateway/storagegateway.feature +13 -0
- package/features/sts/step_definitions/sts.js +35 -0
- package/features/sts/sts.feature +29 -0
- package/features/support/step_definitions/support.js +35 -0
- package/features/support/support.feature +18 -0
- package/features/swf/step_definitions/swf.js +38 -0
- package/features/swf/swf.feature +15 -0
- package/index.js +2 -0
- package/lib/core.js +2 -2
- package/lib/credentials/shared_ini_file_credentials.js +0 -1
- package/lib/event_listeners.js +13 -1
- package/lib/http/node.js +19 -30
- package/lib/model/resource_waiter.js +0 -4
- package/lib/model/shape.js +2 -1
- package/lib/protocol/rest_xml.js +1 -1
- package/lib/region_config.js +31 -0
- package/lib/region_config.json +56 -0
- package/lib/request.js +37 -45
- package/lib/sequential_executor.js +17 -34
- package/lib/service.js +17 -44
- package/lib/services/cloudsearchdomain.js +69 -0
- package/lib/services/route53.js +0 -12
- package/lib/services/s3.js +3 -19
- package/lib/signers/v4.js +2 -1
- package/lib/util.js +28 -3
- package/package.json +3 -3
- package/scripts/console +11 -3
- package/scripts/coverage +126 -0
- package/tasks/apis.rake +122 -0
- package/tasks/browser.rake +89 -0
- package/tasks/docs.rake +36 -0
- package/tasks/lib/cucumber_generator.rb +40 -0
- package/tasks/util.rake +33 -0
- package/test/browser/js/jasmine-1.3.1.js +2600 -0
- package/test/browser/js/jasmine-html.js +681 -0
- package/test/browser/runner.html +109 -0
- package/test/browser/runner.js +92 -0
- package/test/browser/sample/appinfo.sample.js +15 -0
- package/test/browser/sample/console.html +429 -0
- package/test/browser/sample/css/smoothness/images/animated-overlay.gif +0 -0
- package/test/browser/sample/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- package/test/browser/sample/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- package/test/browser/sample/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- package/test/browser/sample/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- package/test/browser/sample/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- package/test/browser/sample/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- package/test/browser/sample/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- package/test/browser/sample/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- package/test/browser/sample/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
- package/test/browser/sample/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- package/test/browser/sample/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
- package/test/browser/sample/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
- package/test/browser/sample/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- package/test/browser/sample/css/smoothness/jquery-ui-1.10.1.custom.css +1175 -0
- package/test/browser/sample/css/smoothness/jquery-ui-1.10.1.custom.min.css +5 -0
- package/test/browser/sample/img/loading.gif +0 -0
- package/test/browser/sample/js/jquery-1.9.1.js +9597 -0
- package/test/browser/sample/js/jquery-ui-1.10.1.custom.js +14903 -0
- package/test/browser/sample/js/jquery-ui-1.10.1.custom.min.js +6 -0
- package/test/browser/sample/s3upload.html +111 -0
- package/test/browser.spec.coffee +207 -0
- package/test/config.spec.coffee +202 -0
- package/test/credential_provider_chain.spec.coffee +90 -0
- package/test/credentials.spec.coffee +452 -0
- package/test/endpoint.spec.coffee +80 -0
- package/test/event_listeners.spec.coffee +493 -0
- package/test/helpers.coffee +150 -0
- package/test/http_request.spec.coffee +55 -0
- package/test/json/builder.spec.coffee +129 -0
- package/test/json/parser.spec.coffee +108 -0
- package/test/metadata_service.spec.coffee +54 -0
- package/test/model/api.spec.coffee +67 -0
- package/test/model/shape.spec.coffee +23 -0
- package/test/node_http_client.spec.coffee +40 -0
- package/test/param_validator.spec.coffee +456 -0
- package/test/protocol/json.spec.coffee +167 -0
- package/test/protocol/query.spec.coffee +191 -0
- package/test/protocol/rest.spec.coffee +237 -0
- package/test/protocol/rest_json.spec.coffee +255 -0
- package/test/protocol/rest_xml.spec.coffee +329 -0
- package/test/query/query_param_serializer.spec.coffee +327 -0
- package/test/region_config.spec.coffee +50 -0
- package/test/request.spec.coffee +316 -0
- package/test/resource_waiter.spec.coffee +89 -0
- package/test/response.spec.coffee +81 -0
- package/test/sequential_executor.spec.coffee +118 -0
- package/test/service.spec.coffee +230 -0
- package/test/services/cloudfront.spec.coffee +44 -0
- package/test/services/cloudsearchdomain.spec.coffee +23 -0
- package/test/services/dynamodb.spec.coffee +32 -0
- package/test/services/ec2.spec.coffee +78 -0
- package/test/services/elastictranscoder.spec.coffee +43 -0
- package/test/services/glacier.spec.coffee +61 -0
- package/test/services/rds.spec.coffee +38 -0
- package/test/services/route53.spec.coffee +77 -0
- package/test/services/s3.spec.coffee +538 -0
- package/test/services/simpledb.spec.coffee +12 -0
- package/test/services/sqs.spec.coffee +130 -0
- package/test/services/sts.spec.coffee +72 -0
- package/test/services/swf.spec.coffee +6 -0
- package/test/signers/presign.spec.coffee +36 -0
- package/test/signers/s3.spec.coffee +297 -0
- package/test/signers/v2.spec.coffee +68 -0
- package/test/signers/v4.spec.coffee +135 -0
- package/test/util.spec.coffee +510 -0
- package/test/xml/builder.spec.coffee +529 -0
- package/test/xml/parser.spec.coffee +587 -0
- package/lib/services/simpledb.js +0 -15
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
helpers = require('./helpers')
|
|
2
|
+
AWS = helpers.AWS
|
|
3
|
+
MockService = helpers.MockService
|
|
4
|
+
|
|
5
|
+
describe 'AWS.Service', ->
|
|
6
|
+
|
|
7
|
+
config = null; service = null
|
|
8
|
+
retryableError = (error, result) ->
|
|
9
|
+
expect(service.retryableError(error)).toEqual(result)
|
|
10
|
+
|
|
11
|
+
beforeEach ->
|
|
12
|
+
config = new AWS.Config()
|
|
13
|
+
service = new AWS.Service(config)
|
|
14
|
+
|
|
15
|
+
describe 'apiVersions', ->
|
|
16
|
+
it 'should set apiVersions property', ->
|
|
17
|
+
CustomService = AWS.Service.defineService('custom', ['2001-01-01', '1999-05-05'])
|
|
18
|
+
expect(CustomService.apiVersions).toEqual(['1999-05-05', '2001-01-01'])
|
|
19
|
+
|
|
20
|
+
describe 'constructor', ->
|
|
21
|
+
it 'should use AWS.config copy if no config is provided', ->
|
|
22
|
+
service = new AWS.Service()
|
|
23
|
+
expect(service.config).not.toBe(AWS.config)
|
|
24
|
+
expect(service.config.sslEnabled).toEqual(true)
|
|
25
|
+
|
|
26
|
+
it 'should merge custom options on top of global defaults if config provided', ->
|
|
27
|
+
service = new AWS.Service(maxRetries: 5)
|
|
28
|
+
expect(service.config.sslEnabled).toEqual(true)
|
|
29
|
+
expect(service.config.maxRetries).toEqual(5)
|
|
30
|
+
|
|
31
|
+
it 'merges credential data into config', ->
|
|
32
|
+
service = new AWS.Service(accessKeyId: 'foo', secretAccessKey: 'bar')
|
|
33
|
+
expect(service.config.credentials.accessKeyId).toEqual('foo')
|
|
34
|
+
expect(service.config.credentials.secretAccessKey).toEqual('bar')
|
|
35
|
+
|
|
36
|
+
it 'should allow AWS.config to be object literal', ->
|
|
37
|
+
cfg = AWS.config
|
|
38
|
+
AWS.config = maxRetries: 20
|
|
39
|
+
service = new AWS.Service({})
|
|
40
|
+
expect(service.config.maxRetries).toEqual(20)
|
|
41
|
+
expect(service.config.sslEnabled).toEqual(true)
|
|
42
|
+
AWS.config = cfg
|
|
43
|
+
|
|
44
|
+
it 'tries to construct service with latest API version', ->
|
|
45
|
+
CustomService = AWS.Service.defineService('custom', ['2001-01-01', '1999-05-05'])
|
|
46
|
+
errmsg = "Could not find API configuration custom-2001-01-01"
|
|
47
|
+
expect(-> new CustomService()).toThrow(errmsg)
|
|
48
|
+
|
|
49
|
+
it 'tries to construct service with exact API version match', ->
|
|
50
|
+
CustomService = AWS.Service.defineService('custom', ['2001-01-01', '1999-05-05'])
|
|
51
|
+
errmsg = "Could not find API configuration custom-1999-05-05"
|
|
52
|
+
expect(-> new CustomService(apiVersion: '1999-05-05')).toThrow(errmsg)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
it 'skips any API versions with a * and uses next (future) service', ->
|
|
56
|
+
CustomService = AWS.Service.defineService('custom', ['1998-01-01', '1999-05-05*', '2001-01-01'])
|
|
57
|
+
errmsg = "Could not find API configuration custom-2001-01-01"
|
|
58
|
+
expect(-> new CustomService(apiVersion: '2000-01-01')).toThrow(errmsg)
|
|
59
|
+
|
|
60
|
+
it 'skips multiple API versions with a * and uses next (future) service', ->
|
|
61
|
+
CustomService = AWS.Service.defineService('custom', ['1998-01-01', '1999-05-05*', '1999-07-07*', '2001-01-01'])
|
|
62
|
+
errmsg = "Could not find API configuration custom-2001-01-01"
|
|
63
|
+
expect(-> new CustomService(apiVersion: '1999-05-05')).toThrow(errmsg)
|
|
64
|
+
|
|
65
|
+
it 'tries to construct service with fuzzy API version match', ->
|
|
66
|
+
CustomService = AWS.Service.defineService('custom', ['2001-01-01', '1999-05-05'])
|
|
67
|
+
errmsg = "Could not find API configuration custom-1999-05-05"
|
|
68
|
+
expect(-> new CustomService(apiVersion: '2000-01-01')).toThrow(errmsg)
|
|
69
|
+
|
|
70
|
+
it 'uses global apiVersion value when constructing versioned services', ->
|
|
71
|
+
AWS.config.apiVersion = '2002-03-04'
|
|
72
|
+
CustomService = AWS.Service.defineService('custom', ['2001-01-01', '1999-05-05'])
|
|
73
|
+
errmsg = "Could not find API configuration custom-2001-01-01"
|
|
74
|
+
expect(-> new CustomService).toThrow(errmsg)
|
|
75
|
+
AWS.config.apiVersion = null
|
|
76
|
+
|
|
77
|
+
it 'uses global apiVersions value when constructing versioned services', ->
|
|
78
|
+
AWS.config.apiVersions = {custom: '2002-03-04'}
|
|
79
|
+
CustomService = AWS.Service.defineService('custom', ['2001-01-01', '1999-05-05'])
|
|
80
|
+
errmsg = "Could not find API configuration custom-2001-01-01"
|
|
81
|
+
expect(-> new CustomService).toThrow(errmsg)
|
|
82
|
+
AWS.config.apiVersions = {}
|
|
83
|
+
|
|
84
|
+
it 'uses service specific apiVersions before apiVersion', ->
|
|
85
|
+
AWS.config.apiVersions = {custom: '2000-01-01'}
|
|
86
|
+
AWS.config.apiVersion = '2002-03-04'
|
|
87
|
+
CustomService = AWS.Service.defineService('custom', ['2001-01-01', '1999-05-05'])
|
|
88
|
+
errmsg = "Could not find API configuration custom-1999-05-05"
|
|
89
|
+
expect(-> new CustomService).toThrow(errmsg)
|
|
90
|
+
AWS.config.apiVersion = null
|
|
91
|
+
AWS.config.apiVersions = {}
|
|
92
|
+
|
|
93
|
+
it 'tries to construct service with fuzzy API version match', ->
|
|
94
|
+
CustomService = AWS.Service.defineService('custom', ['2001-01-01', '1999-05-05'])
|
|
95
|
+
errmsg = "Could not find API configuration custom-1999-05-05"
|
|
96
|
+
expect(-> new CustomService(apiVersion: '2000-01-01')).toThrow(errmsg)
|
|
97
|
+
|
|
98
|
+
it 'fails if apiVersion matches nothing', ->
|
|
99
|
+
CustomService = AWS.Service.defineService('custom', ['2001-01-01', '1999-05-05'])
|
|
100
|
+
errmsg = "Could not find custom API to satisfy version constraint `1998-01-01'"
|
|
101
|
+
expect(-> new CustomService(apiVersion: '1998-01-01')).toThrow(errmsg)
|
|
102
|
+
|
|
103
|
+
it 'allows construction of services from one-off apiConfig properties', ->
|
|
104
|
+
service = new AWS.Service apiConfig:
|
|
105
|
+
operations:
|
|
106
|
+
operationName: input: {}, output: {}
|
|
107
|
+
|
|
108
|
+
expect(typeof service.operationName).toEqual('function')
|
|
109
|
+
expect(service.operationName() instanceof AWS.Request).toEqual(true)
|
|
110
|
+
|
|
111
|
+
it 'interpolates endpoint when reading from configuration', ->
|
|
112
|
+
service = new MockService(endpoint: '{scheme}://{service}.{region}.domain.tld')
|
|
113
|
+
expect(service.config.endpoint).toEqual('https://mockservice.mock-region.domain.tld')
|
|
114
|
+
service = new MockService(sslEnabled: false, endpoint: '{scheme}://{service}.{region}.domain.tld')
|
|
115
|
+
expect(service.config.endpoint).toEqual('http://mockservice.mock-region.domain.tld')
|
|
116
|
+
|
|
117
|
+
describe 'setEndpoint', ->
|
|
118
|
+
FooService = null
|
|
119
|
+
|
|
120
|
+
beforeEach ->
|
|
121
|
+
FooService = AWS.util.inherit AWS.Service, api:
|
|
122
|
+
endpointPrefix: 'fooservice'
|
|
123
|
+
|
|
124
|
+
it 'uses specified endpoint if provided', ->
|
|
125
|
+
service = new FooService()
|
|
126
|
+
service.setEndpoint('notfooservice.amazonaws.com')
|
|
127
|
+
expect(service.endpoint.host).toEqual('notfooservice.amazonaws.com')
|
|
128
|
+
|
|
129
|
+
describe 'makeRequest', ->
|
|
130
|
+
|
|
131
|
+
it 'it treats params as an optinal parameter', ->
|
|
132
|
+
helpers.mockHttpResponse(200, {}, ['FOO', 'BAR'])
|
|
133
|
+
service = new MockService()
|
|
134
|
+
service.makeRequest 'operationName', (err, data) ->
|
|
135
|
+
expect(data).toEqual('FOOBAR')
|
|
136
|
+
|
|
137
|
+
it 'yields data to the callback', ->
|
|
138
|
+
helpers.mockHttpResponse(200, {}, ['FOO', 'BAR'])
|
|
139
|
+
service = new MockService()
|
|
140
|
+
req = service.makeRequest 'operation', (err, data) ->
|
|
141
|
+
expect(err).toEqual(null)
|
|
142
|
+
expect(data).toEqual('FOOBAR')
|
|
143
|
+
|
|
144
|
+
it 'yields service errors to the callback', ->
|
|
145
|
+
helpers.mockHttpResponse(500, {}, ['ServiceError'])
|
|
146
|
+
service = new MockService(maxRetries: 0)
|
|
147
|
+
req = service.makeRequest 'operation', {}, (err, data) ->
|
|
148
|
+
expect(err.code).toEqual('ServiceError')
|
|
149
|
+
expect(err.message).toEqual(null)
|
|
150
|
+
expect(err.statusCode).toEqual(500)
|
|
151
|
+
expect(err.retryable).toEqual(true)
|
|
152
|
+
expect(data).toEqual(null)
|
|
153
|
+
|
|
154
|
+
it 'yields network errors to the callback', ->
|
|
155
|
+
error = { code: 'NetworkingError' }
|
|
156
|
+
helpers.mockHttpResponse(error)
|
|
157
|
+
service = new MockService(maxRetries: 0)
|
|
158
|
+
req = service.makeRequest 'operation', {}, (err, data) ->
|
|
159
|
+
expect(err).toEqual(error)
|
|
160
|
+
expect(data).toEqual(null)
|
|
161
|
+
|
|
162
|
+
it 'does not send the request if a callback function is omitted', ->
|
|
163
|
+
helpers.mockHttpResponse(200, {}, ['FOO', 'BAR'])
|
|
164
|
+
httpClient = AWS.HttpClient.getInstance()
|
|
165
|
+
spyOn(httpClient, 'handleRequest')
|
|
166
|
+
new MockService().makeRequest('operation')
|
|
167
|
+
expect(httpClient.handleRequest).not.toHaveBeenCalled()
|
|
168
|
+
|
|
169
|
+
it 'allows parameter validation to be disabled in config', ->
|
|
170
|
+
helpers.mockHttpResponse(200, {}, ['FOO', 'BAR'])
|
|
171
|
+
service = new MockService(paramValidation: false)
|
|
172
|
+
req = service.makeRequest 'operation', {}, (err, data) ->
|
|
173
|
+
expect(err).toEqual(null)
|
|
174
|
+
expect(data).toEqual('FOOBAR')
|
|
175
|
+
|
|
176
|
+
describe 'bound parameters', ->
|
|
177
|
+
it 'accepts toplevel bound parameters on the service', ->
|
|
178
|
+
service = new AWS.S3(params: {Bucket: 'bucket', Key: 'key'})
|
|
179
|
+
req = service.makeRequest 'getObject'
|
|
180
|
+
expect(req.params).toEqual(Bucket: 'bucket', Key: 'key')
|
|
181
|
+
|
|
182
|
+
it 'ignores bound parameters not in input members', ->
|
|
183
|
+
service = new AWS.S3(params: {Bucket: 'bucket', Key: 'key'})
|
|
184
|
+
req = service.makeRequest 'listObjects'
|
|
185
|
+
expect(req.params).toEqual(Bucket: 'bucket')
|
|
186
|
+
|
|
187
|
+
it 'can override bound parameters', ->
|
|
188
|
+
service = new AWS.S3(params: {Bucket: 'bucket', Key: 'key'})
|
|
189
|
+
params = Bucket: 'notBucket'
|
|
190
|
+
|
|
191
|
+
req = service.makeRequest('listObjects', params)
|
|
192
|
+
expect(params).not.toBe(req.params)
|
|
193
|
+
expect(req.params).toEqual(Bucket: 'notBucket')
|
|
194
|
+
|
|
195
|
+
describe 'global events', ->
|
|
196
|
+
it 'adds AWS.events listeners to requests', ->
|
|
197
|
+
helpers.mockHttpResponse(200, {}, ['FOO', 'BAR'])
|
|
198
|
+
|
|
199
|
+
event = jasmine.createSpy()
|
|
200
|
+
AWS.events.on('complete', event)
|
|
201
|
+
|
|
202
|
+
new MockService().makeRequest('operation').send()
|
|
203
|
+
expect(event).toHaveBeenCalled()
|
|
204
|
+
|
|
205
|
+
describe 'retryableError', ->
|
|
206
|
+
|
|
207
|
+
it 'should retry on throttle error', ->
|
|
208
|
+
retryableError({code: 'ProvisionedThroughputExceededException', statusCode:400}, true)
|
|
209
|
+
|
|
210
|
+
it 'should retry on expired credentials error', ->
|
|
211
|
+
retryableError({code: 'ExpiredTokenException', statusCode:400}, true)
|
|
212
|
+
|
|
213
|
+
it 'should retry on 500 or above regardless of error', ->
|
|
214
|
+
retryableError({code: 'Error', statusCode:500 }, true)
|
|
215
|
+
retryableError({code: 'RandomError', statusCode:505 }, true)
|
|
216
|
+
|
|
217
|
+
it 'should not retry when error is < 500 level status code', ->
|
|
218
|
+
retryableError({code: 'Error', statusCode:200 }, false)
|
|
219
|
+
retryableError({code: 'Error', statusCode:302 }, false)
|
|
220
|
+
retryableError({code: 'Error', statusCode:404 }, false)
|
|
221
|
+
|
|
222
|
+
describe 'numRetries', ->
|
|
223
|
+
it 'should use config max retry value if defined', ->
|
|
224
|
+
service.config.maxRetries = 30
|
|
225
|
+
expect(service.numRetries()).toEqual(30)
|
|
226
|
+
|
|
227
|
+
it 'should use defaultRetries defined on object if undefined on config', ->
|
|
228
|
+
service.defaultRetryCount = 13
|
|
229
|
+
service.config.maxRetries = undefined
|
|
230
|
+
expect(service.numRetries()).toEqual(13)
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
helpers = require('../helpers')
|
|
2
|
+
AWS = helpers.AWS
|
|
3
|
+
|
|
4
|
+
describe 'AWS.CloudFront', ->
|
|
5
|
+
|
|
6
|
+
cf = null
|
|
7
|
+
beforeEach ->
|
|
8
|
+
cf = new AWS.CloudFront()
|
|
9
|
+
|
|
10
|
+
describe 'signing', ->
|
|
11
|
+
it 'signs with us-east-1 region', ->
|
|
12
|
+
helpers.mockHttpResponse 200, {}, ''
|
|
13
|
+
cf.listDistributions ->
|
|
14
|
+
auth = @request.httpRequest.headers['Authorization']
|
|
15
|
+
expect(auth).toMatch(/\/us-east-1\/cloudfront\/aws4_request/)
|
|
16
|
+
|
|
17
|
+
describe 'createInvalidation', ->
|
|
18
|
+
it 'correctly builds the request', ->
|
|
19
|
+
helpers.mockHttpResponse 200, {}, ''
|
|
20
|
+
api = cf.api.apiVersion
|
|
21
|
+
xml =
|
|
22
|
+
"""
|
|
23
|
+
<InvalidationBatch xmlns="http://cloudfront.amazonaws.com/doc/#{api}/">
|
|
24
|
+
<Paths>
|
|
25
|
+
<Quantity>2</Quantity>
|
|
26
|
+
<Items>
|
|
27
|
+
<Path>path1</Path>
|
|
28
|
+
<Path>path2</Path>
|
|
29
|
+
</Items>
|
|
30
|
+
</Paths>
|
|
31
|
+
<CallerReference>abc</CallerReference>
|
|
32
|
+
</InvalidationBatch>
|
|
33
|
+
"""
|
|
34
|
+
params =
|
|
35
|
+
DistributionId: 'ID'
|
|
36
|
+
InvalidationBatch:
|
|
37
|
+
Paths:
|
|
38
|
+
Quantity: 2
|
|
39
|
+
Items: ['path1', 'path2']
|
|
40
|
+
CallerReference: 'abc'
|
|
41
|
+
cf.createInvalidation params, (err, data) ->
|
|
42
|
+
req = this.request.httpRequest
|
|
43
|
+
expect(req.path).toEqual("/#{api}/distribution/ID/invalidation")
|
|
44
|
+
helpers.matchXML(req.body, xml)
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
helpers = require('../helpers')
|
|
2
|
+
AWS = helpers.AWS
|
|
3
|
+
|
|
4
|
+
describe 'AWS.CloudSearchDomain', ->
|
|
5
|
+
describe 'constructor', ->
|
|
6
|
+
it 'fails if there is no provided endpoint', ->
|
|
7
|
+
err = {}
|
|
8
|
+
try
|
|
9
|
+
new AWS.CloudSearchDomain
|
|
10
|
+
catch e
|
|
11
|
+
err = e
|
|
12
|
+
expect(err.name).toEqual('InvalidEndpoint')
|
|
13
|
+
|
|
14
|
+
it 'fails if the endpoint is a template', ->
|
|
15
|
+
err = {}
|
|
16
|
+
try
|
|
17
|
+
new AWS.CloudSearchDomain endpoint: '{region}.domain'
|
|
18
|
+
catch e
|
|
19
|
+
err = e
|
|
20
|
+
expect(err.name).toEqual('InvalidEndpoint')
|
|
21
|
+
|
|
22
|
+
it 'allows explicit endpoint', ->
|
|
23
|
+
expect(-> new AWS.CloudSearchDomain endpoint: 'host.domain').not.toThrow()
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
helpers = require('../helpers')
|
|
2
|
+
AWS = helpers.AWS
|
|
3
|
+
|
|
4
|
+
describe 'AWS.DynamoDB', ->
|
|
5
|
+
|
|
6
|
+
configure = (options) ->
|
|
7
|
+
new AWS.Config(options)
|
|
8
|
+
|
|
9
|
+
ddb = (options) ->
|
|
10
|
+
new AWS.DynamoDB(configure(options))
|
|
11
|
+
|
|
12
|
+
describe 'config', ->
|
|
13
|
+
|
|
14
|
+
it 'returns the configuration object it was constructed with', ->
|
|
15
|
+
config = configure(endpoint: 'localhost')
|
|
16
|
+
dynamo = new AWS.DynamoDB(config)
|
|
17
|
+
expect(dynamo.config).toEqual(config)
|
|
18
|
+
|
|
19
|
+
describe 'numRetries', ->
|
|
20
|
+
|
|
21
|
+
it 'defaults to 10', ->
|
|
22
|
+
expect(ddb().numRetries()).toEqual(10)
|
|
23
|
+
|
|
24
|
+
it 'can be overridden in the config', ->
|
|
25
|
+
expect(ddb({ maxRetries: 2 }).numRetries()).toEqual(2)
|
|
26
|
+
|
|
27
|
+
describe 'retryDelays', ->
|
|
28
|
+
|
|
29
|
+
it 'has a custom backoff function', ->
|
|
30
|
+
delays = [ 0, 50, 100, 200, 400, 800, 1600, 3200, 6400, 12800 ]
|
|
31
|
+
expect(ddb().retryDelays()).toEqual(delays)
|
|
32
|
+
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
helpers = require('../helpers')
|
|
2
|
+
AWS = helpers.AWS
|
|
3
|
+
|
|
4
|
+
describe 'AWS.EC2', ->
|
|
5
|
+
|
|
6
|
+
ec2 = new AWS.EC2()
|
|
7
|
+
|
|
8
|
+
describe 'proxy support', ->
|
|
9
|
+
it 'always sets Host header to correct endpoint', ->
|
|
10
|
+
helpers.mockHttpResponse 200, {}, ''
|
|
11
|
+
ec2 = new AWS.EC2(httpOptions: proxy: 'http://__INVALID_HOSTNAME__:9999')
|
|
12
|
+
ec2.makeRequest 'describeInstances', ->
|
|
13
|
+
expect(@request.httpRequest.headers.Host).
|
|
14
|
+
toEqual('ec2.mock-region.amazonaws.com')
|
|
15
|
+
|
|
16
|
+
describe 'copySnapshot', ->
|
|
17
|
+
it 'generates PresignedUrl and DestinationRegion parameters', ->
|
|
18
|
+
spyOn(AWS.util.date, 'getDate').andReturn(new Date(0))
|
|
19
|
+
helpers.mockHttpResponse 200, {}, ''
|
|
20
|
+
params = SourceRegion: 'src-region', SourceSnapshotId: 'snap-123456789'
|
|
21
|
+
ec2.copySnapshot params, ->
|
|
22
|
+
parts = @request.httpRequest.body.split('&').sort()
|
|
23
|
+
[
|
|
24
|
+
'AWSAccessKeyId=akid',
|
|
25
|
+
'Action=CopySnapshot',
|
|
26
|
+
'DestinationRegion=mock-region',
|
|
27
|
+
'PresignedUrl=https%3A%2F%2Fec2.src-region.amazonaws.com%2F%3F' +
|
|
28
|
+
"Action%3DCopySnapshot%26DestinationRegion%3Dmock-region%26SourceRegion%3Dsrc-region" +
|
|
29
|
+
"%26SourceSnapshotId%3Dsnap-123456789%26Version%3D#{ec2.api.apiVersion}" +
|
|
30
|
+
"%26X-Amz-Algorithm%3DAWS4-HMAC-SHA256%26X-Amz-Credential%3Dakid%252F19700101" +
|
|
31
|
+
"%252Fsrc-region%252Fec2%252Faws4_request%26X-Amz-Date%3D19700101T000000Z" +
|
|
32
|
+
"%26X-Amz-Expires%3D3600%26X-Amz-Security-Token%3Dsession" +
|
|
33
|
+
"%26X-Amz-Signature%3D014459362191e87b3b175e1e16d007c0c9aaa1fdb2743f8cebdfd8dea0fb0cc2" +
|
|
34
|
+
"%26X-Amz-SignedHeaders%3Dhost",
|
|
35
|
+
'SourceRegion=src-region',
|
|
36
|
+
'SourceSnapshotId=snap-123456789'
|
|
37
|
+
].forEach (i) ->
|
|
38
|
+
expect(parts).toContain(i)
|
|
39
|
+
|
|
40
|
+
describe 'parseResponse', ->
|
|
41
|
+
body = ''
|
|
42
|
+
parse = (callback) ->
|
|
43
|
+
helpers.mockHttpResponse 400, {}, body
|
|
44
|
+
ec2.makeRequest 'describeInstances', (error, data) ->
|
|
45
|
+
callback.call(this, error, data)
|
|
46
|
+
|
|
47
|
+
describe 'with error', ->
|
|
48
|
+
beforeEach ->
|
|
49
|
+
body =
|
|
50
|
+
"""
|
|
51
|
+
<Response>
|
|
52
|
+
<Errors>
|
|
53
|
+
<Error>
|
|
54
|
+
<Code>InvalidInstanceID.Malformed</Code>
|
|
55
|
+
<Message>Invalid id: "i-12345678"</Message>
|
|
56
|
+
</Error>
|
|
57
|
+
</Errors>
|
|
58
|
+
<RequestID>ab123mno-6432-dceb-asdf-123mno543123</RequestID>
|
|
59
|
+
</Response>
|
|
60
|
+
"""
|
|
61
|
+
|
|
62
|
+
it 'extracts the error code', ->
|
|
63
|
+
parse (error, data) ->
|
|
64
|
+
expect(error.code).toEqual('InvalidInstanceID.Malformed')
|
|
65
|
+
expect(data).toEqual(null)
|
|
66
|
+
|
|
67
|
+
it 'extracts the error message', ->
|
|
68
|
+
parse (error, data) ->
|
|
69
|
+
expect(error.message).toEqual('Invalid id: "i-12345678"')
|
|
70
|
+
expect(data).toEqual(null)
|
|
71
|
+
|
|
72
|
+
it 'returns an empty error when the body is blank', ->
|
|
73
|
+
body = ''
|
|
74
|
+
parse (error, data) ->
|
|
75
|
+
expect(error.code).toEqual(400)
|
|
76
|
+
expect(error.message).toEqual(null)
|
|
77
|
+
expect(data).toEqual(null)
|
|
78
|
+
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
helpers = require('../helpers')
|
|
2
|
+
AWS = helpers.AWS
|
|
3
|
+
|
|
4
|
+
describe 'AWS.ElasticTranscoder', ->
|
|
5
|
+
|
|
6
|
+
et = null
|
|
7
|
+
beforeEach ->
|
|
8
|
+
et = new AWS.ElasticTranscoder()
|
|
9
|
+
|
|
10
|
+
describe 'error handling', ->
|
|
11
|
+
it 'should generate the correct error name', ->
|
|
12
|
+
helpers.mockHttpResponse 400, {'x-amzn-errortype': 'ErrorName:'}, ''
|
|
13
|
+
et.listPipelines (err, data) ->
|
|
14
|
+
expect(err.code).toEqual('ErrorName')
|
|
15
|
+
|
|
16
|
+
it 'generates generic error name if header is not present', ->
|
|
17
|
+
helpers.mockHttpResponse 400, {}, ''
|
|
18
|
+
et.listPipelines (err, data) ->
|
|
19
|
+
expect(err.code).toEqual('UnknownError')
|
|
20
|
+
|
|
21
|
+
describe 'cancelJob', ->
|
|
22
|
+
it 'omits the body', ->
|
|
23
|
+
helpers.mockHttpResponse 200, {}, ''
|
|
24
|
+
params = { Id: 'job-id' }
|
|
25
|
+
et.cancelJob { Id: 'job-id' }, (err, data) ->
|
|
26
|
+
req = this.request.httpRequest
|
|
27
|
+
expect(req.path).toEqual('/2012-09-25/jobs/job-id')
|
|
28
|
+
expect(req.body).toEqual('{}')
|
|
29
|
+
|
|
30
|
+
describe 'updatePipelineNotifications', ->
|
|
31
|
+
it 'only populates the body with non-uri and non-header params', ->
|
|
32
|
+
helpers.mockHttpResponse 200, {}, ''
|
|
33
|
+
params =
|
|
34
|
+
Id: 'pipeline-id'
|
|
35
|
+
Notifications:
|
|
36
|
+
Progressing: 'arn1'
|
|
37
|
+
Completed: 'arn2'
|
|
38
|
+
Warning: 'arn3'
|
|
39
|
+
Error: 'arn4'
|
|
40
|
+
et.updatePipelineNotifications params, (err, data) ->
|
|
41
|
+
req = this.request.httpRequest
|
|
42
|
+
expect(req.path).toEqual('/2012-09-25/pipelines/pipeline-id/notifications')
|
|
43
|
+
expect(req.body).toEqual('{"Notifications":{"Progressing":"arn1","Completed":"arn2","Warning":"arn3","Error":"arn4"}}')
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
helpers = require('../helpers')
|
|
2
|
+
AWS = helpers.AWS
|
|
3
|
+
Buffer = AWS.util.Buffer
|
|
4
|
+
|
|
5
|
+
if AWS.util.isNode()
|
|
6
|
+
describe 'AWS.Glacier', ->
|
|
7
|
+
|
|
8
|
+
glacier = null
|
|
9
|
+
beforeEach ->
|
|
10
|
+
glacier = new AWS.Glacier()
|
|
11
|
+
|
|
12
|
+
describe 'building requests', ->
|
|
13
|
+
it 'sets accountId to "-" if not set', ->
|
|
14
|
+
req = glacier.listVaults()
|
|
15
|
+
req.emit('validate', [req])
|
|
16
|
+
req.emit('build', [req])
|
|
17
|
+
expect(req.httpRequest.path).toEqual('/-/vaults')
|
|
18
|
+
|
|
19
|
+
it 'will not override accountId if set', ->
|
|
20
|
+
req = glacier.listVaults(accountId: 'ABC123')
|
|
21
|
+
req.emit('validate', [req])
|
|
22
|
+
req.emit('build', [req])
|
|
23
|
+
expect(req.httpRequest.path).toEqual('/ABC123/vaults')
|
|
24
|
+
|
|
25
|
+
describe 'computeChecksums', ->
|
|
26
|
+
it 'returns correct linear and tree hash for buffer data', ->
|
|
27
|
+
# compute a 5.5 megabyte chunk of data filled with '0' string (0 byte)
|
|
28
|
+
# expected values taken from AWS SDK for Ruby
|
|
29
|
+
data = new Buffer(1024 * 1024 * 5.5)
|
|
30
|
+
data.fill('0')
|
|
31
|
+
|
|
32
|
+
expected =
|
|
33
|
+
linearHash: '68aff0c5a91aa0491752bfb96e3fef33eb74953804f6a2f7b708d5bcefa8ff6b',
|
|
34
|
+
treeHash: '154e26c78fd74d0c2c9b3cc4644191619dc4f2cd539ae2a74d5fd07957a3ee6a'
|
|
35
|
+
|
|
36
|
+
expect(glacier.computeChecksums(data)).toEqual(expected)
|
|
37
|
+
|
|
38
|
+
describe 'initiateJob', ->
|
|
39
|
+
it 'correctly builds the request', ->
|
|
40
|
+
helpers.mockHttpResponse 200, {}, ''
|
|
41
|
+
params =
|
|
42
|
+
vaultName: 'vault-name'
|
|
43
|
+
jobParameters:
|
|
44
|
+
Format: 'foo'
|
|
45
|
+
Type: 'bar'
|
|
46
|
+
glacier.initiateJob params, (err, data) ->
|
|
47
|
+
req = this.request.httpRequest
|
|
48
|
+
expect(req.path).toEqual('/-/vaults/vault-name/jobs')
|
|
49
|
+
expect(req.body).toEqual('{"Format":"foo","Type":"bar"}')
|
|
50
|
+
|
|
51
|
+
describe 'uploadArchive', ->
|
|
52
|
+
it 'passes the body along', ->
|
|
53
|
+
helpers.mockHttpResponse 200, {}, ''
|
|
54
|
+
params =
|
|
55
|
+
vaultName: 'vault-name'
|
|
56
|
+
body: 'abc'
|
|
57
|
+
glacier.uploadArchive params, (err, data) ->
|
|
58
|
+
req = this.request.httpRequest
|
|
59
|
+
expect(req.method).toEqual('POST')
|
|
60
|
+
expect(req.path).toEqual('/-/vaults/vault-name/archives')
|
|
61
|
+
expect(req.body).toEqual('abc')
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
helpers = require('../helpers')
|
|
2
|
+
AWS = helpers.AWS
|
|
3
|
+
|
|
4
|
+
describe 'AWS.RDS', ->
|
|
5
|
+
describe 'createDBSecurityGroup', ->
|
|
6
|
+
it 'properly parses XML response', ->
|
|
7
|
+
rds = new AWS.RDS()
|
|
8
|
+
body =
|
|
9
|
+
"""
|
|
10
|
+
<CreateDBSecurityGroupResponse xmlns="http://rds.amazonaws.com/doc/2013-09-09/">
|
|
11
|
+
<CreateDBSecurityGroupResult>
|
|
12
|
+
<DBSecurityGroup>
|
|
13
|
+
<EC2SecurityGroups/>
|
|
14
|
+
<DBSecurityGroupDescription>foo</DBSecurityGroupDescription>
|
|
15
|
+
<IPRanges/>
|
|
16
|
+
<OwnerId>1234567890</OwnerId>
|
|
17
|
+
<DBSecurityGroupName>foo</DBSecurityGroupName>
|
|
18
|
+
</DBSecurityGroup>
|
|
19
|
+
</CreateDBSecurityGroupResult>
|
|
20
|
+
<ResponseMetadata>
|
|
21
|
+
<RequestId>1234567890</RequestId>
|
|
22
|
+
</ResponseMetadata>
|
|
23
|
+
</CreateDBSecurityGroupResponse>
|
|
24
|
+
"""
|
|
25
|
+
helpers.mockHttpResponse 200, {}, body
|
|
26
|
+
params = DBSecurityGroupName:'foo', DBSecurityGroupDescription:'foo'
|
|
27
|
+
rds.createDBSecurityGroup params, (error, data) ->
|
|
28
|
+
expect(error).toBe(null)
|
|
29
|
+
expect(this.requestId).toEqual('1234567890')
|
|
30
|
+
expect(data).toEqual
|
|
31
|
+
DBSecurityGroup:
|
|
32
|
+
DBSecurityGroupDescription: 'foo'
|
|
33
|
+
DBSecurityGroupName: 'foo'
|
|
34
|
+
EC2SecurityGroups: []
|
|
35
|
+
IPRanges: []
|
|
36
|
+
OwnerId: '1234567890'
|
|
37
|
+
ResponseMetadata:
|
|
38
|
+
RequestId: '1234567890'
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
helpers = require('../helpers')
|
|
2
|
+
AWS = helpers.AWS
|
|
3
|
+
|
|
4
|
+
describe 'AWS.Route53', ->
|
|
5
|
+
|
|
6
|
+
service = null
|
|
7
|
+
api = null
|
|
8
|
+
beforeEach ->
|
|
9
|
+
service = new AWS.Route53()
|
|
10
|
+
api = service.api.apiVersion
|
|
11
|
+
|
|
12
|
+
describe 'setEndpoint', ->
|
|
13
|
+
it 'always enables SSL if no endpoint is set', ->
|
|
14
|
+
service = new AWS.Route53(sslEnabled: false)
|
|
15
|
+
expect(service.endpoint.protocol).toEqual('https:')
|
|
16
|
+
|
|
17
|
+
it 'allows overriding SSL if custom endpoint is set', ->
|
|
18
|
+
service = new AWS.Route53(endpoint: 'http://example.com')
|
|
19
|
+
expect(service.endpoint.protocol).toEqual('http:')
|
|
20
|
+
|
|
21
|
+
describe 'building requests', ->
|
|
22
|
+
service = new AWS.Route53
|
|
23
|
+
|
|
24
|
+
it 'should fix hosted zone ID on input', ->
|
|
25
|
+
req = service.getHostedZone(Id: '/hostedzone/ABCDEFG')
|
|
26
|
+
req.emit('build', [req])
|
|
27
|
+
expect(req.httpRequest.path).toMatch('/hostedzone/ABCDEFG$')
|
|
28
|
+
|
|
29
|
+
it 'should fix health check ID on input', ->
|
|
30
|
+
req = service.getHealthCheck(HealthCheckId: '/healthcheck/ABCDEFG')
|
|
31
|
+
req.emit('build', [req])
|
|
32
|
+
expect(req.httpRequest.path).toMatch('/healthcheck/ABCDEFG$')
|
|
33
|
+
|
|
34
|
+
describe 'changeResourceRecordSets', ->
|
|
35
|
+
it 'correctly builds the XML document', ->
|
|
36
|
+
xml =
|
|
37
|
+
"""
|
|
38
|
+
<ChangeResourceRecordSetsRequest xmlns="https://route53.amazonaws.com/doc/#{api}/">
|
|
39
|
+
<ChangeBatch>
|
|
40
|
+
<Comment>comment</Comment>
|
|
41
|
+
<Changes>
|
|
42
|
+
<Change>
|
|
43
|
+
<Action>CREATE</Action>
|
|
44
|
+
<ResourceRecordSet>
|
|
45
|
+
<Name>name</Name>
|
|
46
|
+
<Type>type</Type>
|
|
47
|
+
<ResourceRecords>
|
|
48
|
+
<ResourceRecord>
|
|
49
|
+
<Value>foo.com</Value>
|
|
50
|
+
</ResourceRecord>
|
|
51
|
+
</ResourceRecords>
|
|
52
|
+
</ResourceRecordSet>
|
|
53
|
+
</Change>
|
|
54
|
+
</Changes>
|
|
55
|
+
</ChangeBatch>
|
|
56
|
+
</ChangeResourceRecordSetsRequest>
|
|
57
|
+
"""
|
|
58
|
+
helpers.mockHttpResponse 200, {}, ''
|
|
59
|
+
# params purposefully ordered differently than api to test ordering of
|
|
60
|
+
# xml elements
|
|
61
|
+
params =
|
|
62
|
+
HostedZoneId: 'zone-id'
|
|
63
|
+
ChangeBatch:
|
|
64
|
+
Changes: [
|
|
65
|
+
{
|
|
66
|
+
ResourceRecordSet:
|
|
67
|
+
Name: 'name'
|
|
68
|
+
Type: 'type'
|
|
69
|
+
ResourceRecords: [
|
|
70
|
+
{ Value: 'foo.com' }
|
|
71
|
+
]
|
|
72
|
+
Action: 'CREATE',
|
|
73
|
+
}
|
|
74
|
+
]
|
|
75
|
+
Comment: 'comment'
|
|
76
|
+
service.changeResourceRecordSets params, (err, data) ->
|
|
77
|
+
helpers.matchXML(this.request.httpRequest.body, xml)
|