@aws-sdk/client-pricing 3.310.0 → 3.315.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.
@@ -6,50 +6,35 @@ const smithy_client_1 = require("@aws-sdk/smithy-client");
6
6
  const models_0_1 = require("../models/models_0");
7
7
  const PricingServiceException_1 = require("../models/PricingServiceException");
8
8
  const se_DescribeServicesCommand = async (input, context) => {
9
- const headers = {
10
- "content-type": "application/x-amz-json-1.1",
11
- "x-amz-target": "AWSPriceListService.DescribeServices",
12
- };
9
+ const headers = sharedHeaders("DescribeServices");
13
10
  let body;
14
- body = JSON.stringify(se_DescribeServicesRequest(input, context));
11
+ body = JSON.stringify((0, smithy_client_1._json)(input));
15
12
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
16
13
  };
17
14
  exports.se_DescribeServicesCommand = se_DescribeServicesCommand;
18
15
  const se_GetAttributeValuesCommand = async (input, context) => {
19
- const headers = {
20
- "content-type": "application/x-amz-json-1.1",
21
- "x-amz-target": "AWSPriceListService.GetAttributeValues",
22
- };
16
+ const headers = sharedHeaders("GetAttributeValues");
23
17
  let body;
24
- body = JSON.stringify(se_GetAttributeValuesRequest(input, context));
18
+ body = JSON.stringify((0, smithy_client_1._json)(input));
25
19
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
26
20
  };
27
21
  exports.se_GetAttributeValuesCommand = se_GetAttributeValuesCommand;
28
22
  const se_GetPriceListFileUrlCommand = async (input, context) => {
29
- const headers = {
30
- "content-type": "application/x-amz-json-1.1",
31
- "x-amz-target": "AWSPriceListService.GetPriceListFileUrl",
32
- };
23
+ const headers = sharedHeaders("GetPriceListFileUrl");
33
24
  let body;
34
- body = JSON.stringify(se_GetPriceListFileUrlRequest(input, context));
25
+ body = JSON.stringify((0, smithy_client_1._json)(input));
35
26
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
36
27
  };
37
28
  exports.se_GetPriceListFileUrlCommand = se_GetPriceListFileUrlCommand;
38
29
  const se_GetProductsCommand = async (input, context) => {
39
- const headers = {
40
- "content-type": "application/x-amz-json-1.1",
41
- "x-amz-target": "AWSPriceListService.GetProducts",
42
- };
30
+ const headers = sharedHeaders("GetProducts");
43
31
  let body;
44
- body = JSON.stringify(se_GetProductsRequest(input, context));
32
+ body = JSON.stringify((0, smithy_client_1._json)(input));
45
33
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
46
34
  };
47
35
  exports.se_GetProductsCommand = se_GetProductsCommand;
48
36
  const se_ListPriceListsCommand = async (input, context) => {
49
- const headers = {
50
- "content-type": "application/x-amz-json-1.1",
51
- "x-amz-target": "AWSPriceListService.ListPriceLists",
52
- };
37
+ const headers = sharedHeaders("ListPriceLists");
53
38
  let body;
54
39
  body = JSON.stringify(se_ListPriceListsRequest(input, context));
55
40
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
@@ -61,12 +46,12 @@ const de_DescribeServicesCommand = async (output, context) => {
61
46
  }
62
47
  const data = await parseBody(output.body, context);
63
48
  let contents = {};
64
- contents = de_DescribeServicesResponse(data, context);
49
+ contents = (0, smithy_client_1._json)(data);
65
50
  const response = {
66
51
  $metadata: deserializeMetadata(output),
67
52
  ...contents,
68
53
  };
69
- return Promise.resolve(response);
54
+ return response;
70
55
  };
71
56
  exports.de_DescribeServicesCommand = de_DescribeServicesCommand;
