@aws-sdk/client-iot-jobs-data-plane 3.183.0 → 3.186.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,402 +1,524 @@
1
+ import { __assign, __awaiter, __generator, __read } from "tslib";
1
2
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
3
  import { decorateServiceException as __decorateServiceException, expectLong as __expectLong, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map as __map, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
3
4
  import { IoTJobsDataPlaneServiceException as __BaseException } from "../models/IoTJobsDataPlaneServiceException";
4
5
  import { CertificateValidationException, InvalidRequestException, InvalidStateTransitionException, ResourceNotFoundException, ServiceUnavailableException, TerminalStateException, ThrottlingException, } from "../models/models_0";
5
- export const serializeAws_restJson1DescribeJobExecutionCommand = async (input, context) => {
6
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
7
- const headers = {};
8
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/jobs/{jobId}";
9
- resolvedPath = __resolvedPath(resolvedPath, input, "jobId", () => input.jobId, "{jobId}", false);
10
- resolvedPath = __resolvedPath(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
11
- const query = map({
12
- includeJobDocument: [() => input.includeJobDocument !== void 0, () => input.includeJobDocument.toString()],
13
- executionNumber: [() => input.executionNumber !== void 0, () => input.executionNumber.toString()],
6
+ export var serializeAws_restJson1DescribeJobExecutionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
7
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
8
+ return __generator(this, function (_c) {
9
+ switch (_c.label) {
10
+ case 0: return [4, context.endpoint()];
11
+ case 1:
12
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
13
+ headers = {};
14
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/things/{thingName}/jobs/{jobId}";
15
+ resolvedPath = __resolvedPath(resolvedPath, input, "jobId", function () { return input.jobId; }, "{jobId}", false);
16
+ resolvedPath = __resolvedPath(resolvedPath, input, "thingName", function () { return input.thingName; }, "{thingName}", false);
17
+ query = map({
18
+ includeJobDocument: [function () { return input.includeJobDocument !== void 0; }, function () { return input.includeJobDocument.toString(); }],
19
+ executionNumber: [function () { return input.executionNumber !== void 0; }, function () { return input.executionNumber.toString(); }],
20
+ });
21
+ return [2, new __HttpRequest({
22
+ protocol: protocol,
23
+ hostname: hostname,
24
+ port: port,
25
+ method: "GET",
26
+ headers: headers,
27
+ path: resolvedPath,
28
+ query: query,
29
+ body: body,
30
+ })];
31
+ }
14
32
  });
15
- let body;
16
- return new __HttpRequest({
17
- protocol,
18
- hostname,
19
- port,
20
- method: "GET",
21
- headers,
22
- path: resolvedPath,
23
- query,
24
- body,
33
+ }); };
34
+ export var serializeAws_restJson1GetPendingJobExecutionsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
35
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
36
+ return __generator(this, function (_c) {
37
+ switch (_c.label) {
38
+ case 0: return [4, context.endpoint()];
39
+ case 1:
40
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
41
+ headers = {};
42
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/things/{thingName}/jobs";
43
+ resolvedPath = __resolvedPath(resolvedPath, input, "thingName", function () { return input.thingName; }, "{thingName}", false);
44
+ return [2, new __HttpRequest({
45
+ protocol: protocol,
46
+ hostname: hostname,
47
+ port: port,
48
+ method: "GET",
49
+ headers: headers,
50
+ path: resolvedPath,
51
+ body: body,
52
+ })];
53
+ }
25
54
  });
26
- };
27
- export const serializeAws_restJson1GetPendingJobExecutionsCommand = async (input, context) => {
28
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
29
- const headers = {};
30
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/jobs";
31
- resolvedPath = __resolvedPath(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
32
- let body;
33
- return new __HttpRequest({
34
- protocol,
35
- hostname,
36
- port,
37
- method: "GET",
38
- headers,
39
- path: resolvedPath,
40
- body,
55
+ }); };
56
+ export var serializeAws_restJson1StartNextPendingJobExecutionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
57
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
58
+ return __generator(this, function (_c) {
59
+ switch (_c.label) {
60
+ case 0: return [4, context.endpoint()];
61
+ case 1:
62
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
63
+ headers = {
64
+ "content-type": "application/json",
65
+ };
66
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/things/{thingName}/jobs/$next";
67
+ resolvedPath = __resolvedPath(resolvedPath, input, "thingName", function () { return input.thingName; }, "{thingName}", false);
68
+ body = JSON.stringify(__assign(__assign({}, (input.statusDetails != null && {
69
+ statusDetails: serializeAws_restJson1DetailsMap(input.statusDetails, context),
70
+ })), (input.stepTimeoutInMinutes != null && { stepTimeoutInMinutes: input.stepTimeoutInMinutes })));
71
+ return [2, new __HttpRequest({
72
+ protocol: protocol,
73
+ hostname: hostname,
74
+ port: port,
75
+ method: "PUT",
76
+ headers: headers,
77
+ path: resolvedPath,
78
+ body: body,
79
+ })];
80
+ }
41
81
  });
42
- };
43
- export const serializeAws_restJson1StartNextPendingJobExecutionCommand = async (input, context) => {
44
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
45
- const headers = {
46
- "content-type": "application/json",
47
- };
48
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/jobs/$next";
49
- resolvedPath = __resolvedPath(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
50
- let body;
51
- body = JSON.stringify({
52
- ...(input.statusDetails != null && {
53
- statusDetails: serializeAws_restJson1DetailsMap(input.statusDetails, context),
54
- }),
55
- ...(input.stepTimeoutInMinutes != null && { stepTimeoutInMinutes: input.stepTimeoutInMinutes }),
82
+ }); };
83
+ export var serializeAws_restJson1UpdateJobExecutionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
84
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
85
+ return __generator(this, function (_c) {
86
+ switch (_c.label) {
87
+ case 0: return [4, context.endpoint()];
88
+ case 1:
89
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
90
+ headers = {
91
+ "content-type": "application/json",
92
+ };
93
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/things/{thingName}/jobs/{jobId}";
94
+ resolvedPath = __resolvedPath(resolvedPath, input, "jobId", function () { return input.jobId; }, "{jobId}", false);
95
+ resolvedPath = __resolvedPath(resolvedPath, input, "thingName", function () { return input.thingName; }, "{thingName}", false);
96
+ body = JSON.stringify(__assign(__assign(__assign(__assign(__assign(__assign(__assign({}, (input.executionNumber != null && { executionNumber: input.executionNumber })), (input.expectedVersion != null && { expectedVersion: input.expectedVersion })), (input.includeJobDocument != null && { includeJobDocument: input.includeJobDocument })), (input.includeJobExecutionState != null && { includeJobExecutionState: input.includeJobExecutionState })), (input.status != null && { status: input.status })), (input.statusDetails != null && {
97
+ statusDetails: serializeAws_restJson1DetailsMap(input.statusDetails, context),
98
+ })), (input.stepTimeoutInMinutes != null && { stepTimeoutInMinutes: input.stepTimeoutInMinutes })));
99
+ return [2, new __HttpRequest({
100
+ protocol: protocol,
101
+ hostname: hostname,
102
+ port: port,
103
+ method: "POST",
104
+ headers: headers,
105
+ path: resolvedPath,
106
+ body: body,
107
+ })];
108
+ }
56
109
  });
57
- return new __HttpRequest({
58
- protocol,
59
- hostname,
60
- port,
61
- method: "PUT",
62
- headers,
63
- path: resolvedPath,
64
- body,
110
+ }); };
111
+ export var deserializeAws_restJson1DescribeJobExecutionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
112
+ var contents, data, _a, _b;
113
+ return __generator(this, function (_c) {
114
+ switch (_c.label) {
115
+ case 0:
116
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
117
+ return [2, deserializeAws_restJson1DescribeJobExecutionCommandError(output, context)];
118
+ }
119
+ contents = map({
120
+ $metadata: deserializeMetadata(output),
121
+ });
122
+ _a = __expectNonNull;
123
+ _b = __expectObject;
124
+ return [4, parseBody(output.body, context)];
125
+ case 1:
126
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
127
+ if (data.execution != null) {
128
+ contents.execution = deserializeAws_restJson1JobExecution(data.execution, context);
129
+ }
130
+ return [2, contents];
131
+ }
65
132
  });
66
- };
67
- export const serializeAws_restJson1UpdateJobExecutionCommand = async (input, context) => {
68
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
69
- const headers = {
70
- "content-type": "application/json",
71
- };
72
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/things/{thingName}/jobs/{jobId}";
73
- resolvedPath = __resolvedPath(resolvedPath, input, "jobId", () => input.jobId, "{jobId}", false);
74
- resolvedPath = __resolvedPath(resolvedPath, input, "thingName", () => input.thingName, "{thingName}", false);
75
- let body;
76
- body = JSON.stringify({
77
- ...(input.executionNumber != null && { executionNumber: input.executionNumber }),
78
- ...(input.expectedVersion != null && { expectedVersion: input.expectedVersion }),
79
- ...(input.includeJobDocument != null && { includeJobDocument: input.includeJobDocument }),
80
- ...(input.includeJobExecutionState != null && { includeJobExecutionState: input.includeJobExecutionState }),
81
- ...(input.status != null && { status: input.status }),
82
- ...(input.statusDetails != null && {
83
- statusDetails: serializeAws_restJson1DetailsMap(input.statusDetails, context),
84
- }),
85
- ...(input.stepTimeoutInMinutes != null && { stepTimeoutInMinutes: input.stepTimeoutInMinutes }),
133
+ }); };
134
+ var deserializeAws_restJson1DescribeJobExecutionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
135
+ var parsedOutput, _a, errorCode, _b, parsedBody;
136
+ var _c;
137
+ return __generator(this, function (_d) {
138
+ switch (_d.label) {
139
+ case 0:
140
+ _a = [__assign({}, output)];
141
+ _c = {};
142
+ return [4, parseErrorBody(output.body, context)];
143
+ case 1:
144
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
145
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
146
+ _b = errorCode;
147
+ switch (_b) {
148
+ case "CertificateValidationException": return [3, 2];
149
+ case "com.amazonaws.iotjobsdataplane#CertificateValidationException": return [3, 2];
150
+ case "InvalidRequestException": return [3, 4];
151
+ case "com.amazonaws.iotjobsdataplane#InvalidRequestException": return [3, 4];
152
+ case "ResourceNotFoundException": return [3, 6];
153
+ case "com.amazonaws.iotjobsdataplane#ResourceNotFoundException": return [3, 6];
154
+ case "ServiceUnavailableException": return [3, 8];
155
+ case "com.amazonaws.iotjobsdataplane#ServiceUnavailableException": return [3, 8];
156
+ case "TerminalStateException": return [3, 10];
157
+ case "com.amazonaws.iotjobsdataplane#TerminalStateException": return [3, 10];
158
+ case "ThrottlingException": return [3, 12];
159
+ case "com.amazonaws.iotjobsdataplane#ThrottlingException": return [3, 12];
160
+ }
161
+ return [3, 14];
162
+ case 2: return [4, deserializeAws_restJson1CertificateValidationExceptionResponse(parsedOutput, context)];
163
+ case 3: throw _d.sent();
164
+ case 4: return [4, deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)];
165
+ case 5: throw _d.sent();
166
+ case 6: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
167
+ case 7: throw _d.sent();
168
+ case 8: return [4, deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)];
169
+ case 9: throw _d.sent();
170
+ case 10: return [4, deserializeAws_restJson1TerminalStateExceptionResponse(parsedOutput, context)];
171
+ case 11: throw _d.sent();
172
+ case 12: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
173
+ case 13: throw _d.sent();
174
+ case 14:
175
+ parsedBody = parsedOutput.body;
176
+ throwDefaultError({
177
+ output: output,
178
+ parsedBody: parsedBody,
179
+ exceptionCtor: __BaseException,
180
+ errorCode: errorCode,
181
+ });
182
+ _d.label = 15;
183
+ case 15: return [2];
184
+ }
86
185
  });
