@aws-sdk/client-apigatewaymanagementapi 3.181.0 → 3.183.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,368 +1,259 @@
1
- import { __assign, __awaiter, __generator } from "tslib";
2
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
3
2
  import { decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map as __map, parseRfc3339DateTime as __parseRfc3339DateTime, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
4
3
  import { ApiGatewayManagementApiServiceException as __BaseException } from "../models/ApiGatewayManagementApiServiceException";
5
4
  import { ForbiddenException, GoneException, LimitExceededException, PayloadTooLargeException, } from "../models/models_0";
6
- export var serializeAws_restJson1DeleteConnectionCommand = 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
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/@connections/{ConnectionId}";
15
- resolvedPath = __resolvedPath(resolvedPath, input, "ConnectionId", function () { return input.ConnectionId; }, "{ConnectionId}", false);
16
- return [2, new __HttpRequest({
17
- protocol: protocol,
18
- hostname: hostname,
19
- port: port,
20
- method: "DELETE",
21
- headers: headers,
22
- path: resolvedPath,
23
- body: body,
24
- })];
25
- }
26
- });
27
- }); };
28
- export var serializeAws_restJson1GetConnectionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
29
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
30
- return __generator(this, function (_c) {
31
- switch (_c.label) {
32
- case 0: return [4, context.endpoint()];
33
- case 1:
34
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
35
- headers = {};
36
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/@connections/{ConnectionId}";
37
- resolvedPath = __resolvedPath(resolvedPath, input, "ConnectionId", function () { return input.ConnectionId; }, "{ConnectionId}", false);
38
- return [2, new __HttpRequest({
39
- protocol: protocol,
40
- hostname: hostname,
41
- port: port,
42
- method: "GET",
43
- headers: headers,
44
- path: resolvedPath,
45
- body: body,
46
- })];
47
- }
48
- });
49
- }); };
50
- export var serializeAws_restJson1PostToConnectionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
51
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
52
- return __generator(this, function (_c) {
53
- switch (_c.label) {
54
- case 0: return [4, context.endpoint()];
55
- case 1:
56
- _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
57
- headers = {
58
- "content-type": "application/octet-stream",
59
- };
60
- resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/@connections/{ConnectionId}";
61
- resolvedPath = __resolvedPath(resolvedPath, input, "ConnectionId", function () { return input.ConnectionId; }, "{ConnectionId}", false);
62
- if (input.Data !== undefined) {
63
- body = input.Data;
64
- }
65
- return [2, new __HttpRequest({
66
- protocol: protocol,
67
- hostname: hostname,
68
- port: port,
69
- method: "POST",
70
- headers: headers,
71
- path: resolvedPath,
72
- body: body,
73
- })];
74
- }
75
- });
76
- }); };
77
- export var deserializeAws_restJson1DeleteConnectionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
78
- var contents;
79
- return __generator(this, function (_a) {
80
- switch (_a.label) {
81
- case 0:
82
- if (output.statusCode !== 204 && output.statusCode >= 300) {
83
- return [2, deserializeAws_restJson1DeleteConnectionCommandError(output, context)];
84
- }
85
- contents = map({
86
- $metadata: deserializeMetadata(output),
87
- });
88
- return [4, collectBody(output.body, context)];
89
- case 1:
90
- _a.sent();
91
- return [2, contents];
92
- }
5
+ export const serializeAws_restJson1DeleteConnectionCommand = async (input, context) => {
6
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
7
+ const headers = {};
8
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/@connections/{ConnectionId}";
9
+ resolvedPath = __resolvedPath(resolvedPath, input, "ConnectionId", () => input.ConnectionId, "{ConnectionId}", false);
10
+ let body;
11
+ return new __HttpRequest({
12
+ protocol,
13
+ hostname,
14
+ port,
15
+ method: "DELETE",
16
+ headers,
17
+ path: resolvedPath,
18
+ body,
93
19
  });
94
- }); };
95
- var deserializeAws_restJson1DeleteConnectionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
96
- var parsedOutput, _a, errorCode, _b, parsedBody;
97
- var _c;
98
- return __generator(this, function (_d) {
99
- switch (_d.label) {
100
- case 0:
101
- _a = [__assign({}, output)];
102
- _c = {};
103
- return [4, parseErrorBody(output.body, context)];
104
- case 1:
105
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
106
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
107
- _b = errorCode;
108
- switch (_b) {
109
- case "ForbiddenException": return [3, 2];
110
- case "com.amazonaws.apigatewaymanagementapi#ForbiddenException": return [3, 2];
111
- case "GoneException": return [3, 4];
112
- case "com.amazonaws.apigatewaymanagementapi#GoneException": return [3, 4];
113
- case "LimitExceededException": return [3, 6];
114
- case "com.amazonaws.apigatewaymanagementapi#LimitExceededException": return [3, 6];
115
- }
116
- return [3, 8];
117
- case 2: return [4, deserializeAws_restJson1ForbiddenExceptionResponse(parsedOutput, context)];
118
- case 3: throw _d.sent();
119
- case 4: return [4, deserializeAws_restJson1GoneExceptionResponse(parsedOutput, context)];
120
- case 5: throw _d.sent();
121
- case 6: return [4, deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)];
122
- case 7: throw _d.sent();
123
- case 8:
124
- parsedBody = parsedOutput.body;
125
- throwDefaultError({
126
- output: output,
127
- parsedBody: parsedBody,
128
- exceptionCtor: __BaseException,
129
- errorCode: errorCode,
130
- });
131
- _d.label = 9;
132
- case 9: return [2];
133
- }
20
+ };
21
+ export const serializeAws_restJson1GetConnectionCommand = async (input, context) => {
22
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
23
+ const headers = {};
24
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/@connections/{ConnectionId}";
25
+ resolvedPath = __resolvedPath(resolvedPath, input, "ConnectionId", () => input.ConnectionId, "{ConnectionId}", false);
26
+ let body;
27
+ return new __HttpRequest({
28
+ protocol,
29
+ hostname,
30
+ port,
31
+ method: "GET",
32
+ headers,
33
+ path: resolvedPath,
34
+ body,
134
35
  });
135
- }); };
136
- export var deserializeAws_restJson1GetConnectionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
137
- var contents, data, _a, _b;
138
- return __generator(this, function (_c) {
139
- switch (_c.label) {
140
- case 0:
141
- if (output.statusCode !== 200 && output.statusCode >= 300) {
142
- return [2, deserializeAws_restJson1GetConnectionCommandError(output, context)];
143
- }
144
- contents = map({
145
- $metadata: deserializeMetadata(output),
146
- });
147
- _a = __expectNonNull;
148
- _b = __expectObject;
149
- return [4, parseBody(output.body, context)];
150
- case 1:
151
- data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
152
- if (data.connectedAt != null) {
153
- contents.ConnectedAt = __expectNonNull(__parseRfc3339DateTime(data.connectedAt));
154
- }
155
- if (data.identity != null) {
156
- contents.Identity = deserializeAws_restJson1Identity(data.identity, context);
157
- }
158
- if (data.lastActiveAt != null) {
159
- contents.LastActiveAt = __expectNonNull(__parseRfc3339DateTime(data.lastActiveAt));
160
- }
161
- return [2, contents];
162
- }
36
+ };
37
+ export const serializeAws_restJson1PostToConnectionCommand = async (input, context) => {
38
+ const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
39
+ const headers = {
40
+ "content-type": "application/octet-stream",
41
+ };
42
+ let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/@connections/{ConnectionId}";
43
+ resolvedPath = __resolvedPath(resolvedPath, input, "ConnectionId", () => input.ConnectionId, "{ConnectionId}", false);
44
+ let body;
45
+ if (input.Data !== undefined) {
46
+ body = input.Data;
47
+ }
48
+ return new __HttpRequest({
49
+ protocol,
50
+ hostname,
51
+ port,
52
+ method: "POST",
53
+ headers,
54
+ path: resolvedPath,
55
+ body,
163
56
  });
164
- }); };
165
- var deserializeAws_restJson1GetConnectionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
166
- var parsedOutput, _a, errorCode, _b, parsedBody;
167
- var _c;
168
- return __generator(this, function (_d) {
169
- switch (_d.label) {
170
- case 0:
171
- _a = [__assign({}, output)];
172
- _c = {};
173
- return [4, parseErrorBody(output.body, context)];
174
- case 1:
175
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
176
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
177
- _b = errorCode;
178
- switch (_b) {
179
- case "ForbiddenException": return [3, 2];
180
- case "com.amazonaws.apigatewaymanagementapi#ForbiddenException": return [3, 2];
181
- case "GoneException": return [3, 4];
182
- case "com.amazonaws.apigatewaymanagementapi#GoneException": return [3, 4];
183
- case "LimitExceededException": return [3, 6];
184
- case "com.amazonaws.apigatewaymanagementapi#LimitExceededException": return [3, 6];
185
- }
186
- return [3, 8];
187
- case 2: return [4, deserializeAws_restJson1ForbiddenExceptionResponse(parsedOutput, context)];
188
- case 3: throw _d.sent();
189
- case 4: return [4, deserializeAws_restJson1GoneExceptionResponse(parsedOutput, context)];
190
- case 5: throw _d.sent();
191
- case 6: return [4, deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)];
192
- case 7: throw _d.sent();
193
- case 8:
194
- parsedBody = parsedOutput.body;
195
- throwDefaultError({
196
- output: output,
197
- parsedBody: parsedBody,
198
- exceptionCtor: __BaseException,
199
- errorCode: errorCode,
200
- });
201
- _d.label = 9;
202
- case 9: return [2];
203
- }
57
+ };
58
+ export const deserializeAws_restJson1DeleteConnectionCommand = async (output, context) => {
59
+ if (output.statusCode !== 204 && output.statusCode >= 300) {
60
+ return deserializeAws_restJson1DeleteConnectionCommandError(output, context);
61
+ }
62
+ const contents = map({
63
+ $metadata: deserializeMetadata(output),
204
64
  });
205
- }); };
206
- export var deserializeAws_restJson1PostToConnectionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
207
- var contents;
208
- return __generator(this, function (_a) {
209
- switch (_a.label) {
210
- case 0:
211
- if (output.statusCode !== 200 && output.statusCode >= 300) {
212
- return [2, deserializeAws_restJson1PostToConnectionCommandError(output, context)];
213
- }
214
- contents = map({
215
- $metadata: deserializeMetadata(output),
216
- });
217
- return [4, collectBody(output.body, context)];
218
- case 1:
219
- _a.sent();
220
- return [2, contents];
221
- }
65
+ await collectBody(output.body, context);
66
+ return contents;
67
+ };
68
+ const deserializeAws_restJson1DeleteConnectionCommandError = async (output, context) => {
69
+ const parsedOutput = {
70
+ ...output,
71
+ body: await parseErrorBody(output.body, context),
72
+ };
73
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
74
+ switch (errorCode) {
75
+ case "ForbiddenException":
76
+ case "com.amazonaws.apigatewaymanagementapi#ForbiddenException":
77
+ throw await deserializeAws_restJson1ForbiddenExceptionResponse(parsedOutput, context);
78
+ case "GoneException":
79
+ case "com.amazonaws.apigatewaymanagementapi#GoneException":
80
+ throw await deserializeAws_restJson1GoneExceptionResponse(parsedOutput, context);
81
+ case "LimitExceededException":
82
+ case "com.amazonaws.apigatewaymanagementapi#LimitExceededException":
83
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
84
+ default:
85
+ const parsedBody = parsedOutput.body;
86
+ throwDefaultError({
87
+ output,
88
+ parsedBody,
89
+ exceptionCtor: __BaseException,
90
+ errorCode,
91
+ });
92
+ }
93
+ };
94
+ export const deserializeAws_restJson1GetConnectionCommand = async (output, context) => {
95
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
96
+ return deserializeAws_restJson1GetConnectionCommandError(output, context);
97
+ }
98
+ const contents = map({
99
+ $metadata: deserializeMetadata(output),
222
100
  });
223
- }); };
224
- var deserializeAws_restJson1PostToConnectionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
225
- var parsedOutput, _a, errorCode, _b, parsedBody;
226
- var _c;
227
- return __generator(this, function (_d) {
228
- switch (_d.label) {
229
- case 0:
230
- _a = [__assign({}, output)];
231
- _c = {};
232
- return [4, parseErrorBody(output.body, context)];
233
- case 1:
234
- parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
235
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
236
- _b = errorCode;
237
- switch (_b) {
238
- case "ForbiddenException": return [3, 2];
239
- case "com.amazonaws.apigatewaymanagementapi#ForbiddenException": return [3, 2];
240
- case "GoneException": return [3, 4];
241
- case "com.amazonaws.apigatewaymanagementapi#GoneException": return [3, 4];
242
- case "LimitExceededException": return [3, 6];
243
- case "com.amazonaws.apigatewaymanagementapi#LimitExceededException": return [3, 6];
244
- case "PayloadTooLargeException": return [3, 8];
245
- case "com.amazonaws.apigatewaymanagementapi#PayloadTooLargeException": return [3, 8];
246
- }
247
- return [3, 10];
248
- case 2: return [4, deserializeAws_restJson1ForbiddenExceptionResponse(parsedOutput, context)];
249
- case 3: throw _d.sent();
250
- case 4: return [4, deserializeAws_restJson1GoneExceptionResponse(parsedOutput, context)];
251
- case 5: throw _d.sent();
252
- case 6: return [4, deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context)];
253
- case 7: throw _d.sent();
254
- case 8: return [4, deserializeAws_restJson1PayloadTooLargeExceptionResponse(parsedOutput, context)];
255
- case 9: throw _d.sent();
256
- case 10:
257
- parsedBody = parsedOutput.body;
258
- throwDefaultError({
259
- output: output,
260
- parsedBody: parsedBody,
261
- exceptionCtor: __BaseException,
262
- errorCode: errorCode,
263
- });
264
- _d.label = 11;
265
- case 11: return [2];
266
- }
101
+ const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
102
+ if (data.connectedAt != null) {
103
+ contents.ConnectedAt = __expectNonNull(__parseRfc3339DateTime(data.connectedAt));
104
+ }
105
+ if (data.identity != null) {
106
+ contents.Identity = deserializeAws_restJson1Identity(data.identity, context);
107
+ }
108
+ if (data.lastActiveAt != null) {
109
+ contents.LastActiveAt = __expectNonNull(__parseRfc3339DateTime(data.lastActiveAt));
110
+ }
111
+ return contents;
112
+ };
113
+ const deserializeAws_restJson1GetConnectionCommandError = async (output, context) => {
114
+ const parsedOutput = {
115
+ ...output,
116
+ body: await parseErrorBody(output.body, context),
117
+ };
118
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
119
+ switch (errorCode) {
120
+ case "ForbiddenException":
121
+ case "com.amazonaws.apigatewaymanagementapi#ForbiddenException":
122
+ throw await deserializeAws_restJson1ForbiddenExceptionResponse(parsedOutput, context);
123
+ case "GoneException":
124
+ case "com.amazonaws.apigatewaymanagementapi#GoneException":
125
+ throw await deserializeAws_restJson1GoneExceptionResponse(parsedOutput, context);
126
+ case "LimitExceededException":
127
+ case "com.amazonaws.apigatewaymanagementapi#LimitExceededException":
128
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
129
+ default:
130
+ const parsedBody = parsedOutput.body;
131
+ throwDefaultError({
132
+ output,
133
+ parsedBody,
134
+ exceptionCtor: __BaseException,
135
+ errorCode,
136
+ });
137
+ }
138
+ };
139
+ export const deserializeAws_restJson1PostToConnectionCommand = async (output, context) => {
140
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
141
+ return deserializeAws_restJson1PostToConnectionCommandError(output, context);
142
+ }
143
+ const contents = map({
144
+ $metadata: deserializeMetadata(output),
267
145
  });
