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