87
- return new __HttpRequest({
88
- protocol,
89
- hostname,
90
- port,
91
- method: "POST",
92
- headers,
93
- path: resolvedPath,
94
- body,
186
+ }); };
187
+ export var deserializeAws_restJson1GetPendingJobExecutionsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
188
+ var contents, data, _a, _b;
189
+ return __generator(this, function (_c) {
190
+ switch (_c.label) {
191
+ case 0:
192
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
193
+ return [2, deserializeAws_restJson1GetPendingJobExecutionsCommandError(output, context)];
194
+ }
195
+ contents = map({
196
+ $metadata: deserializeMetadata(output),
197
+ });
198
+ _a = __expectNonNull;
199
+ _b = __expectObject;
200
+ return [4, parseBody(output.body, context)];
201
+ case 1:
202
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
203
+ if (data.inProgressJobs != null) {
204
+ contents.inProgressJobs = deserializeAws_restJson1JobExecutionSummaryList(data.inProgressJobs, context);
205
+ }
206
+ if (data.queuedJobs != null) {
207
+ contents.queuedJobs = deserializeAws_restJson1JobExecutionSummaryList(data.queuedJobs, context);
208
+ }
209
+ return [2, contents];
210
+ }
95
211
  });
96
- };
97
- export const deserializeAws_restJson1DescribeJobExecutionCommand = async (output, context) => {
98
- if (output.statusCode !== 200 && output.statusCode >= 300) {
99
- return deserializeAws_restJson1DescribeJobExecutionCommandError(output, context);
100
- }
101
- const contents = map({
102
- $metadata: deserializeMetadata(output),
212
+ }); };
213
+ var deserializeAws_restJson1GetPendingJobExecutionsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
214
+ var parsedOutput, _a, errorCode, _b, parsedBody;
215
+ var _c;
216
+ return __generator(this, function (_d) {
217
+ switch (_d.label) {
218
+ case 0:
219
+ _a = [__assign({}, output)];
220
+ _c = {};
221
+ return [4, parseErrorBody(output.body, context)];
222
+ case 1:
223
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
224
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
225
+ _b = errorCode;
226
+ switch (_b) {
227
+ case "CertificateValidationException": return [3, 2];
228
+ case "com.amazonaws.iotjobsdataplane#CertificateValidationException": return [3, 2];
229
+ case "InvalidRequestException": return [3, 4];
230
+ case "com.amazonaws.iotjobsdataplane#InvalidRequestException": return [3, 4];
231
+ case "ResourceNotFoundException": return [3, 6];
232
+ case "com.amazonaws.iotjobsdataplane#ResourceNotFoundException": return [3, 6];
233
+ case "ServiceUnavailableException": return [3, 8];
234
+ case "com.amazonaws.iotjobsdataplane#ServiceUnavailableException": return [3, 8];
235
+ case "ThrottlingException": return [3, 10];
236
+ case "com.amazonaws.iotjobsdataplane#ThrottlingException": return [3, 10];
237
+ }
238
+ return [3, 12];
239
+ case 2: return [4, deserializeAws_restJson1CertificateValidationExceptionResponse(parsedOutput, context)];
240
+ case 3: throw _d.sent();
241
+ case 4: return [4, deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)];
242
+ case 5: throw _d.sent();
243
+ case 6: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
244
+ case 7: throw _d.sent();
245
+ case 8: return [4, deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)];
246
+ case 9: throw _d.sent();
247
+ case 10: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
248
+ case 11: throw _d.sent();
249
+ case 12:
250
+ parsedBody = parsedOutput.body;
251
+ throwDefaultError({
252
+ output: output,
253
+ parsedBody: parsedBody,
254
+ exceptionCtor: __BaseException,
255
+ errorCode: errorCode,
256
+ });
257
+ _d.label = 13;
258
+ case 13: return [2];
259
+ }
103
260
  });
