@aws-sdk/client-iot-jobs-data-plane 3.33.0 → 3.36.1

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.
Files changed (115) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/{dist/cjs → dist-cjs}/IoTJobsDataPlane.js +1 -15
  3. package/dist-cjs/IoTJobsDataPlaneClient.js +35 -0
  4. package/{dist/cjs → dist-cjs}/commands/DescribeJobExecutionCommand.js +2 -27
  5. package/{dist/cjs → dist-cjs}/commands/GetPendingJobExecutionsCommand.js +2 -27
  6. package/{dist/cjs → dist-cjs}/commands/StartNextPendingJobExecutionCommand.js +2 -27
  7. package/{dist/cjs → dist-cjs}/commands/UpdateJobExecutionCommand.js +2 -27
  8. package/{dist/cjs → dist-cjs}/endpoints.js +0 -1
  9. package/{dist/cjs → dist-cjs}/index.js +0 -1
  10. package/{dist/cjs → dist-cjs}/models/index.js +0 -1
  11. package/{dist/cjs → dist-cjs}/models/models_0.js +0 -55
  12. package/{dist/cjs → dist-cjs}/protocols/Aws_restJson1.js +0 -6
  13. package/{dist/cjs → dist-cjs}/runtimeConfig.browser.js +1 -5
  14. package/{dist/cjs → dist-cjs}/runtimeConfig.js +1 -5
  15. package/{dist/cjs → dist-cjs}/runtimeConfig.native.js +0 -4
  16. package/{dist/cjs → dist-cjs}/runtimeConfig.shared.js +1 -5
  17. package/{dist/es → dist-es}/IoTJobsDataPlane.js +2 -16
  18. package/{dist/es → dist-es}/IoTJobsDataPlaneClient.js +2 -21
  19. package/{dist/es → dist-es}/commands/DescribeJobExecutionCommand.js +4 -30
  20. package/{dist/es → dist-es}/commands/GetPendingJobExecutionsCommand.js +4 -30
  21. package/{dist/es → dist-es}/commands/StartNextPendingJobExecutionCommand.js +4 -30
  22. package/{dist/es → dist-es}/commands/UpdateJobExecutionCommand.js +4 -30
  23. package/{dist/es → dist-es}/endpoints.js +1 -2
  24. package/{dist/types/index.d.ts → dist-es/index.js} +0 -0
  25. package/{dist/types/models/index.d.ts → dist-es/models/index.js} +0 -0
  26. package/{dist/es → dist-es}/models/models_0.js +0 -55
  27. package/{dist/es → dist-es}/protocols/Aws_restJson1.js +127 -133
  28. package/{dist/es → dist-es}/runtimeConfig.browser.js +1 -5
  29. package/{dist/es → dist-es}/runtimeConfig.js +1 -5
  30. package/{dist/es → dist-es}/runtimeConfig.native.js +0 -4
  31. package/{dist/es → dist-es}/runtimeConfig.shared.js +1 -5
  32. package/{dist/types → dist-types}/IoTJobsDataPlane.d.ts +2 -2
  33. package/{dist/types → dist-types}/IoTJobsDataPlaneClient.d.ts +5 -5
  34. package/{dist/types → dist-types}/commands/DescribeJobExecutionCommand.d.ts +2 -2
  35. package/{dist/types → dist-types}/commands/GetPendingJobExecutionsCommand.d.ts +2 -2
  36. package/{dist/types → dist-types}/commands/StartNextPendingJobExecutionCommand.d.ts +2 -2
  37. package/{dist/types → dist-types}/commands/UpdateJobExecutionCommand.d.ts +2 -2
  38. package/{dist/types → dist-types}/endpoints.d.ts +0 -0
  39. package/{index.ts → dist-types/index.d.ts} +0 -0
  40. package/{models/index.ts → dist-types/models/index.d.ts} +0 -0
  41. package/{dist/types → dist-types}/models/models_0.d.ts +0 -0
  42. package/{dist/types → dist-types}/protocols/Aws_restJson1.d.ts +2 -2
  43. package/{dist/types → dist-types}/runtimeConfig.browser.d.ts +0 -0
  44. package/{dist/types → dist-types}/runtimeConfig.d.ts +2 -4
  45. package/{dist/types → dist-types}/runtimeConfig.native.d.ts +0 -0
  46. package/{dist/types → dist-types}/runtimeConfig.shared.d.ts +0 -0
  47. package/{dist/types → dist-types}/ts3.4/IoTJobsDataPlane.d.ts +7 -27
  48. package/dist-types/ts3.4/IoTJobsDataPlaneClient.d.ts +71 -0
  49. package/{dist/types → dist-types}/ts3.4/commands/DescribeJobExecutionCommand.d.ts +4 -22
  50. package/{dist/types → dist-types}/ts3.4/commands/GetPendingJobExecutionsCommand.d.ts +4 -22
  51. package/{dist/types → dist-types}/ts3.4/commands/StartNextPendingJobExecutionCommand.d.ts +4 -22
  52. package/{dist/types → dist-types}/ts3.4/commands/UpdateJobExecutionCommand.d.ts +4 -22
  53. package/{dist/types → dist-types}/ts3.4/endpoints.d.ts +0 -0
  54. package/{dist/types → dist-types}/ts3.4/index.d.ts +0 -0
  55. package/{dist/types → dist-types}/ts3.4/models/index.d.ts +0 -0
  56. package/dist-types/ts3.4/models/models_0.d.ts +251 -0
  57. package/{dist/types → dist-types}/ts3.4/protocols/Aws_restJson1.d.ts +2 -2
  58. package/{dist/types → dist-types}/ts3.4/runtimeConfig.browser.d.ts +1 -3
  59. package/{dist/types → dist-types}/ts3.4/runtimeConfig.d.ts +3 -7
  60. package/{dist/types → dist-types}/ts3.4/runtimeConfig.native.d.ts +1 -3
  61. package/{dist/types → dist-types}/ts3.4/runtimeConfig.shared.d.ts +1 -3
  62. package/package.json +52 -49
  63. package/IoTJobsDataPlane.ts +0 -165
  64. package/IoTJobsDataPlaneClient.ts +0 -266
  65. package/commands/DescribeJobExecutionCommand.ts +0 -94
  66. package/commands/GetPendingJobExecutionsCommand.ts +0 -94
  67. package/commands/StartNextPendingJobExecutionCommand.ts +0 -99
  68. package/commands/UpdateJobExecutionCommand.ts +0 -94
  69. package/dist/cjs/IoTJobsDataPlane.js.map +0 -1
  70. package/dist/cjs/IoTJobsDataPlaneClient.js +0 -54
  71. package/dist/cjs/IoTJobsDataPlaneClient.js.map +0 -1
  72. package/dist/cjs/commands/DescribeJobExecutionCommand.js.map +0 -1
  73. package/dist/cjs/commands/GetPendingJobExecutionsCommand.js.map +0 -1
  74. package/dist/cjs/commands/StartNextPendingJobExecutionCommand.js.map +0 -1
  75. package/dist/cjs/commands/UpdateJobExecutionCommand.js.map +0 -1
  76. package/dist/cjs/endpoints.js.map +0 -1
  77. package/dist/cjs/index.js.map +0 -1
  78. package/dist/cjs/models/index.js.map +0 -1
  79. package/dist/cjs/models/models_0.js.map +0 -1
  80. package/dist/cjs/package.json +0 -91
  81. package/dist/cjs/protocols/Aws_restJson1.js.map +0 -1
  82. package/dist/cjs/runtimeConfig.browser.js.map +0 -1
  83. package/dist/cjs/runtimeConfig.js.map +0 -1
  84. package/dist/cjs/runtimeConfig.native.js.map +0 -1
  85. package/dist/cjs/runtimeConfig.shared.js.map +0 -1
  86. package/dist/es/IoTJobsDataPlane.js.map +0 -1
  87. package/dist/es/IoTJobsDataPlaneClient.js.map +0 -1
  88. package/dist/es/commands/DescribeJobExecutionCommand.js.map +0 -1
  89. package/dist/es/commands/GetPendingJobExecutionsCommand.js.map +0 -1
  90. package/dist/es/commands/StartNextPendingJobExecutionCommand.js.map +0 -1
  91. package/dist/es/commands/UpdateJobExecutionCommand.js.map +0 -1
  92. package/dist/es/endpoints.js.map +0 -1
  93. package/dist/es/index.js +0 -8
  94. package/dist/es/index.js.map +0 -1
  95. package/dist/es/models/index.js +0 -2
  96. package/dist/es/models/index.js.map +0 -1
  97. package/dist/es/models/models_0.js.map +0 -1
  98. package/dist/es/package.json +0 -91
  99. package/dist/es/protocols/Aws_restJson1.js.map +0 -1
  100. package/dist/es/runtimeConfig.browser.js.map +0 -1
  101. package/dist/es/runtimeConfig.js.map +0 -1
  102. package/dist/es/runtimeConfig.native.js.map +0 -1
  103. package/dist/es/runtimeConfig.shared.js.map +0 -1
  104. package/dist/types/ts3.4/IoTJobsDataPlaneClient.d.ts +0 -146
  105. package/dist/types/ts3.4/models/models_0.d.ts +0 -435
  106. package/endpoints.ts +0 -91
  107. package/jest.config.js +0 -4
  108. package/models/models_0.ts +0 -533
  109. package/protocols/Aws_restJson1.ts +0 -848
  110. package/runtimeConfig.browser.ts +0 -40
  111. package/runtimeConfig.native.ts +0 -16
  112. package/runtimeConfig.shared.ts +0 -16
  113. package/runtimeConfig.ts +0 -45
  114. package/tsconfig.es.json +0 -12
  115. package/tsconfig.json +0 -32
