@aws-sdk/client-pricing 3.35.0 → 3.38.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.
Files changed (116) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist-cjs/Pricing.js +0 -27
  3. package/dist-cjs/PricingClient.js +0 -32
  4. package/dist-cjs/commands/DescribeServicesCommand.js +0 -31
  5. package/dist-cjs/commands/GetAttributeValuesCommand.js +0 -28
  6. package/dist-cjs/commands/GetProductsCommand.js +0 -25
  7. package/dist-cjs/commands/index.js +6 -0
  8. package/dist-cjs/endpoints.js +1 -2
  9. package/dist-cjs/index.js +4 -10
  10. package/dist-cjs/models/index.js +0 -1
  11. package/dist-cjs/models/models_0.js +0 -43
  12. package/dist-cjs/pagination/DescribeServicesPaginator.js +0 -11
  13. package/dist-cjs/pagination/GetAttributeValuesPaginator.js +0 -11
  14. package/dist-cjs/pagination/GetProductsPaginator.js +0 -11
  15. package/dist-cjs/pagination/Interfaces.js +0 -1
  16. package/dist-cjs/pagination/index.js +7 -0
  17. package/dist-cjs/protocols/Aws_json1_1.js +0 -6
  18. package/dist-cjs/runtimeConfig.browser.js +1 -6
  19. package/dist-cjs/runtimeConfig.js +2 -7
  20. package/dist-cjs/runtimeConfig.native.js +0 -4
  21. package/dist-cjs/runtimeConfig.shared.js +0 -4
  22. package/dist-es/Pricing.js +0 -1
  23. package/dist-es/PricingClient.js +0 -1
  24. package/dist-es/commands/DescribeServicesCommand.js +0 -1
  25. package/dist-es/commands/GetAttributeValuesCommand.js +0 -1
  26. package/dist-es/commands/GetProductsCommand.js +0 -1
  27. package/dist-es/commands/index.js +3 -0
  28. package/dist-es/endpoints.js +1 -2
  29. package/dist-es/index.js +4 -10
  30. package/dist-es/models/index.js +0 -1
  31. package/dist-es/models/models_0.js +0 -1
  32. package/dist-es/pagination/DescribeServicesPaginator.js +0 -1
  33. package/dist-es/pagination/GetAttributeValuesPaginator.js +0 -1
  34. package/dist-es/pagination/GetProductsPaginator.js +0 -1
  35. package/dist-es/pagination/Interfaces.js +0 -1
  36. package/dist-es/pagination/index.js +4 -0
  37. package/dist-es/protocols/Aws_json1_1.js +0 -1
  38. package/dist-es/runtimeConfig.browser.js +1 -2
  39. package/dist-es/runtimeConfig.js +2 -3
  40. package/dist-es/runtimeConfig.native.js +0 -1
  41. package/dist-es/runtimeConfig.shared.js +0 -1
  42. package/dist-types/commands/index.d.ts +3 -0
  43. package/dist-types/index.d.ts +4 -9
  44. package/dist-types/pagination/index.d.ts +4 -0
  45. package/dist-types/ts3.4/Pricing.d.ts +4 -44
  46. package/dist-types/ts3.4/PricingClient.d.ts +24 -112
  47. package/dist-types/ts3.4/commands/DescribeServicesCommand.d.ts +2 -26
  48. package/dist-types/ts3.4/commands/GetAttributeValuesCommand.d.ts +2 -23
  49. package/dist-types/ts3.4/commands/GetProductsCommand.d.ts +2 -20
  50. package/dist-types/ts3.4/commands/index.d.ts +3 -0
  51. package/dist-types/ts3.4/index.d.ts +4 -9
  52. package/dist-types/ts3.4/models/models_0.d.ts +49 -173
  53. package/dist-types/ts3.4/pagination/index.d.ts +4 -0
  54. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -3
  55. package/dist-types/ts3.4/runtimeConfig.d.ts +1 -3
  56. package/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -3
  57. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +1 -3
  58. package/package.json +33 -30
  59. package/dist-cjs/Pricing.js.map +0 -1
  60. package/dist-cjs/PricingClient.js.map +0 -1
  61. package/dist-cjs/commands/DescribeServicesCommand.js.map +0 -1
  62. package/dist-cjs/commands/GetAttributeValuesCommand.js.map +0 -1
  63. package/dist-cjs/commands/GetProductsCommand.js.map +0 -1
  64. package/dist-cjs/endpoints.js.map +0 -1
  65. package/dist-cjs/index.js.map +0 -1
  66. package/dist-cjs/models/index.js.map +0 -1
  67. package/dist-cjs/models/models_0.js.map +0 -1
  68. package/dist-cjs/pagination/DescribeServicesPaginator.js.map +0 -1
  69. package/dist-cjs/pagination/GetAttributeValuesPaginator.js.map +0 -1
  70. package/dist-cjs/pagination/GetProductsPaginator.js.map +0 -1
  71. package/dist-cjs/pagination/Interfaces.js.map +0 -1
  72. package/dist-cjs/protocols/Aws_json1_1.js.map +0 -1
  73. package/dist-cjs/runtimeConfig.browser.js.map +0 -1
  74. package/dist-cjs/runtimeConfig.js.map +0 -1
  75. package/dist-cjs/runtimeConfig.native.js.map +0 -1
  76. package/dist-cjs/runtimeConfig.shared.js.map +0 -1
  77. package/dist-es/Pricing.js.map +0 -1
  78. package/dist-es/PricingClient.js.map +0 -1
  79. package/dist-es/commands/DescribeServicesCommand.js.map +0 -1
  80. package/dist-es/commands/GetAttributeValuesCommand.js.map +0 -1
  81. package/dist-es/commands/GetProductsCommand.js.map +0 -1
  82. package/dist-es/endpoints.js.map +0 -1
  83. package/dist-es/index.js.map +0 -1
  84. package/dist-es/models/index.js.map +0 -1
  85. package/dist-es/models/models_0.js.map +0 -1
  86. package/dist-es/pagination/DescribeServicesPaginator.js.map +0 -1
  87. package/dist-es/pagination/GetAttributeValuesPaginator.js.map +0 -1
  88. package/dist-es/pagination/GetProductsPaginator.js.map +0 -1
  89. package/dist-es/pagination/Interfaces.js.map +0 -1
  90. package/dist-es/protocols/Aws_json1_1.js.map +0 -1
  91. package/dist-es/runtimeConfig.browser.js.map +0 -1
  92. package/dist-es/runtimeConfig.js.map +0 -1
  93. package/dist-es/runtimeConfig.native.js.map +0 -1
  94. package/dist-es/runtimeConfig.shared.js.map +0 -1
  95. package/jest.config.js +0 -4
  96. package/src/Pricing.ts +0 -141
  97. package/src/PricingClient.ts +0 -265
  98. package/src/commands/DescribeServicesCommand.ts +0 -101
  99. package/src/commands/GetAttributeValuesCommand.ts +0 -98
  100. package/src/commands/GetProductsCommand.ts +0 -95
  101. package/src/endpoints.ts +0 -57
  102. package/src/index.ts +0 -10
  103. package/src/models/index.ts +0 -1
  104. package/src/models/models_0.ts +0 -365
  105. package/src/pagination/DescribeServicesPaginator.ts +0 -59
  106. package/src/pagination/GetAttributeValuesPaginator.ts +0 -59
  107. package/src/pagination/GetProductsPaginator.ts +0 -55
  108. package/src/pagination/Interfaces.ts +0 -8
  109. package/src/protocols/Aws_json1_1.ts +0 -675
  110. package/src/runtimeConfig.browser.ts +0 -41
  111. package/src/runtimeConfig.native.ts +0 -17
  112. package/src/runtimeConfig.shared.ts +0 -17
  113. package/src/runtimeConfig.ts +0 -46
  114. package/tsconfig.es.json +0 -10
  115. package/tsconfig.json +0 -33
  116. package/tsconfig.types.json +0 -9
