@aws-sdk/client-account 3.183.0 → 3.185.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.
@@ -1,405 +1,532 @@
1
+ import { __assign, __awaiter, __generator } from "tslib";
1
2
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
3
  import { decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map as __map, throwDefaultError, } from "@aws-sdk/smithy-client";
3
4
  import { AccountServiceException as __BaseException } from "../models/AccountServiceException";
4
5
  import { AccessDeniedException, InternalServerException, ResourceNotFoundException, TooManyRequestsException, ValidationException, } from "../models/models_0";
5
- export const serializeAws_restJson1DeleteAlternateContactCommand = async (input, context) => {
6
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
7
- const headers = {
8
- "content-type": "application/json",
9
- };
10
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/deleteAlternateContact";
11
- let body;
12
- body = JSON.stringify({
13
- ...(input.AccountId != null && { AccountId: input.AccountId }),
14
- ...(input.AlternateContactType != null && { AlternateContactType: input.AlternateContactType }),
6
+ export var serializeAws_restJson1DeleteAlternateContactCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
7
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
8
+ return __generator(this, function (_c) {
9
+ switch (_c.label) {
10
+ case 0: return [4, context.endpoint()];
11
+ case 1:
12
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
13
+ headers = {
14
+ "content-type": "application/json",
15
+ };
16
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/deleteAlternateContact";
17
+ body = JSON.stringify(__assign(__assign({}, (input.AccountId != null && { AccountId: input.AccountId })), (input.AlternateContactType != null && { AlternateContactType: input.AlternateContactType })));
18
+ return [2, new __HttpRequest({
19
+ protocol: protocol,
20
+ hostname: hostname,
21
+ port: port,
22
+ method: "POST",
23
+ headers: headers,
24
+ path: resolvedPath,
25
+ body: body,
26
+ })];
27
+ }
15
28
  });
16
- return new __HttpRequest({
17
- protocol,
18
- hostname,
19
- port,
20
- method: "POST",
21
- headers,
22
- path: resolvedPath,
23
- body,
29
+ }); };
30
+ export var serializeAws_restJson1GetAlternateContactCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
31
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
32
+ return __generator(this, function (_c) {
33
+ switch (_c.label) {
34
+ case 0: return [4, context.endpoint()];
35
+ case 1:
36
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
37
+ headers = {
38
+ "content-type": "application/json",
39
+ };
40
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/getAlternateContact";
41
+ body = JSON.stringify(__assign(__assign({}, (input.AccountId != null && { AccountId: input.AccountId })), (input.AlternateContactType != null && { AlternateContactType: input.AlternateContactType })));
42
+ return [2, new __HttpRequest({
43
+ protocol: protocol,
44
+ hostname: hostname,
45
+ port: port,
46
+ method: "POST",
47
+ headers: headers,
48
+ path: resolvedPath,
49
+ body: body,
50
+ })];
51
+ }
24
52
  });
25
- };
26
- export const serializeAws_restJson1GetAlternateContactCommand = async (input, context) => {
27
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
28
- const headers = {
29
- "content-type": "application/json",
30
- };
31
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getAlternateContact";
32
- let body;
33
- body = JSON.stringify({
34
- ...(input.AccountId != null && { AccountId: input.AccountId }),
35
- ...(input.AlternateContactType != null && { AlternateContactType: input.AlternateContactType }),
53
+ }); };
54
+ export var serializeAws_restJson1GetContactInformationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
55
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
56
+ return __generator(this, function (_c) {
57
+ switch (_c.label) {
58
+ case 0: return [4, context.endpoint()];
59
+ case 1:
60
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
61
+ headers = {
62
+ "content-type": "application/json",
63
+ };
64
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/getContactInformation";
65
+ body = JSON.stringify(__assign({}, (input.AccountId != null && { AccountId: input.AccountId })));
66
+ return [2, new __HttpRequest({
67
+ protocol: protocol,
68
+ hostname: hostname,
69
+ port: port,
70
+ method: "POST",
71
+ headers: headers,
72
+ path: resolvedPath,
73
+ body: body,
74
+ })];
75
+ }
36
76
  });
37
- return new __HttpRequest({
38
- protocol,
39
- hostname,
40
- port,
41
- method: "POST",
42
- headers,
43
- path: resolvedPath,
44
- body,
77
+ }); };
78
+ export var serializeAws_restJson1PutAlternateContactCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
79
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
80
+ return __generator(this, function (_c) {
81
+ switch (_c.label) {
82
+ case 0: return [4, context.endpoint()];
83
+ case 1:
84
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
85
+ headers = {
86
+ "content-type": "application/json",
87
+ };
88
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/putAlternateContact";
89
+ body = JSON.stringify(__assign(__assign(__assign(__assign(__assign(__assign({}, (input.AccountId != null && { AccountId: input.AccountId })), (input.AlternateContactType != null && { AlternateContactType: input.AlternateContactType })), (input.EmailAddress != null && { EmailAddress: input.EmailAddress })), (input.Name != null && { Name: input.Name })), (input.PhoneNumber != null && { PhoneNumber: input.PhoneNumber })), (input.Title != null && { Title: input.Title })));
90
+ return [2, new __HttpRequest({
91
+ protocol: protocol,
92
+ hostname: hostname,
93
+ port: port,
94
+ method: "POST",
95
+ headers: headers,
96
+ path: resolvedPath,
97
+ body: body,
98
+ })];
99
+ }
45
100
  });