104
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
105
- if (data.execution != null) {
106
- contents.execution = deserializeAws_restJson1JobExecution(data.execution, context);
107
- }
108
- return contents;
109
- };
110
- const deserializeAws_restJson1DescribeJobExecutionCommandError = async (output, context) => {
111
- const parsedOutput = {
112
- ...output,
113
- body: await parseErrorBody(output.body, context),
114
- };
115
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
116
- switch (errorCode) {
117
- case "CertificateValidationException":
118
- case "com.amazonaws.iotjobsdataplane#CertificateValidationException":
119
- throw await deserializeAws_restJson1CertificateValidationExceptionResponse(parsedOutput, context);
120
- case "InvalidRequestException":
121
- case "com.amazonaws.iotjobsdataplane#InvalidRequestException":
122
- throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
123
- case "ResourceNotFoundException":
124
- case "com.amazonaws.iotjobsdataplane#ResourceNotFoundException":
125
- throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
126
- case "ServiceUnavailableException":
127
- case "com.amazonaws.iotjobsdataplane#ServiceUnavailableException":
128
- throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
129
- case "TerminalStateException":
130
- case "com.amazonaws.iotjobsdataplane#TerminalStateException":
131
- throw await deserializeAws_restJson1TerminalStateExceptionResponse(parsedOutput, context);
132
- case "ThrottlingException":
133
- case "com.amazonaws.iotjobsdataplane#ThrottlingException":
134
- throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
135
- default:
136
- const parsedBody = parsedOutput.body;
137
- throwDefaultError({
138
- output,
139
- parsedBody,
140
- exceptionCtor: __BaseException,
141
- errorCode,
142
- });
143
- }
144
- };
145
- export const deserializeAws_restJson1GetPendingJobExecutionsCommand = async (output, context) => {
146
- if (output.statusCode !== 200 && output.statusCode >= 300) {
147
- return deserializeAws_restJson1GetPendingJobExecutionsCommandError(output, context);
148
- }
149
- const contents = map({
150
- $metadata: deserializeMetadata(output),
261
+ }); };
262
+ export var deserializeAws_restJson1StartNextPendingJobExecutionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
263
+ var contents, data, _a, _b;
264
+ return __generator(this, function (_c) {
265
+ switch (_c.label) {
266
+ case 0:
267
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
268
+ return [2, deserializeAws_restJson1StartNextPendingJobExecutionCommandError(output, context)];
269
+ }
270
+ contents = map({
271
+ $metadata: deserializeMetadata(output),
272
+ });
273
+ _a = __expectNonNull;
274
+ _b = __expectObject;
275
+ return [4, parseBody(output.body, context)];
276
+ case 1:
277
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
278
+ if (data.execution != null) {
279
+ contents.execution = deserializeAws_restJson1JobExecution(data.execution, context);
280
+ }
281
+ return [2, contents];
282
+ }
151
283
  });
