@aws-sdk/client-iot-data-plane 3.490.0 → 3.495.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.
- package/dist-cjs/IoTDataPlane.js +1 -25
- package/dist-cjs/IoTDataPlaneClient.js +1 -43
- package/dist-cjs/commands/DeleteThingShadowCommand.js +1 -28
- package/dist-cjs/commands/GetRetainedMessageCommand.js +1 -28
- package/dist-cjs/commands/GetThingShadowCommand.js +1 -28
- package/dist-cjs/commands/ListNamedShadowsForThingCommand.js +1 -28
- package/dist-cjs/commands/ListRetainedMessagesCommand.js +1 -28
- package/dist-cjs/commands/PublishCommand.js +1 -28
- package/dist-cjs/commands/UpdateThingShadowCommand.js +1 -28
- package/dist-cjs/commands/index.js +1 -10
- package/dist-cjs/endpoint/EndpointParameters.js +1 -18
- package/dist-cjs/extensionConfiguration.js +1 -2
- package/dist-cjs/index.js +1152 -11
- package/dist-cjs/models/IoTDataPlaneServiceException.js +1 -12
- package/dist-cjs/models/index.js +1 -4
- package/dist-cjs/models/models_0.js +1 -138
- package/dist-cjs/pagination/Interfaces.js +1 -2
- package/dist-cjs/pagination/ListRetainedMessagesPaginator.js +1 -7
- package/dist-cjs/pagination/index.js +1 -5
- package/dist-cjs/protocols/Aws_restJson1.js +1 -676
- package/dist-cjs/runtimeExtensions.js +1 -22
- package/package.json +41 -41
|
@@ -1,676 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.de_UpdateThingShadowCommand = exports.de_PublishCommand = exports.de_ListRetainedMessagesCommand = exports.de_ListNamedShadowsForThingCommand = exports.de_GetThingShadowCommand = exports.de_GetRetainedMessageCommand = exports.de_DeleteThingShadowCommand = exports.se_UpdateThingShadowCommand = exports.se_PublishCommand = exports.se_ListRetainedMessagesCommand = exports.se_ListNamedShadowsForThingCommand = exports.se_GetThingShadowCommand = exports.se_GetRetainedMessageCommand = exports.se_DeleteThingShadowCommand = void 0;
|
|
4
|
-
const core_1 = require("@smithy/core");
|
|
5
|
-
const smithy_client_1 = require("@smithy/smithy-client");
|
|
6
|
-
const IoTDataPlaneServiceException_1 = require("../models/IoTDataPlaneServiceException");
|
|
7
|
-
const models_0_1 = require("../models/models_0");
|
|
8
|
-
const se_DeleteThingShadowCommand = async (input, context) => {
|
|
9
|
-
const b = (0, core_1.requestBuilder)(input, context);
|
|
10
|
-
const headers = {};
|
|
11
|
-
b.bp("/things/{thingName}/shadow");
|
|
12
|
-
b.p("thingName", () => input.thingName, "{thingName}", false);
|
|
13
|
-
const query = (0, smithy_client_1.map)({
|
|
14
|
-
[_n]: [, input[_sN]],
|
|
15
|
-
});
|
|
16
|
-
let body;
|
|
17
|
-
b.m("DELETE").h(headers).q(query).b(body);
|
|
18
|
-
return b.build();
|
|
19
|
-
};
|
|
20
|
-
exports.se_DeleteThingShadowCommand = se_DeleteThingShadowCommand;
|
|
21
|
-
const se_GetRetainedMessageCommand = async (input, context) => {
|
|
22
|
-
const b = (0, core_1.requestBuilder)(input, context);
|
|
23
|
-
const headers = {};
|
|
24
|
-
b.bp("/retainedMessage/{topic}");
|
|
25
|
-
b.p("topic", () => input.topic, "{topic}", false);
|
|
26
|
-
let body;
|
|
27
|
-
b.m("GET").h(headers).b(body);
|
|
28
|
-
return b.build();
|
|
29
|
-
};
|
|
30
|
-
exports.se_GetRetainedMessageCommand = se_GetRetainedMessageCommand;
|
|
31
|
-
const se_GetThingShadowCommand = async (input, context) => {
|
|
32
|
-
const b = (0, core_1.requestBuilder)(input, context);
|
|
33
|
-
const headers = {};
|
|
34
|
-
b.bp("/things/{thingName}/shadow");
|
|
35
|
-
b.p("thingName", () => input.thingName, "{thingName}", false);
|
|
36
|
-
const query = (0, smithy_client_1.map)({
|
|
37
|
-
[_n]: [, input[_sN]],
|
|
38
|
-
});
|
|
39
|
-
let body;
|
|
40
|
-
b.m("GET").h(headers).q(query).b(body);
|
|
41
|
-
return b.build();
|
|
42
|
-
};
|
|
43
|
-
exports.se_GetThingShadowCommand = se_GetThingShadowCommand;
|
|
44
|
-
const se_ListNamedShadowsForThingCommand = async (input, context) => {
|
|
45
|
-
const b = (0, core_1.requestBuilder)(input, context);
|
|
46
|
-
const headers = {};
|
|
47
|
-
b.bp("/api/things/shadow/ListNamedShadowsForThing/{thingName}");
|
|
48
|
-
b.p("thingName", () => input.thingName, "{thingName}", false);
|
|
49
|
-
const query = (0, smithy_client_1.map)({
|
|
50
|
-
[_nT]: [, input[_nT]],
|
|
51
|
-
[_pS]: [() => input.pageSize !== void 0, () => input[_pS].toString()],
|
|
52
|
-
});
|
|
53
|
-
let body;
|
|
54
|
-
b.m("GET").h(headers).q(query).b(body);
|
|
55
|
-
return b.build();
|
|
56
|
-
};
|
|
57
|
-
exports.se_ListNamedShadowsForThingCommand = se_ListNamedShadowsForThingCommand;
|
|
58
|
-
const se_ListRetainedMessagesCommand = async (input, context) => {
|
|
59
|
-
const b = (0, core_1.requestBuilder)(input, context);
|
|
60
|
-
const headers = {};
|
|
61
|
-
b.bp("/retainedMessage");
|
|
62
|
-
const query = (0, smithy_client_1.map)({
|
|
63
|
-
[_nT]: [, input[_nT]],
|
|
64
|
-
[_mR]: [() => input.maxResults !== void 0, () => input[_mR].toString()],
|
|
65
|
-
});
|
|
66
|
-
let body;
|
|
67
|
-
b.m("GET").h(headers).q(query).b(body);
|
|
68
|
-
return b.build();
|
|
69
|
-
};
|
|
70
|
-
exports.se_ListRetainedMessagesCommand = se_ListRetainedMessagesCommand;
|
|
71
|
-
const se_PublishCommand = async (input, context) => {
|
|
72
|
-
const b = (0, core_1.requestBuilder)(input, context);
|
|
73
|
-
const headers = (0, smithy_client_1.map)({}, isSerializableHeaderValue, {
|
|
74
|
-
"content-type": "application/octet-stream",
|
|
75
|
-
[_xamup]: [
|
|
76
|
-
() => isSerializableHeaderValue(input[_uP]),
|
|
77
|
-
() => context.base64Encoder(Buffer.from(smithy_client_1.LazyJsonString.fromObject(input[_uP]))),
|
|
78
|
-
],
|
|
79
|
-
[_xampfi]: input[_pFI],
|
|
80
|
-
[_xamcd]: input[_cD],
|
|
81
|
-
});
|
|
82
|
-
b.bp("/topics/{topic}");
|
|
83
|
-
b.p("topic", () => input.topic, "{topic}", false);
|
|
84
|
-
const query = (0, smithy_client_1.map)({
|
|
85
|
-
[_q]: [() => input.qos !== void 0, () => input[_q].toString()],
|
|
86
|
-
[_r]: [() => input.retain !== void 0, () => input[_r].toString()],
|
|
87
|
-
[_cT]: [, input[_cT]],
|
|
88
|
-
[_rT]: [, input[_rT]],
|
|
89
|
-
[_mE]: [() => input.messageExpiry !== void 0, () => input[_mE].toString()],
|
|
90
|
-
});
|
|
91
|
-
let body;
|
|
92
|
-
if (input.payload !== undefined) {
|
|
93
|
-
body = input.payload;
|
|
94
|
-
}
|
|
95
|
-
b.m("POST").h(headers).q(query).b(body);
|
|
96
|
-
return b.build();
|
|
97
|
-
};
|
|
98
|
-
exports.se_PublishCommand = se_PublishCommand;
|
|
99
|
-
const se_UpdateThingShadowCommand = async (input, context) => {
|
|
100
|
-
const b = (0, core_1.requestBuilder)(input, context);
|
|
101
|
-
const headers = {
|
|
102
|
-
"content-type": "application/octet-stream",
|
|
103
|
-
};
|
|
104
|
-
b.bp("/things/{thingName}/shadow");
|
|
105
|
-
b.p("thingName", () => input.thingName, "{thingName}", false);
|
|
106
|
-
const query = (0, smithy_client_1.map)({
|
|
107
|
-
[_n]: [, input[_sN]],
|
|
108
|
-
});
|
|
109
|
-
let body;
|
|
110
|
-
if (input.payload !== undefined) {
|
|
111
|
-
body = input.payload;
|
|
112
|
-
}
|
|
113
|
-
b.m("POST").h(headers).q(query).b(body);
|
|
114
|
-
return b.build();
|
|
115
|
-
};
|
|
116
|
-
exports.se_UpdateThingShadowCommand = se_UpdateThingShadowCommand;
|
|
117
|
-
const de_DeleteThingShadowCommand = async (output, context) => {
|
|
118
|
-
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
119
|
-
return de_DeleteThingShadowCommandError(output, context);
|
|
120
|
-
}
|
|
121
|
-
const contents = (0, smithy_client_1.map)({
|
|
122
|
-
$metadata: deserializeMetadata(output),
|
|
123
|
-
});
|
|
124
|
-
const data = await (0, smithy_client_1.collectBody)(output.body, context);
|
|
125
|
-
contents.payload = data;
|
|
126
|
-
return contents;
|
|
127
|
-
};
|
|
128
|
-
exports.de_DeleteThingShadowCommand = de_DeleteThingShadowCommand;
|
|
129
|
-
const de_DeleteThingShadowCommandError = async (output, context) => {
|
|
130
|
-
const parsedOutput = {
|
|
131
|
-
...output,
|
|
132
|
-
body: await parseErrorBody(output.body, context),
|
|
133
|
-
};
|
|
134
|
-
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
135
|
-
switch (errorCode) {
|
|
136
|
-
case "InternalFailureException":
|
|
137
|
-
case "com.amazonaws.iotdataplane#InternalFailureException":
|
|
138
|
-
throw await de_InternalFailureExceptionRes(parsedOutput, context);
|
|
139
|
-
case "InvalidRequestException":
|
|
140
|
-
case "com.amazonaws.iotdataplane#InvalidRequestException":
|
|
141
|
-
throw await de_InvalidRequestExceptionRes(parsedOutput, context);
|
|
142
|
-
case "MethodNotAllowedException":
|
|
143
|
-
case "com.amazonaws.iotdataplane#MethodNotAllowedException":
|
|
144
|
-
throw await de_MethodNotAllowedExceptionRes(parsedOutput, context);
|
|
145
|
-
case "ResourceNotFoundException":
|
|
146
|
-
case "com.amazonaws.iotdataplane#ResourceNotFoundException":
|
|
147
|
-
throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
|
|
148
|
-
case "ServiceUnavailableException":
|
|
149
|
-
case "com.amazonaws.iotdataplane#ServiceUnavailableException":
|
|
150
|
-
throw await de_ServiceUnavailableExceptionRes(parsedOutput, context);
|
|
151
|
-
case "ThrottlingException":
|
|
152
|
-
case "com.amazonaws.iotdataplane#ThrottlingException":
|
|
153
|
-
throw await de_ThrottlingExceptionRes(parsedOutput, context);
|
|
154
|
-
case "UnauthorizedException":
|
|
155
|
-
case "com.amazonaws.iotdataplane#UnauthorizedException":
|
|
156
|
-
throw await de_UnauthorizedExceptionRes(parsedOutput, context);
|
|
157
|
-
case "UnsupportedDocumentEncodingException":
|
|
158
|
-
case "com.amazonaws.iotdataplane#UnsupportedDocumentEncodingException":
|
|
159
|
-
throw await de_UnsupportedDocumentEncodingExceptionRes(parsedOutput, context);
|
|
160
|
-
default:
|
|
161
|
-
const parsedBody = parsedOutput.body;
|
|
162
|
-
return throwDefaultError({
|
|
163
|
-
output,
|
|
164
|
-
parsedBody,
|
|
165
|
-
errorCode,
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
};
|
|
169
|
-
const de_GetRetainedMessageCommand = async (output, context) => {
|
|
170
|
-
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
171
|
-
return de_GetRetainedMessageCommandError(output, context);
|
|
172
|
-
}
|
|
173
|
-
const contents = (0, smithy_client_1.map)({
|
|
174
|
-
$metadata: deserializeMetadata(output),
|
|
175
|
-
});
|
|
176
|
-
const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
|
|
177
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
178
|
-
lastModifiedTime: smithy_client_1.expectLong,
|
|
179
|
-
payload: context.base64Decoder,
|
|
180
|
-
qos: smithy_client_1.expectInt32,
|
|
181
|
-
topic: smithy_client_1.expectString,
|
|
182
|
-
userProperties: context.base64Decoder,
|
|
183
|
-
});
|
|
184
|
-
Object.assign(contents, doc);
|
|
185
|
-
return contents;
|
|
186
|
-
};
|
|
187
|
-
exports.de_GetRetainedMessageCommand = de_GetRetainedMessageCommand;
|
|
188
|
-
const de_GetRetainedMessageCommandError = async (output, context) => {
|
|
189
|
-
const parsedOutput = {
|
|
190
|
-
...output,
|
|
191
|
-
body: await parseErrorBody(output.body, context),
|
|
192
|
-
};
|
|
193
|
-
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
194
|
-
switch (errorCode) {
|
|
195
|
-
case "InternalFailureException":
|
|
196
|
-
case "com.amazonaws.iotdataplane#InternalFailureException":
|
|
197
|
-
throw await de_InternalFailureExceptionRes(parsedOutput, context);
|
|
198
|
-
case "InvalidRequestException":
|
|
199
|
-
case "com.amazonaws.iotdataplane#InvalidRequestException":
|
|
200
|
-
throw await de_InvalidRequestExceptionRes(parsedOutput, context);
|
|
201
|
-
case "MethodNotAllowedException":
|
|
202
|
-
case "com.amazonaws.iotdataplane#MethodNotAllowedException":
|
|
203
|
-
throw await de_MethodNotAllowedExceptionRes(parsedOutput, context);
|
|
204
|
-
case "ResourceNotFoundException":
|
|
205
|
-
case "com.amazonaws.iotdataplane#ResourceNotFoundException":
|
|
206
|
-
throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
|
|
207
|
-
case "ServiceUnavailableException":
|
|
208
|
-
case "com.amazonaws.iotdataplane#ServiceUnavailableException":
|
|
209
|
-
throw await de_ServiceUnavailableExceptionRes(parsedOutput, context);
|
|
210
|
-
case "ThrottlingException":
|
|
211
|
-
case "com.amazonaws.iotdataplane#ThrottlingException":
|
|
212
|
-
throw await de_ThrottlingExceptionRes(parsedOutput, context);
|
|
213
|
-
case "UnauthorizedException":
|
|
214
|
-
case "com.amazonaws.iotdataplane#UnauthorizedException":
|
|
215
|
-
throw await de_UnauthorizedExceptionRes(parsedOutput, context);
|
|
216
|
-
default:
|
|
217
|
-
const parsedBody = parsedOutput.body;
|
|
218
|
-
return throwDefaultError({
|
|
219
|
-
output,
|
|
220
|
-
parsedBody,
|
|
221
|
-
errorCode,
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
};
|
|
225
|
-
const de_GetThingShadowCommand = async (output, context) => {
|
|
226
|
-
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
227
|
-
return de_GetThingShadowCommandError(output, context);
|
|
228
|
-
}
|
|
229
|
-
const contents = (0, smithy_client_1.map)({
|
|
230
|
-
$metadata: deserializeMetadata(output),
|
|
231
|
-
});
|
|
232
|
-
const data = await (0, smithy_client_1.collectBody)(output.body, context);
|
|
233
|
-
contents.payload = data;
|
|
234
|
-
return contents;
|
|
235
|
-
};
|
|
236
|
-
exports.de_GetThingShadowCommand = de_GetThingShadowCommand;
|
|
237
|
-
const de_GetThingShadowCommandError = async (output, context) => {
|
|
238
|
-
const parsedOutput = {
|
|
239
|
-
...output,
|
|
240
|
-
body: await parseErrorBody(output.body, context),
|
|
241
|
-
};
|
|
242
|
-
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
243
|
-
switch (errorCode) {
|
|
244
|
-
case "InternalFailureException":
|
|
245
|
-
case "com.amazonaws.iotdataplane#InternalFailureException":
|
|
246
|
-
throw await de_InternalFailureExceptionRes(parsedOutput, context);
|
|
247
|
-
case "InvalidRequestException":
|
|
248
|
-
case "com.amazonaws.iotdataplane#InvalidRequestException":
|
|
249
|
-
throw await de_InvalidRequestExceptionRes(parsedOutput, context);
|
|
250
|
-
case "MethodNotAllowedException":
|
|
251
|
-
case "com.amazonaws.iotdataplane#MethodNotAllowedException":
|
|
252
|
-
throw await de_MethodNotAllowedExceptionRes(parsedOutput, context);
|
|
253
|
-
case "ResourceNotFoundException":
|
|
254
|
-
case "com.amazonaws.iotdataplane#ResourceNotFoundException":
|
|
255
|
-
throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
|
|
256
|
-
case "ServiceUnavailableException":
|
|
257
|
-
case "com.amazonaws.iotdataplane#ServiceUnavailableException":
|
|
258
|
-
throw await de_ServiceUnavailableExceptionRes(parsedOutput, context);
|
|
259
|
-
case "ThrottlingException":
|
|
260
|
-
case "com.amazonaws.iotdataplane#ThrottlingException":
|
|
261
|
-
throw await de_ThrottlingExceptionRes(parsedOutput, context);
|
|
262
|
-
case "UnauthorizedException":
|
|
263
|
-
case "com.amazonaws.iotdataplane#UnauthorizedException":
|
|
264
|
-
throw await de_UnauthorizedExceptionRes(parsedOutput, context);
|
|
265
|
-
case "UnsupportedDocumentEncodingException":
|
|
266
|
-
case "com.amazonaws.iotdataplane#UnsupportedDocumentEncodingException":
|
|
267
|
-
throw await de_UnsupportedDocumentEncodingExceptionRes(parsedOutput, context);
|
|
268
|
-
default:
|
|
269
|
-
const parsedBody = parsedOutput.body;
|
|
270
|
-
return throwDefaultError({
|
|
271
|
-
output,
|
|
272
|
-
parsedBody,
|
|
273
|
-
errorCode,
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
const de_ListNamedShadowsForThingCommand = async (output, context) => {
|
|
278
|
-
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
279
|
-
return de_ListNamedShadowsForThingCommandError(output, context);
|
|
280
|
-
}
|
|
281
|
-
const contents = (0, smithy_client_1.map)({
|
|
282
|
-
$metadata: deserializeMetadata(output),
|
|
283
|
-
});
|
|
284
|
-
const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
|
|
285
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
286
|
-
nextToken: smithy_client_1.expectString,
|
|
287
|
-
results: smithy_client_1._json,
|
|
288
|
-
timestamp: smithy_client_1.expectLong,
|
|
289
|
-
});
|
|
290
|
-
Object.assign(contents, doc);
|
|
291
|
-
return contents;
|
|
292
|
-
};
|
|
293
|
-
exports.de_ListNamedShadowsForThingCommand = de_ListNamedShadowsForThingCommand;
|
|
294
|
-
const de_ListNamedShadowsForThingCommandError = async (output, context) => {
|
|
295
|
-
const parsedOutput = {
|
|
296
|
-
...output,
|
|
297
|
-
body: await parseErrorBody(output.body, context),
|
|
298
|
-
};
|
|
299
|
-
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
300
|
-
switch (errorCode) {
|
|
301
|
-
case "InternalFailureException":
|
|
302
|
-
case "com.amazonaws.iotdataplane#InternalFailureException":
|
|
303
|
-
throw await de_InternalFailureExceptionRes(parsedOutput, context);
|
|
304
|
-
case "InvalidRequestException":
|
|
305
|
-
case "com.amazonaws.iotdataplane#InvalidRequestException":
|
|
306
|
-
throw await de_InvalidRequestExceptionRes(parsedOutput, context);
|
|
307
|
-
case "MethodNotAllowedException":
|
|
308
|
-
case "com.amazonaws.iotdataplane#MethodNotAllowedException":
|
|
309
|
-
throw await de_MethodNotAllowedExceptionRes(parsedOutput, context);
|
|
310
|
-
case "ResourceNotFoundException":
|
|
311
|
-
case "com.amazonaws.iotdataplane#ResourceNotFoundException":
|
|
312
|
-
throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
|
|
313
|
-
case "ServiceUnavailableException":
|
|
314
|
-
case "com.amazonaws.iotdataplane#ServiceUnavailableException":
|
|
315
|
-
throw await de_ServiceUnavailableExceptionRes(parsedOutput, context);
|
|
316
|
-
case "ThrottlingException":
|
|
317
|
-
case "com.amazonaws.iotdataplane#ThrottlingException":
|
|
318
|
-
throw await de_ThrottlingExceptionRes(parsedOutput, context);
|
|
319
|
-
case "UnauthorizedException":
|
|
320
|
-
case "com.amazonaws.iotdataplane#UnauthorizedException":
|
|
321
|
-
throw await de_UnauthorizedExceptionRes(parsedOutput, context);
|
|
322
|
-
default:
|
|
323
|
-
const parsedBody = parsedOutput.body;
|
|
324
|
-
return throwDefaultError({
|
|
325
|
-
output,
|
|
326
|
-
parsedBody,
|
|
327
|
-
errorCode,
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
};
|
|
331
|
-
const de_ListRetainedMessagesCommand = async (output, context) => {
|
|
332
|
-
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
333
|
-
return de_ListRetainedMessagesCommandError(output, context);
|
|
334
|
-
}
|
|
335
|
-
const contents = (0, smithy_client_1.map)({
|
|
336
|
-
$metadata: deserializeMetadata(output),
|
|
337
|
-
});
|
|
338
|
-
const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
|
|
339
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
340
|
-
nextToken: smithy_client_1.expectString,
|
|
341
|
-
retainedTopics: smithy_client_1._json,
|
|
342
|
-
});
|
|
343
|
-
Object.assign(contents, doc);
|
|
344
|
-
return contents;
|
|
345
|
-
};
|
|
346
|
-
exports.de_ListRetainedMessagesCommand = de_ListRetainedMessagesCommand;
|
|
347
|
-
const de_ListRetainedMessagesCommandError = async (output, context) => {
|
|
348
|
-
const parsedOutput = {
|
|
349
|
-
...output,
|
|
350
|
-
body: await parseErrorBody(output.body, context),
|
|
351
|
-
};
|
|
352
|
-
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
353
|
-
switch (errorCode) {
|
|
354
|
-
case "InternalFailureException":
|
|
355
|
-
case "com.amazonaws.iotdataplane#InternalFailureException":
|
|
356
|
-
throw await de_InternalFailureExceptionRes(parsedOutput, context);
|
|
357
|
-
case "InvalidRequestException":
|
|
358
|
-
case "com.amazonaws.iotdataplane#InvalidRequestException":
|
|
359
|
-
throw await de_InvalidRequestExceptionRes(parsedOutput, context);
|
|
360
|
-
case "MethodNotAllowedException":
|
|
361
|
-
case "com.amazonaws.iotdataplane#MethodNotAllowedException":
|
|
362
|
-
throw await de_MethodNotAllowedExceptionRes(parsedOutput, context);
|
|
363
|
-
case "ServiceUnavailableException":
|
|
364
|
-
case "com.amazonaws.iotdataplane#ServiceUnavailableException":
|
|
365
|
-
throw await de_ServiceUnavailableExceptionRes(parsedOutput, context);
|
|
366
|
-
case "ThrottlingException":
|
|
367
|
-
case "com.amazonaws.iotdataplane#ThrottlingException":
|
|
368
|
-
throw await de_ThrottlingExceptionRes(parsedOutput, context);
|
|
369
|
-
case "UnauthorizedException":
|
|
370
|
-
case "com.amazonaws.iotdataplane#UnauthorizedException":
|
|
371
|
-
throw await de_UnauthorizedExceptionRes(parsedOutput, context);
|
|
372
|
-
default:
|
|
373
|
-
const parsedBody = parsedOutput.body;
|
|
374
|
-
return throwDefaultError({
|
|
375
|
-
output,
|
|
376
|
-
parsedBody,
|
|
377
|
-
errorCode,
|
|
378
|
-
});
|
|
379
|
-
}
|
|
380
|
-
};
|
|
381
|
-
const de_PublishCommand = async (output, context) => {
|
|
382
|
-
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
383
|
-
return de_PublishCommandError(output, context);
|
|
384
|
-
}
|
|
385
|
-
const contents = (0, smithy_client_1.map)({
|
|
386
|
-
$metadata: deserializeMetadata(output),
|
|
387
|
-
});
|
|
388
|
-
await (0, smithy_client_1.collectBody)(output.body, context);
|
|
389
|
-
return contents;
|
|
390
|
-
};
|
|
391
|
-
exports.de_PublishCommand = de_PublishCommand;
|
|
392
|
-
const de_PublishCommandError = async (output, context) => {
|
|
393
|
-
const parsedOutput = {
|
|
394
|
-
...output,
|
|
395
|
-
body: await parseErrorBody(output.body, context),
|
|
396
|
-
};
|
|
397
|
-
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
398
|
-
switch (errorCode) {
|
|
399
|
-
case "InternalFailureException":
|
|
400
|
-
case "com.amazonaws.iotdataplane#InternalFailureException":
|
|
401
|
-
throw await de_InternalFailureExceptionRes(parsedOutput, context);
|
|
402
|
-
case "InvalidRequestException":
|
|
403
|
-
case "com.amazonaws.iotdataplane#InvalidRequestException":
|
|
404
|
-
throw await de_InvalidRequestExceptionRes(parsedOutput, context);
|
|
405
|
-
case "MethodNotAllowedException":
|
|
406
|
-
case "com.amazonaws.iotdataplane#MethodNotAllowedException":
|
|
407
|
-
throw await de_MethodNotAllowedExceptionRes(parsedOutput, context);
|
|
408
|
-
case "ThrottlingException":
|
|
409
|
-
case "com.amazonaws.iotdataplane#ThrottlingException":
|
|
410
|
-
throw await de_ThrottlingExceptionRes(parsedOutput, context);
|
|
411
|
-
case "UnauthorizedException":
|
|
412
|
-
case "com.amazonaws.iotdataplane#UnauthorizedException":
|
|
413
|
-
throw await de_UnauthorizedExceptionRes(parsedOutput, context);
|
|
414
|
-
default:
|
|
415
|
-
const parsedBody = parsedOutput.body;
|
|
416
|
-
return throwDefaultError({
|
|
417
|
-
output,
|
|
418
|
-
parsedBody,
|
|
419
|
-
errorCode,
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
};
|
|
423
|
-
const de_UpdateThingShadowCommand = async (output, context) => {
|
|
424
|
-
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
425
|
-
return de_UpdateThingShadowCommandError(output, context);
|
|
426
|
-
}
|
|
427
|
-
const contents = (0, smithy_client_1.map)({
|
|
428
|
-
$metadata: deserializeMetadata(output),
|
|
429
|
-
});
|
|
430
|
-
const data = await (0, smithy_client_1.collectBody)(output.body, context);
|
|
431
|
-
contents.payload = data;
|
|
432
|
-
return contents;
|
|
433
|
-
};
|
|
434
|
-
exports.de_UpdateThingShadowCommand = de_UpdateThingShadowCommand;
|
|
435
|
-
const de_UpdateThingShadowCommandError = async (output, context) => {
|
|
436
|
-
const parsedOutput = {
|
|
437
|
-
...output,
|
|
438
|
-
body: await parseErrorBody(output.body, context),
|
|
439
|
-
};
|
|
440
|
-
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
441
|
-
switch (errorCode) {
|
|
442
|
-
case "ConflictException":
|
|
443
|
-
case "com.amazonaws.iotdataplane#ConflictException":
|
|
444
|
-
throw await de_ConflictExceptionRes(parsedOutput, context);
|
|
445
|
-
case "InternalFailureException":
|
|
446
|
-
case "com.amazonaws.iotdataplane#InternalFailureException":
|
|
447
|
-
throw await de_InternalFailureExceptionRes(parsedOutput, context);
|
|
448
|
-
case "InvalidRequestException":
|
|
449
|
-
case "com.amazonaws.iotdataplane#InvalidRequestException":
|
|
450
|
-
throw await de_InvalidRequestExceptionRes(parsedOutput, context);
|
|
451
|
-
case "MethodNotAllowedException":
|
|
452
|
-
case "com.amazonaws.iotdataplane#MethodNotAllowedException":
|
|
453
|
-
throw await de_MethodNotAllowedExceptionRes(parsedOutput, context);
|
|
454
|
-
case "RequestEntityTooLargeException":
|
|
455
|
-
case "com.amazonaws.iotdataplane#RequestEntityTooLargeException":
|
|
456
|
-
throw await de_RequestEntityTooLargeExceptionRes(parsedOutput, context);
|
|
457
|
-
case "ServiceUnavailableException":
|
|
458
|
-
case "com.amazonaws.iotdataplane#ServiceUnavailableException":
|
|
459
|
-
throw await de_ServiceUnavailableExceptionRes(parsedOutput, context);
|
|
460
|
-
case "ThrottlingException":
|
|
461
|
-
case "com.amazonaws.iotdataplane#ThrottlingException":
|
|
462
|
-
throw await de_ThrottlingExceptionRes(parsedOutput, context);
|
|
463
|
-
case "UnauthorizedException":
|
|
464
|
-
case "com.amazonaws.iotdataplane#UnauthorizedException":
|
|
465
|
-
throw await de_UnauthorizedExceptionRes(parsedOutput, context);
|
|
466
|
-
case "UnsupportedDocumentEncodingException":
|
|
467
|
-
case "com.amazonaws.iotdataplane#UnsupportedDocumentEncodingException":
|
|
468
|
-
throw await de_UnsupportedDocumentEncodingExceptionRes(parsedOutput, context);
|
|
469
|
-
default:
|
|
470
|
-
const parsedBody = parsedOutput.body;
|
|
471
|
-
return throwDefaultError({
|
|
472
|
-
output,
|
|
473
|
-
parsedBody,
|
|
474
|
-
errorCode,
|
|
475
|
-
});
|
|
476
|
-
}
|
|
477
|
-
};
|
|
478
|
-
const throwDefaultError = (0, smithy_client_1.withBaseException)(IoTDataPlaneServiceException_1.IoTDataPlaneServiceException);
|
|
479
|
-
const de_ConflictExceptionRes = async (parsedOutput, context) => {
|
|
480
|
-
const contents = (0, smithy_client_1.map)({});
|
|
481
|
-
const data = parsedOutput.body;
|
|
482
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
483
|
-
message: smithy_client_1.expectString,
|
|
484
|
-
});
|
|
485
|
-
Object.assign(contents, doc);
|
|
486
|
-
const exception = new models_0_1.ConflictException({
|
|
487
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
488
|
-
...contents,
|
|
489
|
-
});
|
|
490
|
-
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
491
|
-
};
|
|
492
|
-
const de_InternalFailureExceptionRes = async (parsedOutput, context) => {
|
|
493
|
-
const contents = (0, smithy_client_1.map)({});
|
|
494
|
-
const data = parsedOutput.body;
|
|
495
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
496
|
-
message: smithy_client_1.expectString,
|
|
497
|
-
});
|
|
498
|
-
Object.assign(contents, doc);
|
|
499
|
-
const exception = new models_0_1.InternalFailureException({
|
|
500
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
501
|
-
...contents,
|
|
502
|
-
});
|
|
503
|
-
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
504
|
-
};
|
|
505
|
-
const de_InvalidRequestExceptionRes = async (parsedOutput, context) => {
|
|
506
|
-
const contents = (0, smithy_client_1.map)({});
|
|
507
|
-
const data = parsedOutput.body;
|
|
508
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
509
|
-
message: smithy_client_1.expectString,
|
|
510
|
-
});
|
|
511
|
-
Object.assign(contents, doc);
|
|
512
|
-
const exception = new models_0_1.InvalidRequestException({
|
|
513
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
514
|
-
...contents,
|
|
515
|
-
});
|
|
516
|
-
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
517
|
-
};
|
|
518
|
-
const de_MethodNotAllowedExceptionRes = async (parsedOutput, context) => {
|
|
519
|
-
const contents = (0, smithy_client_1.map)({});
|
|
520
|
-
const data = parsedOutput.body;
|
|
521
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
522
|
-
message: smithy_client_1.expectString,
|
|
523
|
-
});
|
|
524
|
-
Object.assign(contents, doc);
|
|
525
|
-
const exception = new models_0_1.MethodNotAllowedException({
|
|
526
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
527
|
-
...contents,
|
|
528
|
-
});
|
|
529
|
-
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
530
|
-
};
|
|
531
|
-
const de_RequestEntityTooLargeExceptionRes = async (parsedOutput, context) => {
|
|
532
|
-
const contents = (0, smithy_client_1.map)({});
|
|
533
|
-
const data = parsedOutput.body;
|
|
534
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
535
|
-
message: smithy_client_1.expectString,
|
|
536
|
-
});
|
|
537
|
-
Object.assign(contents, doc);
|
|
538
|
-
const exception = new models_0_1.RequestEntityTooLargeException({
|
|
539
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
540
|
-
...contents,
|
|
541
|
-
});
|
|
542
|
-
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
543
|
-
};
|
|
544
|
-
const de_ResourceNotFoundExceptionRes = async (parsedOutput, context) => {
|
|
545
|
-
const contents = (0, smithy_client_1.map)({});
|
|
546
|
-
const data = parsedOutput.body;
|
|
547
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
548
|
-
message: smithy_client_1.expectString,
|
|
549
|
-
});
|
|
550
|
-
Object.assign(contents, doc);
|
|
551
|
-
const exception = new models_0_1.ResourceNotFoundException({
|
|
552
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
553
|
-
...contents,
|
|
554
|
-
});
|
|
555
|
-
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
556
|
-
};
|
|
557
|
-
const de_ServiceUnavailableExceptionRes = async (parsedOutput, context) => {
|
|
558
|
-
const contents = (0, smithy_client_1.map)({});
|
|
559
|
-
const data = parsedOutput.body;
|
|
560
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
561
|
-
message: smithy_client_1.expectString,
|
|
562
|
-
});
|
|
563
|
-
Object.assign(contents, doc);
|
|
564
|
-
const exception = new models_0_1.ServiceUnavailableException({
|
|
565
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
566
|
-
...contents,
|
|
567
|
-
});
|
|
568
|
-
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
569
|
-
};
|
|
570
|
-
const de_ThrottlingExceptionRes = async (parsedOutput, context) => {
|
|
571
|
-
const contents = (0, smithy_client_1.map)({});
|
|
572
|
-
const data = parsedOutput.body;
|
|
573
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
574
|
-
message: smithy_client_1.expectString,
|
|
575
|
-
});
|
|
576
|
-
Object.assign(contents, doc);
|
|
577
|
-
const exception = new models_0_1.ThrottlingException({
|
|
578
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
579
|
-
...contents,
|
|
580
|
-
});
|
|
581
|
-
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
582
|
-
};
|
|
583
|
-
const de_UnauthorizedExceptionRes = async (parsedOutput, context) => {
|
|
584
|
-
const contents = (0, smithy_client_1.map)({});
|
|
585
|
-
const data = parsedOutput.body;
|
|
586
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
587
|
-
message: smithy_client_1.expectString,
|
|
588
|
-
});
|
|
589
|
-
Object.assign(contents, doc);
|
|
590
|
-
const exception = new models_0_1.UnauthorizedException({
|
|
591
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
592
|
-
...contents,
|
|
593
|
-
});
|
|
594
|
-
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
595
|
-
};
|
|
596
|
-
const de_UnsupportedDocumentEncodingExceptionRes = async (parsedOutput, context) => {
|
|
597
|
-
const contents = (0, smithy_client_1.map)({});
|
|
598
|
-
const data = parsedOutput.body;
|
|
599
|
-
const doc = (0, smithy_client_1.take)(data, {
|
|
600
|
-
message: smithy_client_1.expectString,
|
|
601
|
-
});
|
|
602
|
-
Object.assign(contents, doc);
|
|
603
|
-
const exception = new models_0_1.UnsupportedDocumentEncodingException({
|
|
604
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
605
|
-
...contents,
|
|
606
|
-
});
|
|
607
|
-
return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
|
|
608
|
-
};
|
|
609
|
-
const deserializeMetadata = (output) => ({
|
|
610
|
-
httpStatusCode: output.statusCode,
|
|
611
|
-
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
|
|
612
|
-
extendedRequestId: output.headers["x-amz-id-2"],
|
|
613
|
-
cfId: output.headers["x-amz-cf-id"],
|
|
614
|
-
});
|
|
615
|
-
const collectBodyString = (streamBody, context) => (0, smithy_client_1.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body));
|
|
616
|
-
const isSerializableHeaderValue = (value) => value !== undefined &&
|
|
617
|
-
value !== null &&
|
|
618
|
-
value !== "" &&
|
|
619
|
-
(!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
|
|
620
|
-
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
|
|
621
|
-
const _cD = "correlationData";
|
|
622
|
-
const _cT = "contentType";
|
|
623
|
-
const _mE = "messageExpiry";
|
|
624
|
-
const _mR = "maxResults";
|
|
625
|
-
const _n = "name";
|
|
626
|
-
const _nT = "nextToken";
|
|
627
|
-
const _pFI = "payloadFormatIndicator";
|
|
628
|
-
const _pS = "pageSize";
|
|
629
|
-
const _q = "qos";
|
|
630
|
-
const _r = "retain";
|
|
631
|
-
const _rT = "responseTopic";
|
|
632
|
-
const _sN = "shadowName";
|
|
633
|
-
const _uP = "userProperties";
|
|
634
|
-
const _xamcd = "x-amz-mqtt5-correlation-data";
|
|
635
|
-
const _xampfi = "x-amz-mqtt5-payload-format-indicator";
|
|
636
|
-
const _xamup = "x-amz-mqtt5-user-properties";
|
|
637
|
-
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
638
|
-
if (encoded.length) {
|
|
639
|
-
return JSON.parse(encoded);
|
|
640
|
-
}
|
|
641
|
-
return {};
|
|
642
|
-
});
|
|
643
|
-
const parseErrorBody = async (errorBody, context) => {
|
|
644
|
-
const value = await parseBody(errorBody, context);
|
|
645
|
-
value.message = value.message ?? value.Message;
|
|
646
|
-
return value;
|
|
647
|
-
};
|
|
648
|
-
const loadRestJsonErrorCode = (output, data) => {
|
|
649
|
-
const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
650
|
-
const sanitizeErrorCode = (rawValue) => {
|
|
651
|
-
let cleanValue = rawValue;
|
|
652
|
-
if (typeof cleanValue === "number") {
|
|
653
|
-
cleanValue = cleanValue.toString();
|
|
654
|
-
}
|
|
655
|
-
if (cleanValue.indexOf(",") >= 0) {
|
|
656
|
-
cleanValue = cleanValue.split(",")[0];
|
|
657
|
-
}
|
|
658
|
-
if (cleanValue.indexOf(":") >= 0) {
|
|
659
|
-
cleanValue = cleanValue.split(":")[0];
|
|
660
|
-
}
|
|
661
|
-
if (cleanValue.indexOf("#") >= 0) {
|
|
662
|
-
cleanValue = cleanValue.split("#")[1];
|
|
663
|
-
}
|
|
664
|
-
return cleanValue;
|
|
665
|
-
};
|
|
666
|
-
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
667
|
-
if (headerKey !== undefined) {
|
|
668
|
-
return sanitizeErrorCode(output.headers[headerKey]);
|
|
669
|
-
}
|
|
670
|
-
if (data.code !== undefined) {
|
|
671
|
-
return sanitizeErrorCode(data.code);
|
|
672
|
-
}
|
|
673
|
-
if (data["__type"] !== undefined) {
|
|
674
|
-
return sanitizeErrorCode(data["__type"]);
|
|
675
|
-
}
|
|
676
|
-
};
|
|
1
|
+
module.exports = require("../index.js");
|