aws-sdk 2.1012.0 → 2.1013.0

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/lib/core.js CHANGED
@@ -20,7 +20,7 @@ AWS.util.update(AWS, {
20
20
  /**
21
21
  * @constant
22
22
  */
23
- VERSION: '2.1012.0',
23
+ VERSION: '2.1013.0',
24
24
 
25
25
  /**
26
26
  * @api private
@@ -12,30 +12,24 @@ function populateBody(req) {
12
12
  var params = {};
13
13
  var payloadShape = input.members[input.payload];
14
14
  params = req.params[input.payload];
15
- if (params === undefined) return;
16
15
 
17
16
  if (payloadShape.type === 'structure') {
18
- req.httpRequest.body = builder.build(params, payloadShape);
17
+ req.httpRequest.body = builder.build(params || {}, payloadShape);
19
18
  applyContentTypeHeader(req);
20
- } else { // non-JSON payload
19
+ } else if (params !== undefined) {
20
+ // non-JSON payload
21
21
  req.httpRequest.body = params;
22
22
  if (payloadShape.type === 'binary' || payloadShape.isStreaming) {
23
23
  applyContentTypeHeader(req, true);
24
24
  }
25
25
  }
26
26
  } else {
27
- var body = builder.build(req.params, input);
28
- if (body !== '{}' || req.httpRequest.method !== 'GET') { //don't send empty body for GET method
29
- req.httpRequest.body = body;
30
- }
27
+ req.httpRequest.body = builder.build(req.params, input);
31
28
  applyContentTypeHeader(req);
32
29
  }
33
30
  }
34
31
 
35
32
  function applyContentTypeHeader(req, isBinary) {
36
- var operation = req.service.api.operations[req.operation];
37
- var input = operation.input;
38
-
39
33
  if (!req.httpRequest.headers['Content-Type']) {
40
34
  var type = isBinary ? 'binary/octet-stream' : 'application/json';
41
35
  req.httpRequest.headers['Content-Type'] = type;
@@ -45,8 +39,8 @@ function applyContentTypeHeader(req, isBinary) {
45
39
  function buildRequest(req) {
46
40
  Rest.buildRequest(req);
47
41
 
48
- // never send body payload on HEAD/DELETE
49
- if (['HEAD', 'DELETE'].indexOf(req.httpRequest.method) < 0) {
42
+ // never send body payload on GET/HEAD/DELETE
43
+ if (['GET', 'HEAD', 'DELETE'].indexOf(req.httpRequest.method) < 0) {
50
44
  populateBody(req);
51
45
  }
52
46
  }
@@ -3,6 +3,10 @@ var regionConfig = require('./region_config_data.json');
3
3
 
4
4
  function generateRegionPrefix(region) {
5
5
  if (!region) return null;
6
+ if (isFipsRegion(region)) {
7
+ if (isFipsCnRegion(region)) return 'fips-cn-*';
8
+ return 'fips-*';
9
+ }
6
10
 
7
11
  var parts = region.split('-');
8
12
  if (parts.length < 3) return null;
@@ -56,6 +60,12 @@ function configureEndpoint(service) {
56
60
  );
57
61
  }
58
62
 
63
+ // set FIPS signingRegion and endpoint.
64
+ if (isFipsRegion(service.config.region)) {
65
+ config = util.copy(config);
66
+ service.signingRegion = getRealRegion(service.config.region);
67
+ }
68
+
59
69
  // set global endpoint
60
70
  service.isGlobalEndpoint = !!config.globalEndpoint;
61
71
  if (config.signingRegion) {
@@ -90,10 +100,33 @@ function getEndpointSuffix(region) {
90
100
  return defaultSuffix;
91
101
  }
92
102
 
103
+ function isFipsRegion(region) {
104
+ return region && (region.startsWith('fips-') || region.endsWith('-fips'));
105
+ }
106
+
107
+ function isFipsCnRegion(region) {
108
+ return (
109
+ region &&
110
+ region.startsWith('fips-cn-') ||
111
+ (region.startsWith('cn-') && region.endsWith('-fips'))
112
+ );
113
+ }
114
+
115
+ function getRealRegion(region) {
116
+ return isFipsRegion(region)
117
+ ? ['fips-aws-global', 'aws-fips'].includes(region)
118
+ ? 'us-east-1'
119
+ : region === 'fips-aws-us-gov-global'
120
+ ? 'us-gov-west-1'
121
+ : region.replace(/fips-(dkr-|prod-)?|-fips/, '')
122
+ : region;
123
+ }
124
+
93
125
  /**
94
126
  * @api private
95
127
  */
96
128
  module.exports = {
97
129
  configureEndpoint: configureEndpoint,
98
- getEndpointSuffix: getEndpointSuffix
130
+ getEndpointSuffix: getEndpointSuffix,
131
+ getRealRegion: getRealRegion,
99
132
  };
@@ -3,6 +3,12 @@
3
3
  "*/*": {
4
4
  "endpoint": "{service}.{region}.amazonaws.com"
5
5
  },
6
+ "fips-*/*": {
7
+ "endpoint": "{service}-fips.{region}.amazonaws.com"
8
+ },
9
+ "fips-cn-*/*": {
10
+ "endpoint": "{service}-fips.{region}.amazonaws.com.cn"
11
+ },
6
12
  "cn-*/*": {
7
13
  "endpoint": "{service}.{region}.amazonaws.com.cn"
8
14
  },
@@ -61,6 +67,91 @@
61
67
  "*/sdb": {
62
68
  "endpoint": "{service}.{region}.amazonaws.com",
63
69
  "signatureVersion": "v2"
70
+ },
71
+
72
+ "fips-*/api.ecr": {
73
+ "endpoint": "ecr-fips.{region}.amazonaws.com"
74
+ },
75
+ "fips-*/api.sagemaker": {
76
+ "endpoint": "api-fips.sagemaker.{region}.amazonaws.com"
77
+ },
78
+ "fips-*/batch": {
79
+ "endpoint": "fips.batch.{region}.amazonaws.com"
80
+ },
81
+ "fips-*/streams.dynamodb": {
82
+ "endpoint": "dynamodb-fips.{region}.amazonaws.com"
83
+ },
84
+ "fips-*/route53": {
85
+ "endpoint": "route53-fips.amazonaws.com"
86
+ },
87
+ "fips-*/transcribe": {
88
+ "endpoint": "fips.transcribe.{region}.amazonaws.com"
89
+ },
90
+ "fips-*/waf": {
91
+ "endpoint": "waf-fips.amazonaws.com"
92
+ },
93
+ "fips-us-gov-east-1/acm-pca": {
94
+ "endpoint": "acm-pca.{region}.amazonaws.com"
95
+ },
96
+ "fips-us-gov-west-1/acm-pca": {
97
+ "endpoint": "acm-pca.{region}.amazonaws.com"
98
+ },
99
+ "fips-us-gov-east-1/batch": {
100
+ "endpoint": "batch.{region}.amazonaws.com"
101
+ },
102
+ "fips-us-gov-west-1/batch": {
103
+ "endpoint": "batch.{region}.amazonaws.com"
104
+ },
105
+ "us-gov-east-1-fips/dynamodb": {
106
+ "endpoint": "dynamodb.{region}.amazonaws.com"
107
+ },
108
+ "us-gov-west-1-fips/dynamodb": {
109
+ "endpoint": "dynamodb.{region}.amazonaws.com"
110
+ },
111
+ "fips-us-gov-east-1/elasticloadbalancing": {
112
+ "endpoint": "elasticloadbalancing.{region}.amazonaws.com"
113
+ },
114
+ "fips-us-gov-west-1/elasticloadbalancing": {
115
+ "endpoint": "elasticloadbalancing.{region}.amazonaws.com"
116
+ },
117
+ "us-gov-east-1-fips/guardduty": {
118
+ "endpoint": "guardduty.{region}.amazonaws.com"
119
+ },
120
+ "us-gov-west-1-fips/guardduty": {
121
+ "endpoint": "guardduty.{region}.amazonaws.com"
122
+ },
123
+ "fips-us-gov-east-1/monitoring": {
124
+ "endpoint": "monitoring.{region}.amazonaws.com"
125
+ },
126
+ "fips-us-gov-west-1/monitoring": {
127
+ "endpoint": "monitoring.{region}.amazonaws.com"
128
+ },
129
+ "fips-aws-us-gov-global/organizations": {
130
+ "endpoint": "organizations.{region}.amazonaws.com"
131
+ },
132
+ "fips-us-gov-east-1/resource-groups": {
133
+ "endpoint": "resource-groups.{region}.amazonaws.com"
134
+ },
135
+ "fips-us-gov-west-1/resource-groups": {
136
+ "endpoint": "resource-groups.{region}.amazonaws.com"
137
+ },
138
+ "fips-aws-us-gov-global/route53": {
139
+ "endpoint": "route53.us-gov.amazonaws.com"
140
+ },
141
+ "fips-us-gov-east-1/servicecatalog-appregistry": {
142
+ "endpoint": "servicecatalog-appregistry.{region}.amazonaws.com"
143
+ },
144
+ "fips-us-gov-west-1/servicecatalog-appregistry": {
145
+ "endpoint": "servicecatalog-appregistry.{region}.amazonaws.com"
146
+ },
147
+ "fips-us-gov-west-1/states": {
148
+ "endpoint": "states.{region}.amazonaws.com"
149
+ },
150
+ "us-gov-east-1-fips/streams.dynamodb": {
151
+ "endpoint": "dynamodb.{region}.amazonaws.com"
152
+ },
153
+ "us-gov-west-1-fips/streams.dynamodb": {
154
+ "endpoint": "dynamodb.{region}.amazonaws.com"
64
155
  }
65
156
  },
66
157
 
package/lib/request.js CHANGED
@@ -313,12 +313,10 @@ AWS.Request = inherit({
313
313
  var region = service.config.region;
314
314
  var customUserAgent = service.config.customUserAgent;
315
315
 
316
- if (service.isGlobalEndpoint) {
317
- if (service.signingRegion) {
318
- region = service.signingRegion;
319
- } else {
320
- region = 'us-east-1';
321
- }
316
+ if (service.signingRegion) {
317
+ region = service.signingRegion;
318
+ } else if (service.isGlobalEndpoint) {
319
+ region = 'us-east-1';
322
320
  }
323
321
 
324
322
  this.domain = domain && domain.active;
package/lib/service.js CHANGED
@@ -636,7 +636,7 @@ AWS.Service = inherit({
636
636
 
637
637
  var e = endpoint;
638
638
  e = e.replace(/\{service\}/g, this.api.endpointPrefix);
639
- e = e.replace(/\{region\}/g, this.config.region);
639
+ e = e.replace(/\{region\}/g, regionConfig.getRealRegion(this.config.region));
640
640
  e = e.replace(/\{scheme\}/g, this.config.sslEnabled ? 'https' : 'http');
641
641
  return e;
642
642
  },
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "aws-sdk",
3
3
  "description": "AWS SDK for JavaScript",
4
- "version": "2.1012.0",
4
+ "version": "2.1013.0",
5
5
  "author": {
6
6
  "name": "Amazon Web Services",
7
7
  "email": "",
8
8
  "url": "https://aws.amazon.com/"
9
9
  },
10
10
  "config": {
11
- "test_args": "test test/json test/model test/protocol test/query test/services test/signers test/xml test/s3 test/cloudfront test/dynamodb test/polly test/rds test/publisher test/event-stream"
11
+ "test_args": "test test/json test/model test/protocol test/query test/services test/signers test/xml test/s3 test/cloudfront test/dynamodb test/polly test/rds test/publisher test/event-stream test/endpoint"
12
12
  },
13
13
  "homepage": "https://github.com/aws/aws-sdk-js",
14
14
  "contributors": [
@@ -27,7 +27,11 @@ var allowlist = {
27
27
  110,
28
28
  112
29
29
  ],
30
+ '/region_config.js': [
31
+ 117
32
+ ],
30
33
  '/request.js': [
34
+ 318,
31
35
  319
32
36
  ],
33
37
  '/services/s3.js': [
@@ -1,23 +0,0 @@
1
- var AWS = require('../core');
2
-
3
- AWS.util.update(AWS.Finspace.prototype, {
4
- /**
5
- * @api private
6
- */
7
- setupRequestListeners: function setupRequestListeners(request) {
8
- request.addListener('build', this.modifyContentType);
9
- },
10
-
11
- /**
12
- * Normally rest-json services require `Content-Type` header to be 'application/json',
13
- * However Finspace service requires the header to be 'application/x-amz-json-1.1'.
14
- *
15
- * @api private
16
- */
17
- modifyContentType: function modifyContentType(request) {
18
- if (request.httpRequest.headers['Content-Type'] === 'application/json') {
19
- request.httpRequest.headers['Content-Type'] = 'application/x-amz-json-1.1';
20
- }
21
- }
22
- });
23
-
@@ -1,23 +0,0 @@
1
- var AWS = require('../core');
2
-
3
- AWS.util.update(AWS.Finspacedata.prototype, {
4
- /**
5
- * @api private
6
- */
7
- setupRequestListeners: function setupRequestListeners(request) {
8
- request.addListener('build', this.modifyContentType);
9
- },
10
-
11
- /**
12
- * Normally rest-json services require `Content-Type` header to be 'application/json',
13
- * However Finspacedata service requires the header to be 'application/x-amz-json-1.1'.
14
- *
15
- * @api private
16
- */
17
- modifyContentType: function modifyContentType(request) {
18
- if (request.httpRequest.headers['Content-Type'] === 'application/json') {
19
- request.httpRequest.headers['Content-Type'] = 'application/x-amz-json-1.1';
20
- }
21
- }
22
- });
23
-
@@ -1,23 +0,0 @@
1
- var AWS = require('../core');
2
-
3
- AWS.util.update(AWS.LexModelsV2.prototype, {
4
- /**
5
- * @api private
6
- */
7
- setupRequestListeners: function setupRequestListeners(request) {
8
- request.addListener('build', this.modifyContentType);
9
- },
10
-
11
- /**
12
- * Normally rest-json services require `Content-Type` header to be 'application/json',
13
- * However Lex Model V2 services requires the header to be 'application/x-amz-json-1.1'.
14
- *
15
- * @api private
16
- */
17
- modifyContentType: function modifyContentType(request) {
18
- if (request.httpRequest.headers['Content-Type'] === 'application/json') {
19
- request.httpRequest.headers['Content-Type'] = 'application/x-amz-json-1.1';
20
- }
21
- }
22
- });
23
-
@@ -1,22 +0,0 @@
1
- var AWS = require('../core');
2
-
3
- AWS.util.update(AWS.LookoutMetrics.prototype, {
4
- /**
5
- * @api private
6
- */
7
- setupRequestListeners: function setupRequestListeners(request) {
8
- request.addListener('build', this.modifyContentType);
9
- },
10
-
11
- /**
12
- * Normally rest-json services require `Content-Type` header to be 'application/json',
13
- * However lookout metrics services requires the header to be 'application/x-amz-json-1.1'.
14
- *
15
- * @api private
16
- */
17
- modifyContentType: function modifyContentType(request) {
18
- if (request.httpRequest.headers['Content-Type'] === 'application/json') {
19
- request.httpRequest.headers['Content-Type'] = 'application/x-amz-json-1.1';
20
- }
21
- }
22
- });