268
- }); };
269
- var map = __map;
270
- var deserializeAws_restJson1ForbiddenExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
271
- var contents, data, exception;
272
- return __generator(this, function (_a) {
273
- contents = map({});
274
- data = parsedOutput.body;
275
- exception = new ForbiddenException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
276
- return [2, __decorateServiceException(exception, parsedOutput.body)];
146
+ await collectBody(output.body, context);
147
+ return contents;
148
+ };
149
+ const deserializeAws_restJson1PostToConnectionCommandError = async (output, context) => {
150
+ const parsedOutput = {
151
+ ...output,
152
+ body: await parseErrorBody(output.body, context),
153
+ };
154
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
155
+ switch (errorCode) {
156
+ case "ForbiddenException":
157
+ case "com.amazonaws.apigatewaymanagementapi#ForbiddenException":
158
+ throw await deserializeAws_restJson1ForbiddenExceptionResponse(parsedOutput, context);
159
+ case "GoneException":
160
+ case "com.amazonaws.apigatewaymanagementapi#GoneException":
161
+ throw await deserializeAws_restJson1GoneExceptionResponse(parsedOutput, context);
162
+ case "LimitExceededException":
163
+ case "com.amazonaws.apigatewaymanagementapi#LimitExceededException":
164
+ throw await deserializeAws_restJson1LimitExceededExceptionResponse(parsedOutput, context);
165
+ case "PayloadTooLargeException":
166
+ case "com.amazonaws.apigatewaymanagementapi#PayloadTooLargeException":
167
+ throw await deserializeAws_restJson1PayloadTooLargeExceptionResponse(parsedOutput, context);
168
+ default:
169
+ const parsedBody = parsedOutput.body;
170
+ throwDefaultError({
171
+ output,
172
+ parsedBody,
173
+ exceptionCtor: __BaseException,
174
+ errorCode,
175
+ });
176
+ }
177
+ };
178
+ const map = __map;
179
+ const deserializeAws_restJson1ForbiddenExceptionResponse = async (parsedOutput, context) => {
180
+ const contents = map({});
181
+ const data = parsedOutput.body;
182
+ const exception = new ForbiddenException({
183
+ $metadata: deserializeMetadata(parsedOutput),
184
+ ...contents,
277
185
  });
278
- }); };
279
- var deserializeAws_restJson1GoneExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
280
- var contents, data, exception;
281
- return __generator(this, function (_a) {
282
- contents = map({});
283
- data = parsedOutput.body;
284
- exception = new GoneException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
285
- return [2, __decorateServiceException(exception, parsedOutput.body)];
186
+ return __decorateServiceException(exception, parsedOutput.body);
187
+ };
188
+ const deserializeAws_restJson1GoneExceptionResponse = async (parsedOutput, context) => {
189
+ const contents = map({});
190
+ const data = parsedOutput.body;
191
+ const exception = new GoneException({
192
+ $metadata: deserializeMetadata(parsedOutput),
193
+ ...contents,
286
194
  });
287
- }); };
288
- var deserializeAws_restJson1LimitExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
289
- var contents, data, exception;
290
- return __generator(this, function (_a) {
291
- contents = map({});
292
- data = parsedOutput.body;
293
- exception = new LimitExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
294
- return [2, __decorateServiceException(exception, parsedOutput.body)];
195
+ return __decorateServiceException(exception, parsedOutput.body);
196
+ };
197
+ const deserializeAws_restJson1LimitExceededExceptionResponse = async (parsedOutput, context) => {
198
+ const contents = map({});
199
+ const data = parsedOutput.body;
200
+ const exception = new LimitExceededException({
201
+ $metadata: deserializeMetadata(parsedOutput),
202
+ ...contents,
295
203
  });
296
- }); };
297
- var deserializeAws_restJson1PayloadTooLargeExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
298
- var contents, data, exception;
299
- return __generator(this, function (_a) {
300
- contents = map({});
301
- data = parsedOutput.body;
302
- if (data.message != null) {
303
- contents.Message = __expectString(data.message);
304
- }
305
- exception = new PayloadTooLargeException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
306
- return [2, __decorateServiceException(exception, parsedOutput.body)];
204
+ return __decorateServiceException(exception, parsedOutput.body);
205
+ };
206
+ const deserializeAws_restJson1PayloadTooLargeExceptionResponse = async (parsedOutput, context) => {
207
+ const contents = map({});
208
+ const data = parsedOutput.body;
209
+ if (data.message != null) {
210
+ contents.Message = __expectString(data.message);
211
+ }
212
+ const exception = new PayloadTooLargeException({
213
+ $metadata: deserializeMetadata(parsedOutput),
214
+ ...contents,
307
215
  });
308
- }); };
309
- var deserializeAws_restJson1Identity = function (output, context) {
216
+ return __decorateServiceException(exception, parsedOutput.body);
217
+ };
218
+ const deserializeAws_restJson1Identity = (output, context) => {
310
219
  return {
311
220
  SourceIp: __expectString(output.sourceIp),
312
221
  UserAgent: __expectString(output.userAgent),
313
222
  };
314
223
  };