46
- };
47
- export const serializeAws_restJson1GetContactInformationCommand = async (input, context) => {
48
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
49
- const headers = {
50
- "content-type": "application/json",
51
- };
52
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/getContactInformation";
53
- let body;
54
- body = JSON.stringify({
55
- ...(input.AccountId != null && { AccountId: input.AccountId }),
101
+ }); };
102
+ export var serializeAws_restJson1PutContactInformationCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
103
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
104
+ return __generator(this, function (_c) {
105
+ switch (_c.label) {
106
+ case 0: return [4, context.endpoint()];
107
+ case 1:
108
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
109
+ headers = {
110
+ "content-type": "application/json",
111
+ };
112
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/putContactInformation";
113
+ body = JSON.stringify(__assign(__assign({}, (input.AccountId != null && { AccountId: input.AccountId })), (input.ContactInformation != null && {
114
+ ContactInformation: serializeAws_restJson1ContactInformation(input.ContactInformation, context),
115
+ })));
116
+ return [2, new __HttpRequest({
117
+ protocol: protocol,
118
+ hostname: hostname,
119
+ port: port,
120
+ method: "POST",
121
+ headers: headers,
122
+ path: resolvedPath,
123
+ body: body,
124
+ })];
125
+ }
56
126
  });
57
- return new __HttpRequest({
58
- protocol,
59
- hostname,
60
- port,
61
- method: "POST",
62
- headers,
63
- path: resolvedPath,
64
- body,
127
+ }); };
128
+ export var deserializeAws_restJson1DeleteAlternateContactCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
129
+ var contents;
130
+ return __generator(this, function (_a) {
131
+ switch (_a.label) {
132
+ case 0:
133
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
134
+ return [2, deserializeAws_restJson1DeleteAlternateContactCommandError(output, context)];
135
+ }
136
+ contents = map({
137
+ $metadata: deserializeMetadata(output),
138
+ });
139
+ return [4, collectBody(output.body, context)];
140
+ case 1:
141
+ _a.sent();
142
+ return [2, contents];
143
+ }
65
144
  });
66
- };
67
- export const serializeAws_restJson1PutAlternateContactCommand = async (input, context) => {
68
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
69
- const headers = {
70
- "content-type": "application/json",
71
- };
72
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/putAlternateContact";
73
- let body;
74
- body = JSON.stringify({
75
- ...(input.AccountId != null && { AccountId: input.AccountId }),
76
- ...(input.AlternateContactType != null && { AlternateContactType: input.AlternateContactType }),
77
- ...(input.EmailAddress != null && { EmailAddress: input.EmailAddress }),
78
- ...(input.Name != null && { Name: input.Name }),
79
- ...(input.PhoneNumber != null && { PhoneNumber: input.PhoneNumber }),
80
- ...(input.Title != null && { Title: input.Title }),
145
+ }); };
146
+ var deserializeAws_restJson1DeleteAlternateContactCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
147
+ var parsedOutput, _a, errorCode, _b, parsedBody;
148
+ var _c;
149
+ return __generator(this, function (_d) {
150
+ switch (_d.label) {
151
+ case 0:
152
+ _a = [__assign({}, output)];
153
+ _c = {};
154
+ return [4, parseErrorBody(output.body, context)];
155
+ case 1:
156
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
157
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
158
+ _b = errorCode;
159
+ switch (_b) {
160
+ case "AccessDeniedException": return [3, 2];
161
+ case "com.amazonaws.account#AccessDeniedException": return [3, 2];
162
+ case "InternalServerException": return [3, 4];
163
+ case "com.amazonaws.account#InternalServerException": return [3, 4];
164
+ case "ResourceNotFoundException": return [3, 6];
165
+ case "com.amazonaws.account#ResourceNotFoundException": return [3, 6];
166
+ case "TooManyRequestsException": return [3, 8];
167
+ case "com.amazonaws.account#TooManyRequestsException": return [3, 8];
168
+ case "ValidationException": return [3, 10];
169
+ case "com.amazonaws.account#ValidationException": return [3, 10];
170
+ }
171
+ return [3, 12];
172
+ case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
173
+ case 3: throw _d.sent();
174
+ case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
175
+ case 5: throw _d.sent();
176
+ case 6: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
177
+ case 7: throw _d.sent();
178
+ case 8: return [4, deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)];
179
+ case 9: throw _d.sent();
180
+ case 10: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
181
+ case 11: throw _d.sent();
182
+ case 12:
183
+ parsedBody = parsedOutput.body;
184
+ throwDefaultError({
185
+ output: output,
186
+ parsedBody: parsedBody,
187
+ exceptionCtor: __BaseException,
188
+ errorCode: errorCode,
189
+ });
190
+ _d.label = 13;
191
+ case 13: return [2];
192
+ }
81
193
  });