72
57
  const de_DescribeServicesCommandError = async (output, context) => {
@@ -93,10 +78,9 @@ const de_DescribeServicesCommandError = async (output, context) => {
93
78
  throw await de_NotFoundExceptionRes(parsedOutput, context);
94
79
  default:
95
80
  const parsedBody = parsedOutput.body;
96
- (0, smithy_client_1.throwDefaultError)({
81
+ return throwDefaultError({
97
82
  output,
98
83
  parsedBody,
99
- exceptionCtor: PricingServiceException_1.PricingServiceException,
100
84
  errorCode,
101
85
  });
102
86
  }
@@ -107,12 +91,12 @@ const de_GetAttributeValuesCommand = async (output, context) => {
107
91
  }
108
92
  const data = await parseBody(output.body, context);
109
93
  let contents = {};
110
- contents = de_GetAttributeValuesResponse(data, context);
94
+ contents = (0, smithy_client_1._json)(data);
111
95
  const response = {
112
96
  $metadata: deserializeMetadata(output),
113
97
  ...contents,
114
98
  };
115
- return Promise.resolve(response);
99
+ return response;
116
100
  };
117
101
  exports.de_GetAttributeValuesCommand = de_GetAttributeValuesCommand;
118
102
  const de_GetAttributeValuesCommandError = async (output, context) => {
@@ -139,10 +123,9 @@ const de_GetAttributeValuesCommandError = async (output, context) => {
139
123
  throw await de_NotFoundExceptionRes(parsedOutput, context);
140
124
  default:
141
125
  const parsedBody = parsedOutput.body;
142
- (0, smithy_client_1.throwDefaultError)({
126
+ return throwDefaultError({
143
127
  output,
144
128
  parsedBody,
145
- exceptionCtor: PricingServiceException_1.PricingServiceException,
146
129
  errorCode,
147
130
  });
148
131
  }
@@ -153,12 +136,12 @@ const de_GetPriceListFileUrlCommand = async (output, context) => {
153
136
  }
154
137
  const data = await parseBody(output.body, context);
155
138
  let contents = {};
156
- contents = de_GetPriceListFileUrlResponse(data, context);
139
+ contents = (0, smithy_client_1._json)(data);
157
140
  const response = {
158
141
  $metadata: deserializeMetadata(output),
159
142
  ...contents,
160
143
  };
161
- return Promise.resolve(response);
144
+ return response;
162
145
  };
163
146
  exports.de_GetPriceListFileUrlCommand = de_GetPriceListFileUrlCommand;
164
147
  const de_GetPriceListFileUrlCommandError = async (output, context) => {
@@ -182,10 +165,9 @@ const de_GetPriceListFileUrlCommandError = async (output, context) => {
182
165
  throw await de_NotFoundExceptionRes(parsedOutput, context);
183
166
  default:
184
167
  const parsedBody = parsedOutput.body;
185
- (0, smithy_client_1.throwDefaultError)({
168
+ return throwDefaultError({
186
169
  output,
187
170
  parsedBody,
188
- exceptionCtor: PricingServiceException_1.PricingServiceException,
189
171
  errorCode,
190
172
  });
191
173
  }
@@ -201,7 +183,7 @@ const de_GetProductsCommand = async (output, context) => {
201
183
  $metadata: deserializeMetadata(output),
202
184
  ...contents,
203
185
  };
204
- return Promise.resolve(response);
186
+ return response;
205
187
  };
206
188
  exports.de_GetProductsCommand = de_GetProductsCommand;
207
189
  const de_GetProductsCommandError = async (output, context) => {
@@ -228,10 +210,9 @@ const de_GetProductsCommandError = async (output, context) => {
228
210
  throw await de_NotFoundExceptionRes(parsedOutput, context);
229
211
  default:
230
212
  const parsedBody = parsedOutput.body;
231
- (0, smithy_client_1.throwDefaultError)({
213
+ return throwDefaultError({
232
214
  output,
233
215
  parsedBody,
234
- exceptionCtor: PricingServiceException_1.PricingServiceException,
235
216
  errorCode,
236
217
  });
237
218
  }
@@ -242,12 +223,12 @@ const de_ListPriceListsCommand = async (output, context) => {
242
223
  }
243
224
  const data = await parseBody(output.body, context);
244
225
  let contents = {};
245
- contents = de_ListPriceListsResponse(data, context);
226
+ contents = (0, smithy_client_1._json)(data);
246
227
  const response = {
247
228
  $metadata: deserializeMetadata(output),
248
229
  ...contents,
249
230
  };
250
- return Promise.resolve(response);
231
+ return response;
251
232
  };
252
233
  exports.de_ListPriceListsCommand = de_ListPriceListsCommand;
253
234
  const de_ListPriceListsCommandError = async (output, context) => {
@@ -277,17 +258,16 @@ const de_ListPriceListsCommandError = async (output, context) => {
277
258
  throw await de_NotFoundExceptionRes(parsedOutput, context);
278
259
  default:
279
260
  const parsedBody = parsedOutput.body;
280
- (0, smithy_client_1.throwDefaultError)({
261
+ return throwDefaultError({
281
262
  output,
282
263
  parsedBody,
283
- exceptionCtor: PricingServiceException_1.PricingServiceException,
284
264
  errorCode,
285
265
  });
286
266
  }
287
267
  };
288
268
  const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
289
269
  const body = parsedOutput.body;
290
- const deserialized = de_AccessDeniedException(body, context);
270
+ const deserialized = (0, smithy_client_1._json)(body);
291
271
  const exception = new models_0_1.AccessDeniedException({
292
272
  $metadata: deserializeMetadata(parsedOutput),
293
273
  ...deserialized,
@@ -296,7 +276,7 @@ const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
296
276
  };
297
277
  const de_ExpiredNextTokenExceptionRes = async (parsedOutput, context) => {
298
278
  const body = parsedOutput.body;
299
- const deserialized = de_ExpiredNextTokenException(body, context);
279
+ const deserialized = (0, smithy_client_1._json)(body);
300
280
  const exception = new models_0_1.ExpiredNextTokenException({
301
281
  $metadata: deserializeMetadata(parsedOutput),
302
282
  ...deserialized,
@@ -305,7 +285,7 @@ const de_ExpiredNextTokenExceptionRes = async (parsedOutput, context) => {
305
285
  };
306
286
  const de_InternalErrorExceptionRes = async (parsedOutput, context) => {
307
287
  const body = parsedOutput.body;
308
- const deserialized = de_InternalErrorException(body, context);
288
+ const deserialized = (0, smithy_client_1._json)(body);
309
289
  const exception = new models_0_1.InternalErrorException({
310
290
  $metadata: deserializeMetadata(parsedOutput),
311
291
  ...deserialized,
@@ -314,7 +294,7 @@ const de_InternalErrorExceptionRes = async (parsedOutput, context) => {
314
294
  };
315
295
  const de_InvalidNextTokenExceptionRes = async (parsedOutput, context) => {
316
296
  const body = parsedOutput.body;
317
- const deserialized = de_InvalidNextTokenException(body, context);
297
+ const deserialized = (0, smithy_client_1._json)(body);
318
298
  const exception = new models_0_1.InvalidNextTokenException({
319
299
  $metadata: deserializeMetadata(parsedOutput),
320
300
  ...deserialized,
@@ -323,7 +303,7 @@ const de_InvalidNextTokenExceptionRes = async (parsedOutput, context) => {
323
303
  };
324
304
  const de_InvalidParameterExceptionRes = async (parsedOutput, context) => {
325
305
  const body = parsedOutput.body;
326
- const deserialized = de_InvalidParameterException(body, context);
306
+ const deserialized = (0, smithy_client_1._json)(body);
327
307
  const exception = new models_0_1.InvalidParameterException({
328
308
  $metadata: deserializeMetadata(parsedOutput),
329
309
  ...deserialized,
@@ -332,214 +312,38 @@ const de_InvalidParameterExceptionRes = async (parsedOutput, context) => {
332
312
  };
333
313
  const de_NotFoundExceptionRes = async (parsedOutput, context) => {
334
314
  const body = parsedOutput.body;
335
- const deserialized = de_NotFoundException(body, context);
315
+ const deserialized = (0, smithy_client_1._json)(body);
336
316
  const exception = new models_0_1.NotFoundException({
337
317
  $metadata: deserializeMetadata(parsedOutput),
338
318
  ...deserialized,
339
319
  });
340
320
  return (0, smithy_client_1.decorateServiceException)(exception, body);
341
321
  };
342
- const se_DescribeServicesRequest = (input, context) => {
343
- return {
344
- ...(input.FormatVersion != null && { FormatVersion: input.FormatVersion }),
345
- ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
346
- ...(input.NextToken != null && { NextToken: input.NextToken }),
347
- ...(input.ServiceCode != null && { ServiceCode: input.ServiceCode }),
348
- };
349
- };
350
- const se_Filter = (input, context) => {
351
- return {
352
- ...(input.Field != null && { Field: input.Field }),
353
- ...(input.Type != null && { Type: input.Type }),
354
- ...(input.Value != null && { Value: input.Value }),
355
- };
356
- };
357
- const se_Filters = (input, context) => {
358
- return input
359
- .filter((e) => e != null)
360
- .map((entry) => {
361
- return se_Filter(entry, context);
362
- });
363
- };
364
- const se_GetAttributeValuesRequest = (input, context) => {
365
- return {
366
- ...(input.AttributeName != null && { AttributeName: input.AttributeName }),
367
- ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
368
- ...(input.NextToken != null && { NextToken: input.NextToken }),
369
- ...(input.ServiceCode != null && { ServiceCode: input.ServiceCode }),
370
- };
371
- };
372
- const se_GetPriceListFileUrlRequest = (input, context) => {
373
- return {
374
- ...(input.FileFormat != null && { FileFormat: input.FileFormat }),
375
- ...(input.PriceListArn != null && { PriceListArn: input.PriceListArn }),
376
- };
377
- };
378
- const se_GetProductsRequest = (input, context) => {
379
- return {
380
- ...(input.Filters != null && { Filters: se_Filters(input.Filters, context) }),
381
- ...(input.FormatVersion != null && { FormatVersion: input.FormatVersion }),
382
- ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
383
- ...(input.NextToken != null && { NextToken: input.NextToken }),
384
- ...(input.ServiceCode != null && { ServiceCode: input.ServiceCode }),
385
- };
386
- };
387
322
  const se_ListPriceListsRequest = (input, context) => {
388
- return {
389
- ...(input.CurrencyCode != null && { CurrencyCode: input.CurrencyCode }),
390
- ...(input.EffectiveDate != null && { EffectiveDate: Math.round(input.EffectiveDate.getTime() / 1000) }),
391
- ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
392
- ...(input.NextToken != null && { NextToken: input.NextToken }),
393
- ...(input.RegionCode != null && { RegionCode: input.RegionCode }),
394
- ...(input.ServiceCode != null && { ServiceCode: input.ServiceCode }),
395
- };
396
- };
397
- const de_AccessDeniedException = (output, context) => {
398
- return {
399
- Message: (0, smithy_client_1.expectString)(output.Message),
400
- };
401
- };
402
- const de_AttributeNameList = (output, context) => {
403
- const retVal = (output || [])
404
- .filter((e) => e != null)
405
- .map((entry) => {
406
- if (entry === null) {
407
- return null;
408
- }
409
- return (0, smithy_client_1.expectString)(entry);
410
- });
411
- return retVal;
412
- };
413
- const de_AttributeValue = (output, context) => {
414
- return {
415
- Value: (0, smithy_client_1.expectString)(output.Value),
416
- };
417
- };
418
- const de_AttributeValueList = (output, context) => {
419
- const retVal = (output || [])
420
- .filter((e) => e != null)
421
- .map((entry) => {
422
- if (entry === null) {
423
- return null;
424
- }
425
- return de_AttributeValue(entry, context);
323
+ return (0, smithy_client_1.take)(input, {
324
+ CurrencyCode: [],
325
+ EffectiveDate: (_) => Math.round(_.getTime() / 1000),
326
+ MaxResults: [],
327
+ NextToken: [],
328
+ RegionCode: [],
329
+ ServiceCode: [],
426
330
  });
427
- return retVal;
428
- };
429
- const de_DescribeServicesResponse = (output, context) => {
430
- return {
431
- FormatVersion: (0, smithy_client_1.expectString)(output.FormatVersion),
432
- NextToken: (0, smithy_client_1.expectString)(output.NextToken),
433
- Services: output.Services != null ? de_ServiceList(output.Services, context) : undefined,
434
- };
435
- };
436
- const de_ExpiredNextTokenException = (output, context) => {
437
- return {
438
- Message: (0, smithy_client_1.expectString)(output.Message),
439
- };
440
- };
441
- const de_FileFormats = (output, context) => {
442
- const retVal = (output || [])
443
- .filter((e) => e != null)
444
- .map((entry) => {
445
- if (entry === null) {
446
- return null;
447
- }
448
- return (0, smithy_client_1.expectString)(entry);
449
- });
450
- return retVal;
451
- };
452
- const de_GetAttributeValuesResponse = (output, context) => {
453
- return {
454
- AttributeValues: output.AttributeValues != null ? de_AttributeValueList(output.AttributeValues, context) : undefined,
455
- NextToken: (0, smithy_client_1.expectString)(output.NextToken),
456
- };
457
- };
458
- const de_GetPriceListFileUrlResponse = (output, context) => {
459
- return {
460
- Url: (0, smithy_client_1.expectString)(output.Url),
461
- };
462
331
  };
463
332
  const de_GetProductsResponse = (output, context) => {
464
- return {
465
- FormatVersion: (0, smithy_client_1.expectString)(output.FormatVersion),
466
- NextToken: (0, smithy_client_1.expectString)(output.NextToken),
467
- PriceList: output.PriceList != null ? de_PriceListJsonItems(output.PriceList, context) : undefined,
468
- };
469
- };
470
- const de_InternalErrorException = (output, context) => {
471
- return {
472
- Message: (0, smithy_client_1.expectString)(output.Message),
473
- };
474
- };
475
- const de_InvalidNextTokenException = (output, context) => {
476
- return {
477
- Message: (0, smithy_client_1.expectString)(output.Message),
478
- };
479
- };
480
- const de_InvalidParameterException = (output, context) => {
481
- return {
482
- Message: (0, smithy_client_1.expectString)(output.Message),
483
- };
484
- };
485
- const de_ListPriceListsResponse = (output, context) => {
486
- return {
487
- NextToken: (0, smithy_client_1.expectString)(output.NextToken),
488
- PriceLists: output.PriceLists != null ? de_PriceLists(output.PriceLists, context) : undefined,
489
- };
490
- };
491
- const de_NotFoundException = (output, context) => {
492
- return {
493
- Message: (0, smithy_client_1.expectString)(output.Message),
494
- };
495
- };
496
- const de_PriceList = (output, context) => {
497
- return {
498
- CurrencyCode: (0, smithy_client_1.expectString)(output.CurrencyCode),
499
- FileFormats: output.FileFormats != null ? de_FileFormats(output.FileFormats, context) : undefined,
500
- PriceListArn: (0, smithy_client_1.expectString)(output.PriceListArn),
501
- RegionCode: (0, smithy_client_1.expectString)(output.RegionCode),
502
- };
333
+ return (0, smithy_client_1.take)(output, {
334
+ FormatVersion: smithy_client_1.expectString,
335
+ NextToken: smithy_client_1.expectString,
336
+ PriceList: (_) => de_PriceListJsonItems(_, context),
337
+ });
503
338
  };
504
339
  const de_PriceListJsonItems = (output, context) => {
505
340
  const retVal = (output || [])
506
341
  .filter((e) => e != null)
507
342
  .map((entry) => {
508
- if (entry === null) {
509
- return null;
510
- }
511
343
  return new smithy_client_1.LazyJsonString(entry);
512
344
  });
513
345
  return retVal;
514
346
  };
515
- const de_PriceLists = (output, context) => {
516
- const retVal = (output || [])
517
- .filter((e) => e != null)
518
- .map((entry) => {
519
- if (entry === null) {
520
- return null;
521
- }
522
- return de_PriceList(entry, context);
523
- });
524
- return retVal;
525
- };
526
- const de_Service = (output, context) => {
527
- return {
528
- AttributeNames: output.AttributeNames != null ? de_AttributeNameList(output.AttributeNames, context) : undefined,
529
- ServiceCode: (0, smithy_client_1.expectString)(output.ServiceCode),
530
- };
531
- };
532
- const de_ServiceList = (output, context) => {
533
- const retVal = (output || [])
534
- .filter((e) => e != null)
535
- .map((entry) => {
536
- if (entry === null) {
537
- return null;
538
- }
539
- return de_Service(entry, context);
540
- });
541
- return retVal;
542
- };
543
347
  const deserializeMetadata = (output) => ({
544
348
  httpStatusCode: output.statusCode,
545
349
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
@@ -553,6 +357,7 @@ const collectBody = (streamBody = new Uint8Array(), context) => {
553
357
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
554
358
  };
555
359
  const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
360
+ const throwDefaultError = (0, smithy_client_1.withBaseException)(PricingServiceException_1.PricingServiceException);
556
361
  const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
557
362
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
558
363
  const contents = {
@@ -571,6 +376,12 @@ const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, bod
571
376
  }
572
377
  return new protocol_http_1.HttpRequest(contents);
573
378
  };
379
+ function sharedHeaders(operation) {
380
+ return {
381
+ "content-type": "application/x-amz-json-1.1",
382
+ "x-amz-target": `AWSPriceListService.${operation}`,
383
+ };
384
+ }
574
385
  const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
575
386
  if (encoded.length) {
576
387
  return JSON.parse(encoded);
@@ -1,48 +1,33 @@
1
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
- import { decorateServiceException as __decorateServiceException, expectString as __expectString, LazyJsonString as __LazyJsonString, throwDefaultError, } from "@aws-sdk/smithy-client";
2
+ import { _json, decorateServiceException as __decorateServiceException, expectString as __expectString, LazyJsonString as __LazyJsonString, take, withBaseException, } from "@aws-sdk/smithy-client";
3
3
  import { AccessDeniedException, ExpiredNextTokenException, InternalErrorException, InvalidNextTokenException, InvalidParameterException, NotFoundException, } from "../models/models_0";
4
4
  import { PricingServiceException as __BaseException } from "../models/PricingServiceException";
5
5
  export const se_DescribeServicesCommand = async (input, context) => {
6
- const headers = {
7
- "content-type": "application/x-amz-json-1.1",
8
- "x-amz-target": "AWSPriceListService.DescribeServices",
9
- };
6
+ const headers = sharedHeaders("DescribeServices");
10
7
  let body;
11
- body = JSON.stringify(se_DescribeServicesRequest(input, context));
8
+ body = JSON.stringify(_json(input));
12
9
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
13
10
  };
14
11
  export const se_GetAttributeValuesCommand = async (input, context) => {
15
- const headers = {
16
- "content-type": "application/x-amz-json-1.1",
17
- "x-amz-target": "AWSPriceListService.GetAttributeValues",
18
- };
12
+ const headers = sharedHeaders("GetAttributeValues");
19
13
  let body;
20
- body = JSON.stringify(se_GetAttributeValuesRequest(input, context));
14
+ body = JSON.stringify(_json(input));
21
15
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
22
16
  };
23
17
  export const se_GetPriceListFileUrlCommand = async (input, context) => {
24
- const headers = {
25
- "content-type": "application/x-amz-json-1.1",
26
- "x-amz-target": "AWSPriceListService.GetPriceListFileUrl",
27
- };
18
+ const headers = sharedHeaders("GetPriceListFileUrl");
28
19
  let body;
29
- body = JSON.stringify(se_GetPriceListFileUrlRequest(input, context));
20
+ body = JSON.stringify(_json(input));
30
21
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
31
22
  };
32
23
  export const se_GetProductsCommand = async (input, context) => {
33
- const headers = {
34
- "content-type": "application/x-amz-json-1.1",
35
- "x-amz-target": "AWSPriceListService.GetProducts",
36
- };
24
+ const headers = sharedHeaders("GetProducts");
37
25
  let body;
38
- body = JSON.stringify(se_GetProductsRequest(input, context));
26
+ body = JSON.stringify(_json(input));
39
27
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
40
28
  };
41
29
  export const se_ListPriceListsCommand = async (input, context) => {
42
- const headers = {
43
- "content-type": "application/x-amz-json-1.1",
44
- "x-amz-target": "AWSPriceListService.ListPriceLists",
45
- };
30
+ const headers = sharedHeaders("ListPriceLists");
46
31
  let body;
47
32
  body = JSON.stringify(se_ListPriceListsRequest(input, context));
48
33
  return buildHttpRpcRequest(context, headers, "/", undefined, body);
@@ -53,12 +38,12 @@ export const de_DescribeServicesCommand = async (output, context) => {
53
38
  }
54
39
  const data = await parseBody(output.body, context);
55
40
  let contents = {};
56
- contents = de_DescribeServicesResponse(data, context);
41
+ contents = _json(data);
57
42
  const response = {
58
43
  $metadata: deserializeMetadata(output),
59
44
  ...contents,
60
45
  };
61
- return Promise.resolve(response);
46
+ return response;
62
47
  };
63
48
  const de_DescribeServicesCommandError = async (output, context) => {
64
49
  const parsedOutput = {
@@ -84,10 +69,9 @@ const de_DescribeServicesCommandError = async (output, context) => {
84
69
  throw await de_NotFoundExceptionRes(parsedOutput, context);
85
70
  default:
86
71
  const parsedBody = parsedOutput.body;
87
- throwDefaultError({
72
+ return throwDefaultError({
88
73
  output,
89
74
  parsedBody,
90
- exceptionCtor: __BaseException,
91
75
  errorCode,
92
76
  });
93
77
  }
@@ -98,12 +82,12 @@ export const de_GetAttributeValuesCommand = async (output, context) => {
98
82
  }
99
83
  const data = await parseBody(output.body, context);
100
84
  let contents = {};
101
- contents = de_GetAttributeValuesResponse(data, context);
85
+ contents = _json(data);
102
86
  const response = {
103
87
  $metadata: deserializeMetadata(output),
104
88
  ...contents,
105
89
  };
106
- return Promise.resolve(response);
90
+ return response;
107
91
  };
108
92
  const de_GetAttributeValuesCommandError = async (output, context) => {
109
93
  const parsedOutput = {
@@ -129,10 +113,9 @@ const de_GetAttributeValuesCommandError = async (output, context) => {
129
113
  throw await de_NotFoundExceptionRes(parsedOutput, context);
130
114
  default:
131
115
  const parsedBody = parsedOutput.body;
132
- throwDefaultError({
116
+ return throwDefaultError({
133
117
  output,
134
118
  parsedBody,
135
- exceptionCtor: __BaseException,
136
119
  errorCode,
137
120
  });
138
121
  }
@@ -143,12 +126,12 @@ export const de_GetPriceListFileUrlCommand = async (output, context) => {
143
126
  }
144
127
  const data = await parseBody(output.body, context);
145
128
  let contents = {};
146
- contents = de_GetPriceListFileUrlResponse(data, context);
129
+ contents = _json(data);
147
130
  const response = {
148
131
  $metadata: deserializeMetadata(output),
149
132
  ...contents,
150
133
  };
151
- return Promise.resolve(response);
134
+ return response;
152
135
  };
153
136
  const de_GetPriceListFileUrlCommandError = async (output, context) => {
154
137
  const parsedOutput = {
@@ -171,10 +154,9 @@ const de_GetPriceListFileUrlCommandError = async (output, context) => {
171
154
  throw await de_NotFoundExceptionRes(parsedOutput, context);
172
155
  default:
173
156
  const parsedBody = parsedOutput.body;
174
- throwDefaultError({
157
+ return throwDefaultError({
175
158
  output,
176
159
  parsedBody,
177
- exceptionCtor: __BaseException,
178
160
  errorCode,
179
161
  });
180
162
  }
@@ -190,7 +172,7 @@ export const de_GetProductsCommand = async (output, context) => {
190
172
  $metadata: deserializeMetadata(output),
191
173
  ...contents,
192
174
  };
193
- return Promise.resolve(response);
175
+ return response;
194
176
  };
195
177
  const de_GetProductsCommandError = async (output, context) => {
196
178
  const parsedOutput = {
@@ -216,10 +198,9 @@ const de_GetProductsCommandError = async (output, context) => {
216
198
  throw await de_NotFoundExceptionRes(parsedOutput, context);
217
199
  default:
218
200
  const parsedBody = parsedOutput.body;
219
- throwDefaultError({
201
+ return throwDefaultError({
220
202
  output,
221
203
  parsedBody,
222
- exceptionCtor: __BaseException,
223
204
  errorCode,
224
205
  });
225
206
  }
@@ -230,12 +211,12 @@ export const de_ListPriceListsCommand = async (output, context) => {
230
211
  }
231
212
  const data = await parseBody(output.body, context);
232
213
  let contents = {};
233
- contents = de_ListPriceListsResponse(data, context);
214
+ contents = _json(data);
234
215
  const response = {
235
216
  $metadata: deserializeMetadata(output),
236
217
  ...contents,
237
218
  };
238
- return Promise.resolve(response);
219
+ return response;
239
220
  };
240
221
  const de_ListPriceListsCommandError = async (output, context) => {
241
222
  const parsedOutput = {
@@ -264,17 +245,16 @@ const de_ListPriceListsCommandError = async (output, context) => {
264
245
  throw await de_NotFoundExceptionRes(parsedOutput, context);
265
246
  default:
266
247
  const parsedBody = parsedOutput.body;
267
- throwDefaultError({
248
+ return throwDefaultError({
268
249
  output,
269
250
  parsedBody,
270
- exceptionCtor: __BaseException,
271
251
  errorCode,
272
252
  });
273
253
  }
274
254
  };
275
255
  const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
276
256
  const body = parsedOutput.body;
277
- const deserialized = de_AccessDeniedException(body, context);
257
+ const deserialized = _json(body);
278
258
  const exception = new AccessDeniedException({
279
259
  $metadata: deserializeMetadata(parsedOutput),
280
260
  ...deserialized,
@@ -283,7 +263,7 @@ const de_AccessDeniedExceptionRes = async (parsedOutput, context) => {
283
263
  };
284
264
  const de_ExpiredNextTokenExceptionRes = async (parsedOutput, context) => {
285
265
  const body = parsedOutput.body;
286
- const deserialized = de_ExpiredNextTokenException(body, context);
266
+ const deserialized = _json(body);
287
267
  const exception = new ExpiredNextTokenException({
288
268
  $metadata: deserializeMetadata(parsedOutput),
289
269
  ...deserialized,
@@ -292,7 +272,7 @@ const de_ExpiredNextTokenExceptionRes = async (parsedOutput, context) => {
292
272
  };
293
273
  const de_InternalErrorExceptionRes = async (parsedOutput, context) => {
294
274
  const body = parsedOutput.body;
295
- const deserialized = de_InternalErrorException(body, context);
275
+ const deserialized = _json(body);
296
276
  const exception = new InternalErrorException({
297
277
  $metadata: deserializeMetadata(parsedOutput),
298
278
  ...deserialized,
@@ -301,7 +281,7 @@ const de_InternalErrorExceptionRes = async (parsedOutput, context) => {
301
281
  };
302
282
  const de_InvalidNextTokenExceptionRes = async (parsedOutput, context) => {
303
283
  const body = parsedOutput.body;
304
- const deserialized = de_InvalidNextTokenException(body, context);
284
+ const deserialized = _json(body);
305
285
  const exception = new InvalidNextTokenException({
306
286
  $metadata: deserializeMetadata(parsedOutput),
307
287
  ...deserialized,
@@ -310,7 +290,7 @@ const de_InvalidNextTokenExceptionRes = async (parsedOutput, context) => {
310
290
  };
311
291
  const de_InvalidParameterExceptionRes = async (parsedOutput, context) => {
312
292
  const body = parsedOutput.body;
313
- const deserialized = de_InvalidParameterException(body, context);
293
+ const deserialized = _json(body);
314
294
  const exception = new InvalidParameterException({
315
295
  $metadata: deserializeMetadata(parsedOutput),
316
296
  ...deserialized,
@@ -319,214 +299,38 @@ const de_InvalidParameterExceptionRes = async (parsedOutput, context) => {
319
299
  };
320
300
  const de_NotFoundExceptionRes = async (parsedOutput, context) => {
321
301
  const body = parsedOutput.body;
322
- const deserialized = de_NotFoundException(body, context);
302
+ const deserialized = _json(body);
323
303
  const exception = new NotFoundException({
324
304
  $metadata: deserializeMetadata(parsedOutput),
325
305
  ...deserialized,
326
306
  });
327
307
  return __decorateServiceException(exception, body);
328
308
  };
329
- const se_DescribeServicesRequest = (input, context) => {
330
- return {
331
- ...(input.FormatVersion != null && { FormatVersion: input.FormatVersion }),
332
- ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
333
- ...(input.NextToken != null && { NextToken: input.NextToken }),
334
- ...(input.ServiceCode != null && { ServiceCode: input.ServiceCode }),
335
- };
336
- };
337
- const se_Filter = (input, context) => {
338
- return {
339
- ...(input.Field != null && { Field: input.Field }),
340
- ...(input.Type != null && { Type: input.Type }),
341
- ...(input.Value != null && { Value: input.Value }),
342
- };
343
- };
344
- const se_Filters = (input, context) => {
345
- return input
346
- .filter((e) => e != null)
347
- .map((entry) => {
348
- return se_Filter(entry, context);
349
- });
350
- };
351
- const se_GetAttributeValuesRequest = (input, context) => {
352
- return {
353
- ...(input.AttributeName != null && { AttributeName: input.AttributeName }),
354
- ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
355
- ...(input.NextToken != null && { NextToken: input.NextToken }),
356
- ...(input.ServiceCode != null && { ServiceCode: input.ServiceCode }),
357
- };
358
- };
359
- const se_GetPriceListFileUrlRequest = (input, context) => {
360
- return {
361
- ...(input.FileFormat != null && { FileFormat: input.FileFormat }),
362
- ...(input.PriceListArn != null && { PriceListArn: input.PriceListArn }),
363
- };
364
- };
365
- const se_GetProductsRequest = (input, context) => {
366
- return {
367
- ...(input.Filters != null && { Filters: se_Filters(input.Filters, context) }),
368
- ...(input.FormatVersion != null && { FormatVersion: input.FormatVersion }),
369
- ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
370
- ...(input.NextToken != null && { NextToken: input.NextToken }),
371
- ...(input.ServiceCode != null && { ServiceCode: input.ServiceCode }),
372
- };
373
- };
374
309
  const se_ListPriceListsRequest = (input, context) => {
375
- return {
376
- ...(input.CurrencyCode != null && { CurrencyCode: input.CurrencyCode }),
377
- ...(input.EffectiveDate != null && { EffectiveDate: Math.round(input.EffectiveDate.getTime() / 1000) }),
378
- ...(input.MaxResults != null && { MaxResults: input.MaxResults }),
379
- ...(input.NextToken != null && { NextToken: input.NextToken }),
380
- ...(input.RegionCode != null && { RegionCode: input.RegionCode }),
381
- ...(input.ServiceCode != null && { ServiceCode: input.ServiceCode }),
382
- };
383
- };
384
- const de_AccessDeniedException = (output, context) => {
385
- return {
386
- Message: __expectString(output.Message),
387
- };
388
- };
389
- const de_AttributeNameList = (output, context) => {
390
- const retVal = (output || [])
391
- .filter((e) => e != null)
392
- .map((entry) => {
393
- if (entry === null) {
394
- return null;
395
- }
396
- return __expectString(entry);
397
- });
398
- return retVal;
399
- };
400
- const de_AttributeValue = (output, context) => {
401
- return {
402
- Value: __expectString(output.Value),
403
- };
404
- };
405
- const de_AttributeValueList = (output, context) => {
406
- const retVal = (output || [])
407
- .filter((e) => e != null)
408
- .map((entry) => {
409
- if (entry === null) {
410
- return null;
411
- }
412
- return de_AttributeValue(entry, context);
310
+ return take(input, {
311
+ CurrencyCode: [],
312
+ EffectiveDate: (_) => Math.round(_.getTime() / 1000),
313
+ MaxResults: [],
314
+ NextToken: [],
315
+ RegionCode: [],
316
+ ServiceCode: [],
413
317
  });
414
- return retVal;
415
- };
416
- const de_DescribeServicesResponse = (output, context) => {
417
- return {
418
- FormatVersion: __expectString(output.FormatVersion),
419
- NextToken: __expectString(output.NextToken),
420
- Services: output.Services != null ? de_ServiceList(output.Services, context) : undefined,
421
- };
422
- };
423
- const de_ExpiredNextTokenException = (output, context) => {
424
- return {
425
- Message: __expectString(output.Message),
426
- };
427
- };
428
- const de_FileFormats = (output, context) => {
429
- const retVal = (output || [])
430
- .filter((e) => e != null)
431
- .map((entry) => {
432
- if (entry === null) {
433
- return null;
434
- }
435
- return __expectString(entry);
436
- });
437
- return retVal;
438
- };
439
- const de_GetAttributeValuesResponse = (output, context) => {
440
- return {
441
- AttributeValues: output.AttributeValues != null ? de_AttributeValueList(output.AttributeValues, context) : undefined,
442
- NextToken: __expectString(output.NextToken),
443
- };
444
- };
445
- const de_GetPriceListFileUrlResponse = (output, context) => {
446
- return {
447
- Url: __expectString(output.Url),
448
- };
449
318
  };
450
319
  const de_GetProductsResponse = (output, context) => {
451
- return {
452
- FormatVersion: __expectString(output.FormatVersion),
453
- NextToken: __expectString(output.NextToken),
454
- PriceList: output.PriceList != null ? de_PriceListJsonItems(output.PriceList, context) : undefined,
455
- };
456
- };
457
- const de_InternalErrorException = (output, context) => {
458
- return {
459
- Message: __expectString(output.Message),
460
- };
461
- };
462
- const de_InvalidNextTokenException = (output, context) => {
463
- return {
464
- Message: __expectString(output.Message),
465
- };
466
- };
467
- const de_InvalidParameterException = (output, context) => {
468
- return {
469
- Message: __expectString(output.Message),
470
- };
471
- };
472
- const de_ListPriceListsResponse = (output, context) => {
473
- return {
474
- NextToken: __expectString(output.NextToken),
475
- PriceLists: output.PriceLists != null ? de_PriceLists(output.PriceLists, context) : undefined,
476
- };
477
- };
478
- const de_NotFoundException = (output, context) => {
479
- return {
480
- Message: __expectString(output.Message),
481
- };
482
- };
483
- const de_PriceList = (output, context) => {
484
- return {
485
- CurrencyCode: __expectString(output.CurrencyCode),
486
- FileFormats: output.FileFormats != null ? de_FileFormats(output.FileFormats, context) : undefined,
487
- PriceListArn: __expectString(output.PriceListArn),
488
- RegionCode: __expectString(output.RegionCode),
489
- };
320
+ return take(output, {
321
+ FormatVersion: __expectString,
322
+ NextToken: __expectString,
323
+ PriceList: (_) => de_PriceListJsonItems(_, context),
324
+ });
490
325
  };
491
326
  const de_PriceListJsonItems = (output, context) => {
492
327
  const retVal = (output || [])
493
328
  .filter((e) => e != null)
494
329
  .map((entry) => {
495
- if (entry === null) {
496
- return null;
497
- }
498
330
  return new __LazyJsonString(entry);
499
331
  });
500
332
  return retVal;
501
333
  };
502
- const de_PriceLists = (output, context) => {
503
- const retVal = (output || [])
504
- .filter((e) => e != null)
505
- .map((entry) => {
506
- if (entry === null) {
507
- return null;
508
- }
509
- return de_PriceList(entry, context);
510
- });
511
- return retVal;
512
- };
513
- const de_Service = (output, context) => {
514
- return {
515
- AttributeNames: output.AttributeNames != null ? de_AttributeNameList(output.AttributeNames, context) : undefined,
516
- ServiceCode: __expectString(output.ServiceCode),
517
- };
518
- };
519
- const de_ServiceList = (output, context) => {
520
- const retVal = (output || [])
521
- .filter((e) => e != null)
522
- .map((entry) => {
523
- if (entry === null) {
524
- return null;
525
- }
526
- return de_Service(entry, context);
527
- });
528
- return retVal;
529
- };
530
334
  const deserializeMetadata = (output) => ({
531
335
  httpStatusCode: output.statusCode,
532
336
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
@@ -540,6 +344,7 @@ const collectBody = (streamBody = new Uint8Array(), context) => {
540
344
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
541
345
  };
542
346
  const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
347
+ const throwDefaultError = withBaseException(__BaseException);
543
348
  const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, body) => {
544
349
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
545
350
  const contents = {
@@ -558,6 +363,12 @@ const buildHttpRpcRequest = async (context, headers, path, resolvedHostname, bod
558
363
  }
559
364
  return new __HttpRequest(contents);
560
365
  };
366
+ function sharedHeaders(operation) {
367
+ return {
368
+ "content-type": "application/x-amz-json-1.1",
369
+ "x-amz-target": `AWSPriceListService.${operation}`,
370
+ };
371
+ }
561
372
  const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
562
373
  if (encoded.length) {
563
374
  return JSON.parse(encoded);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-pricing",
3
3
  "description": "AWS SDK for JavaScript Pricing Client for Node.js, Browser and React Native",
4
- "version": "3.310.0",
4
+ "version": "3.315.0",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -21,9 +21,9 @@
21
21
  "dependencies": {
22
22
  "@aws-crypto/sha256-browser": "3.0.0",
23
23
  "@aws-crypto/sha256-js": "3.0.0",
24
- "@aws-sdk/client-sts": "3.310.0",
24
+ "@aws-sdk/client-sts": "3.315.0",
25
25
  "@aws-sdk/config-resolver": "3.310.0",
26
- "@aws-sdk/credential-provider-node": "3.310.0",
26
+ "@aws-sdk/credential-provider-node": "3.315.0",
27
27
  "@aws-sdk/fetch-http-handler": "3.310.0",
28
28
  "@aws-sdk/hash-node": "3.310.0",
29
29
  "@aws-sdk/invalid-dependency": "3.310.0",
@@ -40,14 +40,14 @@
40
40
  "@aws-sdk/node-config-provider": "3.310.0",
41
41
  "@aws-sdk/node-http-handler": "3.310.0",
42
42
  "@aws-sdk/protocol-http": "3.310.0",
43
- "@aws-sdk/smithy-client": "3.310.0",
43
+ "@aws-sdk/smithy-client": "3.315.0",
44
44
  "@aws-sdk/types": "3.310.0",
45
45
  "@aws-sdk/url-parser": "3.310.0",
46
46
  "@aws-sdk/util-base64": "3.310.0",
47
47
  "@aws-sdk/util-body-length-browser": "3.310.0",
48
48
  "@aws-sdk/util-body-length-node": "3.310.0",
49
- "@aws-sdk/util-defaults-mode-browser": "3.310.0",
50
- "@aws-sdk/util-defaults-mode-node": "3.310.0",
49
+ "@aws-sdk/util-defaults-mode-browser": "3.315.0",
50
+ "@aws-sdk/util-defaults-mode-node": "3.315.0",
51
51
  "@aws-sdk/util-endpoints": "3.310.0",
52
52
  "@aws-sdk/util-retry": "3.310.0",
53
53
  "@aws-sdk/util-user-agent-browser": "3.310.0",