@aws-sdk/client-iot-jobs-data-plane 3.489.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/index.js CHANGED
@@ -1,11 +1,779 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.IoTJobsDataPlaneServiceException = void 0;
4
- const tslib_1 = require("tslib");
5
- tslib_1.__exportStar(require("./IoTJobsDataPlaneClient"), exports);
6
- tslib_1.__exportStar(require("./IoTJobsDataPlane"), exports);
7
- tslib_1.__exportStar(require("./commands"), exports);
8
- tslib_1.__exportStar(require("./models"), exports);
9
- require("@aws-sdk/util-endpoints");
10
- var IoTJobsDataPlaneServiceException_1 = require("./models/IoTJobsDataPlaneServiceException");
11
- Object.defineProperty(exports, "IoTJobsDataPlaneServiceException", { enumerable: true, get: function () { return IoTJobsDataPlaneServiceException_1.IoTJobsDataPlaneServiceException; } });
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/index.ts
22
+ var src_exports = {};
23
+ __export(src_exports, {
24
+ CertificateValidationException: () => CertificateValidationException,
25
+ DescribeJobExecutionCommand: () => DescribeJobExecutionCommand,
26
+ GetPendingJobExecutionsCommand: () => GetPendingJobExecutionsCommand,
27
+ InvalidRequestException: () => InvalidRequestException,
28
+ InvalidStateTransitionException: () => InvalidStateTransitionException,
29
+ IoTJobsDataPlane: () => IoTJobsDataPlane,
30
+ IoTJobsDataPlaneClient: () => IoTJobsDataPlaneClient,
31
+ IoTJobsDataPlaneServiceException: () => IoTJobsDataPlaneServiceException,
32
+ JobExecutionStatus: () => JobExecutionStatus,
33
+ ResourceNotFoundException: () => ResourceNotFoundException,
34
+ ServiceUnavailableException: () => ServiceUnavailableException,
35
+ StartNextPendingJobExecutionCommand: () => StartNextPendingJobExecutionCommand,
36
+ TerminalStateException: () => TerminalStateException,
37
+ ThrottlingException: () => ThrottlingException,
38
+ UpdateJobExecutionCommand: () => UpdateJobExecutionCommand,
39
+ __Client: () => import_smithy_client.Client
40
+ });
41
+ module.exports = __toCommonJS(src_exports);
42
+
43
+ // src/IoTJobsDataPlaneClient.ts
44
+ var import_middleware_host_header = require("@aws-sdk/middleware-host-header");
45
+ var import_middleware_logger = require("@aws-sdk/middleware-logger");
46
+ var import_middleware_recursion_detection = require("@aws-sdk/middleware-recursion-detection");
47
+ var import_middleware_signing = require("@aws-sdk/middleware-signing");
48
+ var import_middleware_user_agent = require("@aws-sdk/middleware-user-agent");
49
+ var import_config_resolver = require("@smithy/config-resolver");
50
+ var import_middleware_content_length = require("@smithy/middleware-content-length");
51
+ var import_middleware_endpoint = require("@smithy/middleware-endpoint");
52
+ var import_middleware_retry = require("@smithy/middleware-retry");
53
+
54
+
55
+ // src/endpoint/EndpointParameters.ts
56
+ var resolveClientEndpointParameters = /* @__PURE__ */ __name((options) => {
57
+ return {
58
+ ...options,
59
+ useDualstackEndpoint: options.useDualstackEndpoint ?? false,
60
+ useFipsEndpoint: options.useFipsEndpoint ?? false,
61
+ defaultSigningName: "iot-jobs-data"
62
+ };
63
+ }, "resolveClientEndpointParameters");
64
+ var commonParams = {
65
+ UseFIPS: { type: "builtInParams", name: "useFipsEndpoint" },
66
+ Endpoint: { type: "builtInParams", name: "endpoint" },
67
+ Region: { type: "builtInParams", name: "region" },
68
+ UseDualStack: { type: "builtInParams", name: "useDualstackEndpoint" }
69
+ };
70
+
71
+ // src/IoTJobsDataPlaneClient.ts
72
+ var import_runtimeConfig = require("././runtimeConfig");
73
+
74
+ // src/runtimeExtensions.ts
75
+ var import_region_config_resolver = require("@aws-sdk/region-config-resolver");
76
+ var import_protocol_http = require("@smithy/protocol-http");
77
+ var import_smithy_client = require("@smithy/smithy-client");
78
+ var asPartial = /* @__PURE__ */ __name((t) => t, "asPartial");
79
+ var resolveRuntimeExtensions = /* @__PURE__ */ __name((runtimeConfig, extensions) => {
80
+ const extensionConfiguration = {
81
+ ...asPartial((0, import_region_config_resolver.getAwsRegionExtensionConfiguration)(runtimeConfig)),
82
+ ...asPartial((0, import_smithy_client.getDefaultExtensionConfiguration)(runtimeConfig)),
83
+ ...asPartial((0, import_protocol_http.getHttpHandlerExtensionConfiguration)(runtimeConfig))
84
+ };
85
+ extensions.forEach((extension) => extension.configure(extensionConfiguration));
86
+ return {
87
+ ...runtimeConfig,
88
+ ...(0, import_region_config_resolver.resolveAwsRegionExtensionConfiguration)(extensionConfiguration),
89
+ ...(0, import_smithy_client.resolveDefaultRuntimeConfig)(extensionConfiguration),
90
+ ...(0, import_protocol_http.resolveHttpHandlerRuntimeConfig)(extensionConfiguration)
91
+ };
92
+ }, "resolveRuntimeExtensions");
93
+
94
+ // src/IoTJobsDataPlaneClient.ts
95
+ var _IoTJobsDataPlaneClient = class _IoTJobsDataPlaneClient extends import_smithy_client.Client {
96
+ constructor(...[configuration]) {
97
+ const _config_0 = (0, import_runtimeConfig.getRuntimeConfig)(configuration || {});
98
+ const _config_1 = resolveClientEndpointParameters(_config_0);
99
+ const _config_2 = (0, import_config_resolver.resolveRegionConfig)(_config_1);
100
+ const _config_3 = (0, import_middleware_endpoint.resolveEndpointConfig)(_config_2);
101
+ const _config_4 = (0, import_middleware_retry.resolveRetryConfig)(_config_3);
102
+ const _config_5 = (0, import_middleware_host_header.resolveHostHeaderConfig)(_config_4);
103
+ const _config_6 = (0, import_middleware_signing.resolveAwsAuthConfig)(_config_5);
104
+ const _config_7 = (0, import_middleware_user_agent.resolveUserAgentConfig)(_config_6);
105
+ const _config_8 = resolveRuntimeExtensions(_config_7, (configuration == null ? void 0 : configuration.extensions) || []);
106
+ super(_config_8);
107
+ this.config = _config_8;
108
+ this.middlewareStack.use((0, import_middleware_retry.getRetryPlugin)(this.config));
109
+ this.middlewareStack.use((0, import_middleware_content_length.getContentLengthPlugin)(this.config));
110
+ this.middlewareStack.use((0, import_middleware_host_header.getHostHeaderPlugin)(this.config));
111
+ this.middlewareStack.use((0, import_middleware_logger.getLoggerPlugin)(this.config));
112
+ this.middlewareStack.use((0, import_middleware_recursion_detection.getRecursionDetectionPlugin)(this.config));
113
+ this.middlewareStack.use((0, import_middleware_signing.getAwsAuthPlugin)(this.config));
114
+ this.middlewareStack.use((0, import_middleware_user_agent.getUserAgentPlugin)(this.config));
115
+ }
116
+ /**
117
+ * Destroy underlying resources, like sockets. It's usually not necessary to do this.
118
+ * However in Node.js, it's best to explicitly shut down the client's agent when it is no longer needed.
119
+ * Otherwise, sockets might stay open for quite a long time before the server terminates them.
120
+ */
121
+ destroy() {
122
+ super.destroy();
123
+ }
124
+ };
125
+ __name(_IoTJobsDataPlaneClient, "IoTJobsDataPlaneClient");
126
+ var IoTJobsDataPlaneClient = _IoTJobsDataPlaneClient;
127
+
128
+ // src/IoTJobsDataPlane.ts
129
+
130
+
131
+ // src/commands/DescribeJobExecutionCommand.ts
132
+
133
+ var import_middleware_serde = require("@smithy/middleware-serde");
134
+
135
+ var import_types = require("@smithy/types");
136
+
137
+ // src/protocols/Aws_restJson1.ts
138
+ var import_core = require("@smithy/core");
139
+
140
+
141
+ // src/models/IoTJobsDataPlaneServiceException.ts
142
+
143
+ var _IoTJobsDataPlaneServiceException = class _IoTJobsDataPlaneServiceException extends import_smithy_client.ServiceException {
144
+ /**
145
+ * @internal
146
+ */
147
+ constructor(options) {
148
+ super(options);
149
+ Object.setPrototypeOf(this, _IoTJobsDataPlaneServiceException.prototype);
150
+ }
151
+ };
152
+ __name(_IoTJobsDataPlaneServiceException, "IoTJobsDataPlaneServiceException");
153
+ var IoTJobsDataPlaneServiceException = _IoTJobsDataPlaneServiceException;
154
+
155
+ // src/models/models_0.ts
156
+ var _CertificateValidationException = class _CertificateValidationException extends IoTJobsDataPlaneServiceException {
157
+ /**
158
+ * @internal
159
+ */
160
+ constructor(opts) {
161
+ super({
162
+ name: "CertificateValidationException",
163
+ $fault: "client",
164
+ ...opts
165
+ });
166
+ this.name = "CertificateValidationException";
167
+ this.$fault = "client";
168
+ Object.setPrototypeOf(this, _CertificateValidationException.prototype);
169
+ }
170
+ };
171
+ __name(_CertificateValidationException, "CertificateValidationException");
172
+ var CertificateValidationException = _CertificateValidationException;
173
+ var JobExecutionStatus = {
174
+ CANCELED: "CANCELED",
175
+ FAILED: "FAILED",
176
+ IN_PROGRESS: "IN_PROGRESS",
177
+ QUEUED: "QUEUED",
178
+ REJECTED: "REJECTED",
179
+ REMOVED: "REMOVED",
180
+ SUCCEEDED: "SUCCEEDED",
181
+ TIMED_OUT: "TIMED_OUT"
182
+ };
183
+ var _InvalidRequestException = class _InvalidRequestException extends IoTJobsDataPlaneServiceException {
184
+ /**
185
+ * @internal
186
+ */
187
+ constructor(opts) {
188
+ super({
189
+ name: "InvalidRequestException",
190
+ $fault: "client",
191
+ ...opts
192
+ });
193
+ this.name = "InvalidRequestException";
194
+ this.$fault = "client";
195
+ Object.setPrototypeOf(this, _InvalidRequestException.prototype);
196
+ }
197
+ };
198
+ __name(_InvalidRequestException, "InvalidRequestException");
199
+ var InvalidRequestException = _InvalidRequestException;
200
+ var _ResourceNotFoundException = class _ResourceNotFoundException extends IoTJobsDataPlaneServiceException {
201
+ /**
202
+ * @internal
203
+ */
204
+ constructor(opts) {
205
+ super({
206
+ name: "ResourceNotFoundException",
207
+ $fault: "client",
208
+ ...opts
209
+ });
210
+ this.name = "ResourceNotFoundException";
211
+ this.$fault = "client";
212
+ Object.setPrototypeOf(this, _ResourceNotFoundException.prototype);
213
+ }
214
+ };
215
+ __name(_ResourceNotFoundException, "ResourceNotFoundException");
216
+ var ResourceNotFoundException = _ResourceNotFoundException;
217
+ var _ServiceUnavailableException = class _ServiceUnavailableException extends IoTJobsDataPlaneServiceException {
218
+ /**
219
+ * @internal
220
+ */
221
+ constructor(opts) {
222
+ super({
223
+ name: "ServiceUnavailableException",
224
+ $fault: "server",
225
+ ...opts
226
+ });
227
+ this.name = "ServiceUnavailableException";
228
+ this.$fault = "server";
229
+ Object.setPrototypeOf(this, _ServiceUnavailableException.prototype);
230
+ }
231
+ };
232
+ __name(_ServiceUnavailableException, "ServiceUnavailableException");
233
+ var ServiceUnavailableException = _ServiceUnavailableException;
234
+ var _TerminalStateException = class _TerminalStateException extends IoTJobsDataPlaneServiceException {
235
+ /**
236
+ * @internal
237
+ */
238
+ constructor(opts) {
239
+ super({
240
+ name: "TerminalStateException",
241
+ $fault: "client",
242
+ ...opts
243
+ });
244
+ this.name = "TerminalStateException";
245
+ this.$fault = "client";
246
+ Object.setPrototypeOf(this, _TerminalStateException.prototype);
247
+ }
248
+ };
249
+ __name(_TerminalStateException, "TerminalStateException");
250
+ var TerminalStateException = _TerminalStateException;
251
+ var _ThrottlingException = class _ThrottlingException extends IoTJobsDataPlaneServiceException {
252
+ /**
253
+ * @internal
254
+ */
255
+ constructor(opts) {
256
+ super({
257
+ name: "ThrottlingException",
258
+ $fault: "client",
259
+ ...opts
260
+ });
261
+ this.name = "ThrottlingException";
262
+ this.$fault = "client";
263
+ Object.setPrototypeOf(this, _ThrottlingException.prototype);
264
+ this.payload = opts.payload;
265
+ }
266
+ };
267
+ __name(_ThrottlingException, "ThrottlingException");
268
+ var ThrottlingException = _ThrottlingException;
269
+ var _InvalidStateTransitionException = class _InvalidStateTransitionException extends IoTJobsDataPlaneServiceException {
270
+ /**
271
+ * @internal
272
+ */
273
+ constructor(opts) {
274
+ super({
275
+ name: "InvalidStateTransitionException",
276
+ $fault: "client",
277
+ ...opts
278
+ });
279
+ this.name = "InvalidStateTransitionException";
280
+ this.$fault = "client";
281
+ Object.setPrototypeOf(this, _InvalidStateTransitionException.prototype);
282
+ }
283
+ };
284
+ __name(_InvalidStateTransitionException, "InvalidStateTransitionException");
285
+ var InvalidStateTransitionException = _InvalidStateTransitionException;
286
+
287
+ // src/protocols/Aws_restJson1.ts
288
+ var se_DescribeJobExecutionCommand = /* @__PURE__ */ __name(async (input, context) => {
289
+ const b = (0, import_core.requestBuilder)(input, context);
290
+ const headers = {};
291
+ b.bp("/things/{thingName}/jobs/{jobId}");
292
+ b.p("jobId", () => input.jobId, "{jobId}", false);
293
+ b.p("thingName", () => input.thingName, "{thingName}", false);
294
+ const query = (0, import_smithy_client.map)({
295
+ [_iJD]: [() => input.includeJobDocument !== void 0, () => input[_iJD].toString()],
296
+ [_eN]: [() => input.executionNumber !== void 0, () => input[_eN].toString()]
297
+ });
298
+ let body;
299
+ b.m("GET").h(headers).q(query).b(body);
300
+ return b.build();
301
+ }, "se_DescribeJobExecutionCommand");
302
+ var se_GetPendingJobExecutionsCommand = /* @__PURE__ */ __name(async (input, context) => {
303
+ const b = (0, import_core.requestBuilder)(input, context);
304
+ const headers = {};
305
+ b.bp("/things/{thingName}/jobs");
306
+ b.p("thingName", () => input.thingName, "{thingName}", false);
307
+ let body;
308
+ b.m("GET").h(headers).b(body);
309
+ return b.build();
310
+ }, "se_GetPendingJobExecutionsCommand");
311
+ var se_StartNextPendingJobExecutionCommand = /* @__PURE__ */ __name(async (input, context) => {
312
+ const b = (0, import_core.requestBuilder)(input, context);
313
+ const headers = {
314
+ "content-type": "application/json"
315
+ };
316
+ b.bp("/things/{thingName}/jobs/$next");
317
+ b.p("thingName", () => input.thingName, "{thingName}", false);
318
+ let body;
319
+ body = JSON.stringify(
320
+ (0, import_smithy_client.take)(input, {
321
+ statusDetails: (_) => (0, import_smithy_client._json)(_),
322
+ stepTimeoutInMinutes: []
323
+ })
324
+ );
325
+ b.m("PUT").h(headers).b(body);
326
+ return b.build();
327
+ }, "se_StartNextPendingJobExecutionCommand");
328
+ var se_UpdateJobExecutionCommand = /* @__PURE__ */ __name(async (input, context) => {
329
+ const b = (0, import_core.requestBuilder)(input, context);
330
+ const headers = {
331
+ "content-type": "application/json"
332
+ };
333
+ b.bp("/things/{thingName}/jobs/{jobId}");
334
+ b.p("jobId", () => input.jobId, "{jobId}", false);
335
+ b.p("thingName", () => input.thingName, "{thingName}", false);
336
+ let body;
337
+ body = JSON.stringify(
338
+ (0, import_smithy_client.take)(input, {
339
+ executionNumber: [],
340
+ expectedVersion: [],
341
+ includeJobDocument: [],
342
+ includeJobExecutionState: [],
343
+ status: [],
344
+ statusDetails: (_) => (0, import_smithy_client._json)(_),
345
+ stepTimeoutInMinutes: []
346
+ })
347
+ );
348
+ b.m("POST").h(headers).b(body);
349
+ return b.build();
350
+ }, "se_UpdateJobExecutionCommand");
351
+ var de_DescribeJobExecutionCommand = /* @__PURE__ */ __name(async (output, context) => {
352
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
353
+ return de_DescribeJobExecutionCommandError(output, context);
354
+ }
355
+ const contents = (0, import_smithy_client.map)({
356
+ $metadata: deserializeMetadata(output)
357
+ });
358
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
359
+ const doc = (0, import_smithy_client.take)(data, {
360
+ execution: import_smithy_client._json
361
+ });
362
+ Object.assign(contents, doc);
363
+ return contents;
364
+ }, "de_DescribeJobExecutionCommand");
365
+ var de_DescribeJobExecutionCommandError = /* @__PURE__ */ __name(async (output, context) => {
366
+ const parsedOutput = {
367
+ ...output,
368
+ body: await parseErrorBody(output.body, context)
369
+ };
370
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
371
+ switch (errorCode) {
372
+ case "CertificateValidationException":
373
+ case "com.amazonaws.iotjobsdataplane#CertificateValidationException":
374
+ throw await de_CertificateValidationExceptionRes(parsedOutput, context);
375
+ case "InvalidRequestException":
376
+ case "com.amazonaws.iotjobsdataplane#InvalidRequestException":
377
+ throw await de_InvalidRequestExceptionRes(parsedOutput, context);
378
+ case "ResourceNotFoundException":
379
+ case "com.amazonaws.iotjobsdataplane#ResourceNotFoundException":
380
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
381
+ case "ServiceUnavailableException":
382
+ case "com.amazonaws.iotjobsdataplane#ServiceUnavailableException":
383
+ throw await de_ServiceUnavailableExceptionRes(parsedOutput, context);
384
+ case "TerminalStateException":
385
+ case "com.amazonaws.iotjobsdataplane#TerminalStateException":
386
+ throw await de_TerminalStateExceptionRes(parsedOutput, context);
387
+ case "ThrottlingException":
388
+ case "com.amazonaws.iotjobsdataplane#ThrottlingException":
389
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
390
+ default:
391
+ const parsedBody = parsedOutput.body;
392
+ return throwDefaultError({
393
+ output,
394
+ parsedBody,
395
+ errorCode
396
+ });
397
+ }
398
+ }, "de_DescribeJobExecutionCommandError");
399
+ var de_GetPendingJobExecutionsCommand = /* @__PURE__ */ __name(async (output, context) => {
400
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
401
+ return de_GetPendingJobExecutionsCommandError(output, context);
402
+ }
403
+ const contents = (0, import_smithy_client.map)({
404
+ $metadata: deserializeMetadata(output)
405
+ });
406
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
407
+ const doc = (0, import_smithy_client.take)(data, {
408
+ inProgressJobs: import_smithy_client._json,
409
+ queuedJobs: import_smithy_client._json
410
+ });
411
+ Object.assign(contents, doc);
412
+ return contents;
413
+ }, "de_GetPendingJobExecutionsCommand");
414
+ var de_GetPendingJobExecutionsCommandError = /* @__PURE__ */ __name(async (output, context) => {
415
+ const parsedOutput = {
416
+ ...output,
417
+ body: await parseErrorBody(output.body, context)
418
+ };
419
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
420
+ switch (errorCode) {
421
+ case "CertificateValidationException":
422
+ case "com.amazonaws.iotjobsdataplane#CertificateValidationException":
423
+ throw await de_CertificateValidationExceptionRes(parsedOutput, context);
424
+ case "InvalidRequestException":
425
+ case "com.amazonaws.iotjobsdataplane#InvalidRequestException":
426
+ throw await de_InvalidRequestExceptionRes(parsedOutput, context);
427
+ case "ResourceNotFoundException":
428
+ case "com.amazonaws.iotjobsdataplane#ResourceNotFoundException":
429
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
430
+ case "ServiceUnavailableException":
431
+ case "com.amazonaws.iotjobsdataplane#ServiceUnavailableException":
432
+ throw await de_ServiceUnavailableExceptionRes(parsedOutput, context);
433
+ case "ThrottlingException":
434
+ case "com.amazonaws.iotjobsdataplane#ThrottlingException":
435
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
436
+ default:
437
+ const parsedBody = parsedOutput.body;
438
+ return throwDefaultError({
439
+ output,
440
+ parsedBody,
441
+ errorCode
442
+ });
443
+ }
444
+ }, "de_GetPendingJobExecutionsCommandError");
445
+ var de_StartNextPendingJobExecutionCommand = /* @__PURE__ */ __name(async (output, context) => {
446
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
447
+ return de_StartNextPendingJobExecutionCommandError(output, context);
448
+ }
449
+ const contents = (0, import_smithy_client.map)({
450
+ $metadata: deserializeMetadata(output)
451
+ });
452
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
453
+ const doc = (0, import_smithy_client.take)(data, {
454
+ execution: import_smithy_client._json
455
+ });
456
+ Object.assign(contents, doc);
457
+ return contents;
458
+ }, "de_StartNextPendingJobExecutionCommand");
459
+ var de_StartNextPendingJobExecutionCommandError = /* @__PURE__ */ __name(async (output, context) => {
460
+ const parsedOutput = {
461
+ ...output,
462
+ body: await parseErrorBody(output.body, context)
463
+ };
464
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
465
+ switch (errorCode) {
466
+ case "CertificateValidationException":
467
+ case "com.amazonaws.iotjobsdataplane#CertificateValidationException":
468
+ throw await de_CertificateValidationExceptionRes(parsedOutput, context);
469
+ case "InvalidRequestException":
470
+ case "com.amazonaws.iotjobsdataplane#InvalidRequestException":
471
+ throw await de_InvalidRequestExceptionRes(parsedOutput, context);
472
+ case "ResourceNotFoundException":
473
+ case "com.amazonaws.iotjobsdataplane#ResourceNotFoundException":
474
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
475
+ case "ServiceUnavailableException":
476
+ case "com.amazonaws.iotjobsdataplane#ServiceUnavailableException":
477
+ throw await de_ServiceUnavailableExceptionRes(parsedOutput, context);
478
+ case "ThrottlingException":
479
+ case "com.amazonaws.iotjobsdataplane#ThrottlingException":
480
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
481
+ default:
482
+ const parsedBody = parsedOutput.body;
483
+ return throwDefaultError({
484
+ output,
485
+ parsedBody,
486
+ errorCode
487
+ });
488
+ }
489
+ }, "de_StartNextPendingJobExecutionCommandError");
490
+ var de_UpdateJobExecutionCommand = /* @__PURE__ */ __name(async (output, context) => {
491
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
492
+ return de_UpdateJobExecutionCommandError(output, context);
493
+ }
494
+ const contents = (0, import_smithy_client.map)({
495
+ $metadata: deserializeMetadata(output)
496
+ });
497
+ const data = (0, import_smithy_client.expectNonNull)((0, import_smithy_client.expectObject)(await parseBody(output.body, context)), "body");
498
+ const doc = (0, import_smithy_client.take)(data, {
499
+ executionState: import_smithy_client._json,
500
+ jobDocument: import_smithy_client.expectString
501
+ });
502
+ Object.assign(contents, doc);
503
+ return contents;
504
+ }, "de_UpdateJobExecutionCommand");
505
+ var de_UpdateJobExecutionCommandError = /* @__PURE__ */ __name(async (output, context) => {
506
+ const parsedOutput = {
507
+ ...output,
508
+ body: await parseErrorBody(output.body, context)
509
+ };
510
+ const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
511
+ switch (errorCode) {
512
+ case "CertificateValidationException":
513
+ case "com.amazonaws.iotjobsdataplane#CertificateValidationException":
514
+ throw await de_CertificateValidationExceptionRes(parsedOutput, context);
515
+ case "InvalidRequestException":
516
+ case "com.amazonaws.iotjobsdataplane#InvalidRequestException":
517
+ throw await de_InvalidRequestExceptionRes(parsedOutput, context);
518
+ case "InvalidStateTransitionException":
519
+ case "com.amazonaws.iotjobsdataplane#InvalidStateTransitionException":
520
+ throw await de_InvalidStateTransitionExceptionRes(parsedOutput, context);
521
+ case "ResourceNotFoundException":
522
+ case "com.amazonaws.iotjobsdataplane#ResourceNotFoundException":
523
+ throw await de_ResourceNotFoundExceptionRes(parsedOutput, context);
524
+ case "ServiceUnavailableException":
525
+ case "com.amazonaws.iotjobsdataplane#ServiceUnavailableException":
526
+ throw await de_ServiceUnavailableExceptionRes(parsedOutput, context);
527
+ case "ThrottlingException":
528
+ case "com.amazonaws.iotjobsdataplane#ThrottlingException":
529
+ throw await de_ThrottlingExceptionRes(parsedOutput, context);
530
+ default:
531
+ const parsedBody = parsedOutput.body;
532
+ return throwDefaultError({
533
+ output,
534
+ parsedBody,
535
+ errorCode
536
+ });
537
+ }
538
+ }, "de_UpdateJobExecutionCommandError");
539
+ var throwDefaultError = (0, import_smithy_client.withBaseException)(IoTJobsDataPlaneServiceException);
540
+ var de_CertificateValidationExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
541
+ const contents = (0, import_smithy_client.map)({});
542
+ const data = parsedOutput.body;
543
+ const doc = (0, import_smithy_client.take)(data, {
544
+ message: import_smithy_client.expectString
545
+ });
546
+ Object.assign(contents, doc);
547
+ const exception = new CertificateValidationException({
548
+ $metadata: deserializeMetadata(parsedOutput),
549
+ ...contents
550
+ });
551
+ return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
552
+ }, "de_CertificateValidationExceptionRes");
553
+ var de_InvalidRequestExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
554
+ const contents = (0, import_smithy_client.map)({});
555
+ const data = parsedOutput.body;
556
+ const doc = (0, import_smithy_client.take)(data, {
557
+ message: import_smithy_client.expectString
558
+ });
559
+ Object.assign(contents, doc);
560
+ const exception = new InvalidRequestException({
561
+ $metadata: deserializeMetadata(parsedOutput),
562
+ ...contents
563
+ });
564
+ return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
565
+ }, "de_InvalidRequestExceptionRes");
566
+ var de_InvalidStateTransitionExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
567
+ const contents = (0, import_smithy_client.map)({});
568
+ const data = parsedOutput.body;
569
+ const doc = (0, import_smithy_client.take)(data, {
570
+ message: import_smithy_client.expectString
571
+ });
572
+ Object.assign(contents, doc);
573
+ const exception = new InvalidStateTransitionException({
574
+ $metadata: deserializeMetadata(parsedOutput),
575
+ ...contents
576
+ });
577
+ return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
578
+ }, "de_InvalidStateTransitionExceptionRes");
579
+ var de_ResourceNotFoundExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
580
+ const contents = (0, import_smithy_client.map)({});
581
+ const data = parsedOutput.body;
582
+ const doc = (0, import_smithy_client.take)(data, {
583
+ message: import_smithy_client.expectString
584
+ });
585
+ Object.assign(contents, doc);
586
+ const exception = new ResourceNotFoundException({
587
+ $metadata: deserializeMetadata(parsedOutput),
588
+ ...contents
589
+ });
590
+ return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
591
+ }, "de_ResourceNotFoundExceptionRes");
592
+ var de_ServiceUnavailableExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
593
+ const contents = (0, import_smithy_client.map)({});
594
+ const data = parsedOutput.body;
595
+ const doc = (0, import_smithy_client.take)(data, {
596
+ message: import_smithy_client.expectString
597
+ });
598
+ Object.assign(contents, doc);
599
+ const exception = new ServiceUnavailableException({
600
+ $metadata: deserializeMetadata(parsedOutput),
601
+ ...contents
602
+ });
603
+ return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
604
+ }, "de_ServiceUnavailableExceptionRes");
605
+ var de_TerminalStateExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
606
+ const contents = (0, import_smithy_client.map)({});
607
+ const data = parsedOutput.body;
608
+ const doc = (0, import_smithy_client.take)(data, {
609
+ message: import_smithy_client.expectString
610
+ });
611
+ Object.assign(contents, doc);
612
+ const exception = new TerminalStateException({
613
+ $metadata: deserializeMetadata(parsedOutput),
614
+ ...contents
615
+ });
616
+ return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
617
+ }, "de_TerminalStateExceptionRes");
618
+ var de_ThrottlingExceptionRes = /* @__PURE__ */ __name(async (parsedOutput, context) => {
619
+ const contents = (0, import_smithy_client.map)({});
620
+ const data = parsedOutput.body;
621
+ const doc = (0, import_smithy_client.take)(data, {
622
+ message: import_smithy_client.expectString,
623
+ payload: context.base64Decoder
624
+ });
625
+ Object.assign(contents, doc);
626
+ const exception = new ThrottlingException({
627
+ $metadata: deserializeMetadata(parsedOutput),
628
+ ...contents
629
+ });
630
+ return (0, import_smithy_client.decorateServiceException)(exception, parsedOutput.body);
631
+ }, "de_ThrottlingExceptionRes");
632
+ var deserializeMetadata = /* @__PURE__ */ __name((output) => ({
633
+ httpStatusCode: output.statusCode,
634
+ requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
635
+ extendedRequestId: output.headers["x-amz-id-2"],
636
+ cfId: output.headers["x-amz-cf-id"]
637
+ }), "deserializeMetadata");
638
+ var collectBodyString = /* @__PURE__ */ __name((streamBody, context) => (0, import_smithy_client.collectBody)(streamBody, context).then((body) => context.utf8Encoder(body)), "collectBodyString");
639
+ var _eN = "executionNumber";
640
+ var _iJD = "includeJobDocument";
641
+ var parseBody = /* @__PURE__ */ __name((streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
642
+ if (encoded.length) {
643
+ return JSON.parse(encoded);
644
+ }
645
+ return {};
646
+ }), "parseBody");
647
+ var parseErrorBody = /* @__PURE__ */ __name(async (errorBody, context) => {
648
+ const value = await parseBody(errorBody, context);
649
+ value.message = value.message ?? value.Message;
650
+ return value;
651
+ }, "parseErrorBody");
652
+ var loadRestJsonErrorCode = /* @__PURE__ */ __name((output, data) => {
653
+ const findKey = /* @__PURE__ */ __name((object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase()), "findKey");
654
+ const sanitizeErrorCode = /* @__PURE__ */ __name((rawValue) => {
655
+ let cleanValue = rawValue;
656
+ if (typeof cleanValue === "number") {
657
+ cleanValue = cleanValue.toString();
658
+ }
659
+ if (cleanValue.indexOf(",") >= 0) {
660
+ cleanValue = cleanValue.split(",")[0];
661
+ }
662
+ if (cleanValue.indexOf(":") >= 0) {
663
+ cleanValue = cleanValue.split(":")[0];
664
+ }
665
+ if (cleanValue.indexOf("#") >= 0) {
666
+ cleanValue = cleanValue.split("#")[1];
667
+ }
668
+ return cleanValue;
669
+ }, "sanitizeErrorCode");
670
+ const headerKey = findKey(output.headers, "x-amzn-errortype");
671
+ if (headerKey !== void 0) {
672
+ return sanitizeErrorCode(output.headers[headerKey]);
673
+ }
674
+ if (data.code !== void 0) {
675
+ return sanitizeErrorCode(data.code);
676
+ }
677
+ if (data["__type"] !== void 0) {
678
+ return sanitizeErrorCode(data["__type"]);
679
+ }
680
+ }, "loadRestJsonErrorCode");
681
+
682
+ // src/commands/DescribeJobExecutionCommand.ts
683
+ var _DescribeJobExecutionCommand = class _DescribeJobExecutionCommand extends import_smithy_client.Command.classBuilder().ep({
684
+ ...commonParams
685
+ }).m(function(Command, cs, config, o) {
686
+ return [
687
+ (0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
688
+ (0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions())
689
+ ];
690
+ }).s("IotLaserThingJobManagerExternalService", "DescribeJobExecution", {}).n("IoTJobsDataPlaneClient", "DescribeJobExecutionCommand").f(void 0, void 0).ser(se_DescribeJobExecutionCommand).de(de_DescribeJobExecutionCommand).build() {
691
+ };
692
+ __name(_DescribeJobExecutionCommand, "DescribeJobExecutionCommand");
693
+ var DescribeJobExecutionCommand = _DescribeJobExecutionCommand;
694
+
695
+ // src/commands/GetPendingJobExecutionsCommand.ts
696
+
697
+
698
+
699
+
700
+ var _GetPendingJobExecutionsCommand = class _GetPendingJobExecutionsCommand extends import_smithy_client.Command.classBuilder().ep({
701
+ ...commonParams
702
+ }).m(function(Command, cs, config, o) {
703
+ return [
704
+ (0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
705
+ (0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions())
706
+ ];
707
+ }).s("IotLaserThingJobManagerExternalService", "GetPendingJobExecutions", {}).n("IoTJobsDataPlaneClient", "GetPendingJobExecutionsCommand").f(void 0, void 0).ser(se_GetPendingJobExecutionsCommand).de(de_GetPendingJobExecutionsCommand).build() {
708
+ };
709
+ __name(_GetPendingJobExecutionsCommand, "GetPendingJobExecutionsCommand");
710
+ var GetPendingJobExecutionsCommand = _GetPendingJobExecutionsCommand;
711
+
712
+ // src/commands/StartNextPendingJobExecutionCommand.ts
713
+
714
+
715
+
716
+
717
+ var _StartNextPendingJobExecutionCommand = class _StartNextPendingJobExecutionCommand extends import_smithy_client.Command.classBuilder().ep({
718
+ ...commonParams
719
+ }).m(function(Command, cs, config, o) {
720
+ return [
721
+ (0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
722
+ (0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions())
723
+ ];
724
+ }).s("IotLaserThingJobManagerExternalService", "StartNextPendingJobExecution", {}).n("IoTJobsDataPlaneClient", "StartNextPendingJobExecutionCommand").f(void 0, void 0).ser(se_StartNextPendingJobExecutionCommand).de(de_StartNextPendingJobExecutionCommand).build() {
725
+ };
726
+ __name(_StartNextPendingJobExecutionCommand, "StartNextPendingJobExecutionCommand");
727
+ var StartNextPendingJobExecutionCommand = _StartNextPendingJobExecutionCommand;
728
+
729
+ // src/commands/UpdateJobExecutionCommand.ts
730
+
731
+
732
+
733
+
734
+ var _UpdateJobExecutionCommand = class _UpdateJobExecutionCommand extends import_smithy_client.Command.classBuilder().ep({
735
+ ...commonParams
736
+ }).m(function(Command, cs, config, o) {
737
+ return [
738
+ (0, import_middleware_serde.getSerdePlugin)(config, this.serialize, this.deserialize),
739
+ (0, import_middleware_endpoint.getEndpointPlugin)(config, Command.getEndpointParameterInstructions())
740
+ ];
741
+ }).s("IotLaserThingJobManagerExternalService", "UpdateJobExecution", {}).n("IoTJobsDataPlaneClient", "UpdateJobExecutionCommand").f(void 0, void 0).ser(se_UpdateJobExecutionCommand).de(de_UpdateJobExecutionCommand).build() {
742
+ };
743
+ __name(_UpdateJobExecutionCommand, "UpdateJobExecutionCommand");
744
+ var UpdateJobExecutionCommand = _UpdateJobExecutionCommand;
745
+
746
+ // src/IoTJobsDataPlane.ts
747
+ var commands = {
748
+ DescribeJobExecutionCommand,
749
+ GetPendingJobExecutionsCommand,
750
+ StartNextPendingJobExecutionCommand,
751
+ UpdateJobExecutionCommand
752
+ };
753
+ var _IoTJobsDataPlane = class _IoTJobsDataPlane extends IoTJobsDataPlaneClient {
754
+ };
755
+ __name(_IoTJobsDataPlane, "IoTJobsDataPlane");
756
+ var IoTJobsDataPlane = _IoTJobsDataPlane;
757
+ (0, import_smithy_client.createAggregatedClient)(commands, IoTJobsDataPlane);
758
+
759
+ // src/index.ts
760
+ var import_util_endpoints = require("@aws-sdk/util-endpoints");
761
+ // Annotate the CommonJS export names for ESM import in node:
762
+ 0 && (module.exports = {
763
+ CertificateValidationException,
764
+ DescribeJobExecutionCommand,
765
+ GetPendingJobExecutionsCommand,
766
+ InvalidRequestException,
767
+ InvalidStateTransitionException,
768
+ IoTJobsDataPlane,
769
+ IoTJobsDataPlaneClient,
770
+ IoTJobsDataPlaneServiceException,
771
+ JobExecutionStatus,
772
+ ResourceNotFoundException,
773
+ ServiceUnavailableException,
774
+ StartNextPendingJobExecutionCommand,
775
+ TerminalStateException,
776
+ ThrottlingException,
777
+ UpdateJobExecutionCommand,
778
+ __Client
779
+ });