315
- var deserializeMetadata = function (output) {
316
- var _a;
317
- return ({
318
- httpStatusCode: output.statusCode,
319
- requestId: (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"],
320
- extendedRequestId: output.headers["x-amz-id-2"],
321
- cfId: output.headers["x-amz-cf-id"],
322
- });
323
- };
324
- var collectBody = function (streamBody, context) {
325
- if (streamBody === void 0) { streamBody = new Uint8Array(); }
224
+ const deserializeMetadata = (output) => ({
225
+ httpStatusCode: output.statusCode,
226
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
227
+ extendedRequestId: output.headers["x-amz-id-2"],
228
+ cfId: output.headers["x-amz-cf-id"],
229
+ });
230
+ const collectBody = (streamBody = new Uint8Array(), context) => {
326
231
  if (streamBody instanceof Uint8Array) {
327
232
  return Promise.resolve(streamBody);
328
233
  }
329
234
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
330
235
  };
331
- var collectBodyString = function (streamBody, context) {
332
- return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
333
- };
334
- var isSerializableHeaderValue = function (value) {
335
- return value !== undefined &&
336
- value !== null &&
337
- value !== "" &&
338
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
339
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
340
- };
341
- var parseBody = function (streamBody, context) {
342
- return collectBodyString(streamBody, context).then(function (encoded) {
343
- if (encoded.length) {
344
- return JSON.parse(encoded);
345
- }
346
- return {};
347
- });
236
+ const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
237
+ const isSerializableHeaderValue = (value) => value !== undefined &&
238
+ value !== null &&
239
+ value !== "" &&
240
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
241
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
242
+ const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
243
+ if (encoded.length) {
244
+ return JSON.parse(encoded);
245
+ }
246
+ return {};
247
+ });
248
+ const parseErrorBody = async (errorBody, context) => {
249
+ const value = await parseBody(errorBody, context);
250
+ value.message = value.message ?? value.Message;
251
+ return value;
348
252
  };
349
- var parseErrorBody = function (errorBody, context) { return __awaiter(void 0, void 0, void 0, function () {
350
- var value;
351
- var _a;
352
- return __generator(this, function (_b) {
353
- switch (_b.label) {
354
- case 0: return [4, parseBody(errorBody, context)];
355
- case 1:
356
- value = _b.sent();
357
- value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
358
- return [2, value];
359
- }
360
- });
361
- }); };
362
- var loadRestJsonErrorCode = function (output, data) {
363
- var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
364
- var sanitizeErrorCode = function (rawValue) {
365
- var cleanValue = rawValue;
253
+ const loadRestJsonErrorCode = (output, data) => {
254
+ const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
255
+ const sanitizeErrorCode = (rawValue) => {
256
+ let cleanValue = rawValue;
366
257
  if (typeof cleanValue === "number") {
367
258
  cleanValue = cleanValue.toString();
368
259
  }
@@ -377,7 +268,7 @@ var loadRestJsonErrorCode = function (output, data) {
377
268
  }
378
269
  return cleanValue;
379
270
  };
380
- var headerKey = findKey(output.headers, "x-amzn-errortype");
271
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
381
272
  if (headerKey !== undefined) {
382
273
  return sanitizeErrorCode(output.headers[headerKey]);
383
274
  }