82
- return new __HttpRequest({
83
- protocol,
84
- hostname,
85
- port,
86
- method: "POST",
87
- headers,
88
- path: resolvedPath,
89
- body,
194
+ }); };
195
+ export var deserializeAws_restJson1GetAlternateContactCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
196
+ var contents, data, _a, _b;
197
+ return __generator(this, function (_c) {
198
+ switch (_c.label) {
199
+ case 0:
200
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
201
+ return [2, deserializeAws_restJson1GetAlternateContactCommandError(output, context)];
202
+ }
203
+ contents = map({
204
+ $metadata: deserializeMetadata(output),
205
+ });
206
+ _a = __expectNonNull;
207
+ _b = __expectObject;
208
+ return [4, parseBody(output.body, context)];
209
+ case 1:
210
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
211
+ if (data.AlternateContact != null) {
212
+ contents.AlternateContact = deserializeAws_restJson1AlternateContact(data.AlternateContact, context);
213
+ }
214
+ return [2, contents];
215
+ }
90
216
  });
91
- };
92
- export const serializeAws_restJson1PutContactInformationCommand = async (input, context) => {
93
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
94
- const headers = {
95
- "content-type": "application/json",
96
- };
97
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/putContactInformation";
98
- let body;
99
- body = JSON.stringify({
100
- ...(input.AccountId != null && { AccountId: input.AccountId }),
101
- ...(input.ContactInformation != null && {
102
- ContactInformation: serializeAws_restJson1ContactInformation(input.ContactInformation, context),
103
- }),
217
+ }); };
218
+ var deserializeAws_restJson1GetAlternateContactCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
219
+ var parsedOutput, _a, errorCode, _b, parsedBody;
220
+ var _c;
221
+ return __generator(this, function (_d) {
222
+ switch (_d.label) {
223
+ case 0:
224
+ _a = [__assign({}, output)];
225
+ _c = {};
226
+ return [4, parseErrorBody(output.body, context)];
227
+ case 1:
228
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
229
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
230
+ _b = errorCode;
231
+ switch (_b) {
232
+ case "AccessDeniedException": return [3, 2];
233
+ case "com.amazonaws.account#AccessDeniedException": return [3, 2];
234
+ case "InternalServerException": return [3, 4];
235
+ case "com.amazonaws.account#InternalServerException": return [3, 4];
236
+ case "ResourceNotFoundException": return [3, 6];
237
+ case "com.amazonaws.account#ResourceNotFoundException": return [3, 6];
238
+ case "TooManyRequestsException": return [3, 8];
239
+ case "com.amazonaws.account#TooManyRequestsException": return [3, 8];
240
+ case "ValidationException": return [3, 10];
241
+ case "com.amazonaws.account#ValidationException": return [3, 10];
242
+ }
243
+ return [3, 12];
244
+ case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
245
+ case 3: throw _d.sent();
246
+ case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
247
+ case 5: throw _d.sent();
248
+ case 6: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
249
+ case 7: throw _d.sent();
250
+ case 8: return [4, deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)];
251
+ case 9: throw _d.sent();
252
+ case 10: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
253
+ case 11: throw _d.sent();
254
+ case 12:
255
+ parsedBody = parsedOutput.body;
256
+ throwDefaultError({
257
+ output: output,
258
+ parsedBody: parsedBody,
259
+ exceptionCtor: __BaseException,
260
+ errorCode: errorCode,
261
+ });
262
+ _d.label = 13;
263
+ case 13: return [2];
264
+ }
104
265
  });
105
- return new __HttpRequest({
106
- protocol,
107
- hostname,
108
- port,
109
- method: "POST",
110
- headers,
111
- path: resolvedPath,
112
- body,
266
+ }); };
267
+ export var deserializeAws_restJson1GetContactInformationCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
268
+ var contents, data, _a, _b;
269
+ return __generator(this, function (_c) {
270
+ switch (_c.label) {
271
+ case 0:
272
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
273
+ return [2, deserializeAws_restJson1GetContactInformationCommandError(output, context)];
274
+ }
275
+ contents = map({
276
+ $metadata: deserializeMetadata(output),
277
+ });
278
+ _a = __expectNonNull;
279
+ _b = __expectObject;
280
+ return [4, parseBody(output.body, context)];
281
+ case 1:
282
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
283
+ if (data.ContactInformation != null) {
284
+ contents.ContactInformation = deserializeAws_restJson1ContactInformation(data.ContactInformation, context);
285
+ }
286
+ return [2, contents];
287
+ }
113
288
  });