152
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
153
- if (data.inProgressJobs != null) {
154
- contents.inProgressJobs = deserializeAws_restJson1JobExecutionSummaryList(data.inProgressJobs, context);
155
- }
156
- if (data.queuedJobs != null) {
157
- contents.queuedJobs = deserializeAws_restJson1JobExecutionSummaryList(data.queuedJobs, context);
158
- }
159
- return contents;
160
- };
161
- const deserializeAws_restJson1GetPendingJobExecutionsCommandError = async (output, context) => {
162
- const parsedOutput = {
163
- ...output,
164
- body: await parseErrorBody(output.body, context),
165
- };
166
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
167
- switch (errorCode) {
168
- case "CertificateValidationException":
169
- case "com.amazonaws.iotjobsdataplane#CertificateValidationException":
170
- throw await deserializeAws_restJson1CertificateValidationExceptionResponse(parsedOutput, context);
171
- case "InvalidRequestException":
172
- case "com.amazonaws.iotjobsdataplane#InvalidRequestException":
173
- throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
174
- case "ResourceNotFoundException":
175
- case "com.amazonaws.iotjobsdataplane#ResourceNotFoundException":
176
- throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
177
- case "ServiceUnavailableException":
178
- case "com.amazonaws.iotjobsdataplane#ServiceUnavailableException":
179
- throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
180
- case "ThrottlingException":
181
- case "com.amazonaws.iotjobsdataplane#ThrottlingException":
182
- throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
183
- default:
184
- const parsedBody = parsedOutput.body;
185
- throwDefaultError({
186
- output,
187
- parsedBody,
188
- exceptionCtor: __BaseException,
189
- errorCode,
190
- });
191
- }
192
- };
193
- export const deserializeAws_restJson1StartNextPendingJobExecutionCommand = async (output, context) => {
194
- if (output.statusCode !== 200 && output.statusCode >= 300) {
195
- return deserializeAws_restJson1StartNextPendingJobExecutionCommandError(output, context);
196
- }
197
- const contents = map({
198
- $metadata: deserializeMetadata(output),
284
+ }); };
285
+ var deserializeAws_restJson1StartNextPendingJobExecutionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
286
+ var parsedOutput, _a, errorCode, _b, parsedBody;
287
+ var _c;
288
+ return __generator(this, function (_d) {
289
+ switch (_d.label) {
290
+ case 0:
291
+ _a = [__assign({}, output)];
292
+ _c = {};
293
+ return [4, parseErrorBody(output.body, context)];
294
+ case 1:
295
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
296
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
297
+ _b = errorCode;
298
+ switch (_b) {
299
+ case "CertificateValidationException": return [3, 2];
300
+ case "com.amazonaws.iotjobsdataplane#CertificateValidationException": return [3, 2];
301
+ case "InvalidRequestException": return [3, 4];
302
+ case "com.amazonaws.iotjobsdataplane#InvalidRequestException": return [3, 4];
303
+ case "ResourceNotFoundException": return [3, 6];
304
+ case "com.amazonaws.iotjobsdataplane#ResourceNotFoundException": return [3, 6];
305
+ case "ServiceUnavailableException": return [3, 8];
306
+ case "com.amazonaws.iotjobsdataplane#ServiceUnavailableException": return [3, 8];
307
+ case "ThrottlingException": return [3, 10];
308
+ case "com.amazonaws.iotjobsdataplane#ThrottlingException": return [3, 10];
309
+ }
310
+ return [3, 12];
311
+ case 2: return [4, deserializeAws_restJson1CertificateValidationExceptionResponse(parsedOutput, context)];
312
+ case 3: throw _d.sent();
313
+ case 4: return [4, deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)];
314
+ case 5: throw _d.sent();
315
+ case 6: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
316
+ case 7: throw _d.sent();
317
+ case 8: return [4, deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)];
318
+ case 9: throw _d.sent();
319
+ case 10: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
320
+ case 11: throw _d.sent();
321
+ case 12:
322
+ parsedBody = parsedOutput.body;
323
+ throwDefaultError({
324
+ output: output,
325
+ parsedBody: parsedBody,
326
+ exceptionCtor: __BaseException,
327
+ errorCode: errorCode,
328
+ });
329
+ _d.label = 13;
330
+ case 13: return [2];
331
+ }
199
332
  });