@@ -1,675 +0,0 @@
1
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
2
- import { expectString as __expectString, LazyJsonString as __LazyJsonString } from "@aws-sdk/smithy-client";
3
- import {
4
- Endpoint as __Endpoint,
5
- HeaderBag as __HeaderBag,
6
- MetadataBearer as __MetadataBearer,
7
- ResponseMetadata as __ResponseMetadata,
8
- SerdeContext as __SerdeContext,
9
- SmithyException as __SmithyException,
10
- } from "@aws-sdk/types";
11
-
12
- import { DescribeServicesCommandInput, DescribeServicesCommandOutput } from "../commands/DescribeServicesCommand";
13
- import { GetAttributeValuesCommandInput, GetAttributeValuesCommandOutput } from "../commands/GetAttributeValuesCommand";
14
- import { GetProductsCommandInput, GetProductsCommandOutput } from "../commands/GetProductsCommand";
15
- import {
16
- AttributeValue,
17
- DescribeServicesRequest,
18
- DescribeServicesResponse,
19
- ExpiredNextTokenException,
20
- Filter,
21
- GetAttributeValuesRequest,
22
- GetAttributeValuesResponse,
23
- GetProductsRequest,
24
- GetProductsResponse,
25
- InternalErrorException,
26
- InvalidNextTokenException,
27
- InvalidParameterException,
28
- NotFoundException,
29
- Service,
30
- } from "../models/models_0";
31
-
32
- export const serializeAws_json1_1DescribeServicesCommand = async (
33
- input: DescribeServicesCommandInput,
34
- context: __SerdeContext
35
- ): Promise<__HttpRequest> => {
36
- const headers: __HeaderBag = {
37
- "content-type": "application/x-amz-json-1.1",
38
- "x-amz-target": "AWSPriceListService.DescribeServices",
39
- };
40
- let body: any;
41
- body = JSON.stringify(serializeAws_json1_1DescribeServicesRequest(input, context));
42
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
43
- };
44
-
45
- export const serializeAws_json1_1GetAttributeValuesCommand = async (
46
- input: GetAttributeValuesCommandInput,
47
- context: __SerdeContext
48
- ): Promise<__HttpRequest> => {
49
- const headers: __HeaderBag = {
50
- "content-type": "application/x-amz-json-1.1",
51
- "x-amz-target": "AWSPriceListService.GetAttributeValues",
52
- };
53
- let body: any;
54
- body = JSON.stringify(serializeAws_json1_1GetAttributeValuesRequest(input, context));
55
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
56
- };
57
-
58
- export const serializeAws_json1_1GetProductsCommand = async (
59
- input: GetProductsCommandInput,
60
- context: __SerdeContext
61
- ): Promise<__HttpRequest> => {
62
- const headers: __HeaderBag = {
63
- "content-type": "application/x-amz-json-1.1",
64
- "x-amz-target": "AWSPriceListService.GetProducts",
65
- };
66
- let body: any;
67
- body = JSON.stringify(serializeAws_json1_1GetProductsRequest(input, context));
68
- return buildHttpRpcRequest(context, headers, "/", undefined, body);
69
- };
70
-
71
- export const deserializeAws_json1_1DescribeServicesCommand = async (
72
- output: __HttpResponse,
73
- context: __SerdeContext
74
- ): Promise<DescribeServicesCommandOutput> => {
75
- if (output.statusCode >= 300) {
76
- return deserializeAws_json1_1DescribeServicesCommandError(output, context);
77
- }
78
- const data: any = await parseBody(output.body, context);
79
- let contents: any = {};
80
- contents = deserializeAws_json1_1DescribeServicesResponse(data, context);
81
- const response: DescribeServicesCommandOutput = {
82
- $metadata: deserializeMetadata(output),
83
- ...contents,
84
- };
85
- return Promise.resolve(response);
86
- };
87
-
88
- const deserializeAws_json1_1DescribeServicesCommandError = async (
89
- output: __HttpResponse,
90
- context: __SerdeContext
91
- ): Promise<DescribeServicesCommandOutput> => {
92
- const parsedOutput: any = {
93
- ...output,
94
- body: await parseBody(output.body, context),
95
- };
96
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
97
- let errorCode = "UnknownError";
98
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
99
- switch (errorCode) {
100
- case "ExpiredNextTokenException":
101
- case "com.amazonaws.pricing#ExpiredNextTokenException":
102
- response = {
103
- ...(await deserializeAws_json1_1ExpiredNextTokenExceptionResponse(parsedOutput, context)),
104
- name: errorCode,
105
- $metadata: deserializeMetadata(output),
106
- };
107
- break;
108
- case "InternalErrorException":
109
- case "com.amazonaws.pricing#InternalErrorException":
110
- response = {
111
- ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),
112
- name: errorCode,
113
- $metadata: deserializeMetadata(output),
114
- };
115
- break;
116
- case "InvalidNextTokenException":
117
- case "com.amazonaws.pricing#InvalidNextTokenException":
118
- response = {
119
- ...(await deserializeAws_json1_1InvalidNextTokenExceptionResponse(parsedOutput, context)),
120
- name: errorCode,
121
- $metadata: deserializeMetadata(output),
122
- };
123
- break;
124
- case "InvalidParameterException":
125
- case "com.amazonaws.pricing#InvalidParameterException":
126
- response = {
127
- ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),
128
- name: errorCode,
129
- $metadata: deserializeMetadata(output),
130
- };
131
- break;
132
- case "NotFoundException":
133
- case "com.amazonaws.pricing#NotFoundException":
134
- response = {
135
- ...(await deserializeAws_json1_1NotFoundExceptionResponse(parsedOutput, context)),
136
- name: errorCode,
137
- $metadata: deserializeMetadata(output),
138
- };
139
- break;
140
- default:
141
- const parsedBody = parsedOutput.body;
142
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
143
- response = {
144
- ...parsedBody,
145
- name: `${errorCode}`,
146
- message: parsedBody.message || parsedBody.Message || errorCode,
147
- $fault: "client",
148
- $metadata: deserializeMetadata(output),
149
- } as any;
150
- }
151
- const message = response.message || response.Message || errorCode;
152
- response.message = message;
153
- delete response.Message;
154
- return Promise.reject(Object.assign(new Error(message), response));
155
- };
156
-
157
- export const deserializeAws_json1_1GetAttributeValuesCommand = async (
158
- output: __HttpResponse,
159
- context: __SerdeContext
160
- ): Promise<GetAttributeValuesCommandOutput> => {
161
- if (output.statusCode >= 300) {
162
- return deserializeAws_json1_1GetAttributeValuesCommandError(output, context);
163
- }
164
- const data: any = await parseBody(output.body, context);
165
- let contents: any = {};
166
- contents = deserializeAws_json1_1GetAttributeValuesResponse(data, context);
167
- const response: GetAttributeValuesCommandOutput = {
168
- $metadata: deserializeMetadata(output),
169
- ...contents,
170
- };
171
- return Promise.resolve(response);
172
- };
173
-
174
- const deserializeAws_json1_1GetAttributeValuesCommandError = async (
175
- output: __HttpResponse,
176
- context: __SerdeContext
177
- ): Promise<GetAttributeValuesCommandOutput> => {
178
- const parsedOutput: any = {
179
- ...output,
180
- body: await parseBody(output.body, context),
181
- };
182
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
183
- let errorCode = "UnknownError";
184
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
185
- switch (errorCode) {
186
- case "ExpiredNextTokenException":
187
- case "com.amazonaws.pricing#ExpiredNextTokenException":
188
- response = {
189
- ...(await deserializeAws_json1_1ExpiredNextTokenExceptionResponse(parsedOutput, context)),
190
- name: errorCode,
191
- $metadata: deserializeMetadata(output),
192
- };
193
- break;
194
- case "InternalErrorException":
195
- case "com.amazonaws.pricing#InternalErrorException":
196
- response = {
197
- ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),
198
- name: errorCode,
199
- $metadata: deserializeMetadata(output),
200
- };
201
- break;
202
- case "InvalidNextTokenException":
203
- case "com.amazonaws.pricing#InvalidNextTokenException":
204
- response = {
205
- ...(await deserializeAws_json1_1InvalidNextTokenExceptionResponse(parsedOutput, context)),
206
- name: errorCode,
207
- $metadata: deserializeMetadata(output),
208
- };
209
- break;
210
- case "InvalidParameterException":
211
- case "com.amazonaws.pricing#InvalidParameterException":
212
- response = {
213
- ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),
214
- name: errorCode,
215
- $metadata: deserializeMetadata(output),
216
- };
217
- break;
218
- case "NotFoundException":
219
- case "com.amazonaws.pricing#NotFoundException":
220
- response = {
221
- ...(await deserializeAws_json1_1NotFoundExceptionResponse(parsedOutput, context)),
222
- name: errorCode,
223
- $metadata: deserializeMetadata(output),
224
- };
225
- break;
226
- default:
227
- const parsedBody = parsedOutput.body;
228
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
229
- response = {
230
- ...parsedBody,
231
- name: `${errorCode}`,
232
- message: parsedBody.message || parsedBody.Message || errorCode,
233
- $fault: "client",
234
- $metadata: deserializeMetadata(output),
235
- } as any;
236
- }
237
- const message = response.message || response.Message || errorCode;
238
- response.message = message;
239
- delete response.Message;
240
- return Promise.reject(Object.assign(new Error(message), response));
241
- };
242
-
243
- export const deserializeAws_json1_1GetProductsCommand = async (
244
- output: __HttpResponse,
245
- context: __SerdeContext
246
- ): Promise<GetProductsCommandOutput> => {
247
- if (output.statusCode >= 300) {
248
- return deserializeAws_json1_1GetProductsCommandError(output, context);
249
- }
250
- const data: any = await parseBody(output.body, context);
251
- let contents: any = {};
252
- contents = deserializeAws_json1_1GetProductsResponse(data, context);
253
- const response: GetProductsCommandOutput = {
254
- $metadata: deserializeMetadata(output),
255
- ...contents,
256
- };
257
- return Promise.resolve(response);
258
- };
259
-
260
- const deserializeAws_json1_1GetProductsCommandError = async (
261
- output: __HttpResponse,
262
- context: __SerdeContext
263
- ): Promise<GetProductsCommandOutput> => {
264
- const parsedOutput: any = {
265
- ...output,
266
- body: await parseBody(output.body, context),
267
- };
268
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
269
- let errorCode = "UnknownError";
270
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
271
- switch (errorCode) {
272
- case "ExpiredNextTokenException":
273
- case "com.amazonaws.pricing#ExpiredNextTokenException":
274
- response = {
275
- ...(await deserializeAws_json1_1ExpiredNextTokenExceptionResponse(parsedOutput, context)),
276
- name: errorCode,
277
- $metadata: deserializeMetadata(output),
278
- };
279
- break;
280
- case "InternalErrorException":
281
- case "com.amazonaws.pricing#InternalErrorException":
282
- response = {
283
- ...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),
284
- name: errorCode,
285
- $metadata: deserializeMetadata(output),
286
- };
287
- break;
288
- case "InvalidNextTokenException":
289
- case "com.amazonaws.pricing#InvalidNextTokenException":
290
- response = {
291
- ...(await deserializeAws_json1_1InvalidNextTokenExceptionResponse(parsedOutput, context)),
292
- name: errorCode,
293
- $metadata: deserializeMetadata(output),
294
- };
295
- break;
296
- case "InvalidParameterException":
297
- case "com.amazonaws.pricing#InvalidParameterException":
298
- response = {
299
- ...(await deserializeAws_json1_1InvalidParameterExceptionResponse(parsedOutput, context)),
300
- name: errorCode,
301
- $metadata: deserializeMetadata(output),
302
- };
303
- break;
304
- case "NotFoundException":
305
- case "com.amazonaws.pricing#NotFoundException":
306
- response = {
307
- ...(await deserializeAws_json1_1NotFoundExceptionResponse(parsedOutput, context)),
308
- name: errorCode,
309
- $metadata: deserializeMetadata(output),
310
- };
311
- break;
312
- default:
313
- const parsedBody = parsedOutput.body;
314
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
315
- response = {
316
- ...parsedBody,
317
- name: `${errorCode}`,
318
- message: parsedBody.message || parsedBody.Message || errorCode,
319
- $fault: "client",
320
- $metadata: deserializeMetadata(output),
321
- } as any;
322
- }
323
- const message = response.message || response.Message || errorCode;
324
- response.message = message;
325
- delete response.Message;
326
- return Promise.reject(Object.assign(new Error(message), response));
327
- };
328
-
329
- const deserializeAws_json1_1ExpiredNextTokenExceptionResponse = async (
330
- parsedOutput: any,
331
- context: __SerdeContext
332
- ): Promise<ExpiredNextTokenException> => {
333
- const body = parsedOutput.body;
334
- const deserialized: any = deserializeAws_json1_1ExpiredNextTokenException(body, context);
335
- const contents: ExpiredNextTokenException = {
336
- name: "ExpiredNextTokenException",
337
- $fault: "client",
338
- $metadata: deserializeMetadata(parsedOutput),
339
- ...deserialized,
340
- };
341
- return contents;
342
- };
343
-
344
- const deserializeAws_json1_1InternalErrorExceptionResponse = async (
345
- parsedOutput: any,
346
- context: __SerdeContext
347
- ): Promise<InternalErrorException> => {
348
- const body = parsedOutput.body;
349
- const deserialized: any = deserializeAws_json1_1InternalErrorException(body, context);
350
- const contents: InternalErrorException = {
351
- name: "InternalErrorException",
352
- $fault: "server",
353
- $metadata: deserializeMetadata(parsedOutput),
354
- ...deserialized,
355
- };
356
- return contents;
357
- };
358
-
359
- const deserializeAws_json1_1InvalidNextTokenExceptionResponse = async (
360
- parsedOutput: any,
361
- context: __SerdeContext
362
- ): Promise<InvalidNextTokenException> => {
363
- const body = parsedOutput.body;
364
- const deserialized: any = deserializeAws_json1_1InvalidNextTokenException(body, context);
365
- const contents: InvalidNextTokenException = {
366
- name: "InvalidNextTokenException",
367
- $fault: "client",
368
- $metadata: deserializeMetadata(parsedOutput),
369
- ...deserialized,
370
- };
371
- return contents;
372
- };
373
-
374
- const deserializeAws_json1_1InvalidParameterExceptionResponse = async (
375
- parsedOutput: any,
376
- context: __SerdeContext
377
- ): Promise<InvalidParameterException> => {
378
- const body = parsedOutput.body;
379
- const deserialized: any = deserializeAws_json1_1InvalidParameterException(body, context);
380
- const contents: InvalidParameterException = {
381
- name: "InvalidParameterException",
382
- $fault: "client",
383
- $metadata: deserializeMetadata(parsedOutput),
384
- ...deserialized,
385
- };
386
- return contents;
387
- };
388
-
389
- const deserializeAws_json1_1NotFoundExceptionResponse = async (
390
- parsedOutput: any,
391
- context: __SerdeContext
392
- ): Promise<NotFoundException> => {
393
- const body = parsedOutput.body;
394
- const deserialized: any = deserializeAws_json1_1NotFoundException(body, context);
395
- const contents: NotFoundException = {
396
- name: "NotFoundException",
397
- $fault: "client",
398
- $metadata: deserializeMetadata(parsedOutput),
399
- ...deserialized,
400
- };
401
- return contents;
402
- };
403
-
404
- const serializeAws_json1_1DescribeServicesRequest = (input: DescribeServicesRequest, context: __SerdeContext): any => {
405
- return {
406
- ...(input.FormatVersion !== undefined && input.FormatVersion !== null && { FormatVersion: input.FormatVersion }),
407
- ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),
408
- ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),
409
- ...(input.ServiceCode !== undefined && input.ServiceCode !== null && { ServiceCode: input.ServiceCode }),
410
- };
411
- };
412
-
413
- const serializeAws_json1_1Filter = (input: Filter, context: __SerdeContext): any => {
414
- return {
415
- ...(input.Field !== undefined && input.Field !== null && { Field: input.Field }),
416
- ...(input.Type !== undefined && input.Type !== null && { Type: input.Type }),
417
- ...(input.Value !== undefined && input.Value !== null && { Value: input.Value }),
418
- };
419
- };
420
-
421
- const serializeAws_json1_1Filters = (input: Filter[], context: __SerdeContext): any => {
422
- return input
423
- .filter((e: any) => e != null)
424
- .map((entry) => {
425
- if (entry === null) {
426
- return null as any;
427
- }
428
- return serializeAws_json1_1Filter(entry, context);
429
- });
430
- };
431
-
432
- const serializeAws_json1_1GetAttributeValuesRequest = (
433
- input: GetAttributeValuesRequest,
434
- context: __SerdeContext
435
- ): any => {
436
- return {
437
- ...(input.AttributeName !== undefined && input.AttributeName !== null && { AttributeName: input.AttributeName }),
438
- ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),
439
- ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),
440
- ...(input.ServiceCode !== undefined && input.ServiceCode !== null && { ServiceCode: input.ServiceCode }),
441
- };
442
- };
443
-
444
- const serializeAws_json1_1GetProductsRequest = (input: GetProductsRequest, context: __SerdeContext): any => {
445
- return {
446
- ...(input.Filters !== undefined &&
447
- input.Filters !== null && { Filters: serializeAws_json1_1Filters(input.Filters, context) }),
448
- ...(input.FormatVersion !== undefined && input.FormatVersion !== null && { FormatVersion: input.FormatVersion }),
449
- ...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),
450
- ...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),
451
- ...(input.ServiceCode !== undefined && input.ServiceCode !== null && { ServiceCode: input.ServiceCode }),
452
- };
453
- };
454
-
455
- const deserializeAws_json1_1AttributeNameList = (output: any, context: __SerdeContext): string[] => {
456
- return (output || [])
457
- .filter((e: any) => e != null)
458
- .map((entry: any) => {
459
- if (entry === null) {
460
- return null as any;
461
- }
462
- return __expectString(entry) as any;
463
- });
464
- };
465
-
466
- const deserializeAws_json1_1AttributeValue = (output: any, context: __SerdeContext): AttributeValue => {
467
- return {
468
- Value: __expectString(output.Value),
469
- } as any;
470
- };
471
-
472
- const deserializeAws_json1_1AttributeValueList = (output: any, context: __SerdeContext): AttributeValue[] => {
473
- return (output || [])
474
- .filter((e: any) => e != null)
475
- .map((entry: any) => {
476
- if (entry === null) {
477
- return null as any;
478
- }
479
- return deserializeAws_json1_1AttributeValue(entry, context);
480
- });
481
- };
482
-
483
- const deserializeAws_json1_1DescribeServicesResponse = (
484
- output: any,
485
- context: __SerdeContext
486
- ): DescribeServicesResponse => {
487
- return {
488
- FormatVersion: __expectString(output.FormatVersion),
489
- NextToken: __expectString(output.NextToken),
490
- Services:
491
- output.Services !== undefined && output.Services !== null
492
- ? deserializeAws_json1_1ServiceList(output.Services, context)
493
- : undefined,
494
- } as any;
495
- };
496
-
497
- const deserializeAws_json1_1ExpiredNextTokenException = (
498
- output: any,
499
- context: __SerdeContext
500
- ): ExpiredNextTokenException => {
501
- return {
502
- Message: __expectString(output.Message),
503
- } as any;
504
- };
505
-
506
- const deserializeAws_json1_1GetAttributeValuesResponse = (
507
- output: any,
508
- context: __SerdeContext
509
- ): GetAttributeValuesResponse => {
510
- return {
511
- AttributeValues:
512
- output.AttributeValues !== undefined && output.AttributeValues !== null
513
- ? deserializeAws_json1_1AttributeValueList(output.AttributeValues, context)
514
- : undefined,
515
- NextToken: __expectString(output.NextToken),
516
- } as any;
517
- };
518
-
519
- const deserializeAws_json1_1GetProductsResponse = (output: any, context: __SerdeContext): GetProductsResponse => {
520
- return {
521
- FormatVersion: __expectString(output.FormatVersion),
522
- NextToken: __expectString(output.NextToken),
523
- PriceList:
524
- output.PriceList !== undefined && output.PriceList !== null
525
- ? deserializeAws_json1_1PriceList(output.PriceList, context)
526
- : undefined,
527
- } as any;
528
- };
529
-
530
- const deserializeAws_json1_1InternalErrorException = (output: any, context: __SerdeContext): InternalErrorException => {
531
- return {
532
- Message: __expectString(output.Message),
533
- } as any;
534
- };
535
-
536
- const deserializeAws_json1_1InvalidNextTokenException = (
537
- output: any,
538
- context: __SerdeContext
539
- ): InvalidNextTokenException => {
540
- return {
541
- Message: __expectString(output.Message),
542
- } as any;
543
- };
544
-
545
- const deserializeAws_json1_1InvalidParameterException = (
546
- output: any,
547
- context: __SerdeContext
548
- ): InvalidParameterException => {
549
- return {
550
- Message: __expectString(output.Message),
551
- } as any;
552
- };
553
-
554
- const deserializeAws_json1_1NotFoundException = (output: any, context: __SerdeContext): NotFoundException => {
555
- return {
556
- Message: __expectString(output.Message),
557
- } as any;
558
- };
559
-
560
- const deserializeAws_json1_1PriceList = (output: any, context: __SerdeContext): (__LazyJsonString | string)[] => {
561
- return (output || [])
562
- .filter((e: any) => e != null)
563
- .map((entry: any) => {
564
- if (entry === null) {
565
- return null as any;
566
- }
567
- return new __LazyJsonString(entry);
568
- });
569
- };
570
-
571
- const deserializeAws_json1_1Service = (output: any, context: __SerdeContext): Service => {
572
- return {
573
- AttributeNames:
574
- output.AttributeNames !== undefined && output.AttributeNames !== null
575
- ? deserializeAws_json1_1AttributeNameList(output.AttributeNames, context)
576
- : undefined,
577
- ServiceCode: __expectString(output.ServiceCode),
578
- } as any;
579
- };
580
-
581
- const deserializeAws_json1_1ServiceList = (output: any, context: __SerdeContext): Service[] => {
582
- return (output || [])
583
- .filter((e: any) => e != null)
584
- .map((entry: any) => {
585
- if (entry === null) {
586
- return null as any;
587
- }
588
- return deserializeAws_json1_1Service(entry, context);
589
- });
590
- };
591
-
592
- const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
593
- httpStatusCode: output.statusCode,
594
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
595
- extendedRequestId: output.headers["x-amz-id-2"],
596
- cfId: output.headers["x-amz-cf-id"],
597
- });
598
-
599
- // Collect low-level response body stream to Uint8Array.
600
- const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
601
- if (streamBody instanceof Uint8Array) {
602
- return Promise.resolve(streamBody);
603
- }
604
- return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
605
- };
606
-
607
- // Encode Uint8Array data into string with utf-8.
608
- const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
609
- collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
610
-
611
- const buildHttpRpcRequest = async (
612
- context: __SerdeContext,
613
- headers: __HeaderBag,
614
- path: string,
615
- resolvedHostname: string | undefined,
616
- body: any
617
- ): Promise<__HttpRequest> => {
618
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
619
- const contents: any = {
620
- protocol,
621
- hostname,
622
- port,
623
- method: "POST",
624
- path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
625
- headers,
626
- };
627
- if (resolvedHostname !== undefined) {
628
- contents.hostname = resolvedHostname;
629
- }
630
- if (body !== undefined) {
631
- contents.body = body;
632
- }
633
- return new __HttpRequest(contents);
634
- };
635
-
636
- const parseBody = (streamBody: any, context: __SerdeContext): any =>
637
- collectBodyString(streamBody, context).then((encoded) => {
638
- if (encoded.length) {
639
- return JSON.parse(encoded);
640
- }
641
- return {};
642
- });
643
-
644
- /**
645
- * Load an error code for the aws.rest-json-1.1 protocol.
646
- */
647
- const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => {
648
- const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
649
-
650
- const sanitizeErrorCode = (rawValue: string): string => {
651
- let cleanValue = rawValue;
652
- if (cleanValue.indexOf(":") >= 0) {
653
- cleanValue = cleanValue.split(":")[0];
654
- }
655
- if (cleanValue.indexOf("#") >= 0) {
656
- cleanValue = cleanValue.split("#")[1];
657
- }
658
- return cleanValue;
659
- };
660
-
661
- const headerKey = findKey(output.headers, "x-amzn-errortype");
662
- if (headerKey !== undefined) {
663
- return sanitizeErrorCode(output.headers[headerKey]);
664
- }
665
-
666
- if (data.code !== undefined) {
667
- return sanitizeErrorCode(data.code);
668
- }
669
-
670
- if (data["__type"] !== undefined) {
671
- return sanitizeErrorCode(data["__type"]);
672
- }
673
-
674
- return "";
675
- };