114
- };
115
- export const deserializeAws_restJson1DeleteAlternateContactCommand = async (output, context) => {
116
- if (output.statusCode !== 200 && output.statusCode >= 300) {
117
- return deserializeAws_restJson1DeleteAlternateContactCommandError(output, context);
118
- }
119
- const contents = map({
120
- $metadata: deserializeMetadata(output),
289
+ }); };
290
+ var deserializeAws_restJson1GetContactInformationCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
291
+ var parsedOutput, _a, errorCode, _b, parsedBody;
292
+ var _c;
293
+ return __generator(this, function (_d) {
294
+ switch (_d.label) {
295
+ case 0:
296
+ _a = [__assign({}, output)];
297
+ _c = {};
298
+ return [4, parseErrorBody(output.body, context)];
299
+ case 1:
300
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
301
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
302
+ _b = errorCode;
303
+ switch (_b) {
304
+ case "AccessDeniedException": return [3, 2];
305
+ case "com.amazonaws.account#AccessDeniedException": return [3, 2];
306
+ case "InternalServerException": return [3, 4];
307
+ case "com.amazonaws.account#InternalServerException": return [3, 4];
308
+ case "ResourceNotFoundException": return [3, 6];
309
+ case "com.amazonaws.account#ResourceNotFoundException": return [3, 6];
310
+ case "TooManyRequestsException": return [3, 8];
311
+ case "com.amazonaws.account#TooManyRequestsException": return [3, 8];
312
+ case "ValidationException": return [3, 10];
313
+ case "com.amazonaws.account#ValidationException": return [3, 10];
314
+ }
315
+ return [3, 12];
316
+ case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
317
+ case 3: throw _d.sent();
318
+ case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
319
+ case 5: throw _d.sent();
320
+ case 6: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
321
+ case 7: throw _d.sent();
322
+ case 8: return [4, deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)];
323
+ case 9: throw _d.sent();
324
+ case 10: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
325
+ case 11: throw _d.sent();
326
+ case 12:
327
+ parsedBody = parsedOutput.body;
328
+ throwDefaultError({
329
+ output: output,
330
+ parsedBody: parsedBody,
331
+ exceptionCtor: __BaseException,
332
+ errorCode: errorCode,
333
+ });
334
+ _d.label = 13;
335
+ case 13: return [2];
336
+ }
121
337
  });
122
- await collectBody(output.body, context);
123
- return contents;
124
- };
125
- const deserializeAws_restJson1DeleteAlternateContactCommandError = async (output, context) => {
126
- const parsedOutput = {
127
- ...output,
128
- body: await parseErrorBody(output.body, context),
129
- };
130
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
131
- switch (errorCode) {
132
- case "AccessDeniedException":
133
- case "com.amazonaws.account#AccessDeniedException":
134
- throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
135
- case "InternalServerException":
136
- case "com.amazonaws.account#InternalServerException":
137
- throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
138
- case "ResourceNotFoundException":
139
- case "com.amazonaws.account#ResourceNotFoundException":
140
- throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
141
- case "TooManyRequestsException":
142
- case "com.amazonaws.account#TooManyRequestsException":
143
- throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
144
- case "ValidationException":
145
- case "com.amazonaws.account#ValidationException":
146
- throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
147
- default:
148
- const parsedBody = parsedOutput.body;
149
- throwDefaultError({
150
- output,
151
- parsedBody,
152
- exceptionCtor: __BaseException,
153
- errorCode,
154
- });
155
- }
156
- };
157
- export const deserializeAws_restJson1GetAlternateContactCommand = async (output, context) => {
158
- if (output.statusCode !== 200 && output.statusCode >= 300) {
159
- return deserializeAws_restJson1GetAlternateContactCommandError(output, context);
160
- }
161
- const contents = map({
162
- $metadata: deserializeMetadata(output),
338
+ }); };
339
+ export var deserializeAws_restJson1PutAlternateContactCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
340
+ var contents;
341
+ return __generator(this, function (_a) {
342
+ switch (_a.label) {
343
+ case 0:
344
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
345
+ return [2, deserializeAws_restJson1PutAlternateContactCommandError(output, context)];
346
+ }
347
+ contents = map({
348
+ $metadata: deserializeMetadata(output),
349
+ });
350
+ return [4, collectBody(output.body, context)];
351
+ case 1:
352
+ _a.sent();
353
+ return [2, contents];
354
+ }
163
355
  });