@@ -1,848 +0,0 @@
1
- import {
2
- DescribeJobExecutionCommandInput,
3
- DescribeJobExecutionCommandOutput,
4
- } from "../commands/DescribeJobExecutionCommand";
5
- import {
6
- GetPendingJobExecutionsCommandInput,
7
- GetPendingJobExecutionsCommandOutput,
8
- } from "../commands/GetPendingJobExecutionsCommand";
9
- import {
10
- StartNextPendingJobExecutionCommandInput,
11
- StartNextPendingJobExecutionCommandOutput,
12
- } from "../commands/StartNextPendingJobExecutionCommand";
13
- import { UpdateJobExecutionCommandInput, UpdateJobExecutionCommandOutput } from "../commands/UpdateJobExecutionCommand";
14
- import {
15
- CertificateValidationException,
16
- InvalidRequestException,
17
- InvalidStateTransitionException,
18
- JobExecution,
19
- JobExecutionState,
20
- JobExecutionSummary,
21
- ResourceNotFoundException,
22
- ServiceUnavailableException,
23
- TerminalStateException,
24
- ThrottlingException,
25
- } from "../models/models_0";
26
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
27
- import {
28
- expectLong as __expectLong,
29
- expectNonNull as __expectNonNull,
30
- expectObject as __expectObject,
31
- expectString as __expectString,
32
- extendedEncodeURIComponent as __extendedEncodeURIComponent,
33
- } from "@aws-sdk/smithy-client";
34
- import {
35
- Endpoint as __Endpoint,
36
- MetadataBearer as __MetadataBearer,
37
- ResponseMetadata as __ResponseMetadata,
38
- SerdeContext as __SerdeContext,
39
- SmithyException as __SmithyException,
40
- } from "@aws-sdk/types";
41
-
42
- export const serializeAws_restJson1DescribeJobExecutionCommand = async (
43
- input: DescribeJobExecutionCommandInput,
44
- context: __SerdeContext
45
- ): Promise<__HttpRequest> => {
46
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
47
- const headers: any = {};
48
- let resolvedPath =
49
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/jobs/{jobId}";
50
- if (input.jobId !== undefined) {
51
- const labelValue: string = input.jobId;
52
- if (labelValue.length <= 0) {
53
- throw new Error("Empty value provided for input HTTP label: jobId.");
54
- }
55
- resolvedPath = resolvedPath.replace("{jobId}", __extendedEncodeURIComponent(labelValue));
56
- } else {
57
- throw new Error("No value provided for input HTTP label: jobId.");
58
- }
59
- if (input.thingName !== undefined) {
60
- const labelValue: string = input.thingName;
61
- if (labelValue.length <= 0) {
62
- throw new Error("Empty value provided for input HTTP label: thingName.");
63
- }
64
- resolvedPath = resolvedPath.replace("{thingName}", __extendedEncodeURIComponent(labelValue));
65
- } else {
66
- throw new Error("No value provided for input HTTP label: thingName.");
67
- }
68
- const query: any = {
69
- ...(input.includeJobDocument !== undefined && { includeJobDocument: input.includeJobDocument.toString() }),
70
- ...(input.executionNumber !== undefined && { executionNumber: input.executionNumber.toString() }),
71
- };
72
- let body: any;
73
- return new __HttpRequest({
74
- protocol,
75
- hostname,
76
- port,
77
- method: "GET",
78
- headers,
79
- path: resolvedPath,
80
- query,
81
- body,
82
- });
83
- };
84
-
85
- export const serializeAws_restJson1GetPendingJobExecutionsCommand = async (
86
- input: GetPendingJobExecutionsCommandInput,
87
- context: __SerdeContext
88
- ): Promise<__HttpRequest> => {
89
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
90
- const headers: any = {};
91
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/jobs";
92
- if (input.thingName !== undefined) {
93
- const labelValue: string = input.thingName;
94
- if (labelValue.length <= 0) {
95
- throw new Error("Empty value provided for input HTTP label: thingName.");
96
- }
97
- resolvedPath = resolvedPath.replace("{thingName}", __extendedEncodeURIComponent(labelValue));
98
- } else {
99
- throw new Error("No value provided for input HTTP label: thingName.");
100
- }
101
- let body: any;
102
- return new __HttpRequest({
103
- protocol,
104
- hostname,
105
- port,
106
- method: "GET",
107
- headers,
108
- path: resolvedPath,
109
- body,
110
- });
111
- };
112
-
113
- export const serializeAws_restJson1StartNextPendingJobExecutionCommand = async (
114
- input: StartNextPendingJobExecutionCommandInput,
115
- context: __SerdeContext
116
- ): Promise<__HttpRequest> => {
117
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
118
- const headers: any = {
119
- "content-type": "application/json",
120
- };
121
- let resolvedPath =
122
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/jobs/$next";
123
- if (input.thingName !== undefined) {
124
- const labelValue: string = input.thingName;
125
- if (labelValue.length <= 0) {
126
- throw new Error("Empty value provided for input HTTP label: thingName.");
127
- }
128
- resolvedPath = resolvedPath.replace("{thingName}", __extendedEncodeURIComponent(labelValue));
129
- } else {
130
- throw new Error("No value provided for input HTTP label: thingName.");
131
- }
132
- let body: any;
133
- body = JSON.stringify({
134
- ...(input.statusDetails !== undefined &&
135
- input.statusDetails !== null && {
136
- statusDetails: serializeAws_restJson1DetailsMap(input.statusDetails, context),
137
- }),
138
- ...(input.stepTimeoutInMinutes !== undefined &&
139
- input.stepTimeoutInMinutes !== null && { stepTimeoutInMinutes: input.stepTimeoutInMinutes }),
140
- });
141
- return new __HttpRequest({
142
- protocol,
143
- hostname,
144
- port,
145
- method: "PUT",
146
- headers,
147
- path: resolvedPath,
148
- body,
149
- });
150
- };
151
-
152
- export const serializeAws_restJson1UpdateJobExecutionCommand = async (
153
- input: UpdateJobExecutionCommandInput,
154
- context: __SerdeContext
155
- ): Promise<__HttpRequest> => {
156
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
157
- const headers: any = {
158
- "content-type": "application/json",
159
- };
160
- let resolvedPath =
161
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/jobs/{jobId}";
162
- if (input.jobId !== undefined) {
163
- const labelValue: string = input.jobId;
164
- if (labelValue.length <= 0) {
165
- throw new Error("Empty value provided for input HTTP label: jobId.");
166
- }
167
- resolvedPath = resolvedPath.replace("{jobId}", __extendedEncodeURIComponent(labelValue));
168
- } else {
169
- throw new Error("No value provided for input HTTP label: jobId.");
170
- }
171
- if (input.thingName !== undefined) {
172
- const labelValue: string = input.thingName;
173
- if (labelValue.length <= 0) {
174
- throw new Error("Empty value provided for input HTTP label: thingName.");
175
- }
176
- resolvedPath = resolvedPath.replace("{thingName}", __extendedEncodeURIComponent(labelValue));
177
- } else {
178
- throw new Error("No value provided for input HTTP label: thingName.");
179
- }
180
- let body: any;
181
- body = JSON.stringify({
182
- ...(input.executionNumber !== undefined &&
183
- input.executionNumber !== null && { executionNumber: input.executionNumber }),
184
- ...(input.expectedVersion !== undefined &&
185
- input.expectedVersion !== null && { expectedVersion: input.expectedVersion }),
186
- ...(input.includeJobDocument !== undefined &&
187
- input.includeJobDocument !== null && { includeJobDocument: input.includeJobDocument }),
188
- ...(input.includeJobExecutionState !== undefined &&
189
- input.includeJobExecutionState !== null && { includeJobExecutionState: input.includeJobExecutionState }),
190
- ...(input.status !== undefined && input.status !== null && { status: input.status }),
191
- ...(input.statusDetails !== undefined &&
192
- input.statusDetails !== null && {
193
- statusDetails: serializeAws_restJson1DetailsMap(input.statusDetails, context),
194
- }),
195
- ...(input.stepTimeoutInMinutes !== undefined &&
196
- input.stepTimeoutInMinutes !== null && { stepTimeoutInMinutes: input.stepTimeoutInMinutes }),
197
- });
198
- return new __HttpRequest({
199
- protocol,
200
- hostname,
201
- port,
202
- method: "POST",
203
- headers,
204
- path: resolvedPath,
205
- body,
206
- });
207
- };
208
-
209
- export const deserializeAws_restJson1DescribeJobExecutionCommand = async (
210
- output: __HttpResponse,
211
- context: __SerdeContext
212
- ): Promise<DescribeJobExecutionCommandOutput> => {
213
- if (output.statusCode !== 200 && output.statusCode >= 300) {
214
- return deserializeAws_restJson1DescribeJobExecutionCommandError(output, context);
215
- }
216
- const contents: DescribeJobExecutionCommandOutput = {
217
- $metadata: deserializeMetadata(output),
218
- execution: undefined,
219
- };
220
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
221
- if (data.execution !== undefined && data.execution !== null) {
222
- contents.execution = deserializeAws_restJson1JobExecution(data.execution, context);
223
- }
224
- return Promise.resolve(contents);
225
- };
226
-
227
- const deserializeAws_restJson1DescribeJobExecutionCommandError = async (
228
- output: __HttpResponse,
229
- context: __SerdeContext
230
- ): Promise<DescribeJobExecutionCommandOutput> => {
231
- const parsedOutput: any = {
232
- ...output,
233
- body: await parseBody(output.body, context),
234
- };
235
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
236
- let errorCode: string = "UnknownError";
237
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
238
- switch (errorCode) {
239
- case "CertificateValidationException":
240
- case "com.amazonaws.iotjobsdataplane#CertificateValidationException":
241
- response = {
242
- ...(await deserializeAws_restJson1CertificateValidationExceptionResponse(parsedOutput, context)),
243
- name: errorCode,
244
- $metadata: deserializeMetadata(output),
245
- };
246
- break;
247
- case "InvalidRequestException":
248
- case "com.amazonaws.iotjobsdataplane#InvalidRequestException":
249
- response = {
250
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
251
- name: errorCode,
252
- $metadata: deserializeMetadata(output),
253
- };
254
- break;
255
- case "ResourceNotFoundException":
256
- case "com.amazonaws.iotjobsdataplane#ResourceNotFoundException":
257
- response = {
258
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
259
- name: errorCode,
260
- $metadata: deserializeMetadata(output),
261
- };
262
- break;
263
- case "ServiceUnavailableException":
264
- case "com.amazonaws.iotjobsdataplane#ServiceUnavailableException":
265
- response = {
266
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
267
- name: errorCode,
268
- $metadata: deserializeMetadata(output),
269
- };
270
- break;
271
- case "TerminalStateException":
272
- case "com.amazonaws.iotjobsdataplane#TerminalStateException":
273
- response = {
274
- ...(await deserializeAws_restJson1TerminalStateExceptionResponse(parsedOutput, context)),
275
- name: errorCode,
276
- $metadata: deserializeMetadata(output),
277
- };
278
- break;
279
- case "ThrottlingException":
280
- case "com.amazonaws.iotjobsdataplane#ThrottlingException":
281
- response = {
282
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
283
- name: errorCode,
284
- $metadata: deserializeMetadata(output),
285
- };
286
- break;
287
- default:
288
- const parsedBody = parsedOutput.body;
289
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
290
- response = {
291
- ...parsedBody,
292
- name: `${errorCode}`,
293
- message: parsedBody.message || parsedBody.Message || errorCode,
294
- $fault: "client",
295
- $metadata: deserializeMetadata(output),
296
- } as any;
297
- }
298
- const message = response.message || response.Message || errorCode;
299
- response.message = message;
300
- delete response.Message;
301
- return Promise.reject(Object.assign(new Error(message), response));
302
- };
303
-
304
- export const deserializeAws_restJson1GetPendingJobExecutionsCommand = async (
305
- output: __HttpResponse,
306
- context: __SerdeContext
307
- ): Promise<GetPendingJobExecutionsCommandOutput> => {
308
- if (output.statusCode !== 200 && output.statusCode >= 300) {
309
- return deserializeAws_restJson1GetPendingJobExecutionsCommandError(output, context);
310
- }
311
- const contents: GetPendingJobExecutionsCommandOutput = {
312
- $metadata: deserializeMetadata(output),
313
- inProgressJobs: undefined,
314
- queuedJobs: undefined,
315
- };
316
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
317
- if (data.inProgressJobs !== undefined && data.inProgressJobs !== null) {
318
- contents.inProgressJobs = deserializeAws_restJson1JobExecutionSummaryList(data.inProgressJobs, context);
319
- }
320
- if (data.queuedJobs !== undefined && data.queuedJobs !== null) {
321
- contents.queuedJobs = deserializeAws_restJson1JobExecutionSummaryList(data.queuedJobs, context);
322
- }
323
- return Promise.resolve(contents);
324
- };
325
-
326
- const deserializeAws_restJson1GetPendingJobExecutionsCommandError = async (
327
- output: __HttpResponse,
328
- context: __SerdeContext
329
- ): Promise<GetPendingJobExecutionsCommandOutput> => {
330
- const parsedOutput: any = {
331
- ...output,
332
- body: await parseBody(output.body, context),
333
- };
334
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
335
- let errorCode: string = "UnknownError";
336
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
337
- switch (errorCode) {
338
- case "CertificateValidationException":
339
- case "com.amazonaws.iotjobsdataplane#CertificateValidationException":
340
- response = {
341
- ...(await deserializeAws_restJson1CertificateValidationExceptionResponse(parsedOutput, context)),
342
- name: errorCode,
343
- $metadata: deserializeMetadata(output),
344
- };
345
- break;
346
- case "InvalidRequestException":
347
- case "com.amazonaws.iotjobsdataplane#InvalidRequestException":
348
- response = {
349
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
350
- name: errorCode,
351
- $metadata: deserializeMetadata(output),
352
- };
353
- break;
354
- case "ResourceNotFoundException":
355
- case "com.amazonaws.iotjobsdataplane#ResourceNotFoundException":
356
- response = {
357
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
358
- name: errorCode,
359
- $metadata: deserializeMetadata(output),
360
- };
361
- break;
362
- case "ServiceUnavailableException":
363
- case "com.amazonaws.iotjobsdataplane#ServiceUnavailableException":
364
- response = {
365
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
366
- name: errorCode,
367
- $metadata: deserializeMetadata(output),
368
- };
369
- break;
370
- case "ThrottlingException":
371
- case "com.amazonaws.iotjobsdataplane#ThrottlingException":
372
- response = {
373
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
374
- name: errorCode,
375
- $metadata: deserializeMetadata(output),
376
- };
377
- break;
378
- default:
379
- const parsedBody = parsedOutput.body;
380
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
381
- response = {
382
- ...parsedBody,
383
- name: `${errorCode}`,
384
- message: parsedBody.message || parsedBody.Message || errorCode,
385
- $fault: "client",
386
- $metadata: deserializeMetadata(output),
387
- } as any;
388
- }
389
- const message = response.message || response.Message || errorCode;
390
- response.message = message;
391
- delete response.Message;
392
- return Promise.reject(Object.assign(new Error(message), response));
393
- };
394
-
395
- export const deserializeAws_restJson1StartNextPendingJobExecutionCommand = async (
396
- output: __HttpResponse,
397
- context: __SerdeContext
398
- ): Promise<StartNextPendingJobExecutionCommandOutput> => {
399
- if (output.statusCode !== 200 && output.statusCode >= 300) {
400
- return deserializeAws_restJson1StartNextPendingJobExecutionCommandError(output, context);
401
- }
402
- const contents: StartNextPendingJobExecutionCommandOutput = {
403
- $metadata: deserializeMetadata(output),
404
- execution: undefined,
405
- };
406
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
407
- if (data.execution !== undefined && data.execution !== null) {
408
- contents.execution = deserializeAws_restJson1JobExecution(data.execution, context);
409
- }
410
- return Promise.resolve(contents);
411
- };
412
-
413
- const deserializeAws_restJson1StartNextPendingJobExecutionCommandError = async (
414
- output: __HttpResponse,
415
- context: __SerdeContext
416
- ): Promise<StartNextPendingJobExecutionCommandOutput> => {
417
- const parsedOutput: any = {
418
- ...output,
419
- body: await parseBody(output.body, context),
420
- };
421
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
422
- let errorCode: string = "UnknownError";
423
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
424
- switch (errorCode) {
425
- case "CertificateValidationException":
426
- case "com.amazonaws.iotjobsdataplane#CertificateValidationException":
427
- response = {
428
- ...(await deserializeAws_restJson1CertificateValidationExceptionResponse(parsedOutput, context)),
429
- name: errorCode,
430
- $metadata: deserializeMetadata(output),
431
- };
432
- break;
433
- case "InvalidRequestException":
434
- case "com.amazonaws.iotjobsdataplane#InvalidRequestException":
435
- response = {
436
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
437
- name: errorCode,
438
- $metadata: deserializeMetadata(output),
439
- };
440
- break;
441
- case "ResourceNotFoundException":
442
- case "com.amazonaws.iotjobsdataplane#ResourceNotFoundException":
443
- response = {
444
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
445
- name: errorCode,
446
- $metadata: deserializeMetadata(output),
447
- };
448
- break;
449
- case "ServiceUnavailableException":
450
- case "com.amazonaws.iotjobsdataplane#ServiceUnavailableException":
451
- response = {
452
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
453
- name: errorCode,
454
- $metadata: deserializeMetadata(output),
455
- };
456
- break;
457
- case "ThrottlingException":
458
- case "com.amazonaws.iotjobsdataplane#ThrottlingException":
459
- response = {
460
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
461
- name: errorCode,
462
- $metadata: deserializeMetadata(output),
463
- };
464
- break;
465
- default:
466
- const parsedBody = parsedOutput.body;
467
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
468
- response = {
469
- ...parsedBody,
470
- name: `${errorCode}`,
471
- message: parsedBody.message || parsedBody.Message || errorCode,
472
- $fault: "client",
473
- $metadata: deserializeMetadata(output),
474
- } as any;
475
- }
476
- const message = response.message || response.Message || errorCode;
477
- response.message = message;
478
- delete response.Message;
479
- return Promise.reject(Object.assign(new Error(message), response));
480
- };
481
-
482
- export const deserializeAws_restJson1UpdateJobExecutionCommand = async (
483
- output: __HttpResponse,
484
- context: __SerdeContext
485
- ): Promise<UpdateJobExecutionCommandOutput> => {
486
- if (output.statusCode !== 200 && output.statusCode >= 300) {
487
- return deserializeAws_restJson1UpdateJobExecutionCommandError(output, context);
488
- }
489
- const contents: UpdateJobExecutionCommandOutput = {
490
- $metadata: deserializeMetadata(output),
491
- executionState: undefined,
492
- jobDocument: undefined,
493
- };
494
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
495
- if (data.executionState !== undefined && data.executionState !== null) {
496
- contents.executionState = deserializeAws_restJson1JobExecutionState(data.executionState, context);
497
- }
498
- if (data.jobDocument !== undefined && data.jobDocument !== null) {
499
- contents.jobDocument = __expectString(data.jobDocument);
500
- }
501
- return Promise.resolve(contents);
502
- };
503
-
504
- const deserializeAws_restJson1UpdateJobExecutionCommandError = async (
505
- output: __HttpResponse,
506
- context: __SerdeContext
507
- ): Promise<UpdateJobExecutionCommandOutput> => {
508
- const parsedOutput: any = {
509
- ...output,
510
- body: await parseBody(output.body, context),
511
- };
512
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
513
- let errorCode: string = "UnknownError";
514
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
515
- switch (errorCode) {
516
- case "CertificateValidationException":
517
- case "com.amazonaws.iotjobsdataplane#CertificateValidationException":
518
- response = {
519
- ...(await deserializeAws_restJson1CertificateValidationExceptionResponse(parsedOutput, context)),
520
- name: errorCode,
521
- $metadata: deserializeMetadata(output),
522
- };
523
- break;
524
- case "InvalidRequestException":
525
- case "com.amazonaws.iotjobsdataplane#InvalidRequestException":
526
- response = {
527
- ...(await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)),
528
- name: errorCode,
529
- $metadata: deserializeMetadata(output),
530
- };
531
- break;
532
- case "InvalidStateTransitionException":
533
- case "com.amazonaws.iotjobsdataplane#InvalidStateTransitionException":
534
- response = {
535
- ...(await deserializeAws_restJson1InvalidStateTransitionExceptionResponse(parsedOutput, context)),
536
- name: errorCode,
537
- $metadata: deserializeMetadata(output),
538
- };
539
- break;
540
- case "ResourceNotFoundException":
541
- case "com.amazonaws.iotjobsdataplane#ResourceNotFoundException":
542
- response = {
543
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
544
- name: errorCode,
545
- $metadata: deserializeMetadata(output),
546
- };
547
- break;
548
- case "ServiceUnavailableException":
549
- case "com.amazonaws.iotjobsdataplane#ServiceUnavailableException":
550
- response = {
551
- ...(await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)),
552
- name: errorCode,
553
- $metadata: deserializeMetadata(output),
554
- };
555
- break;
556
- case "ThrottlingException":
557
- case "com.amazonaws.iotjobsdataplane#ThrottlingException":
558
- response = {
559
- ...(await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)),
560
- name: errorCode,
561
- $metadata: deserializeMetadata(output),
562
- };
563
- break;
564
- default:
565
- const parsedBody = parsedOutput.body;
566
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
567
- response = {
568
- ...parsedBody,
569
- name: `${errorCode}`,
570
- message: parsedBody.message || parsedBody.Message || errorCode,
571
- $fault: "client",
572
- $metadata: deserializeMetadata(output),
573
- } as any;
574
- }
575
- const message = response.message || response.Message || errorCode;
576
- response.message = message;
577
- delete response.Message;
578
- return Promise.reject(Object.assign(new Error(message), response));
579
- };
580
-
581
- const deserializeAws_restJson1CertificateValidationExceptionResponse = async (
582
- parsedOutput: any,
583
- context: __SerdeContext
584
- ): Promise<CertificateValidationException> => {
585
- const contents: CertificateValidationException = {
586
- name: "CertificateValidationException",
587
- $fault: "client",
588
- $metadata: deserializeMetadata(parsedOutput),
589
- message: undefined,
590
- };
591
- const data: any = parsedOutput.body;
592
- if (data.message !== undefined && data.message !== null) {
593
- contents.message = __expectString(data.message);
594
- }
595
- return contents;
596
- };
597
-
598
- const deserializeAws_restJson1InvalidRequestExceptionResponse = async (
599
- parsedOutput: any,
600
- context: __SerdeContext
601
- ): Promise<InvalidRequestException> => {
602
- const contents: InvalidRequestException = {
603
- name: "InvalidRequestException",
604
- $fault: "client",
605
- $metadata: deserializeMetadata(parsedOutput),
606
- message: undefined,
607
- };
608
- const data: any = parsedOutput.body;
609
- if (data.message !== undefined && data.message !== null) {
610
- contents.message = __expectString(data.message);
611
- }
612
- return contents;
613
- };
614
-
615
- const deserializeAws_restJson1InvalidStateTransitionExceptionResponse = async (
616
- parsedOutput: any,
617
- context: __SerdeContext
618
- ): Promise<InvalidStateTransitionException> => {
619
- const contents: InvalidStateTransitionException = {
620
- name: "InvalidStateTransitionException",
621
- $fault: "client",
622
- $metadata: deserializeMetadata(parsedOutput),
623
- message: undefined,
624
- };
625
- const data: any = parsedOutput.body;
626
- if (data.message !== undefined && data.message !== null) {
627
- contents.message = __expectString(data.message);
628
- }
629
- return contents;
630
- };
631
-
632
- const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (
633
- parsedOutput: any,
634
- context: __SerdeContext
635
- ): Promise<ResourceNotFoundException> => {
636
- const contents: ResourceNotFoundException = {
637
- name: "ResourceNotFoundException",
638
- $fault: "client",
639
- $metadata: deserializeMetadata(parsedOutput),
640
- message: undefined,
641
- };
642
- const data: any = parsedOutput.body;
643
- if (data.message !== undefined && data.message !== null) {
644
- contents.message = __expectString(data.message);
645
- }
646
- return contents;
647
- };
648
-
649
- const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async (
650
- parsedOutput: any,
651
- context: __SerdeContext
652
- ): Promise<ServiceUnavailableException> => {
653
- const contents: ServiceUnavailableException = {
654
- name: "ServiceUnavailableException",
655
- $fault: "server",
656
- $metadata: deserializeMetadata(parsedOutput),
657
- message: undefined,
658
- };
659
- const data: any = parsedOutput.body;
660
- if (data.message !== undefined && data.message !== null) {
661
- contents.message = __expectString(data.message);
662
- }
663
- return contents;
664
- };
665
-
666
- const deserializeAws_restJson1TerminalStateExceptionResponse = async (
667
- parsedOutput: any,
668
- context: __SerdeContext
669
- ): Promise<TerminalStateException> => {
670
- const contents: TerminalStateException = {
671
- name: "TerminalStateException",
672
- $fault: "client",
673
- $metadata: deserializeMetadata(parsedOutput),
674
- message: undefined,
675
- };
676
- const data: any = parsedOutput.body;
677
- if (data.message !== undefined && data.message !== null) {
678
- contents.message = __expectString(data.message);
679
- }
680
- return contents;
681
- };
682
-
683
- const deserializeAws_restJson1ThrottlingExceptionResponse = async (
684
- parsedOutput: any,
685
- context: __SerdeContext
686
- ): Promise<ThrottlingException> => {
687
- const contents: ThrottlingException = {
688
- name: "ThrottlingException",
689
- $fault: "client",
690
- $metadata: deserializeMetadata(parsedOutput),
691
- message: undefined,
692
- payload: undefined,
693
- };
694
- const data: any = parsedOutput.body;
695
- if (data.message !== undefined && data.message !== null) {
696
- contents.message = __expectString(data.message);
697
- }
698
- if (data.payload !== undefined && data.payload !== null) {
699
- contents.payload = context.base64Decoder(data.payload);
700
- }
701
- return contents;
702
- };
703
-
704
- const serializeAws_restJson1DetailsMap = (input: { [key: string]: string }, context: __SerdeContext): any => {
705
- return Object.entries(input).reduce((acc: { [key: string]: any }, [key, value]: [string, any]) => {
706
- if (value === null) {
707
- return acc;
708
- }
709
- return {
710
- ...acc,
711
- [key]: value,
712
- };
713
- }, {});
714
- };
715
-
716
- const deserializeAws_restJson1DetailsMap = (output: any, context: __SerdeContext): { [key: string]: string } => {
717
- return Object.entries(output).reduce((acc: { [key: string]: string }, [key, value]: [string, any]) => {
718
- if (value === null) {
719
- return acc;
720
- }
721
- return {
722
- ...acc,
723
- [key]: __expectString(value) as any,
724
- };
725
- }, {});
726
- };
727
-
728
- const deserializeAws_restJson1JobExecution = (output: any, context: __SerdeContext): JobExecution => {
729
- return {
730
- approximateSecondsBeforeTimedOut: __expectLong(output.approximateSecondsBeforeTimedOut),
731
- executionNumber: __expectLong(output.executionNumber),
732
- jobDocument: __expectString(output.jobDocument),
733
- jobId: __expectString(output.jobId),
734
- lastUpdatedAt: __expectLong(output.lastUpdatedAt),
735
- queuedAt: __expectLong(output.queuedAt),
736
- startedAt: __expectLong(output.startedAt),
737
- status: __expectString(output.status),
738
- statusDetails:
739
- output.statusDetails !== undefined && output.statusDetails !== null
740
- ? deserializeAws_restJson1DetailsMap(output.statusDetails, context)
741
- : undefined,
742
- thingName: __expectString(output.thingName),
743
- versionNumber: __expectLong(output.versionNumber),
744
- } as any;
745
- };
746
-
747
- const deserializeAws_restJson1JobExecutionState = (output: any, context: __SerdeContext): JobExecutionState => {
748
- return {
749
- status: __expectString(output.status),
750
- statusDetails:
751
- output.statusDetails !== undefined && output.statusDetails !== null
752
- ? deserializeAws_restJson1DetailsMap(output.statusDetails, context)
753
- : undefined,
754
- versionNumber: __expectLong(output.versionNumber),
755
- } as any;
756
- };
757
-
758
- const deserializeAws_restJson1JobExecutionSummary = (output: any, context: __SerdeContext): JobExecutionSummary => {
759
- return {
760
- executionNumber: __expectLong(output.executionNumber),
761
- jobId: __expectString(output.jobId),
762
- lastUpdatedAt: __expectLong(output.lastUpdatedAt),
763
- queuedAt: __expectLong(output.queuedAt),
764
- startedAt: __expectLong(output.startedAt),
765
- versionNumber: __expectLong(output.versionNumber),
766
- } as any;
767
- };
768
-
769
- const deserializeAws_restJson1JobExecutionSummaryList = (
770
- output: any,
771
- context: __SerdeContext
772
- ): JobExecutionSummary[] => {
773
- return (output || [])
774
- .filter((e: any) => e != null)
775
- .map((entry: any) => {
776
- if (entry === null) {
777
- return null as any;
778
- }
779
- return deserializeAws_restJson1JobExecutionSummary(entry, context);
780
- });
781
- };
782
-
783
- const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
784
- httpStatusCode: output.statusCode,
785
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
786
- extendedRequestId: output.headers["x-amz-id-2"],
787
- cfId: output.headers["x-amz-cf-id"],
788
- });
789
-
790
- // Collect low-level response body stream to Uint8Array.
791
- const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
792
- if (streamBody instanceof Uint8Array) {
793
- return Promise.resolve(streamBody);
794
- }
795
- return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
796
- };
797
-
798
- // Encode Uint8Array data into string with utf-8.
799
- const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
800
- collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
801
-
802
- const isSerializableHeaderValue = (value: any): boolean =>
803
- value !== undefined &&
804
- value !== null &&
805
- value !== "" &&
806
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
807
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
808
-
809
- const parseBody = (streamBody: any, context: __SerdeContext): any =>
810
- collectBodyString(streamBody, context).then((encoded) => {
811
- if (encoded.length) {
812
- return JSON.parse(encoded);
813
- }
814
- return {};
815
- });
816
-
817
- /**
818
- * Load an error code for the aws.rest-json-1.1 protocol.
819
- */
820
- const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => {
821
- const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
822
-
823
- const sanitizeErrorCode = (rawValue: string): string => {
824
- let cleanValue = rawValue;
825
- if (cleanValue.indexOf(":") >= 0) {
826
- cleanValue = cleanValue.split(":")[0];
827
- }
828
- if (cleanValue.indexOf("#") >= 0) {
829
- cleanValue = cleanValue.split("#")[1];
830
- }
831
- return cleanValue;
832
- };
833
-
834
- const headerKey = findKey(output.headers, "x-amzn-errortype");
835
- if (headerKey !== undefined) {
836
- return sanitizeErrorCode(output.headers[headerKey]);
837
- }
838
-
839
- if (data.code !== undefined) {
840
- return sanitizeErrorCode(data.code);
841
- }
842
-
843
- if (data["__type"] !== undefined) {
844
- return sanitizeErrorCode(data["__type"]);
845
- }
846
-
847
- return "";
848
- };