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