164
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
165
- if (data.AlternateContact != null) {
166
- contents.AlternateContact = deserializeAws_restJson1AlternateContact(data.AlternateContact, context);
167
- }
168
- return contents;
169
- };
170
- const deserializeAws_restJson1GetAlternateContactCommandError = async (output, context) => {
171
- const parsedOutput = {
172
- ...output,
173
- body: await parseErrorBody(output.body, context),
174
- };
175
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
176
- switch (errorCode) {
177
- case "AccessDeniedException":
178
- case "com.amazonaws.account#AccessDeniedException":
179
- throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
180
- case "InternalServerException":
181
- case "com.amazonaws.account#InternalServerException":
182
- throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
183
- case "ResourceNotFoundException":
184
- case "com.amazonaws.account#ResourceNotFoundException":
185
- throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
186
- case "TooManyRequestsException":
187
- case "com.amazonaws.account#TooManyRequestsException":
188
- throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
189
- case "ValidationException":
190
- case "com.amazonaws.account#ValidationException":
191
- throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
192
- default:
193
- const parsedBody = parsedOutput.body;
194
- throwDefaultError({
195
- output,
196
- parsedBody,
197
- exceptionCtor: __BaseException,
198
- errorCode,
199
- });
200
- }
201
- };
202
- export const deserializeAws_restJson1GetContactInformationCommand = async (output, context) => {
203
- if (output.statusCode !== 200 && output.statusCode >= 300) {
204
- return deserializeAws_restJson1GetContactInformationCommandError(output, context);
205
- }
206
- const contents = map({
207
- $metadata: deserializeMetadata(output),
356
+ }); };
357
+ var deserializeAws_restJson1PutAlternateContactCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
358
+ var parsedOutput, _a, errorCode, _b, parsedBody;
359
+ var _c;
360
+ return __generator(this, function (_d) {
361
+ switch (_d.label) {
362
+ case 0:
363
+ _a = [__assign({}, output)];
364
+ _c = {};
365
+ return [4, parseErrorBody(output.body, context)];
366
+ case 1:
367
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
368
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
369
+ _b = errorCode;
370
+ switch (_b) {
371
+ case "AccessDeniedException": return [3, 2];
372
+ case "com.amazonaws.account#AccessDeniedException": return [3, 2];
373
+ case "InternalServerException": return [3, 4];
374
+ case "com.amazonaws.account#InternalServerException": return [3, 4];
375
+ case "TooManyRequestsException": return [3, 6];
376
+ case "com.amazonaws.account#TooManyRequestsException": return [3, 6];
377
+ case "ValidationException": return [3, 8];
378
+ case "com.amazonaws.account#ValidationException": return [3, 8];
379
+ }
380
+ return [3, 10];
381
+ case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
382
+ case 3: throw _d.sent();
383
+ case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
384
+ case 5: throw _d.sent();
385
+ case 6: return [4, deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)];
386
+ case 7: throw _d.sent();
387
+ case 8: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
388
+ case 9: throw _d.sent();
389
+ case 10:
390
+ parsedBody = parsedOutput.body;
391
+ throwDefaultError({
392
+ output: output,
393
+ parsedBody: parsedBody,
394
+ exceptionCtor: __BaseException,
395
+ errorCode: errorCode,
396
+ });
397
+ _d.label = 11;
398
+ case 11: return [2];
399
+ }
208
400
  });
209
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
210
- if (data.ContactInformation != null) {
211
- contents.ContactInformation = deserializeAws_restJson1ContactInformation(data.ContactInformation, context);
212
- }
213
- return contents;
214
- };
215
- const deserializeAws_restJson1GetContactInformationCommandError = async (output, context) => {
216
- const parsedOutput = {
217
- ...output,
218
- body: await parseErrorBody(output.body, context),
219
- };
220
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
221
- switch (errorCode) {
222
- case "AccessDeniedException":
223
- case "com.amazonaws.account#AccessDeniedException":
224
- throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
225
- case "InternalServerException":
226
- case "com.amazonaws.account#InternalServerException":
227
- throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
228
- case "ResourceNotFoundException":
229
- case "com.amazonaws.account#ResourceNotFoundException":
230
- throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
231
- case "TooManyRequestsException":
232
- case "com.amazonaws.account#TooManyRequestsException":
233
- throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
234
- case "ValidationException":
235
- case "com.amazonaws.account#ValidationException":
236
- throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
237
- default:
238
- const parsedBody = parsedOutput.body;
239
- throwDefaultError({
240
- output,
241
- parsedBody,
242
- exceptionCtor: __BaseException,
243
- errorCode,
244
- });
245
- }
246
- };
247
- export const deserializeAws_restJson1PutAlternateContactCommand = async (output, context) => {
248
- if (output.statusCode !== 200 && output.statusCode >= 300) {
249
- return deserializeAws_restJson1PutAlternateContactCommandError(output, context);
250
- }
251
- const contents = map({
252
- $metadata: deserializeMetadata(output),
401
+ }); };
402
+ export var deserializeAws_restJson1PutContactInformationCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
403
+ var contents;
404
+ return __generator(this, function (_a) {
405
+ switch (_a.label) {
406
+ case 0:
407
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
408
+ return [2, deserializeAws_restJson1PutContactInformationCommandError(output, context)];
409
+ }
410
+ contents = map({
411
+ $metadata: deserializeMetadata(output),
412
+ });
413
+ return [4, collectBody(output.body, context)];
414
+ case 1:
415
+ _a.sent();
416
+ return [2, contents];
417
+ }
253
418
  });