200
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
201
- if (data.execution != null) {
202
- contents.execution = deserializeAws_restJson1JobExecution(data.execution, context);
203
- }
204
- return contents;
205
- };
206
- const deserializeAws_restJson1StartNextPendingJobExecutionCommandError = async (output, context) => {
207
- const parsedOutput = {
208
- ...output,
209
- body: await parseErrorBody(output.body, context),
210
- };
211
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
212
- switch (errorCode) {
213
- case "CertificateValidationException":
214
- case "com.amazonaws.iotjobsdataplane#CertificateValidationException":
215
- throw await deserializeAws_restJson1CertificateValidationExceptionResponse(parsedOutput, context);
216
- case "InvalidRequestException":
217
- case "com.amazonaws.iotjobsdataplane#InvalidRequestException":
218
- throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
219
- case "ResourceNotFoundException":
220
- case "com.amazonaws.iotjobsdataplane#ResourceNotFoundException":
221
- throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
222
- case "ServiceUnavailableException":
223
- case "com.amazonaws.iotjobsdataplane#ServiceUnavailableException":
224
- throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
225
- case "ThrottlingException":
226
- case "com.amazonaws.iotjobsdataplane#ThrottlingException":
227
- throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
228
- default:
229
- const parsedBody = parsedOutput.body;
230
- throwDefaultError({
231
- output,
232
- parsedBody,
233
- exceptionCtor: __BaseException,
234
- errorCode,
235
- });
236
- }
237
- };
238
- export const deserializeAws_restJson1UpdateJobExecutionCommand = async (output, context) => {
239
- if (output.statusCode !== 200 && output.statusCode >= 300) {
240
- return deserializeAws_restJson1UpdateJobExecutionCommandError(output, context);
241
- }
242
- const contents = map({
243
- $metadata: deserializeMetadata(output),
333
+ }); };
334
+ export var deserializeAws_restJson1UpdateJobExecutionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
335
+ var contents, data, _a, _b;
336
+ return __generator(this, function (_c) {
337
+ switch (_c.label) {
338
+ case 0:
339
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
340
+ return [2, deserializeAws_restJson1UpdateJobExecutionCommandError(output, context)];
341
+ }
342
+ contents = map({
343
+ $metadata: deserializeMetadata(output),
344
+ });
345
+ _a = __expectNonNull;
346
+ _b = __expectObject;
347
+ return [4, parseBody(output.body, context)];
348
+ case 1:
349
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
350
+ if (data.executionState != null) {
351
+ contents.executionState = deserializeAws_restJson1JobExecutionState(data.executionState, context);
352
+ }
353
+ if (data.jobDocument != null) {
354
+ contents.jobDocument = __expectString(data.jobDocument);
355
+ }
356
+ return [2, contents];
357
+ }
244
358
  });
