@aws-sdk/client-iot-data-plane 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,647 +1,885 @@
1
+ import { __assign, __awaiter, __generator } from "tslib";
1
2
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
3
  import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectLong as __expectLong, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map as __map, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
3
4
  import { IoTDataPlaneServiceException as __BaseException } from "../models/IoTDataPlaneServiceException";
4
5
  import { ConflictException, InternalFailureException, InvalidRequestException, MethodNotAllowedException, RequestEntityTooLargeException, ResourceNotFoundException, ServiceUnavailableException, ThrottlingException, UnauthorizedException, UnsupportedDocumentEncodingException, } from "../models/models_0";
5
- export const serializeAws_restJson1DeleteThingShadowCommand = 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 || ""}` + "/things/{thingName}/shadow";
9
- resolvedPath = __resolvedPath(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
10
- const query = map({
11
- name: [, input.shadowName],
12
- });
13
- let body;
14
- return new __HttpRequest({
15
- protocol,
16
- hostname,
17
- port,
18
- method: "DELETE",
19
- headers,
20
- path: resolvedPath,
21
- query,
22
- body,
23
- });
24
- };
25
- export const serializeAws_restJson1GetRetainedMessageCommand = async (input, context) => {
26
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
27
- const headers = {};
28
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/retainedMessage/{topic}";
29
- resolvedPath = __resolvedPath(resolvedPath, input, "topic", () => input.topic, "{topic}", false);
30
- let body;
31
- return new __HttpRequest({
32
- protocol,
33
- hostname,
34
- port,
35
- method: "GET",
36
- headers,
37
- path: resolvedPath,
38
- body,
39
- });
40
- };
41
- export const serializeAws_restJson1GetThingShadowCommand = async (input, context) => {
42
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
43
- const headers = {};
44
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/shadow";
45
- resolvedPath = __resolvedPath(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
46
- const query = map({
47
- name: [, input.shadowName],
48
- });
49
- let body;
50
- return new __HttpRequest({
51
- protocol,
52
- hostname,
53
- port,
54
- method: "GET",
55
- headers,
56
- path: resolvedPath,
57
- query,
58
- body,
59
- });
60
- };
61
- export const serializeAws_restJson1ListNamedShadowsForThingCommand = async (input, context) => {
62
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
63
- const headers = {};
64
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
65
- "/api/things/shadow/ListNamedShadowsForThing/{thingName}";
66
- resolvedPath = __resolvedPath(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
67
- const query = map({
68
- nextToken: [, input.nextToken],
69
- pageSize: [() => input.pageSize !== void 0, () => input.pageSize.toString()],
70
- });
71
- let body;
72
- return new __HttpRequest({
73
- protocol,
74
- hostname,
75
- port,
76
- method: "GET",
77
- headers,
78
- path: resolvedPath,
79
- query,
80
- body,
6
+ export var serializeAws_restJson1DeleteThingShadowCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
7
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, 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 || "") + "/things/{thingName}/shadow";
15
+ resolvedPath = __resolvedPath(resolvedPath, input, "thingName", function () { return input.thingName; }, "{thingName}", false);
16
+ query = map({
17
+ name: [, input.shadowName],
18
+ });
19
+ return [2, new __HttpRequest({
20
+ protocol: protocol,
21
+ hostname: hostname,
22
+ port: port,
23
+ method: "DELETE",
24
+ headers: headers,
25
+ path: resolvedPath,
26
+ query: query,
27
+ body: body,
28
+ })];
29
+ }
81
30
  });
82
- };
83
- export const serializeAws_restJson1ListRetainedMessagesCommand = async (input, context) => {
84
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
85
- const headers = {};
86
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/retainedMessage";
87
- const query = map({
88
- nextToken: [, input.nextToken],
89
- maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
90
- });
91
- let body;
92
- return new __HttpRequest({
93
- protocol,
94
- hostname,
95
- port,
96
- method: "GET",
97
- headers,
98
- path: resolvedPath,
99
- query,
100
- body,
31
+ }); };
32
+ export var serializeAws_restJson1GetRetainedMessageCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
33
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
34
+ return __generator(this, function (_c) {
35
+ switch (_c.label) {
36
+ case 0: return [4, context.endpoint()];
37
+ case 1:
38
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
39
+ headers = {};
40
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/retainedMessage/{topic}";
41
+ resolvedPath = __resolvedPath(resolvedPath, input, "topic", function () { return input.topic; }, "{topic}", false);
42
+ return [2, new __HttpRequest({
43
+ protocol: protocol,
44
+ hostname: hostname,
45
+ port: port,
46
+ method: "GET",
47
+ headers: headers,
48
+ path: resolvedPath,
49
+ body: body,
50
+ })];
51
+ }
101
52
  });
102
- };
103
- export const serializeAws_restJson1PublishCommand = async (input, context) => {
104
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
105
- const headers = {
106
- "content-type": "application/octet-stream",
107
- };
108
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/topics/{topic}";
109
- resolvedPath = __resolvedPath(resolvedPath, input, "topic", () => input.topic, "{topic}", false);
110
- const query = map({
111
- qos: [() => input.qos !== void 0, () => input.qos.toString()],
112
- retain: [() => input.retain !== void 0, () => input.retain.toString()],
113
- });
114
- let body;
115
- if (input.payload !== undefined) {
116
- body = input.payload;
117
- }
118
- return new __HttpRequest({
119
- protocol,
120
- hostname,
121
- port,
122
- method: "POST",
123
- headers,
124
- path: resolvedPath,
125
- query,
126
- body,
53
+ }); };
54
+ export var serializeAws_restJson1GetThingShadowCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
55
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, 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
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/things/{thingName}/shadow";
63
+ resolvedPath = __resolvedPath(resolvedPath, input, "thingName", function () { return input.thingName; }, "{thingName}", false);
64
+ query = map({
65
+ name: [, input.shadowName],
66
+ });
67
+ return [2, new __HttpRequest({
68
+ protocol: protocol,
69
+ hostname: hostname,
70
+ port: port,
71
+ method: "GET",
72
+ headers: headers,
73
+ path: resolvedPath,
74
+ query: query,
75
+ body: body,
76
+ })];
77
+ }
127
78
  });
128
- };
129
- export const serializeAws_restJson1UpdateThingShadowCommand = async (input, context) => {
130
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
131
- const headers = {
132
- "content-type": "application/octet-stream",
133
- };
134
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/shadow";
135
- resolvedPath = __resolvedPath(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
136
- const query = map({
137
- name: [, input.shadowName],
138
- });
139
- let body;
140
- if (input.payload !== undefined) {
141
- body = input.payload;
142
- }
143
- return new __HttpRequest({
144
- protocol,
145
- hostname,
146
- port,
147
- method: "POST",
148
- headers,
149
- path: resolvedPath,
150
- query,
151
- body,
79
+ }); };
80
+ export var serializeAws_restJson1ListNamedShadowsForThingCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
81
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
82
+ return __generator(this, function (_c) {
83
+ switch (_c.label) {
84
+ case 0: return [4, context.endpoint()];
85
+ case 1:
86
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
87
+ headers = {};
88
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
89
+ "/api/things/shadow/ListNamedShadowsForThing/{thingName}";
90
+ resolvedPath = __resolvedPath(resolvedPath, input, "thingName", function () { return input.thingName; }, "{thingName}", false);
91
+ query = map({
92
+ nextToken: [, input.nextToken],
93
+ pageSize: [function () { return input.pageSize !== void 0; }, function () { return input.pageSize.toString(); }],
94
+ });
95
+ return [2, new __HttpRequest({
96
+ protocol: protocol,
97
+ hostname: hostname,
98
+ port: port,
99
+ method: "GET",
100
+ headers: headers,
101
+ path: resolvedPath,
102
+ query: query,
103
+ body: body,
104
+ })];
105
+ }
152
106
  });
153
- };
154
- export const deserializeAws_restJson1DeleteThingShadowCommand = async (output, context) => {
155
- if (output.statusCode !== 200 && output.statusCode >= 300) {
156
- return deserializeAws_restJson1DeleteThingShadowCommandError(output, context);
157
- }
158
- const contents = map({
159
- $metadata: deserializeMetadata(output),
107
+ }); };
108
+ export var serializeAws_restJson1ListRetainedMessagesCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
109
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
110
+ return __generator(this, function (_c) {
111
+ switch (_c.label) {
112
+ case 0: return [4, context.endpoint()];
113
+ case 1:
114
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
115
+ headers = {};
116
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/retainedMessage";
117
+ query = map({
118
+ nextToken: [, input.nextToken],
119
+ maxResults: [function () { return input.maxResults !== void 0; }, function () { return input.maxResults.toString(); }],
120
+ });
121
+ return [2, new __HttpRequest({
122
+ protocol: protocol,
123
+ hostname: hostname,
124
+ port: port,
125
+ method: "GET",
126
+ headers: headers,
127
+ path: resolvedPath,
128
+ query: query,
129
+ body: body,
130
+ })];
131
+ }
160
132
  });
161
- const data = await collectBody(output.body, context);
162
- contents.payload = data;
163
- return contents;
164
- };
165
- const deserializeAws_restJson1DeleteThingShadowCommandError = async (output, context) => {
166
- const parsedOutput = {
167
- ...output,
168
- body: await parseErrorBody(output.body, context),
169
- };
170
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
171
- switch (errorCode) {
172
- case "InternalFailureException":
173
- case "com.amazonaws.iotdataplane#InternalFailureException":
174
- throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
175
- case "InvalidRequestException":
176
- case "com.amazonaws.iotdataplane#InvalidRequestException":
177
- throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
178
- case "MethodNotAllowedException":
179
- case "com.amazonaws.iotdataplane#MethodNotAllowedException":
180
- throw await deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context);
181
- case "ResourceNotFoundException":
182
- case "com.amazonaws.iotdataplane#ResourceNotFoundException":
183
- throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
184
- case "ServiceUnavailableException":
185
- case "com.amazonaws.iotdataplane#ServiceUnavailableException":
186
- throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
187
- case "ThrottlingException":
188
- case "com.amazonaws.iotdataplane#ThrottlingException":
189
- throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
190
- case "UnauthorizedException":
191
- case "com.amazonaws.iotdataplane#UnauthorizedException":
192
- throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
193
- case "UnsupportedDocumentEncodingException":
194
- case "com.amazonaws.iotdataplane#UnsupportedDocumentEncodingException":
195
- throw await deserializeAws_restJson1UnsupportedDocumentEncodingExceptionResponse(parsedOutput, context);
196
- default:
197
- const parsedBody = parsedOutput.body;
198
- throwDefaultError({
199
- output,
200
- parsedBody,
201
- exceptionCtor: __BaseException,
202
- errorCode,
203
- });
204
- }
205
- };
206
- export const deserializeAws_restJson1GetRetainedMessageCommand = async (output, context) => {
207
- if (output.statusCode !== 200 && output.statusCode >= 300) {
208
- return deserializeAws_restJson1GetRetainedMessageCommandError(output, context);
209
- }
210
- const contents = map({
211
- $metadata: deserializeMetadata(output),
133
+ }); };
134
+ export var serializeAws_restJson1PublishCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
135
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
136
+ return __generator(this, function (_c) {
137
+ switch (_c.label) {
138
+ case 0: return [4, context.endpoint()];
139
+ case 1:
140
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
141
+ headers = {
142
+ "content-type": "application/octet-stream",
143
+ };
144
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/topics/{topic}";
145
+ resolvedPath = __resolvedPath(resolvedPath, input, "topic", function () { return input.topic; }, "{topic}", false);
146
+ query = map({
147
+ qos: [function () { return input.qos !== void 0; }, function () { return input.qos.toString(); }],
148
+ retain: [function () { return input.retain !== void 0; }, function () { return input.retain.toString(); }],
149
+ });
150
+ if (input.payload !== undefined) {
151
+ body = input.payload;
152
+ }
153
+ return [2, new __HttpRequest({
154
+ protocol: protocol,
155
+ hostname: hostname,
156
+ port: port,
157
+ method: "POST",
158
+ headers: headers,
159
+ path: resolvedPath,
160
+ query: query,
161
+ body: body,
162
+ })];
163
+ }
212
164
  });
213
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
214
- if (data.lastModifiedTime != null) {
215
- contents.lastModifiedTime = __expectLong(data.lastModifiedTime);
216
- }
217
- if (data.payload != null) {
218
- contents.payload = context.base64Decoder(data.payload);
219
- }
220
- if (data.qos != null) {
221
- contents.qos = __expectInt32(data.qos);
222
- }
223
- if (data.topic != null) {
224
- contents.topic = __expectString(data.topic);
225
- }
226
- return contents;
227
- };
228
- const deserializeAws_restJson1GetRetainedMessageCommandError = async (output, context) => {
229
- const parsedOutput = {
230
- ...output,
231
- body: await parseErrorBody(output.body, context),
232
- };
233
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
234
- switch (errorCode) {
235
- case "InternalFailureException":
236
- case "com.amazonaws.iotdataplane#InternalFailureException":
237
- throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
238
- case "InvalidRequestException":
239
- case "com.amazonaws.iotdataplane#InvalidRequestException":
240
- throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
241
- case "MethodNotAllowedException":
242
- case "com.amazonaws.iotdataplane#MethodNotAllowedException":
243
- throw await deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context);
244
- case "ResourceNotFoundException":
245
- case "com.amazonaws.iotdataplane#ResourceNotFoundException":
246
- throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
247
- case "ServiceUnavailableException":
248
- case "com.amazonaws.iotdataplane#ServiceUnavailableException":
249
- throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
250
- case "ThrottlingException":
251
- case "com.amazonaws.iotdataplane#ThrottlingException":
252
- throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
253
- case "UnauthorizedException":
254
- case "com.amazonaws.iotdataplane#UnauthorizedException":
255
- throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
256
- default:
257
- const parsedBody = parsedOutput.body;
258
- throwDefaultError({
259
- output,
260
- parsedBody,
261
- exceptionCtor: __BaseException,
262
- errorCode,
263
- });
264
- }
265
- };
266
- export const deserializeAws_restJson1GetThingShadowCommand = async (output, context) => {
267
- if (output.statusCode !== 200 && output.statusCode >= 300) {
268
- return deserializeAws_restJson1GetThingShadowCommandError(output, context);
269
- }
270
- const contents = map({
271
- $metadata: deserializeMetadata(output),
165
+ }); };
166
+ export var serializeAws_restJson1UpdateThingShadowCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
167
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
168
+ return __generator(this, function (_c) {
169
+ switch (_c.label) {
170
+ case 0: return [4, context.endpoint()];
171
+ case 1:
172
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
173
+ headers = {
174
+ "content-type": "application/octet-stream",
175
+ };
176
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/things/{thingName}/shadow";
177
+ resolvedPath = __resolvedPath(resolvedPath, input, "thingName", function () { return input.thingName; }, "{thingName}", false);
178
+ query = map({
179
+ name: [, input.shadowName],
180
+ });
181
+ if (input.payload !== undefined) {
182
+ body = input.payload;
183
+ }
184
+ return [2, new __HttpRequest({
185
+ protocol: protocol,
186
+ hostname: hostname,
187
+ port: port,
188
+ method: "POST",
189
+ headers: headers,
190
+ path: resolvedPath,
191
+ query: query,
192
+ body: body,
193
+ })];
194
+ }
272
195
  });
273
- const data = await collectBody(output.body, context);
274
- contents.payload = data;
275
- return contents;
276
- };
277
- const deserializeAws_restJson1GetThingShadowCommandError = async (output, context) => {
278
- const parsedOutput = {
279
- ...output,
280
- body: await parseErrorBody(output.body, context),
281
- };
282
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
283
- switch (errorCode) {
284
- case "InternalFailureException":
285
- case "com.amazonaws.iotdataplane#InternalFailureException":
286
- throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
287
- case "InvalidRequestException":
288
- case "com.amazonaws.iotdataplane#InvalidRequestException":
289
- throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
290
- case "MethodNotAllowedException":
291
- case "com.amazonaws.iotdataplane#MethodNotAllowedException":
292
- throw await deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context);
293
- case "ResourceNotFoundException":
294
- case "com.amazonaws.iotdataplane#ResourceNotFoundException":
295
- throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
296
- case "ServiceUnavailableException":
297
- case "com.amazonaws.iotdataplane#ServiceUnavailableException":
298
- throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
299
- case "ThrottlingException":
300
- case "com.amazonaws.iotdataplane#ThrottlingException":
301
- throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
302
- case "UnauthorizedException":
303
- case "com.amazonaws.iotdataplane#UnauthorizedException":
304
- throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
305
- case "UnsupportedDocumentEncodingException":
306
- case "com.amazonaws.iotdataplane#UnsupportedDocumentEncodingException":
307
- throw await deserializeAws_restJson1UnsupportedDocumentEncodingExceptionResponse(parsedOutput, context);
308
- default:
309
- const parsedBody = parsedOutput.body;
310
- throwDefaultError({
311
- output,
312
- parsedBody,
313
- exceptionCtor: __BaseException,
314
- errorCode,
315
- });
316
- }
317
- };
318
- export const deserializeAws_restJson1ListNamedShadowsForThingCommand = async (output, context) => {
319
- if (output.statusCode !== 200 && output.statusCode >= 300) {
320
- return deserializeAws_restJson1ListNamedShadowsForThingCommandError(output, context);
321
- }
322
- const contents = map({
323
- $metadata: deserializeMetadata(output),
196
+ }); };
197
+ export var deserializeAws_restJson1DeleteThingShadowCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
198
+ var contents, data;
199
+ return __generator(this, function (_a) {
200
+ switch (_a.label) {
201
+ case 0:
202
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
203
+ return [2, deserializeAws_restJson1DeleteThingShadowCommandError(output, context)];
204
+ }
205
+ contents = map({
206
+ $metadata: deserializeMetadata(output),
207
+ });
208
+ return [4, collectBody(output.body, context)];
209
+ case 1:
210
+ data = _a.sent();
211
+ contents.payload = data;
212
+ return [2, contents];
213
+ }
324
214
  });
325
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
326
- if (data.nextToken != null) {
327
- contents.nextToken = __expectString(data.nextToken);
328
- }
329
- if (data.results != null) {
330
- contents.results = deserializeAws_restJson1NamedShadowList(data.results, context);
331
- }
332
- if (data.timestamp != null) {
333
- contents.timestamp = __expectLong(data.timestamp);
334
- }
335
- return contents;
336
- };
337
- const deserializeAws_restJson1ListNamedShadowsForThingCommandError = async (output, context) => {
338
- const parsedOutput = {
339
- ...output,
340
- body: await parseErrorBody(output.body, context),
341
- };
342
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
343
- switch (errorCode) {
344
- case "InternalFailureException":
345
- case "com.amazonaws.iotdataplane#InternalFailureException":
346
- throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
347
- case "InvalidRequestException":
348
- case "com.amazonaws.iotdataplane#InvalidRequestException":
349
- throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
350
- case "MethodNotAllowedException":
351
- case "com.amazonaws.iotdataplane#MethodNotAllowedException":
352
- throw await deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context);
353
- case "ResourceNotFoundException":
354
- case "com.amazonaws.iotdataplane#ResourceNotFoundException":
355
- throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
356
- case "ServiceUnavailableException":
357
- case "com.amazonaws.iotdataplane#ServiceUnavailableException":
358
- throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
359
- case "ThrottlingException":
360
- case "com.amazonaws.iotdataplane#ThrottlingException":
361
- throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
362
- case "UnauthorizedException":
363
- case "com.amazonaws.iotdataplane#UnauthorizedException":
364
- throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
365
- default:
366
- const parsedBody = parsedOutput.body;
367
- throwDefaultError({
368
- output,
369
- parsedBody,
370
- exceptionCtor: __BaseException,
371
- errorCode,
372
- });
373
- }
374
- };
375
- export const deserializeAws_restJson1ListRetainedMessagesCommand = async (output, context) => {
376
- if (output.statusCode !== 200 && output.statusCode >= 300) {
377
- return deserializeAws_restJson1ListRetainedMessagesCommandError(output, context);
378
- }
379
- const contents = map({
380
- $metadata: deserializeMetadata(output),
215
+ }); };
216
+ var deserializeAws_restJson1DeleteThingShadowCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
217
+ var parsedOutput, _a, errorCode, _b, parsedBody;
218
+ var _c;
219
+ return __generator(this, function (_d) {
220
+ switch (_d.label) {
221
+ case 0:
222
+ _a = [__assign({}, output)];
223
+ _c = {};
224
+ return [4, parseErrorBody(output.body, context)];
225
+ case 1:
226
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
227
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
228
+ _b = errorCode;
229
+ switch (_b) {
230
+ case "InternalFailureException": return [3, 2];
231
+ case "com.amazonaws.iotdataplane#InternalFailureException": return [3, 2];
232
+ case "InvalidRequestException": return [3, 4];
233
+ case "com.amazonaws.iotdataplane#InvalidRequestException": return [3, 4];
234
+ case "MethodNotAllowedException": return [3, 6];
235
+ case "com.amazonaws.iotdataplane#MethodNotAllowedException": return [3, 6];
236
+ case "ResourceNotFoundException": return [3, 8];
237
+ case "com.amazonaws.iotdataplane#ResourceNotFoundException": return [3, 8];
238
+ case "ServiceUnavailableException": return [3, 10];
239
+ case "com.amazonaws.iotdataplane#ServiceUnavailableException": return [3, 10];
240
+ case "ThrottlingException": return [3, 12];
241
+ case "com.amazonaws.iotdataplane#ThrottlingException": return [3, 12];
242
+ case "UnauthorizedException": return [3, 14];
243
+ case "com.amazonaws.iotdataplane#UnauthorizedException": return [3, 14];
244
+ case "UnsupportedDocumentEncodingException": return [3, 16];
245
+ case "com.amazonaws.iotdataplane#UnsupportedDocumentEncodingException": return [3, 16];
246
+ }
247
+ return [3, 18];
248
+ case 2: return [4, deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)];
249
+ case 3: throw _d.sent();
250
+ case 4: return [4, deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)];
251
+ case 5: throw _d.sent();
252
+ case 6: return [4, deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context)];
253
+ case 7: throw _d.sent();
254
+ case 8: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
255
+ case 9: throw _d.sent();
256
+ case 10: return [4, deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)];
257
+ case 11: throw _d.sent();
258
+ case 12: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
259
+ case 13: throw _d.sent();
260
+ case 14: return [4, deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)];
261
+ case 15: throw _d.sent();
262
+ case 16: return [4, deserializeAws_restJson1UnsupportedDocumentEncodingExceptionResponse(parsedOutput, context)];
263
+ case 17: throw _d.sent();
264
+ case 18:
265
+ parsedBody = parsedOutput.body;
266
+ throwDefaultError({
267
+ output: output,
268
+ parsedBody: parsedBody,
269
+ exceptionCtor: __BaseException,
270
+ errorCode: errorCode,
271
+ });
272
+ _d.label = 19;
273
+ case 19: return [2];
274
+ }
381
275
  });
382
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
383
- if (data.nextToken != null) {
384
- contents.nextToken = __expectString(data.nextToken);
385
- }
386
- if (data.retainedTopics != null) {
387
- contents.retainedTopics = deserializeAws_restJson1RetainedMessageList(data.retainedTopics, context);
388
- }
389
- return contents;
390
- };
391
- const deserializeAws_restJson1ListRetainedMessagesCommandError = async (output, context) => {
392
- const parsedOutput = {
393
- ...output,
394
- body: await parseErrorBody(output.body, context),
395
- };
396
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
397
- switch (errorCode) {
398
- case "InternalFailureException":
399
- case "com.amazonaws.iotdataplane#InternalFailureException":
400
- throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
401
- case "InvalidRequestException":
402
- case "com.amazonaws.iotdataplane#InvalidRequestException":
403
- throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
404
- case "MethodNotAllowedException":
405
- case "com.amazonaws.iotdataplane#MethodNotAllowedException":
406
- throw await deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context);
407
- case "ServiceUnavailableException":
408
- case "com.amazonaws.iotdataplane#ServiceUnavailableException":
409
- throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
410
- case "ThrottlingException":
411
- case "com.amazonaws.iotdataplane#ThrottlingException":
412
- throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
413
- case "UnauthorizedException":
414
- case "com.amazonaws.iotdataplane#UnauthorizedException":
415
- throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
416
- default:
417
- const parsedBody = parsedOutput.body;
418
- throwDefaultError({
419
- output,
420
- parsedBody,
421
- exceptionCtor: __BaseException,
422
- errorCode,
423
- });
424
- }
425
- };
426
- export const deserializeAws_restJson1PublishCommand = async (output, context) => {
427
- if (output.statusCode !== 200 && output.statusCode >= 300) {
428
- return deserializeAws_restJson1PublishCommandError(output, context);
429
- }
430
- const contents = map({
431
- $metadata: deserializeMetadata(output),
276
+ }); };
277
+ export var deserializeAws_restJson1GetRetainedMessageCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
278
+ var contents, data, _a, _b;
279
+ return __generator(this, function (_c) {
280
+ switch (_c.label) {
281
+ case 0:
282
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
283
+ return [2, deserializeAws_restJson1GetRetainedMessageCommandError(output, context)];
284
+ }
285
+ contents = map({
286
+ $metadata: deserializeMetadata(output),
287
+ });
288
+ _a = __expectNonNull;
289
+ _b = __expectObject;
290
+ return [4, parseBody(output.body, context)];
291
+ case 1:
292
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
293
+ if (data.lastModifiedTime != null) {
294
+ contents.lastModifiedTime = __expectLong(data.lastModifiedTime);
295
+ }
296
+ if (data.payload != null) {
297
+ contents.payload = context.base64Decoder(data.payload);
298
+ }
299
+ if (data.qos != null) {
300
+ contents.qos = __expectInt32(data.qos);
301
+ }
302
+ if (data.topic != null) {
303
+ contents.topic = __expectString(data.topic);
304
+ }
305
+ return [2, contents];
306
+ }
432
307
  });
433
- await collectBody(output.body, context);
434
- return contents;
435
- };
436
- const deserializeAws_restJson1PublishCommandError = async (output, context) => {
437
- const parsedOutput = {
438
- ...output,
439
- body: await parseErrorBody(output.body, context),
440
- };
441
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
442
- switch (errorCode) {
443
- case "InternalFailureException":
444
- case "com.amazonaws.iotdataplane#InternalFailureException":
445
- throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
446
- case "InvalidRequestException":
447
- case "com.amazonaws.iotdataplane#InvalidRequestException":
448
- throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
449
- case "MethodNotAllowedException":
450
- case "com.amazonaws.iotdataplane#MethodNotAllowedException":
451
- throw await deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context);
452
- case "UnauthorizedException":
453
- case "com.amazonaws.iotdataplane#UnauthorizedException":
454
- throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
455
- default:
456
- const parsedBody = parsedOutput.body;
457
- throwDefaultError({
458
- output,
459
- parsedBody,
460
- exceptionCtor: __BaseException,
461
- errorCode,
462
- });
463
- }
464
- };
465
- export const deserializeAws_restJson1UpdateThingShadowCommand = async (output, context) => {
466
- if (output.statusCode !== 200 && output.statusCode >= 300) {
467
- return deserializeAws_restJson1UpdateThingShadowCommandError(output, context);
468
- }
469
- const contents = map({
470
- $metadata: deserializeMetadata(output),
308
+ }); };
309
+ var deserializeAws_restJson1GetRetainedMessageCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
310
+ var parsedOutput, _a, errorCode, _b, parsedBody;
311
+ var _c;
312
+ return __generator(this, function (_d) {
313
+ switch (_d.label) {
314
+ case 0:
315
+ _a = [__assign({}, output)];
316
+ _c = {};
317
+ return [4, parseErrorBody(output.body, context)];
318
+ case 1:
319
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
320
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
321
+ _b = errorCode;
322
+ switch (_b) {
323
+ case "InternalFailureException": return [3, 2];
324
+ case "com.amazonaws.iotdataplane#InternalFailureException": return [3, 2];
325
+ case "InvalidRequestException": return [3, 4];
326
+ case "com.amazonaws.iotdataplane#InvalidRequestException": return [3, 4];
327
+ case "MethodNotAllowedException": return [3, 6];
328
+ case "com.amazonaws.iotdataplane#MethodNotAllowedException": return [3, 6];
329
+ case "ResourceNotFoundException": return [3, 8];
330
+ case "com.amazonaws.iotdataplane#ResourceNotFoundException": return [3, 8];
331
+ case "ServiceUnavailableException": return [3, 10];
332
+ case "com.amazonaws.iotdataplane#ServiceUnavailableException": return [3, 10];
333
+ case "ThrottlingException": return [3, 12];
334
+ case "com.amazonaws.iotdataplane#ThrottlingException": return [3, 12];
335
+ case "UnauthorizedException": return [3, 14];
336
+ case "com.amazonaws.iotdataplane#UnauthorizedException": return [3, 14];
337
+ }
338
+ return [3, 16];
339
+ case 2: return [4, deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)];
340
+ case 3: throw _d.sent();
341
+ case 4: return [4, deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)];
342
+ case 5: throw _d.sent();
343
+ case 6: return [4, deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context)];
344
+ case 7: throw _d.sent();
345
+ case 8: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
346
+ case 9: throw _d.sent();
347
+ case 10: return [4, deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)];
348
+ case 11: throw _d.sent();
349
+ case 12: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
350
+ case 13: throw _d.sent();
351
+ case 14: return [4, deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)];
352
+ case 15: throw _d.sent();
353
+ case 16:
354
+ parsedBody = parsedOutput.body;
355
+ throwDefaultError({
356
+ output: output,
357
+ parsedBody: parsedBody,
358
+ exceptionCtor: __BaseException,
359
+ errorCode: errorCode,
360
+ });
361
+ _d.label = 17;
362
+ case 17: return [2];
363
+ }
471
364
  });
472
- const data = await collectBody(output.body, context);
473
- contents.payload = data;
474
- return contents;
475
- };
476
- const deserializeAws_restJson1UpdateThingShadowCommandError = async (output, context) => {
477
- const parsedOutput = {
478
- ...output,
479
- body: await parseErrorBody(output.body, context),
480
- };
481
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
482
- switch (errorCode) {
483
- case "ConflictException":
484
- case "com.amazonaws.iotdataplane#ConflictException":
485
- throw await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context);
486
- case "InternalFailureException":
487
- case "com.amazonaws.iotdataplane#InternalFailureException":
488
- throw await deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context);
489
- case "InvalidRequestException":
490
- case "com.amazonaws.iotdataplane#InvalidRequestException":
491
- throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
492
- case "MethodNotAllowedException":
493
- case "com.amazonaws.iotdataplane#MethodNotAllowedException":
494
- throw await deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context);
495
- case "RequestEntityTooLargeException":
496
- case "com.amazonaws.iotdataplane#RequestEntityTooLargeException":
497
- throw await deserializeAws_restJson1RequestEntityTooLargeExceptionResponse(parsedOutput, context);
498
- case "ServiceUnavailableException":
499
- case "com.amazonaws.iotdataplane#ServiceUnavailableException":
500
- throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
501
- case "ThrottlingException":
502
- case "com.amazonaws.iotdataplane#ThrottlingException":
503
- throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
504
- case "UnauthorizedException":
505
- case "com.amazonaws.iotdataplane#UnauthorizedException":
506
- throw await deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context);
507
- case "UnsupportedDocumentEncodingException":
508
- case "com.amazonaws.iotdataplane#UnsupportedDocumentEncodingException":
509
- throw await deserializeAws_restJson1UnsupportedDocumentEncodingExceptionResponse(parsedOutput, context);
510
- default:
511
- const parsedBody = parsedOutput.body;
512
- throwDefaultError({
513
- output,
514
- parsedBody,
515
- exceptionCtor: __BaseException,
516
- errorCode,
517
- });
518
- }
519
- };
520
- const map = __map;
521
- const deserializeAws_restJson1ConflictExceptionResponse = async (parsedOutput, context) => {
522
- const contents = map({});
523
- const data = parsedOutput.body;
524
- if (data.message != null) {
525
- contents.message = __expectString(data.message);
526
- }
527
- const exception = new ConflictException({
528
- $metadata: deserializeMetadata(parsedOutput),
529
- ...contents,
365
+ }); };
366
+ export var deserializeAws_restJson1GetThingShadowCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
367
+ var contents, data;
368
+ return __generator(this, function (_a) {
369
+ switch (_a.label) {
370
+ case 0:
371
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
372
+ return [2, deserializeAws_restJson1GetThingShadowCommandError(output, context)];
373
+ }
374
+ contents = map({
375
+ $metadata: deserializeMetadata(output),
376
+ });
377
+ return [4, collectBody(output.body, context)];
378
+ case 1:
379
+ data = _a.sent();
380
+ contents.payload = data;
381
+ return [2, contents];
382
+ }
530
383
  });
531
- return __decorateServiceException(exception, parsedOutput.body);
532
- };
533
- const deserializeAws_restJson1InternalFailureExceptionResponse = async (parsedOutput, context) => {
534
- const contents = map({});
535
- const data = parsedOutput.body;
536
- if (data.message != null) {
537
- contents.message = __expectString(data.message);
538
- }
539
- const exception = new InternalFailureException({
540
- $metadata: deserializeMetadata(parsedOutput),
541
- ...contents,
384
+ }); };
385
+ var deserializeAws_restJson1GetThingShadowCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
386
+ var parsedOutput, _a, errorCode, _b, parsedBody;
387
+ var _c;
388
+ return __generator(this, function (_d) {
389
+ switch (_d.label) {
390
+ case 0:
391
+ _a = [__assign({}, output)];
392
+ _c = {};
393
+ return [4, parseErrorBody(output.body, context)];
394
+ case 1:
395
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
396
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
397
+ _b = errorCode;
398
+ switch (_b) {
399
+ case "InternalFailureException": return [3, 2];
400
+ case "com.amazonaws.iotdataplane#InternalFailureException": return [3, 2];
401
+ case "InvalidRequestException": return [3, 4];
402
+ case "com.amazonaws.iotdataplane#InvalidRequestException": return [3, 4];
403
+ case "MethodNotAllowedException": return [3, 6];
404
+ case "com.amazonaws.iotdataplane#MethodNotAllowedException": return [3, 6];
405
+ case "ResourceNotFoundException": return [3, 8];
406
+ case "com.amazonaws.iotdataplane#ResourceNotFoundException": return [3, 8];
407
+ case "ServiceUnavailableException": return [3, 10];
408
+ case "com.amazonaws.iotdataplane#ServiceUnavailableException": return [3, 10];
409
+ case "ThrottlingException": return [3, 12];
410
+ case "com.amazonaws.iotdataplane#ThrottlingException": return [3, 12];
411
+ case "UnauthorizedException": return [3, 14];
412
+ case "com.amazonaws.iotdataplane#UnauthorizedException": return [3, 14];
413
+ case "UnsupportedDocumentEncodingException": return [3, 16];
414
+ case "com.amazonaws.iotdataplane#UnsupportedDocumentEncodingException": return [3, 16];
415
+ }
416
+ return [3, 18];
417
+ case 2: return [4, deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)];
418
+ case 3: throw _d.sent();
419
+ case 4: return [4, deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)];
420
+ case 5: throw _d.sent();
421
+ case 6: return [4, deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context)];
422
+ case 7: throw _d.sent();
423
+ case 8: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
424
+ case 9: throw _d.sent();
425
+ case 10: return [4, deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)];
426
+ case 11: throw _d.sent();
427
+ case 12: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
428
+ case 13: throw _d.sent();
429
+ case 14: return [4, deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)];
430
+ case 15: throw _d.sent();
431
+ case 16: return [4, deserializeAws_restJson1UnsupportedDocumentEncodingExceptionResponse(parsedOutput, context)];
432
+ case 17: throw _d.sent();
433
+ case 18:
434
+ parsedBody = parsedOutput.body;
435
+ throwDefaultError({
436
+ output: output,
437
+ parsedBody: parsedBody,
438
+ exceptionCtor: __BaseException,
439
+ errorCode: errorCode,
440
+ });
441
+ _d.label = 19;
442
+ case 19: return [2];
443
+ }
542
444
  });
543
- return __decorateServiceException(exception, parsedOutput.body);
544
- };
545
- const deserializeAws_restJson1InvalidRequestExceptionResponse = async (parsedOutput, context) => {
546
- const contents = map({});
547
- const data = parsedOutput.body;
548
- if (data.message != null) {
549
- contents.message = __expectString(data.message);
550
- }
551
- const exception = new InvalidRequestException({
552
- $metadata: deserializeMetadata(parsedOutput),
553
- ...contents,
445
+ }); };
446
+ export var deserializeAws_restJson1ListNamedShadowsForThingCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
447
+ var contents, data, _a, _b;
448
+ return __generator(this, function (_c) {
449
+ switch (_c.label) {
450
+ case 0:
451
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
452
+ return [2, deserializeAws_restJson1ListNamedShadowsForThingCommandError(output, context)];
453
+ }
454
+ contents = map({
455
+ $metadata: deserializeMetadata(output),
456
+ });
457
+ _a = __expectNonNull;
458
+ _b = __expectObject;
459
+ return [4, parseBody(output.body, context)];
460
+ case 1:
461
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
462
+ if (data.nextToken != null) {
463
+ contents.nextToken = __expectString(data.nextToken);
464
+ }
465
+ if (data.results != null) {
466
+ contents.results = deserializeAws_restJson1NamedShadowList(data.results, context);
467
+ }
468
+ if (data.timestamp != null) {
469
+ contents.timestamp = __expectLong(data.timestamp);
470
+ }
471
+ return [2, contents];
472
+ }
554
473
  });
555
- return __decorateServiceException(exception, parsedOutput.body);
556
- };
557
- const deserializeAws_restJson1MethodNotAllowedExceptionResponse = async (parsedOutput, context) => {
558
- const contents = map({});
559
- const data = parsedOutput.body;
560
- if (data.message != null) {
561
- contents.message = __expectString(data.message);
562
- }
563
- const exception = new MethodNotAllowedException({
564
- $metadata: deserializeMetadata(parsedOutput),
565
- ...contents,
474
+ }); };
475
+ var deserializeAws_restJson1ListNamedShadowsForThingCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
476
+ var parsedOutput, _a, errorCode, _b, parsedBody;
477
+ var _c;
478
+ return __generator(this, function (_d) {
479
+ switch (_d.label) {
480
+ case 0:
481
+ _a = [__assign({}, output)];
482
+ _c = {};
483
+ return [4, parseErrorBody(output.body, context)];
484
+ case 1:
485
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
486
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
487
+ _b = errorCode;
488
+ switch (_b) {
489
+ case "InternalFailureException": return [3, 2];
490
+ case "com.amazonaws.iotdataplane#InternalFailureException": return [3, 2];
491
+ case "InvalidRequestException": return [3, 4];
492
+ case "com.amazonaws.iotdataplane#InvalidRequestException": return [3, 4];
493
+ case "MethodNotAllowedException": return [3, 6];
494
+ case "com.amazonaws.iotdataplane#MethodNotAllowedException": return [3, 6];
495
+ case "ResourceNotFoundException": return [3, 8];
496
+ case "com.amazonaws.iotdataplane#ResourceNotFoundException": return [3, 8];
497
+ case "ServiceUnavailableException": return [3, 10];
498
+ case "com.amazonaws.iotdataplane#ServiceUnavailableException": return [3, 10];
499
+ case "ThrottlingException": return [3, 12];
500
+ case "com.amazonaws.iotdataplane#ThrottlingException": return [3, 12];
501
+ case "UnauthorizedException": return [3, 14];
502
+ case "com.amazonaws.iotdataplane#UnauthorizedException": return [3, 14];
503
+ }
504
+ return [3, 16];
505
+ case 2: return [4, deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)];
506
+ case 3: throw _d.sent();
507
+ case 4: return [4, deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)];
508
+ case 5: throw _d.sent();
509
+ case 6: return [4, deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context)];
510
+ case 7: throw _d.sent();
511
+ case 8: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
512
+ case 9: throw _d.sent();
513
+ case 10: return [4, deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)];
514
+ case 11: throw _d.sent();
515
+ case 12: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
516
+ case 13: throw _d.sent();
517
+ case 14: return [4, deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)];
518
+ case 15: throw _d.sent();
519
+ case 16:
520
+ parsedBody = parsedOutput.body;
521
+ throwDefaultError({
522
+ output: output,
523
+ parsedBody: parsedBody,
524
+ exceptionCtor: __BaseException,
525
+ errorCode: errorCode,
526
+ });
527
+ _d.label = 17;
528
+ case 17: return [2];
529
+ }
566
530
  });
567
- return __decorateServiceException(exception, parsedOutput.body);
568
- };
569
- const deserializeAws_restJson1RequestEntityTooLargeExceptionResponse = async (parsedOutput, context) => {
570
- const contents = map({});
571
- const data = parsedOutput.body;
572
- if (data.message != null) {
573
- contents.message = __expectString(data.message);
574
- }
575
- const exception = new RequestEntityTooLargeException({
576
- $metadata: deserializeMetadata(parsedOutput),
577
- ...contents,
531
+ }); };
532
+ export var deserializeAws_restJson1ListRetainedMessagesCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
533
+ var contents, data, _a, _b;
534
+ return __generator(this, function (_c) {
535
+ switch (_c.label) {
536
+ case 0:
537
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
538
+ return [2, deserializeAws_restJson1ListRetainedMessagesCommandError(output, context)];
539
+ }
540
+ contents = map({
541
+ $metadata: deserializeMetadata(output),
542
+ });
543
+ _a = __expectNonNull;
544
+ _b = __expectObject;
545
+ return [4, parseBody(output.body, context)];
546
+ case 1:
547
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
548
+ if (data.nextToken != null) {
549
+ contents.nextToken = __expectString(data.nextToken);
550
+ }
551
+ if (data.retainedTopics != null) {
552
+ contents.retainedTopics = deserializeAws_restJson1RetainedMessageList(data.retainedTopics, context);
553
+ }
554
+ return [2, contents];
555
+ }
578
556
  });
579
- return __decorateServiceException(exception, parsedOutput.body);
580
- };
581
- const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
582
- const contents = map({});
583
- const data = parsedOutput.body;
584
- if (data.message != null) {
585
- contents.message = __expectString(data.message);
586
- }
587
- const exception = new ResourceNotFoundException({
588
- $metadata: deserializeMetadata(parsedOutput),
589
- ...contents,
557
+ }); };
558
+ var deserializeAws_restJson1ListRetainedMessagesCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
559
+ var parsedOutput, _a, errorCode, _b, parsedBody;
560
+ var _c;
561
+ return __generator(this, function (_d) {
562
+ switch (_d.label) {
563
+ case 0:
564
+ _a = [__assign({}, output)];
565
+ _c = {};
566
+ return [4, parseErrorBody(output.body, context)];
567
+ case 1:
568
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
569
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
570
+ _b = errorCode;
571
+ switch (_b) {
572
+ case "InternalFailureException": return [3, 2];
573
+ case "com.amazonaws.iotdataplane#InternalFailureException": return [3, 2];
574
+ case "InvalidRequestException": return [3, 4];
575
+ case "com.amazonaws.iotdataplane#InvalidRequestException": return [3, 4];
576
+ case "MethodNotAllowedException": return [3, 6];
577
+ case "com.amazonaws.iotdataplane#MethodNotAllowedException": return [3, 6];
578
+ case "ServiceUnavailableException": return [3, 8];
579
+ case "com.amazonaws.iotdataplane#ServiceUnavailableException": return [3, 8];
580
+ case "ThrottlingException": return [3, 10];
581
+ case "com.amazonaws.iotdataplane#ThrottlingException": return [3, 10];
582
+ case "UnauthorizedException": return [3, 12];
583
+ case "com.amazonaws.iotdataplane#UnauthorizedException": return [3, 12];
584
+ }
585
+ return [3, 14];
586
+ case 2: return [4, deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)];
587
+ case 3: throw _d.sent();
588
+ case 4: return [4, deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)];
589
+ case 5: throw _d.sent();
590
+ case 6: return [4, deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context)];
591
+ case 7: throw _d.sent();
592
+ case 8: return [4, deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)];
593
+ case 9: throw _d.sent();
594
+ case 10: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
595
+ case 11: throw _d.sent();
596
+ case 12: return [4, deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)];
597
+ case 13: throw _d.sent();
598
+ case 14:
599
+ parsedBody = parsedOutput.body;
600
+ throwDefaultError({
601
+ output: output,
602
+ parsedBody: parsedBody,
603
+ exceptionCtor: __BaseException,
604
+ errorCode: errorCode,
605
+ });
606
+ _d.label = 15;
607
+ case 15: return [2];
608
+ }
590
609
  });
591
- return __decorateServiceException(exception, parsedOutput.body);
592
- };
593
- const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async (parsedOutput, context) => {
594
- const contents = map({});
595
- const data = parsedOutput.body;
596
- if (data.message != null) {
597
- contents.message = __expectString(data.message);
598
- }
599
- const exception = new ServiceUnavailableException({
600
- $metadata: deserializeMetadata(parsedOutput),
601
- ...contents,
610
+ }); };
611
+ export var deserializeAws_restJson1PublishCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
612
+ var contents;
613
+ return __generator(this, function (_a) {
614
+ switch (_a.label) {
615
+ case 0:
616
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
617
+ return [2, deserializeAws_restJson1PublishCommandError(output, context)];
618
+ }
619
+ contents = map({
620
+ $metadata: deserializeMetadata(output),
621
+ });
622
+ return [4, collectBody(output.body, context)];
623
+ case 1:
624
+ _a.sent();
625
+ return [2, contents];
626
+ }
602
627
  });
603
- return __decorateServiceException(exception, parsedOutput.body);
604
- };
605
- const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
606
- const contents = map({});
607
- const data = parsedOutput.body;
608
- if (data.message != null) {
609
- contents.message = __expectString(data.message);
610
- }
611
- const exception = new ThrottlingException({
612
- $metadata: deserializeMetadata(parsedOutput),
613
- ...contents,
628
+ }); };
629
+ var deserializeAws_restJson1PublishCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
630
+ var parsedOutput, _a, errorCode, _b, parsedBody;
631
+ var _c;
632
+ return __generator(this, function (_d) {
633
+ switch (_d.label) {
634
+ case 0:
635
+ _a = [__assign({}, output)];
636
+ _c = {};
637
+ return [4, parseErrorBody(output.body, context)];
638
+ case 1:
639
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
640
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
641
+ _b = errorCode;
642
+ switch (_b) {
643
+ case "InternalFailureException": return [3, 2];
644
+ case "com.amazonaws.iotdataplane#InternalFailureException": return [3, 2];
645
+ case "InvalidRequestException": return [3, 4];
646
+ case "com.amazonaws.iotdataplane#InvalidRequestException": return [3, 4];
647
+ case "MethodNotAllowedException": return [3, 6];
648
+ case "com.amazonaws.iotdataplane#MethodNotAllowedException": return [3, 6];
649
+ case "UnauthorizedException": return [3, 8];
650
+ case "com.amazonaws.iotdataplane#UnauthorizedException": return [3, 8];
651
+ }
652
+ return [3, 10];
653
+ case 2: return [4, deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)];
654
+ case 3: throw _d.sent();
655
+ case 4: return [4, deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)];
656
+ case 5: throw _d.sent();
657
+ case 6: return [4, deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context)];
658
+ case 7: throw _d.sent();
659
+ case 8: return [4, deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)];
660
+ case 9: throw _d.sent();
661
+ case 10:
662
+ parsedBody = parsedOutput.body;
663
+ throwDefaultError({
664
+ output: output,
665
+ parsedBody: parsedBody,
666
+ exceptionCtor: __BaseException,
667
+ errorCode: errorCode,
668
+ });
669
+ _d.label = 11;
670
+ case 11: return [2];
671
+ }
614
672
  });
615
- return __decorateServiceException(exception, parsedOutput.body);
616
- };
617
- const deserializeAws_restJson1UnauthorizedExceptionResponse = async (parsedOutput, context) => {
618
- const contents = map({});
619
- const data = parsedOutput.body;
620
- if (data.message != null) {
621
- contents.message = __expectString(data.message);
622
- }
623
- const exception = new UnauthorizedException({
624
- $metadata: deserializeMetadata(parsedOutput),
625
- ...contents,
673
+ }); };
674
+ export var deserializeAws_restJson1UpdateThingShadowCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
675
+ var contents, data;
676
+ return __generator(this, function (_a) {
677
+ switch (_a.label) {
678
+ case 0:
679
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
680
+ return [2, deserializeAws_restJson1UpdateThingShadowCommandError(output, context)];
681
+ }
682
+ contents = map({
683
+ $metadata: deserializeMetadata(output),
684
+ });
685
+ return [4, collectBody(output.body, context)];
686
+ case 1:
687
+ data = _a.sent();
688
+ contents.payload = data;
689
+ return [2, contents];
690
+ }
626
691
  });
627
- return __decorateServiceException(exception, parsedOutput.body);
628
- };
629
- const deserializeAws_restJson1UnsupportedDocumentEncodingExceptionResponse = async (parsedOutput, context) => {
630
- const contents = map({});
631
- const data = parsedOutput.body;
632
- if (data.message != null) {
633
- contents.message = __expectString(data.message);
634
- }
635
- const exception = new UnsupportedDocumentEncodingException({
636
- $metadata: deserializeMetadata(parsedOutput),
637
- ...contents,
692
+ }); };
693
+ var deserializeAws_restJson1UpdateThingShadowCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
694
+ var parsedOutput, _a, errorCode, _b, parsedBody;
695
+ var _c;
696
+ return __generator(this, function (_d) {
697
+ switch (_d.label) {
698
+ case 0:
699
+ _a = [__assign({}, output)];
700
+ _c = {};
701
+ return [4, parseErrorBody(output.body, context)];
702
+ case 1:
703
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
704
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
705
+ _b = errorCode;
706
+ switch (_b) {
707
+ case "ConflictException": return [3, 2];
708
+ case "com.amazonaws.iotdataplane#ConflictException": return [3, 2];
709
+ case "InternalFailureException": return [3, 4];
710
+ case "com.amazonaws.iotdataplane#InternalFailureException": return [3, 4];
711
+ case "InvalidRequestException": return [3, 6];
712
+ case "com.amazonaws.iotdataplane#InvalidRequestException": return [3, 6];
713
+ case "MethodNotAllowedException": return [3, 8];
714
+ case "com.amazonaws.iotdataplane#MethodNotAllowedException": return [3, 8];
715
+ case "RequestEntityTooLargeException": return [3, 10];
716
+ case "com.amazonaws.iotdataplane#RequestEntityTooLargeException": return [3, 10];
717
+ case "ServiceUnavailableException": return [3, 12];
718
+ case "com.amazonaws.iotdataplane#ServiceUnavailableException": return [3, 12];
719
+ case "ThrottlingException": return [3, 14];
720
+ case "com.amazonaws.iotdataplane#ThrottlingException": return [3, 14];
721
+ case "UnauthorizedException": return [3, 16];
722
+ case "com.amazonaws.iotdataplane#UnauthorizedException": return [3, 16];
723
+ case "UnsupportedDocumentEncodingException": return [3, 18];
724
+ case "com.amazonaws.iotdataplane#UnsupportedDocumentEncodingException": return [3, 18];
725
+ }
726
+ return [3, 20];
727
+ case 2: return [4, deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)];
728
+ case 3: throw _d.sent();
729
+ case 4: return [4, deserializeAws_restJson1InternalFailureExceptionResponse(parsedOutput, context)];
730
+ case 5: throw _d.sent();
731
+ case 6: return [4, deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)];
732
+ case 7: throw _d.sent();
733
+ case 8: return [4, deserializeAws_restJson1MethodNotAllowedExceptionResponse(parsedOutput, context)];
734
+ case 9: throw _d.sent();
735
+ case 10: return [4, deserializeAws_restJson1RequestEntityTooLargeExceptionResponse(parsedOutput, context)];
736
+ case 11: throw _d.sent();
737
+ case 12: return [4, deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)];
738
+ case 13: throw _d.sent();
739
+ case 14: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
740
+ case 15: throw _d.sent();
741
+ case 16: return [4, deserializeAws_restJson1UnauthorizedExceptionResponse(parsedOutput, context)];
742
+ case 17: throw _d.sent();
743
+ case 18: return [4, deserializeAws_restJson1UnsupportedDocumentEncodingExceptionResponse(parsedOutput, context)];
744
+ case 19: throw _d.sent();
745
+ case 20:
746
+ parsedBody = parsedOutput.body;
747
+ throwDefaultError({
748
+ output: output,
749
+ parsedBody: parsedBody,
750
+ exceptionCtor: __BaseException,
751
+ errorCode: errorCode,
752
+ });
753
+ _d.label = 21;
754
+ case 21: return [2];
755
+ }
638
756
  });
639
- return __decorateServiceException(exception, parsedOutput.body);
640
- };
641
- const deserializeAws_restJson1NamedShadowList = (output, context) => {
642
- const retVal = (output || [])
643
- .filter((e) => e != null)
644
- .map((entry) => {
757
+ }); };
758
+ var map = __map;
759
+ var deserializeAws_restJson1ConflictExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
760
+ var contents, data, exception;
761
+ return __generator(this, function (_a) {
762
+ contents = map({});
763
+ data = parsedOutput.body;
764
+ if (data.message != null) {
765
+ contents.message = __expectString(data.message);
766
+ }
767
+ exception = new ConflictException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
768
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
769
+ });
770
+ }); };
771
+ var deserializeAws_restJson1InternalFailureExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
772
+ var contents, data, exception;
773
+ return __generator(this, function (_a) {
774
+ contents = map({});
775
+ data = parsedOutput.body;
776
+ if (data.message != null) {
777
+ contents.message = __expectString(data.message);
778
+ }
779
+ exception = new InternalFailureException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
780
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
781
+ });
782
+ }); };
783
+ var deserializeAws_restJson1InvalidRequestExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
784
+ var contents, data, exception;
785
+ return __generator(this, function (_a) {
786
+ contents = map({});
787
+ data = parsedOutput.body;
788
+ if (data.message != null) {
789
+ contents.message = __expectString(data.message);
790
+ }
791
+ exception = new InvalidRequestException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
792
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
793
+ });
794
+ }); };
795
+ var deserializeAws_restJson1MethodNotAllowedExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
796
+ var contents, data, exception;
797
+ return __generator(this, function (_a) {
798
+ contents = map({});
799
+ data = parsedOutput.body;
800
+ if (data.message != null) {
801
+ contents.message = __expectString(data.message);
802
+ }
803
+ exception = new MethodNotAllowedException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
804
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
805
+ });
806
+ }); };
807
+ var deserializeAws_restJson1RequestEntityTooLargeExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
808
+ var contents, data, exception;
809
+ return __generator(this, function (_a) {
810
+ contents = map({});
811
+ data = parsedOutput.body;
812
+ if (data.message != null) {
813
+ contents.message = __expectString(data.message);
814
+ }
815
+ exception = new RequestEntityTooLargeException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
816
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
817
+ });
818
+ }); };
819
+ var deserializeAws_restJson1ResourceNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
820
+ var contents, data, exception;
821
+ return __generator(this, function (_a) {
822
+ contents = map({});
823
+ data = parsedOutput.body;
824
+ if (data.message != null) {
825
+ contents.message = __expectString(data.message);
826
+ }
827
+ exception = new ResourceNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
828
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
829
+ });
830
+ }); };
831
+ var deserializeAws_restJson1ServiceUnavailableExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
832
+ var contents, data, exception;
833
+ return __generator(this, function (_a) {
834
+ contents = map({});
835
+ data = parsedOutput.body;
836
+ if (data.message != null) {
837
+ contents.message = __expectString(data.message);
838
+ }
839
+ exception = new ServiceUnavailableException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
840
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
841
+ });
842
+ }); };
843
+ var deserializeAws_restJson1ThrottlingExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
844
+ var contents, data, exception;
845
+ return __generator(this, function (_a) {
846
+ contents = map({});
847
+ data = parsedOutput.body;
848
+ if (data.message != null) {
849
+ contents.message = __expectString(data.message);
850
+ }
851
+ exception = new ThrottlingException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
852
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
853
+ });
854
+ }); };
855
+ var deserializeAws_restJson1UnauthorizedExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
856
+ var contents, data, exception;
857
+ return __generator(this, function (_a) {
858
+ contents = map({});
859
+ data = parsedOutput.body;
860
+ if (data.message != null) {
861
+ contents.message = __expectString(data.message);
862
+ }
863
+ exception = new UnauthorizedException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
864
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
865
+ });
866
+ }); };
867
+ var deserializeAws_restJson1UnsupportedDocumentEncodingExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
868
+ var contents, data, exception;
869
+ return __generator(this, function (_a) {
870
+ contents = map({});
871
+ data = parsedOutput.body;
872
+ if (data.message != null) {
873
+ contents.message = __expectString(data.message);
874
+ }
875
+ exception = new UnsupportedDocumentEncodingException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
876
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
877
+ });
878
+ }); };
879
+ var deserializeAws_restJson1NamedShadowList = function (output, context) {
880
+ var retVal = (output || [])
881
+ .filter(function (e) { return e != null; })
882
+ .map(function (entry) {
645
883
  if (entry === null) {
646
884
  return null;
647
885
  }
@@ -649,10 +887,10 @@ const deserializeAws_restJson1NamedShadowList = (output, context) => {
649
887
  });
650
888
  return retVal;
651
889
  };
652
- const deserializeAws_restJson1RetainedMessageList = (output, context) => {
653
- const retVal = (output || [])
654
- .filter((e) => e != null)
655
- .map((entry) => {
890
+ var deserializeAws_restJson1RetainedMessageList = function (output, context) {
891
+ var retVal = (output || [])
892
+ .filter(function (e) { return e != null; })
893
+ .map(function (entry) {
656
894
  if (entry === null) {
657
895
  return null;
658
896
  }
@@ -660,7 +898,7 @@ const deserializeAws_restJson1RetainedMessageList = (output, context) => {
660
898
  });
661
899
  return retVal;
662
900
  };
663
- const deserializeAws_restJson1RetainedMessageSummary = (output, context) => {
901
+ var deserializeAws_restJson1RetainedMessageSummary = function (output, context) {
664
902
  return {
665
903
  lastModifiedTime: __expectLong(output.lastModifiedTime),
666
904
  payloadSize: __expectLong(output.payloadSize),
@@ -668,39 +906,57 @@ const deserializeAws_restJson1RetainedMessageSummary = (output, context) => {
668
906
  topic: __expectString(output.topic),
669
907
  };
670
908
  };
671
- const deserializeMetadata = (output) => ({
672
- httpStatusCode: output.statusCode,
673
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
674
- extendedRequestId: output.headers["x-amz-id-2"],
675
- cfId: output.headers["x-amz-cf-id"],
676
- });
677
- const collectBody = (streamBody = new Uint8Array(), context) => {
909
+ var deserializeMetadata = function (output) {
910
+ var _a, _b;
911
+ return ({
912
+ httpStatusCode: output.statusCode,
913
+ 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"],
914
+ extendedRequestId: output.headers["x-amz-id-2"],
915
+ cfId: output.headers["x-amz-cf-id"],
916
+ });
917
+ };
918
+ var collectBody = function (streamBody, context) {
919
+ if (streamBody === void 0) { streamBody = new Uint8Array(); }
678
920
  if (streamBody instanceof Uint8Array) {
679
921
  return Promise.resolve(streamBody);
680
922
  }
681
923
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
682
924
  };
683
- const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
684
- const isSerializableHeaderValue = (value) => value !== undefined &&
685
- value !== null &&
686
- value !== "" &&
687
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
688
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
689
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
690
- if (encoded.length) {
691
- return JSON.parse(encoded);
692
- }
693
- return {};
694
- });
695
- const parseErrorBody = async (errorBody, context) => {
696
- const value = await parseBody(errorBody, context);
697
- value.message = value.message ?? value.Message;
698
- return value;
925
+ var collectBodyString = function (streamBody, context) {
926
+ return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
927
+ };
928
+ var isSerializableHeaderValue = function (value) {
929
+ return value !== undefined &&
930
+ value !== null &&
931
+ value !== "" &&
932
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
933
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
699
934
  };
700
- const loadRestJsonErrorCode = (output, data) => {
701
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
702
- const sanitizeErrorCode = (rawValue) => {
703
- let cleanValue = rawValue;
935
+ var parseBody = function (streamBody, context) {
936
+ return collectBodyString(streamBody, context).then(function (encoded) {
937
+ if (encoded.length) {
938
+ return JSON.parse(encoded);
939
+ }
940
+ return {};
941
+ });
942
+ };
943
+ var parseErrorBody = function (errorBody, context) { return __awaiter(void 0, void 0, void 0, function () {
944
+ var value;
945
+ var _a;
946
+ return __generator(this, function (_b) {
947
+ switch (_b.label) {
948
+ case 0: return [4, parseBody(errorBody, context)];
949
+ case 1:
950
+ value = _b.sent();
951
+ value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
952
+ return [2, value];
953
+ }
954
+ });
955
+ }); };
956
+ var loadRestJsonErrorCode = function (output, data) {
957
+ var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
958
+ var sanitizeErrorCode = function (rawValue) {
959
+ var cleanValue = rawValue;
704
960
  if (typeof cleanValue === "number") {
705
961
  cleanValue = cleanValue.toString();
706
962
  }
@@ -715,7 +971,7 @@ const loadRestJsonErrorCode = (output, data) => {
715
971
  }
716
972
  return cleanValue;
717
973
  };
718
- const headerKey = findKey(output.headers, "x-amzn-errortype");
974
+ var headerKey = findKey(output.headers, "x-amzn-errortype");
719
975
  if (headerKey !== undefined) {
720
976
  return sanitizeErrorCode(output.headers[headerKey]);
721
977
  }