254
- await collectBody(output.body, context);
255
- return contents;
256
- };
257
- const deserializeAws_restJson1PutAlternateContactCommandError = async (output, context) => {
258
- const parsedOutput = {
259
- ...output,
260
- body: await parseErrorBody(output.body, context),
261
- };
262
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
263
- switch (errorCode) {
264
- case "AccessDeniedException":
265
- case "com.amazonaws.account#AccessDeniedException":
266
- throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
267
- case "InternalServerException":
268
- case "com.amazonaws.account#InternalServerException":
269
- throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
270
- case "TooManyRequestsException":
271
- case "com.amazonaws.account#TooManyRequestsException":
272
- throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
273
- case "ValidationException":
274
- case "com.amazonaws.account#ValidationException":
275
- throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
276
- default:
277
- const parsedBody = parsedOutput.body;
278
- throwDefaultError({
279
- output,
280
- parsedBody,
281
- exceptionCtor: __BaseException,
282
- errorCode,
283
- });
284
- }
285
- };
286
- export const deserializeAws_restJson1PutContactInformationCommand = async (output, context) => {
287
- if (output.statusCode !== 200 && output.statusCode >= 300) {
288
- return deserializeAws_restJson1PutContactInformationCommandError(output, context);
289
- }
290
- const contents = map({
291
- $metadata: deserializeMetadata(output),
419
+ }); };
420
+ var deserializeAws_restJson1PutContactInformationCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
421
+ var parsedOutput, _a, errorCode, _b, parsedBody;
422
+ var _c;
423
+ return __generator(this, function (_d) {
424
+ switch (_d.label) {
425
+ case 0:
426
+ _a = [__assign({}, output)];
427
+ _c = {};
428
+ return [4, parseErrorBody(output.body, context)];
429
+ case 1:
430
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
431
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
432
+ _b = errorCode;
433
+ switch (_b) {
434
+ case "AccessDeniedException": return [3, 2];
435
+ case "com.amazonaws.account#AccessDeniedException": return [3, 2];
436
+ case "InternalServerException": return [3, 4];
437
+ case "com.amazonaws.account#InternalServerException": return [3, 4];
438
+ case "TooManyRequestsException": return [3, 6];
439
+ case "com.amazonaws.account#TooManyRequestsException": return [3, 6];
440
+ case "ValidationException": return [3, 8];
441
+ case "com.amazonaws.account#ValidationException": return [3, 8];
442
+ }
443
+ return [3, 10];
444
+ case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
445
+ case 3: throw _d.sent();
446
+ case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
447
+ case 5: throw _d.sent();
448
+ case 6: return [4, deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context)];
449
+ case 7: throw _d.sent();
450
+ case 8: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
451
+ case 9: throw _d.sent();
452
+ case 10:
453
+ parsedBody = parsedOutput.body;
454
+ throwDefaultError({
455
+ output: output,
456
+ parsedBody: parsedBody,
457
+ exceptionCtor: __BaseException,
458
+ errorCode: errorCode,
459
+ });
460
+ _d.label = 11;
461
+ case 11: return [2];
462
+ }
292
463
  });
293
- await collectBody(output.body, context);
294
- return contents;
295
- };
296
- const deserializeAws_restJson1PutContactInformationCommandError = async (output, context) => {
297
- const parsedOutput = {
298
- ...output,
299
- body: await parseErrorBody(output.body, context),
300
- };
301
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
302
- switch (errorCode) {
303
- case "AccessDeniedException":
304
- case "com.amazonaws.account#AccessDeniedException":
305
- throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
306
- case "InternalServerException":
307
- case "com.amazonaws.account#InternalServerException":
308
- throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
309
- case "TooManyRequestsException":
310
- case "com.amazonaws.account#TooManyRequestsException":
311
- throw await deserializeAws_restJson1TooManyRequestsExceptionResponse(parsedOutput, context);
312
- case "ValidationException":
313
- case "com.amazonaws.account#ValidationException":
314
- throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
315
- default:
316
- const parsedBody = parsedOutput.body;
317
- throwDefaultError({
318
- output,
319
- parsedBody,
320
- exceptionCtor: __BaseException,
321
- errorCode,
322
- });
323
- }
324
- };
325
- const map = __map;
326
- const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
327
- const contents = map({});
328
- const data = parsedOutput.body;
329
- if (data.message != null) {
330
- contents.message = __expectString(data.message);
331
- }
332
- const exception = new AccessDeniedException({
333
- $metadata: deserializeMetadata(parsedOutput),
334
- ...contents,
464
+ }); };
465
+ var map = __map;
466
+ var deserializeAws_restJson1AccessDeniedExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
467
+ var contents, data, exception;
468
+ return __generator(this, function (_a) {
469
+ contents = map({});
470
+ data = parsedOutput.body;
471
+ if (data.message != null) {
472
+ contents.message = __expectString(data.message);
473
+ }
474
+ exception = new AccessDeniedException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
475
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
335
476
  });