245
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
246
- if (data.executionState != null) {
247
- contents.executionState = deserializeAws_restJson1JobExecutionState(data.executionState, context);
248
- }
249
- if (data.jobDocument != null) {
250
- contents.jobDocument = __expectString(data.jobDocument);
251
- }
252
- return contents;
253
- };
254
- const deserializeAws_restJson1UpdateJobExecutionCommandError = async (output, context) => {
255
- const parsedOutput = {
256
- ...output,
257
- body: await parseErrorBody(output.body, context),
258
- };
259
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
260
- switch (errorCode) {
261
- case "CertificateValidationException":
262
- case "com.amazonaws.iotjobsdataplane#CertificateValidationException":
263
- throw await deserializeAws_restJson1CertificateValidationExceptionResponse(parsedOutput, context);
264
- case "InvalidRequestException":
265
- case "com.amazonaws.iotjobsdataplane#InvalidRequestException":
266
- throw await deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context);
267
- case "InvalidStateTransitionException":
268
- case "com.amazonaws.iotjobsdataplane#InvalidStateTransitionException":
269
- throw await deserializeAws_restJson1InvalidStateTransitionExceptionResponse(parsedOutput, context);
270
- case "ResourceNotFoundException":
271
- case "com.amazonaws.iotjobsdataplane#ResourceNotFoundException":
272
- throw await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context);
273
- case "ServiceUnavailableException":
274
- case "com.amazonaws.iotjobsdataplane#ServiceUnavailableException":
275
- throw await deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context);
276
- case "ThrottlingException":
277
- case "com.amazonaws.iotjobsdataplane#ThrottlingException":
278
- throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
279
- default:
280
- const parsedBody = parsedOutput.body;
281
- throwDefaultError({
282
- output,
283
- parsedBody,
284
- exceptionCtor: __BaseException,
285
- errorCode,
286
- });
287
- }
288
- };
289
- const map = __map;
290
- const deserializeAws_restJson1CertificateValidationExceptionResponse = async (parsedOutput, context) => {
291
- const contents = map({});
292
- const data = parsedOutput.body;
293
- if (data.message != null) {
294
- contents.message = __expectString(data.message);
295
- }
296
- const exception = new CertificateValidationException({
297
- $metadata: deserializeMetadata(parsedOutput),
298
- ...contents,
359
+ }); };
360
+ var deserializeAws_restJson1UpdateJobExecutionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
361
+ var parsedOutput, _a, errorCode, _b, parsedBody;
362
+ var _c;
363
+ return __generator(this, function (_d) {
364
+ switch (_d.label) {
365
+ case 0:
366
+ _a = [__assign({}, output)];
367
+ _c = {};
368
+ return [4, parseErrorBody(output.body, context)];
369
+ case 1:
370
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
371
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
372
+ _b = errorCode;
373
+ switch (_b) {
374
+ case "CertificateValidationException": return [3, 2];
375
+ case "com.amazonaws.iotjobsdataplane#CertificateValidationException": return [3, 2];
376
+ case "InvalidRequestException": return [3, 4];
377
+ case "com.amazonaws.iotjobsdataplane#InvalidRequestException": return [3, 4];
378
+ case "InvalidStateTransitionException": return [3, 6];
379
+ case "com.amazonaws.iotjobsdataplane#InvalidStateTransitionException": return [3, 6];
380
+ case "ResourceNotFoundException": return [3, 8];
381
+ case "com.amazonaws.iotjobsdataplane#ResourceNotFoundException": return [3, 8];
382
+ case "ServiceUnavailableException": return [3, 10];
383
+ case "com.amazonaws.iotjobsdataplane#ServiceUnavailableException": return [3, 10];
384
+ case "ThrottlingException": return [3, 12];
385
+ case "com.amazonaws.iotjobsdataplane#ThrottlingException": return [3, 12];
386
+ }
387
+ return [3, 14];
388
+ case 2: return [4, deserializeAws_restJson1CertificateValidationExceptionResponse(parsedOutput, context)];
389
+ case 3: throw _d.sent();
390
+ case 4: return [4, deserializeAws_restJson1InvalidRequestExceptionResponse(parsedOutput, context)];
391
+ case 5: throw _d.sent();
392
+ case 6: return [4, deserializeAws_restJson1InvalidStateTransitionExceptionResponse(parsedOutput, context)];
393
+ case 7: throw _d.sent();
394
+ case 8: return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
395
+ case 9: throw _d.sent();
396
+ case 10: return [4, deserializeAws_restJson1ServiceUnavailableExceptionResponse(parsedOutput, context)];
397
+ case 11: throw _d.sent();
398
+ case 12: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
399
+ case 13: throw _d.sent();
400
+ case 14:
401
+ parsedBody = parsedOutput.body;
402
+ throwDefaultError({
403
+ output: output,
404
+ parsedBody: parsedBody,
405
+ exceptionCtor: __BaseException,
406
+ errorCode: errorCode,
407
+ });
408
+ _d.label = 15;
409
+ case 15: return [2];
410
+ }
299
411
  });
300
- return __decorateServiceException(exception, parsedOutput.body);
301
- };
302
- const deserializeAws_restJson1InvalidRequestExceptionResponse = async (parsedOutput, context) => {
303
- const contents = map({});
304
- const data = parsedOutput.body;
305
- if (data.message != null) {
306
- contents.message = __expectString(data.message);
307
- }
308
- const exception = new InvalidRequestException({
309
- $metadata: deserializeMetadata(parsedOutput),
310
- ...contents,
412
+ }); };
413
+ var map = __map;
414
+ var deserializeAws_restJson1CertificateValidationExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
415
+ var contents, data, exception;
416
+ return __generator(this, function (_a) {
417
+ contents = map({});
418
+ data = parsedOutput.body;
419
+ if (data.message != null) {
420
+ contents.message = __expectString(data.message);
421
+ }
422
+ exception = new CertificateValidationException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
423
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
311
424
  });
312
- return __decorateServiceException(exception, parsedOutput.body);
313
- };
314
- const deserializeAws_restJson1InvalidStateTransitionExceptionResponse = async (parsedOutput, context) => {
315
- const contents = map({});
316
- const data = parsedOutput.body;
317
- if (data.message != null) {
318
- contents.message = __expectString(data.message);
319
- }
320
- const exception = new InvalidStateTransitionException({
321
- $metadata: deserializeMetadata(parsedOutput),
322
- ...contents,
425
+ }); };
426
+ var deserializeAws_restJson1InvalidRequestExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
427
+ var contents, data, exception;
428
+ return __generator(this, function (_a) {
429
+ contents = map({});
430
+ data = parsedOutput.body;
431
+ if (data.message != null) {
432
+ contents.message = __expectString(data.message);
433
+ }
434
+ exception = new InvalidRequestException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
435
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
323
436
  });