336
- return __decorateServiceException(exception, parsedOutput.body);
337
- };
338
- const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
339
- const contents = map({});
340
- const data = parsedOutput.body;
341
- if (data.message != null) {
342
- contents.message = __expectString(data.message);
343
- }
344
- const exception = new InternalServerException({
345
- $metadata: deserializeMetadata(parsedOutput),
346
- ...contents,
477
+ }); };
478
+ var deserializeAws_restJson1InternalServerExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
479
+ var contents, data, exception;
480
+ return __generator(this, function (_a) {
481
+ contents = map({});
482
+ data = parsedOutput.body;
483
+ if (data.message != null) {
484
+ contents.message = __expectString(data.message);
485
+ }
486
+ exception = new InternalServerException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
487
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
347
488
  });
348
- return __decorateServiceException(exception, parsedOutput.body);
349
- };
350
- const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
351
- const contents = map({});
352
- const data = parsedOutput.body;
353
- if (data.message != null) {
354
- contents.message = __expectString(data.message);
355
- }
356
- const exception = new ResourceNotFoundException({
357
- $metadata: deserializeMetadata(parsedOutput),
358
- ...contents,
489
+ }); };
490
+ var deserializeAws_restJson1ResourceNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
491
+ var contents, data, exception;
492
+ return __generator(this, function (_a) {
493
+ contents = map({});
494
+ data = parsedOutput.body;
495
+ if (data.message != null) {
496
+ contents.message = __expectString(data.message);
497
+ }
498
+ exception = new ResourceNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
499
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
359
500
  });
360
- return __decorateServiceException(exception, parsedOutput.body);
361
- };
362
- const deserializeAws_restJson1TooManyRequestsExceptionResponse = async (parsedOutput, context) => {
363
- const contents = map({});
364
- const data = parsedOutput.body;
365
- if (data.message != null) {
366
- contents.message = __expectString(data.message);
367
- }
368
- const exception = new TooManyRequestsException({
369
- $metadata: deserializeMetadata(parsedOutput),
370
- ...contents,
501
+ }); };
502
+ var deserializeAws_restJson1TooManyRequestsExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
503
+ var contents, data, exception;
504
+ return __generator(this, function (_a) {
505
+ contents = map({});
506
+ data = parsedOutput.body;
507
+ if (data.message != null) {
508
+ contents.message = __expectString(data.message);
509
+ }
510
+ exception = new TooManyRequestsException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
511
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
371
512
  });
372
- return __decorateServiceException(exception, parsedOutput.body);
373
- };
374
- const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
375
- const contents = map({});
376
- const data = parsedOutput.body;
377
- if (data.message != null) {
378
- contents.message = __expectString(data.message);
379
- }
380
- const exception = new ValidationException({
381
- $metadata: deserializeMetadata(parsedOutput),
382
- ...contents,
513
+ }); };
514
+ var deserializeAws_restJson1ValidationExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
515
+ var contents, data, exception;
516
+ return __generator(this, function (_a) {
517
+ contents = map({});
518
+ data = parsedOutput.body;
519
+ if (data.message != null) {
520
+ contents.message = __expectString(data.message);
521
+ }
522
+ exception = new ValidationException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
523
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
383
524
  });
384
- return __decorateServiceException(exception, parsedOutput.body);
385
- };
386
- const serializeAws_restJson1ContactInformation = (input, context) => {
387
- return {
388
- ...(input.AddressLine1 != null && { AddressLine1: input.AddressLine1 }),
389
- ...(input.AddressLine2 != null && { AddressLine2: input.AddressLine2 }),
390
- ...(input.AddressLine3 != null && { AddressLine3: input.AddressLine3 }),
391
- ...(input.City != null && { City: input.City }),
392
- ...(input.CompanyName != null && { CompanyName: input.CompanyName }),
393
- ...(input.CountryCode != null && { CountryCode: input.CountryCode }),
394
- ...(input.DistrictOrCounty != null && { DistrictOrCounty: input.DistrictOrCounty }),
395
- ...(input.FullName != null && { FullName: input.FullName }),
396
- ...(input.PhoneNumber != null && { PhoneNumber: input.PhoneNumber }),
397
- ...(input.PostalCode != null && { PostalCode: input.PostalCode }),
398
- ...(input.StateOrRegion != null && { StateOrRegion: input.StateOrRegion }),
399
- ...(input.WebsiteUrl != null && { WebsiteUrl: input.WebsiteUrl }),
400
- };
525
+ }); };
526
+ var serializeAws_restJson1ContactInformation = function (input, context) {
527
+ return __assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, (input.AddressLine1 != null && { AddressLine1: input.AddressLine1 })), (input.AddressLine2 != null && { AddressLine2: input.AddressLine2 })), (input.AddressLine3 != null && { AddressLine3: input.AddressLine3 })), (input.City != null && { City: input.City })), (input.CompanyName != null && { CompanyName: input.CompanyName })), (input.CountryCode != null && { CountryCode: input.CountryCode })), (input.DistrictOrCounty != null && { DistrictOrCounty: input.DistrictOrCounty })), (input.FullName != null && { FullName: input.FullName })), (input.PhoneNumber != null && { PhoneNumber: input.PhoneNumber })), (input.PostalCode != null && { PostalCode: input.PostalCode })), (input.StateOrRegion != null && { StateOrRegion: input.StateOrRegion })), (input.WebsiteUrl != null && { WebsiteUrl: input.WebsiteUrl }));
401
528
  };
402
- const deserializeAws_restJson1AlternateContact = (output, context) => {
529
+ var deserializeAws_restJson1AlternateContact = function (output, context) {
403
530
  return {
404
531
  AlternateContactType: __expectString(output.AlternateContactType),
405
532
  EmailAddress: __expectString(output.EmailAddress),
@@ -408,7 +535,7 @@ const deserializeAws_restJson1AlternateContact = (output, context) => {
408
535
  Title: __expectString(output.Title),
409
536
  };
410
537
  };
411
- const deserializeAws_restJson1ContactInformation = (output, context) => {
538
+ var deserializeAws_restJson1ContactInformation = function (output, context) {
412
539
  return {
413
540
  AddressLine1: __expectString(output.AddressLine1),
414
541
  AddressLine2: __expectString(output.AddressLine2),
@@ -424,39 +551,57 @@ const deserializeAws_restJson1ContactInformation = (output, context) => {
424
551
  WebsiteUrl: __expectString(output.WebsiteUrl),
425
552
  };
426
553
  };
427
- const deserializeMetadata = (output) => ({
428
- httpStatusCode: output.statusCode,
429
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
430
- extendedRequestId: output.headers["x-amz-id-2"],
431
- cfId: output.headers["x-amz-cf-id"],
432
- });
433
- const collectBody = (streamBody = new Uint8Array(), context) => {
554
+ var deserializeMetadata = function (output) {
555
+ var _a, _b;
556
+ return ({
557
+ httpStatusCode: output.statusCode,
558
+ requestId: (_b = (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"]) !== null && _b !== void 0 ? _b : output.headers["x-amz-request-id"],
559
+ extendedRequestId: output.headers["x-amz-id-2"],
560
+ cfId: output.headers["x-amz-cf-id"],
561
+ });
562
+ };
563
+ var collectBody = function (streamBody, context) {
564
+ if (streamBody === void 0) { streamBody = new Uint8Array(); }
434
565
  if (streamBody instanceof Uint8Array) {
435
566
  return Promise.resolve(streamBody);
436
567
  }
437
568
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
438
569
  };
439
- const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
440
- const isSerializableHeaderValue = (value) => value !== undefined &&
441
- value !== null &&
442
- value !== "" &&
443
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
444
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
445
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
446
- if (encoded.length) {
447
- return JSON.parse(encoded);
448
- }
449
- return {};
450
- });
451
- const parseErrorBody = async (errorBody, context) => {
452
- const value = await parseBody(errorBody, context);
453
- value.message = value.message ?? value.Message;
454
- return value;
570
+ var collectBodyString = function (streamBody, context) {
571
+ return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
455
572
  };
456
- const loadRestJsonErrorCode = (output, data) => {
457
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
458
- const sanitizeErrorCode = (rawValue) => {
459
- let cleanValue = rawValue;
573
+ var isSerializableHeaderValue = function (value) {
574
+ return value !== undefined &&
575
+ value !== null &&
576
+ value !== "" &&
577
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
578
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
579
+ };
580
+ var parseBody = function (streamBody, context) {
581
+ return collectBodyString(streamBody, context).then(function (encoded) {
582
+ if (encoded.length) {
583
+ return JSON.parse(encoded);
584
+ }
585
+ return {};
586
+ });
587
+ };
588
+ var parseErrorBody = function (errorBody, context) { return __awaiter(void 0, void 0, void 0, function () {
589
+ var value;
590
+ var _a;
591
+ return __generator(this, function (_b) {
592
+ switch (_b.label) {
593
+ case 0: return [4, parseBody(errorBody, context)];
594
+ case 1:
595
+ value = _b.sent();
596
+ value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
597
+ return [2, value];
598
+ }
599
+ });
600
+ }); };
601
+ var loadRestJsonErrorCode = function (output, data) {
602
+ var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
603
+ var sanitizeErrorCode = function (rawValue) {
604
+ var cleanValue = rawValue;
460
605
  if (typeof cleanValue === "number") {
461
606
  cleanValue = cleanValue.toString();
462
607
  }
@@ -471,7 +616,7 @@ const loadRestJsonErrorCode = (output, data) => {
471
616
  }
472
617
  return cleanValue;
473
618
  };
474
- const headerKey = findKey(output.headers, "x-amzn-errortype");
619
+ var headerKey = findKey(output.headers, "x-amzn-errortype");
475
620
  if (headerKey !== undefined) {
476
621
  return sanitizeErrorCode(output.headers[headerKey]);
477
622
  }