324
- return __decorateServiceException(exception, parsedOutput.body);
325
- };
326
- const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (parsedOutput, context) => {
327
- const contents = map({});
328
- const data = parsedOutput.body;
329
- if (data.message != null) {
330
- contents.message = __expectString(data.message);
331
- }
332
- const exception = new ResourceNotFoundException({
333
- $metadata: deserializeMetadata(parsedOutput),
334
- ...contents,
437
+ }); };
438
+ var deserializeAws_restJson1InvalidStateTransitionExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
439
+ var contents, data, exception;
440
+ return __generator(this, function (_a) {
441
+ contents = map({});
442
+ data = parsedOutput.body;
443
+ if (data.message != null) {
444
+ contents.message = __expectString(data.message);
445
+ }
446
+ exception = new InvalidStateTransitionException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
447
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
335
448
  });
336
- return __decorateServiceException(exception, parsedOutput.body);
337
- };
338
- const deserializeAws_restJson1ServiceUnavailableExceptionResponse = async (parsedOutput, context) => {
339
- const contents = map({});
340
- const data = parsedOutput.body;
341
- if (data.message != null) {
342
- contents.message = __expectString(data.message);
343
- }
344
- const exception = new ServiceUnavailableException({
345
- $metadata: deserializeMetadata(parsedOutput),
346
- ...contents,
449
+ }); };
450
+ var deserializeAws_restJson1ResourceNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
451
+ var contents, data, exception;
452
+ return __generator(this, function (_a) {
453
+ contents = map({});
454
+ data = parsedOutput.body;
455
+ if (data.message != null) {
456
+ contents.message = __expectString(data.message);
457
+ }
458
+ exception = new ResourceNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
459
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
347
460
  });
348
- return __decorateServiceException(exception, parsedOutput.body);
349
- };
350
- const deserializeAws_restJson1TerminalStateExceptionResponse = async (parsedOutput, context) => {
351
- const contents = map({});
352
- const data = parsedOutput.body;
353
- if (data.message != null) {
354
- contents.message = __expectString(data.message);
355
- }
356
- const exception = new TerminalStateException({
357
- $metadata: deserializeMetadata(parsedOutput),
358
- ...contents,
461
+ }); };
462
+ var deserializeAws_restJson1ServiceUnavailableExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
463
+ var contents, data, exception;
464
+ return __generator(this, function (_a) {
465
+ contents = map({});
466
+ data = parsedOutput.body;
467
+ if (data.message != null) {
468
+ contents.message = __expectString(data.message);
469
+ }
470
+ exception = new ServiceUnavailableException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
471
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
359
472
  });
360
- return __decorateServiceException(exception, parsedOutput.body);
361
- };
362
- const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
363
- const contents = map({});
364
- const data = parsedOutput.body;
365
- if (data.message != null) {
366
- contents.message = __expectString(data.message);
367
- }
368
- if (data.payload != null) {
369
- contents.payload = context.base64Decoder(data.payload);
370
- }
371
- const exception = new ThrottlingException({
372
- $metadata: deserializeMetadata(parsedOutput),
373
- ...contents,
473
+ }); };
474
+ var deserializeAws_restJson1TerminalStateExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
475
+ var contents, data, exception;
476
+ return __generator(this, function (_a) {
477
+ contents = map({});
478
+ data = parsedOutput.body;
479
+ if (data.message != null) {
480
+ contents.message = __expectString(data.message);
481
+ }
482
+ exception = new TerminalStateException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
483
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
374
484
  });
375
- return __decorateServiceException(exception, parsedOutput.body);
376
- };
377
- const serializeAws_restJson1DetailsMap = (input, context) => {
378
- return Object.entries(input).reduce((acc, [key, value]) => {
485
+ }); };
486
+ var deserializeAws_restJson1ThrottlingExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
487
+ var contents, data, exception;
488
+ return __generator(this, function (_a) {
489
+ contents = map({});
490
+ data = parsedOutput.body;
491
+ if (data.message != null) {
492
+ contents.message = __expectString(data.message);
493
+ }
494
+ if (data.payload != null) {
495
+ contents.payload = context.base64Decoder(data.payload);
496
+ }
497
+ exception = new ThrottlingException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
498
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
499
+ });
500
+ }); };
501
+ var serializeAws_restJson1DetailsMap = function (input, context) {
502
+ return Object.entries(input).reduce(function (acc, _a) {
503
+ var _b;
504
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
379
505
  if (value === null) {
380
506
  return acc;
381
507
  }
382
- return {
383
- ...acc,
384
- [key]: value,
385
- };
508
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = value, _b));
386
509
  }, {});
387
510
  };
388
- const deserializeAws_restJson1DetailsMap = (output, context) => {
389
- return Object.entries(output).reduce((acc, [key, value]) => {
511
+ var deserializeAws_restJson1DetailsMap = function (output, context) {
512
+ return Object.entries(output).reduce(function (acc, _a) {
513
+ var _b;
514
+ var _c = __read(_a, 2), key = _c[0], value = _c[1];
390
515
  if (value === null) {
391
516
  return acc;
392
517
  }
393
- return {
394
- ...acc,
395
- [key]: __expectString(value),
396
- };
518
+ return __assign(__assign({}, acc), (_b = {}, _b[key] = __expectString(value), _b));
397
519
  }, {});
398
520
  };
399
- const deserializeAws_restJson1JobExecution = (output, context) => {
521
+ var deserializeAws_restJson1JobExecution = function (output, context) {
400
522
  return {
401
523
  approximateSecondsBeforeTimedOut: __expectLong(output.approximateSecondsBeforeTimedOut),
402
524
  executionNumber: __expectLong(output.executionNumber),
@@ -411,14 +533,14 @@ const deserializeAws_restJson1JobExecution = (output, context) => {
411
533
  versionNumber: __expectLong(output.versionNumber),
412
534
  };
413
535
  };
414
- const deserializeAws_restJson1JobExecutionState = (output, context) => {
536
+ var deserializeAws_restJson1JobExecutionState = function (output, context) {
415
537
  return {
416
538
  status: __expectString(output.status),
417
539
  statusDetails: output.statusDetails != null ? deserializeAws_restJson1DetailsMap(output.statusDetails, context) : undefined,
418
540
  versionNumber: __expectLong(output.versionNumber),
419
541
  };
420
542
  };
421
- const deserializeAws_restJson1JobExecutionSummary = (output, context) => {
543
+ var deserializeAws_restJson1JobExecutionSummary = function (output, context) {
422
544
  return {
423
545
  executionNumber: __expectLong(output.executionNumber),
424
546
  jobId: __expectString(output.jobId),
@@ -428,10 +550,10 @@ const deserializeAws_restJson1JobExecutionSummary = (output, context) => {
428
550
  versionNumber: __expectLong(output.versionNumber),
429
551
  };
430
552
  };
431
- const deserializeAws_restJson1JobExecutionSummaryList = (output, context) => {
432
- const retVal = (output || [])
433
- .filter((e) => e != null)
434
- .map((entry) => {
553
+ var deserializeAws_restJson1JobExecutionSummaryList = function (output, context) {
554
+ var retVal = (output || [])
555
+ .filter(function (e) { return e != null; })
556
+ .map(function (entry) {
435
557
  if (entry === null) {
436
558
  return null;
437
559
  }
@@ -439,39 +561,57 @@ const deserializeAws_restJson1JobExecutionSummaryList = (output, context) => {
439
561
  });
440
562
  return retVal;
441
563
  };
442
- const deserializeMetadata = (output) => ({
443
- httpStatusCode: output.statusCode,
444
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
445
- extendedRequestId: output.headers["x-amz-id-2"],
446
- cfId: output.headers["x-amz-cf-id"],
447
- });
448
- const collectBody = (streamBody = new Uint8Array(), context) => {
564
+ var deserializeMetadata = function (output) {
565
+ var _a, _b;
566
+ return ({
567
+ httpStatusCode: output.statusCode,
568
+ requestId: (_b = (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"]) !== null && _b !== void 0 ? _b : output.headers["x-amz-request-id"],
569
+ extendedRequestId: output.headers["x-amz-id-2"],
570
+ cfId: output.headers["x-amz-cf-id"],
571
+ });
572
+ };
573
+ var collectBody = function (streamBody, context) {
574
+ if (streamBody === void 0) { streamBody = new Uint8Array(); }
449
575
  if (streamBody instanceof Uint8Array) {
450
576
  return Promise.resolve(streamBody);
451
577
  }
452
578
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
453
579
  };
454
- const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
455
- const isSerializableHeaderValue = (value) => value !== undefined &&
456
- value !== null &&
457
- value !== "" &&
458
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
459
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
460
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
461
- if (encoded.length) {
462
- return JSON.parse(encoded);
463
- }
464
- return {};
465
- });
466
- const parseErrorBody = async (errorBody, context) => {
467
- const value = await parseBody(errorBody, context);
468
- value.message = value.message ?? value.Message;
469
- return value;
580
+ var collectBodyString = function (streamBody, context) {
581
+ return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
470
582
  };
471
- const loadRestJsonErrorCode = (output, data) => {
472
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
473
- const sanitizeErrorCode = (rawValue) => {
474
- let cleanValue = rawValue;
583
+ var isSerializableHeaderValue = function (value) {
584
+ return value !== undefined &&
585
+ value !== null &&
586
+ value !== "" &&
587
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
588
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
589
+ };
590
+ var parseBody = function (streamBody, context) {
591
+ return collectBodyString(streamBody, context).then(function (encoded) {
592
+ if (encoded.length) {
593
+ return JSON.parse(encoded);
594
+ }
595
+ return {};
596
+ });
597
+ };
598
+ var parseErrorBody = function (errorBody, context) { return __awaiter(void 0, void 0, void 0, function () {
599
+ var value;
600
+ var _a;
601
+ return __generator(this, function (_b) {
602
+ switch (_b.label) {
603
+ case 0: return [4, parseBody(errorBody, context)];
604
+ case 1:
605
+ value = _b.sent();
606
+ value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
607
+ return [2, value];
608
+ }
609
+ });
610
+ }); };
611
+ var loadRestJsonErrorCode = function (output, data) {
612
+ var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
613
+ var sanitizeErrorCode = function (rawValue) {
614
+ var cleanValue = rawValue;
475
615
  if (typeof cleanValue === "number") {
476
616
  cleanValue = cleanValue.toString();
477
617
  }
@@ -486,7 +626,7 @@ const loadRestJsonErrorCode = (output, data) => {
486
626
  }
487
627
  return cleanValue;
488
628
  };
489
- const headerKey = findKey(output.headers, "x-amzn-errortype");
629
+ var headerKey = findKey(output.headers, "x-amzn-errortype");
490
630
  if (headerKey !== undefined) {
491
631
  return sanitizeErrorCode(output.headers[headerKey]);
492
632
  }