@aws-sdk/client-rbin 3.44.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.
Files changed (96) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/LICENSE +201 -0
  3. package/README.md +216 -0
  4. package/dist-cjs/Rbin.js +127 -0
  5. package/dist-cjs/RbinClient.js +35 -0
  6. package/dist-cjs/commands/CreateRuleCommand.js +36 -0
  7. package/dist-cjs/commands/DeleteRuleCommand.js +36 -0
  8. package/dist-cjs/commands/GetRuleCommand.js +36 -0
  9. package/dist-cjs/commands/ListRulesCommand.js +36 -0
  10. package/dist-cjs/commands/ListTagsForResourceCommand.js +36 -0
  11. package/dist-cjs/commands/TagResourceCommand.js +36 -0
  12. package/dist-cjs/commands/UntagResourceCommand.js +36 -0
  13. package/dist-cjs/commands/UpdateRuleCommand.js +36 -0
  14. package/dist-cjs/commands/index.js +11 -0
  15. package/dist-cjs/endpoints.js +130 -0
  16. package/dist-cjs/index.js +8 -0
  17. package/dist-cjs/models/index.js +4 -0
  18. package/dist-cjs/models/models_0.js +173 -0
  19. package/dist-cjs/pagination/Interfaces.js +2 -0
  20. package/dist-cjs/pagination/ListRulesPaginator.js +35 -0
  21. package/dist-cjs/pagination/index.js +5 -0
  22. package/dist-cjs/protocols/Aws_restJson1.js +1020 -0
  23. package/dist-cjs/runtimeConfig.browser.js +40 -0
  24. package/dist-cjs/runtimeConfig.js +44 -0
  25. package/dist-cjs/runtimeConfig.native.js +16 -0
  26. package/dist-cjs/runtimeConfig.shared.js +17 -0
  27. package/dist-es/Rbin.js +130 -0
  28. package/dist-es/RbinClient.js +37 -0
  29. package/dist-es/commands/CreateRuleCommand.js +39 -0
  30. package/dist-es/commands/DeleteRuleCommand.js +39 -0
  31. package/dist-es/commands/GetRuleCommand.js +39 -0
  32. package/dist-es/commands/ListRulesCommand.js +39 -0
  33. package/dist-es/commands/ListTagsForResourceCommand.js +39 -0
  34. package/dist-es/commands/TagResourceCommand.js +39 -0
  35. package/dist-es/commands/UntagResourceCommand.js +39 -0
  36. package/dist-es/commands/UpdateRuleCommand.js +39 -0
  37. package/dist-es/commands/index.js +8 -0
  38. package/dist-es/endpoints.js +126 -0
  39. package/dist-es/index.js +5 -0
  40. package/dist-es/models/index.js +1 -0
  41. package/dist-es/models/models_0.js +123 -0
  42. package/dist-es/pagination/Interfaces.js +1 -0
  43. package/dist-es/pagination/ListRulesPaginator.js +74 -0
  44. package/dist-es/pagination/index.js +2 -0
  45. package/dist-es/protocols/Aws_restJson1.js +1154 -0
  46. package/dist-es/runtimeConfig.browser.js +17 -0
  47. package/dist-es/runtimeConfig.js +21 -0
  48. package/dist-es/runtimeConfig.native.js +8 -0
  49. package/dist-es/runtimeConfig.shared.js +13 -0
  50. package/dist-types/Rbin.d.ts +79 -0
  51. package/dist-types/RbinClient.d.ts +161 -0
  52. package/dist-types/commands/CreateRuleCommand.d.ts +36 -0
  53. package/dist-types/commands/DeleteRuleCommand.d.ts +36 -0
  54. package/dist-types/commands/GetRuleCommand.d.ts +35 -0
  55. package/dist-types/commands/ListRulesCommand.d.ts +35 -0
  56. package/dist-types/commands/ListTagsForResourceCommand.d.ts +35 -0
  57. package/dist-types/commands/TagResourceCommand.d.ts +35 -0
  58. package/dist-types/commands/UntagResourceCommand.d.ts +35 -0
  59. package/dist-types/commands/UpdateRuleCommand.d.ts +36 -0
  60. package/dist-types/commands/index.d.ts +8 -0
  61. package/dist-types/endpoints.d.ts +2 -0
  62. package/dist-types/index.d.ts +5 -0
  63. package/dist-types/models/index.d.ts +1 -0
  64. package/dist-types/models/models_0.d.ts +485 -0
  65. package/dist-types/pagination/Interfaces.d.ts +6 -0
  66. package/dist-types/pagination/ListRulesPaginator.d.ts +4 -0
  67. package/dist-types/pagination/index.d.ts +2 -0
  68. package/dist-types/protocols/Aws_restJson1.d.ts +26 -0
  69. package/dist-types/runtimeConfig.browser.d.ts +39 -0
  70. package/dist-types/runtimeConfig.d.ts +39 -0
  71. package/dist-types/runtimeConfig.native.d.ts +38 -0
  72. package/dist-types/runtimeConfig.shared.d.ts +13 -0
  73. package/dist-types/ts3.4/Rbin.d.ts +45 -0
  74. package/dist-types/ts3.4/RbinClient.d.ts +79 -0
  75. package/dist-types/ts3.4/commands/CreateRuleCommand.d.ts +17 -0
  76. package/dist-types/ts3.4/commands/DeleteRuleCommand.d.ts +17 -0
  77. package/dist-types/ts3.4/commands/GetRuleCommand.d.ts +17 -0
  78. package/dist-types/ts3.4/commands/ListRulesCommand.d.ts +17 -0
  79. package/dist-types/ts3.4/commands/ListTagsForResourceCommand.d.ts +17 -0
  80. package/dist-types/ts3.4/commands/TagResourceCommand.d.ts +17 -0
  81. package/dist-types/ts3.4/commands/UntagResourceCommand.d.ts +17 -0
  82. package/dist-types/ts3.4/commands/UpdateRuleCommand.d.ts +17 -0
  83. package/dist-types/ts3.4/commands/index.d.ts +8 -0
  84. package/dist-types/ts3.4/endpoints.d.ts +2 -0
  85. package/dist-types/ts3.4/index.d.ts +5 -0
  86. package/dist-types/ts3.4/models/index.d.ts +1 -0
  87. package/dist-types/ts3.4/models/models_0.d.ts +295 -0
  88. package/dist-types/ts3.4/pagination/Interfaces.d.ts +6 -0
  89. package/dist-types/ts3.4/pagination/ListRulesPaginator.d.ts +4 -0
  90. package/dist-types/ts3.4/pagination/index.d.ts +2 -0
  91. package/dist-types/ts3.4/protocols/Aws_restJson1.d.ts +26 -0
  92. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +37 -0
  93. package/dist-types/ts3.4/runtimeConfig.d.ts +37 -0
  94. package/dist-types/ts3.4/runtimeConfig.native.d.ts +36 -0
  95. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +11 -0
  96. package/package.json +94 -0
@@ -0,0 +1,1154 @@
1
+ import { __assign, __awaiter, __generator } from "tslib";
2
+ import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
3
+ import { expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, extendedEncodeURIComponent as __extendedEncodeURIComponent, } from "@aws-sdk/smithy-client";
4
+ export var serializeAws_restJson1CreateRuleCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
5
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
6
+ return __generator(this, function (_c) {
7
+ switch (_c.label) {
8
+ case 0: return [4, context.endpoint()];
9
+ case 1:
10
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
11
+ headers = {
12
+ "content-type": "application/json",
13
+ };
14
+ resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/rules";
15
+ body = JSON.stringify(__assign(__assign(__assign(__assign(__assign({}, (input.Description !== undefined && input.Description !== null && { Description: input.Description })), (input.ResourceTags !== undefined &&
16
+ input.ResourceTags !== null && { ResourceTags: serializeAws_restJson1ResourceTags(input.ResourceTags, context) })), (input.ResourceType !== undefined && input.ResourceType !== null && { ResourceType: input.ResourceType })), (input.RetentionPeriod !== undefined &&
17
+ input.RetentionPeriod !== null && {
18
+ RetentionPeriod: serializeAws_restJson1RetentionPeriod(input.RetentionPeriod, context),
19
+ })), (input.Tags !== undefined &&
20
+ input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) })));
21
+ return [2, new __HttpRequest({
22
+ protocol: protocol,
23
+ hostname: hostname,
24
+ port: port,
25
+ method: "POST",
26
+ headers: headers,
27
+ path: resolvedPath,
28
+ body: body,
29
+ })];
30
+ }
31
+ });
32
+ }); };
33
+ export var serializeAws_restJson1DeleteRuleCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
34
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
35
+ return __generator(this, function (_c) {
36
+ switch (_c.label) {
37
+ case 0: return [4, context.endpoint()];
38
+ case 1:
39
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
40
+ headers = {};
41
+ resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/rules/{Identifier}";
42
+ if (input.Identifier !== undefined) {
43
+ labelValue = input.Identifier;
44
+ if (labelValue.length <= 0) {
45
+ throw new Error("Empty value provided for input HTTP label: Identifier.");
46
+ }
47
+ resolvedPath = resolvedPath.replace("{Identifier}", __extendedEncodeURIComponent(labelValue));
48
+ }
49
+ else {
50
+ throw new Error("No value provided for input HTTP label: Identifier.");
51
+ }
52
+ return [2, new __HttpRequest({
53
+ protocol: protocol,
54
+ hostname: hostname,
55
+ port: port,
56
+ method: "DELETE",
57
+ headers: headers,
58
+ path: resolvedPath,
59
+ body: body,
60
+ })];
61
+ }
62
+ });
63
+ }); };
64
+ export var serializeAws_restJson1GetRuleCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
65
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
66
+ return __generator(this, function (_c) {
67
+ switch (_c.label) {
68
+ case 0: return [4, context.endpoint()];
69
+ case 1:
70
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
71
+ headers = {};
72
+ resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/rules/{Identifier}";
73
+ if (input.Identifier !== undefined) {
74
+ labelValue = input.Identifier;
75
+ if (labelValue.length <= 0) {
76
+ throw new Error("Empty value provided for input HTTP label: Identifier.");
77
+ }
78
+ resolvedPath = resolvedPath.replace("{Identifier}", __extendedEncodeURIComponent(labelValue));
79
+ }
80
+ else {
81
+ throw new Error("No value provided for input HTTP label: Identifier.");
82
+ }
83
+ return [2, new __HttpRequest({
84
+ protocol: protocol,
85
+ hostname: hostname,
86
+ port: port,
87
+ method: "GET",
88
+ headers: headers,
89
+ path: resolvedPath,
90
+ body: body,
91
+ })];
92
+ }
93
+ });
94
+ }); };
95
+ export var serializeAws_restJson1ListRulesCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
96
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
97
+ return __generator(this, function (_c) {
98
+ switch (_c.label) {
99
+ case 0: return [4, context.endpoint()];
100
+ case 1:
101
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
102
+ headers = {
103
+ "content-type": "application/json",
104
+ };
105
+ resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/list-rules";
106
+ body = JSON.stringify(__assign(__assign(__assign(__assign({}, (input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults })), (input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken })), (input.ResourceTags !== undefined &&
107
+ input.ResourceTags !== null && { ResourceTags: serializeAws_restJson1ResourceTags(input.ResourceTags, context) })), (input.ResourceType !== undefined && input.ResourceType !== null && { ResourceType: input.ResourceType })));
108
+ return [2, new __HttpRequest({
109
+ protocol: protocol,
110
+ hostname: hostname,
111
+ port: port,
112
+ method: "POST",
113
+ headers: headers,
114
+ path: resolvedPath,
115
+ body: body,
116
+ })];
117
+ }
118
+ });
119
+ }); };
120
+ export var serializeAws_restJson1ListTagsForResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
121
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
122
+ return __generator(this, function (_c) {
123
+ switch (_c.label) {
124
+ case 0: return [4, context.endpoint()];
125
+ case 1:
126
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
127
+ headers = {};
128
+ resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/tags/{ResourceArn}";
129
+ if (input.ResourceArn !== undefined) {
130
+ labelValue = input.ResourceArn;
131
+ if (labelValue.length <= 0) {
132
+ throw new Error("Empty value provided for input HTTP label: ResourceArn.");
133
+ }
134
+ resolvedPath = resolvedPath.replace("{ResourceArn}", __extendedEncodeURIComponent(labelValue));
135
+ }
136
+ else {
137
+ throw new Error("No value provided for input HTTP label: ResourceArn.");
138
+ }
139
+ return [2, new __HttpRequest({
140
+ protocol: protocol,
141
+ hostname: hostname,
142
+ port: port,
143
+ method: "GET",
144
+ headers: headers,
145
+ path: resolvedPath,
146
+ body: body,
147
+ })];
148
+ }
149
+ });
150
+ }); };
151
+ export var serializeAws_restJson1TagResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
152
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, 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
+ "content-type": "application/json",
160
+ };
161
+ resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/tags/{ResourceArn}";
162
+ if (input.ResourceArn !== undefined) {
163
+ labelValue = input.ResourceArn;
164
+ if (labelValue.length <= 0) {
165
+ throw new Error("Empty value provided for input HTTP label: ResourceArn.");
166
+ }
167
+ resolvedPath = resolvedPath.replace("{ResourceArn}", __extendedEncodeURIComponent(labelValue));
168
+ }
169
+ else {
170
+ throw new Error("No value provided for input HTTP label: ResourceArn.");
171
+ }
172
+ body = JSON.stringify(__assign({}, (input.Tags !== undefined &&
173
+ input.Tags !== null && { Tags: serializeAws_restJson1TagList(input.Tags, context) })));
174
+ return [2, new __HttpRequest({
175
+ protocol: protocol,
176
+ hostname: hostname,
177
+ port: port,
178
+ method: "POST",
179
+ headers: headers,
180
+ path: resolvedPath,
181
+ body: body,
182
+ })];
183
+ }
184
+ });
185
+ }); };
186
+ export var serializeAws_restJson1UntagResourceCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
187
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, query, body;
188
+ return __generator(this, function (_c) {
189
+ switch (_c.label) {
190
+ case 0: return [4, context.endpoint()];
191
+ case 1:
192
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
193
+ headers = {};
194
+ resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/tags/{ResourceArn}";
195
+ if (input.ResourceArn !== undefined) {
196
+ labelValue = input.ResourceArn;
197
+ if (labelValue.length <= 0) {
198
+ throw new Error("Empty value provided for input HTTP label: ResourceArn.");
199
+ }
200
+ resolvedPath = resolvedPath.replace("{ResourceArn}", __extendedEncodeURIComponent(labelValue));
201
+ }
202
+ else {
203
+ throw new Error("No value provided for input HTTP label: ResourceArn.");
204
+ }
205
+ query = __assign({}, (input.TagKeys !== undefined && { tagKeys: (input.TagKeys || []).map(function (_entry) { return _entry; }) }));
206
+ return [2, new __HttpRequest({
207
+ protocol: protocol,
208
+ hostname: hostname,
209
+ port: port,
210
+ method: "DELETE",
211
+ headers: headers,
212
+ path: resolvedPath,
213
+ query: query,
214
+ body: body,
215
+ })];
216
+ }
217
+ });
218
+ }); };
219
+ export var serializeAws_restJson1UpdateRuleCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
220
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
221
+ return __generator(this, function (_c) {
222
+ switch (_c.label) {
223
+ case 0: return [4, context.endpoint()];
224
+ case 1:
225
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
226
+ headers = {
227
+ "content-type": "application/json",
228
+ };
229
+ resolvedPath = "" + ((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/rules/{Identifier}";
230
+ if (input.Identifier !== undefined) {
231
+ labelValue = input.Identifier;
232
+ if (labelValue.length <= 0) {
233
+ throw new Error("Empty value provided for input HTTP label: Identifier.");
234
+ }
235
+ resolvedPath = resolvedPath.replace("{Identifier}", __extendedEncodeURIComponent(labelValue));
236
+ }
237
+ else {
238
+ throw new Error("No value provided for input HTTP label: Identifier.");
239
+ }
240
+ body = JSON.stringify(__assign(__assign(__assign(__assign({}, (input.Description !== undefined && input.Description !== null && { Description: input.Description })), (input.ResourceTags !== undefined &&
241
+ input.ResourceTags !== null && { ResourceTags: serializeAws_restJson1ResourceTags(input.ResourceTags, context) })), (input.ResourceType !== undefined && input.ResourceType !== null && { ResourceType: input.ResourceType })), (input.RetentionPeriod !== undefined &&
242
+ input.RetentionPeriod !== null && {
243
+ RetentionPeriod: serializeAws_restJson1RetentionPeriod(input.RetentionPeriod, context),
244
+ })));
245
+ return [2, new __HttpRequest({
246
+ protocol: protocol,
247
+ hostname: hostname,
248
+ port: port,
249
+ method: "PATCH",
250
+ headers: headers,
251
+ path: resolvedPath,
252
+ body: body,
253
+ })];
254
+ }
255
+ });
256
+ }); };
257
+ export var deserializeAws_restJson1CreateRuleCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
258
+ var contents, data, _a, _b;
259
+ return __generator(this, function (_c) {
260
+ switch (_c.label) {
261
+ case 0:
262
+ if (output.statusCode !== 201 && output.statusCode >= 300) {
263
+ return [2, deserializeAws_restJson1CreateRuleCommandError(output, context)];
264
+ }
265
+ contents = {
266
+ $metadata: deserializeMetadata(output),
267
+ Description: undefined,
268
+ Identifier: undefined,
269
+ ResourceTags: undefined,
270
+ ResourceType: undefined,
271
+ RetentionPeriod: undefined,
272
+ Status: undefined,
273
+ Tags: undefined,
274
+ };
275
+ _a = __expectNonNull;
276
+ _b = __expectObject;
277
+ return [4, parseBody(output.body, context)];
278
+ case 1:
279
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
280
+ if (data.Description !== undefined && data.Description !== null) {
281
+ contents.Description = __expectString(data.Description);
282
+ }
283
+ if (data.Identifier !== undefined && data.Identifier !== null) {
284
+ contents.Identifier = __expectString(data.Identifier);
285
+ }
286
+ if (data.ResourceTags !== undefined && data.ResourceTags !== null) {
287
+ contents.ResourceTags = deserializeAws_restJson1ResourceTags(data.ResourceTags, context);
288
+ }
289
+ if (data.ResourceType !== undefined && data.ResourceType !== null) {
290
+ contents.ResourceType = __expectString(data.ResourceType);
291
+ }
292
+ if (data.RetentionPeriod !== undefined && data.RetentionPeriod !== null) {
293
+ contents.RetentionPeriod = deserializeAws_restJson1RetentionPeriod(data.RetentionPeriod, context);
294
+ }
295
+ if (data.Status !== undefined && data.Status !== null) {
296
+ contents.Status = __expectString(data.Status);
297
+ }
298
+ if (data.Tags !== undefined && data.Tags !== null) {
299
+ contents.Tags = deserializeAws_restJson1TagList(data.Tags, context);
300
+ }
301
+ return [2, Promise.resolve(contents)];
302
+ }
303
+ });
304
+ }); };
305
+ var deserializeAws_restJson1CreateRuleCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
306
+ var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
307
+ var _f;
308
+ return __generator(this, function (_g) {
309
+ switch (_g.label) {
310
+ case 0:
311
+ _a = [__assign({}, output)];
312
+ _f = {};
313
+ return [4, parseBody(output.body, context)];
314
+ case 1:
315
+ parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
316
+ errorCode = "UnknownError";
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 "ServiceQuotaExceededException": return [3, 4];
323
+ case "com.amazonaws.rbin#ServiceQuotaExceededException": 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:
329
+ _c = [{}];
330
+ return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
331
+ case 3:
332
+ response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
333
+ return [3, 9];
334
+ case 4:
335
+ _d = [{}];
336
+ return [4, deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)];
337
+ case 5:
338
+ response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
339
+ return [3, 9];
340
+ case 6:
341
+ _e = [{}];
342
+ return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
343
+ case 7:
344
+ response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
345
+ return [3, 9];
346
+ case 8:
347
+ parsedBody = parsedOutput.body;
348
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
349
+ response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
350
+ _g.label = 9;
351
+ case 9:
352
+ message = response.message || response.Message || errorCode;
353
+ response.message = message;
354
+ delete response.Message;
355
+ return [2, Promise.reject(Object.assign(new Error(message), response))];
356
+ }
357
+ });
358
+ }); };
359
+ export var deserializeAws_restJson1DeleteRuleCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
360
+ var contents;
361
+ return __generator(this, function (_a) {
362
+ switch (_a.label) {
363
+ case 0:
364
+ if (output.statusCode !== 204 && output.statusCode >= 300) {
365
+ return [2, deserializeAws_restJson1DeleteRuleCommandError(output, context)];
366
+ }
367
+ contents = {
368
+ $metadata: deserializeMetadata(output),
369
+ };
370
+ return [4, collectBody(output.body, context)];
371
+ case 1:
372
+ _a.sent();
373
+ return [2, Promise.resolve(contents)];
374
+ }
375
+ });
376
+ }); };
377
+ var deserializeAws_restJson1DeleteRuleCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
378
+ var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
379
+ var _f;
380
+ return __generator(this, function (_g) {
381
+ switch (_g.label) {
382
+ case 0:
383
+ _a = [__assign({}, output)];
384
+ _f = {};
385
+ return [4, parseBody(output.body, context)];
386
+ case 1:
387
+ parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
388
+ errorCode = "UnknownError";
389
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
390
+ _b = errorCode;
391
+ switch (_b) {
392
+ case "InternalServerException": return [3, 2];
393
+ case "com.amazonaws.rbin#InternalServerException": return [3, 2];
394
+ case "ResourceNotFoundException": return [3, 4];
395
+ case "com.amazonaws.rbin#ResourceNotFoundException": return [3, 4];
396
+ case "ValidationException": return [3, 6];
397
+ case "com.amazonaws.rbin#ValidationException": return [3, 6];
398
+ }
399
+ return [3, 8];
400
+ case 2:
401
+ _c = [{}];
402
+ return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
403
+ case 3:
404
+ response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
405
+ return [3, 9];
406
+ case 4:
407
+ _d = [{}];
408
+ return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
409
+ case 5:
410
+ response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
411
+ return [3, 9];
412
+ case 6:
413
+ _e = [{}];
414
+ return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
415
+ case 7:
416
+ response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
417
+ return [3, 9];
418
+ case 8:
419
+ parsedBody = parsedOutput.body;
420
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
421
+ response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
422
+ _g.label = 9;
423
+ case 9:
424
+ message = response.message || response.Message || errorCode;
425
+ response.message = message;
426
+ delete response.Message;
427
+ return [2, Promise.reject(Object.assign(new Error(message), response))];
428
+ }
429
+ });
430
+ }); };
431
+ export var deserializeAws_restJson1GetRuleCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
432
+ var contents, data, _a, _b;
433
+ return __generator(this, function (_c) {
434
+ switch (_c.label) {
435
+ case 0:
436
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
437
+ return [2, deserializeAws_restJson1GetRuleCommandError(output, context)];
438
+ }
439
+ contents = {
440
+ $metadata: deserializeMetadata(output),
441
+ Description: undefined,
442
+ Identifier: undefined,
443
+ ResourceTags: undefined,
444
+ ResourceType: undefined,
445
+ RetentionPeriod: undefined,
446
+ Status: undefined,
447
+ };
448
+ _a = __expectNonNull;
449
+ _b = __expectObject;
450
+ return [4, parseBody(output.body, context)];
451
+ case 1:
452
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
453
+ if (data.Description !== undefined && data.Description !== null) {
454
+ contents.Description = __expectString(data.Description);
455
+ }
456
+ if (data.Identifier !== undefined && data.Identifier !== null) {
457
+ contents.Identifier = __expectString(data.Identifier);
458
+ }
459
+ if (data.ResourceTags !== undefined && data.ResourceTags !== null) {
460
+ contents.ResourceTags = deserializeAws_restJson1ResourceTags(data.ResourceTags, context);
461
+ }
462
+ if (data.ResourceType !== undefined && data.ResourceType !== null) {
463
+ contents.ResourceType = __expectString(data.ResourceType);
464
+ }
465
+ if (data.RetentionPeriod !== undefined && data.RetentionPeriod !== null) {
466
+ contents.RetentionPeriod = deserializeAws_restJson1RetentionPeriod(data.RetentionPeriod, context);
467
+ }
468
+ if (data.Status !== undefined && data.Status !== null) {
469
+ contents.Status = __expectString(data.Status);
470
+ }
471
+ return [2, Promise.resolve(contents)];
472
+ }
473
+ });
474
+ }); };
475
+ var deserializeAws_restJson1GetRuleCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
476
+ var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
477
+ var _f;
478
+ return __generator(this, function (_g) {
479
+ switch (_g.label) {
480
+ case 0:
481
+ _a = [__assign({}, output)];
482
+ _f = {};
483
+ return [4, parseBody(output.body, context)];
484
+ case 1:
485
+ parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
486
+ errorCode = "UnknownError";
487
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
488
+ _b = errorCode;
489
+ switch (_b) {
490
+ case "InternalServerException": return [3, 2];
491
+ case "com.amazonaws.rbin#InternalServerException": return [3, 2];
492
+ case "ResourceNotFoundException": return [3, 4];
493
+ case "com.amazonaws.rbin#ResourceNotFoundException": return [3, 4];
494
+ case "ValidationException": return [3, 6];
495
+ case "com.amazonaws.rbin#ValidationException": return [3, 6];
496
+ }
497
+ return [3, 8];
498
+ case 2:
499
+ _c = [{}];
500
+ return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
501
+ case 3:
502
+ response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
503
+ return [3, 9];
504
+ case 4:
505
+ _d = [{}];
506
+ return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
507
+ case 5:
508
+ response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
509
+ return [3, 9];
510
+ case 6:
511
+ _e = [{}];
512
+ return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
513
+ case 7:
514
+ response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
515
+ return [3, 9];
516
+ case 8:
517
+ parsedBody = parsedOutput.body;
518
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
519
+ response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
520
+ _g.label = 9;
521
+ case 9:
522
+ message = response.message || response.Message || errorCode;
523
+ response.message = message;
524
+ delete response.Message;
525
+ return [2, Promise.reject(Object.assign(new Error(message), response))];
526
+ }
527
+ });
528
+ }); };
529
+ export var deserializeAws_restJson1ListRulesCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
530
+ var contents, data, _a, _b;
531
+ return __generator(this, function (_c) {
532
+ switch (_c.label) {
533
+ case 0:
534
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
535
+ return [2, deserializeAws_restJson1ListRulesCommandError(output, context)];
536
+ }
537
+ contents = {
538
+ $metadata: deserializeMetadata(output),
539
+ NextToken: undefined,
540
+ Rules: undefined,
541
+ };
542
+ _a = __expectNonNull;
543
+ _b = __expectObject;
544
+ return [4, parseBody(output.body, context)];
545
+ case 1:
546
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
547
+ if (data.NextToken !== undefined && data.NextToken !== null) {
548
+ contents.NextToken = __expectString(data.NextToken);
549
+ }
550
+ if (data.Rules !== undefined && data.Rules !== null) {
551
+ contents.Rules = deserializeAws_restJson1RuleSummaryList(data.Rules, context);
552
+ }
553
+ return [2, Promise.resolve(contents)];
554
+ }
555
+ });
556
+ }); };
557
+ var deserializeAws_restJson1ListRulesCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
558
+ var parsedOutput, _a, response, errorCode, _b, _c, _d, parsedBody, message;
559
+ var _e;
560
+ return __generator(this, function (_f) {
561
+ switch (_f.label) {
562
+ case 0:
563
+ _a = [__assign({}, output)];
564
+ _e = {};
565
+ return [4, parseBody(output.body, context)];
566
+ case 1:
567
+ parsedOutput = __assign.apply(void 0, _a.concat([(_e.body = _f.sent(), _e)]));
568
+ errorCode = "UnknownError";
569
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
570
+ _b = errorCode;
571
+ switch (_b) {
572
+ case "InternalServerException": return [3, 2];
573
+ case "com.amazonaws.rbin#InternalServerException": return [3, 2];
574
+ case "ValidationException": return [3, 4];
575
+ case "com.amazonaws.rbin#ValidationException": return [3, 4];
576
+ }
577
+ return [3, 6];
578
+ case 2:
579
+ _c = [{}];
580
+ return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
581
+ case 3:
582
+ response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_f.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
583
+ return [3, 7];
584
+ case 4:
585
+ _d = [{}];
586
+ return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
587
+ case 5:
588
+ response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_f.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
589
+ return [3, 7];
590
+ case 6:
591
+ parsedBody = parsedOutput.body;
592
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
593
+ response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
594
+ _f.label = 7;
595
+ case 7:
596
+ message = response.message || response.Message || errorCode;
597
+ response.message = message;
598
+ delete response.Message;
599
+ return [2, Promise.reject(Object.assign(new Error(message), response))];
600
+ }
601
+ });
602
+ }); };
603
+ export var deserializeAws_restJson1ListTagsForResourceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
604
+ var contents, data, _a, _b;
605
+ return __generator(this, function (_c) {
606
+ switch (_c.label) {
607
+ case 0:
608
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
609
+ return [2, deserializeAws_restJson1ListTagsForResourceCommandError(output, context)];
610
+ }
611
+ contents = {
612
+ $metadata: deserializeMetadata(output),
613
+ Tags: undefined,
614
+ };
615
+ _a = __expectNonNull;
616
+ _b = __expectObject;
617
+ return [4, parseBody(output.body, context)];
618
+ case 1:
619
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
620
+ if (data.Tags !== undefined && data.Tags !== null) {
621
+ contents.Tags = deserializeAws_restJson1TagList(data.Tags, context);
622
+ }
623
+ return [2, Promise.resolve(contents)];
624
+ }
625
+ });
626
+ }); };
627
+ var deserializeAws_restJson1ListTagsForResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
628
+ var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
629
+ var _f;
630
+ return __generator(this, function (_g) {
631
+ switch (_g.label) {
632
+ case 0:
633
+ _a = [__assign({}, output)];
634
+ _f = {};
635
+ return [4, parseBody(output.body, context)];
636
+ case 1:
637
+ parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
638
+ errorCode = "UnknownError";
639
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
640
+ _b = errorCode;
641
+ switch (_b) {
642
+ case "InternalServerException": return [3, 2];
643
+ case "com.amazonaws.rbin#InternalServerException": return [3, 2];
644
+ case "ResourceNotFoundException": return [3, 4];
645
+ case "com.amazonaws.rbin#ResourceNotFoundException": return [3, 4];
646
+ case "ValidationException": return [3, 6];
647
+ case "com.amazonaws.rbin#ValidationException": return [3, 6];
648
+ }
649
+ return [3, 8];
650
+ case 2:
651
+ _c = [{}];
652
+ return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
653
+ case 3:
654
+ response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
655
+ return [3, 9];
656
+ case 4:
657
+ _d = [{}];
658
+ return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
659
+ case 5:
660
+ response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
661
+ return [3, 9];
662
+ case 6:
663
+ _e = [{}];
664
+ return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
665
+ case 7:
666
+ response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
667
+ return [3, 9];
668
+ case 8:
669
+ parsedBody = parsedOutput.body;
670
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
671
+ response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
672
+ _g.label = 9;
673
+ case 9:
674
+ message = response.message || response.Message || errorCode;
675
+ response.message = message;
676
+ delete response.Message;
677
+ return [2, Promise.reject(Object.assign(new Error(message), response))];
678
+ }
679
+ });
680
+ }); };
681
+ export var deserializeAws_restJson1TagResourceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
682
+ var contents;
683
+ return __generator(this, function (_a) {
684
+ switch (_a.label) {
685
+ case 0:
686
+ if (output.statusCode !== 201 && output.statusCode >= 300) {
687
+ return [2, deserializeAws_restJson1TagResourceCommandError(output, context)];
688
+ }
689
+ contents = {
690
+ $metadata: deserializeMetadata(output),
691
+ };
692
+ return [4, collectBody(output.body, context)];
693
+ case 1:
694
+ _a.sent();
695
+ return [2, Promise.resolve(contents)];
696
+ }
697
+ });
698
+ }); };
699
+ var deserializeAws_restJson1TagResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
700
+ var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, _f, parsedBody, message;
701
+ var _g;
702
+ return __generator(this, function (_h) {
703
+ switch (_h.label) {
704
+ case 0:
705
+ _a = [__assign({}, output)];
706
+ _g = {};
707
+ return [4, parseBody(output.body, context)];
708
+ case 1:
709
+ parsedOutput = __assign.apply(void 0, _a.concat([(_g.body = _h.sent(), _g)]));
710
+ errorCode = "UnknownError";
711
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
712
+ _b = errorCode;
713
+ switch (_b) {
714
+ case "InternalServerException": return [3, 2];
715
+ case "com.amazonaws.rbin#InternalServerException": return [3, 2];
716
+ case "ResourceNotFoundException": return [3, 4];
717
+ case "com.amazonaws.rbin#ResourceNotFoundException": return [3, 4];
718
+ case "ServiceQuotaExceededException": return [3, 6];
719
+ case "com.amazonaws.rbin#ServiceQuotaExceededException": return [3, 6];
720
+ case "ValidationException": return [3, 8];
721
+ case "com.amazonaws.rbin#ValidationException": return [3, 8];
722
+ }
723
+ return [3, 10];
724
+ case 2:
725
+ _c = [{}];
726
+ return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
727
+ case 3:
728
+ response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
729
+ return [3, 11];
730
+ case 4:
731
+ _d = [{}];
732
+ return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
733
+ case 5:
734
+ response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
735
+ return [3, 11];
736
+ case 6:
737
+ _e = [{}];
738
+ return [4, deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)];
739
+ case 7:
740
+ response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
741
+ return [3, 11];
742
+ case 8:
743
+ _f = [{}];
744
+ return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
745
+ case 9:
746
+ response = __assign.apply(void 0, [__assign.apply(void 0, _f.concat([(_h.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
747
+ return [3, 11];
748
+ case 10:
749
+ parsedBody = parsedOutput.body;
750
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
751
+ response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
752
+ _h.label = 11;
753
+ case 11:
754
+ message = response.message || response.Message || errorCode;
755
+ response.message = message;
756
+ delete response.Message;
757
+ return [2, Promise.reject(Object.assign(new Error(message), response))];
758
+ }
759
+ });
760
+ }); };
761
+ export var deserializeAws_restJson1UntagResourceCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
762
+ var contents;
763
+ return __generator(this, function (_a) {
764
+ switch (_a.label) {
765
+ case 0:
766
+ if (output.statusCode !== 204 && output.statusCode >= 300) {
767
+ return [2, deserializeAws_restJson1UntagResourceCommandError(output, context)];
768
+ }
769
+ contents = {
770
+ $metadata: deserializeMetadata(output),
771
+ };
772
+ return [4, collectBody(output.body, context)];
773
+ case 1:
774
+ _a.sent();
775
+ return [2, Promise.resolve(contents)];
776
+ }
777
+ });
778
+ }); };
779
+ var deserializeAws_restJson1UntagResourceCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
780
+ var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
781
+ var _f;
782
+ return __generator(this, function (_g) {
783
+ switch (_g.label) {
784
+ case 0:
785
+ _a = [__assign({}, output)];
786
+ _f = {};
787
+ return [4, parseBody(output.body, context)];
788
+ case 1:
789
+ parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
790
+ errorCode = "UnknownError";
791
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
792
+ _b = errorCode;
793
+ switch (_b) {
794
+ case "InternalServerException": return [3, 2];
795
+ case "com.amazonaws.rbin#InternalServerException": return [3, 2];
796
+ case "ResourceNotFoundException": return [3, 4];
797
+ case "com.amazonaws.rbin#ResourceNotFoundException": return [3, 4];
798
+ case "ValidationException": return [3, 6];
799
+ case "com.amazonaws.rbin#ValidationException": return [3, 6];
800
+ }
801
+ return [3, 8];
802
+ case 2:
803
+ _c = [{}];
804
+ return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
805
+ case 3:
806
+ response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
807
+ return [3, 9];
808
+ case 4:
809
+ _d = [{}];
810
+ return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
811
+ case 5:
812
+ response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
813
+ return [3, 9];
814
+ case 6:
815
+ _e = [{}];
816
+ return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
817
+ case 7:
818
+ response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
819
+ return [3, 9];
820
+ case 8:
821
+ parsedBody = parsedOutput.body;
822
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
823
+ response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
824
+ _g.label = 9;
825
+ case 9:
826
+ message = response.message || response.Message || errorCode;
827
+ response.message = message;
828
+ delete response.Message;
829
+ return [2, Promise.reject(Object.assign(new Error(message), response))];
830
+ }
831
+ });
832
+ }); };
833
+ export var deserializeAws_restJson1UpdateRuleCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
834
+ var contents, data, _a, _b;
835
+ return __generator(this, function (_c) {
836
+ switch (_c.label) {
837
+ case 0:
838
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
839
+ return [2, deserializeAws_restJson1UpdateRuleCommandError(output, context)];
840
+ }
841
+ contents = {
842
+ $metadata: deserializeMetadata(output),
843
+ Description: undefined,
844
+ Identifier: undefined,
845
+ ResourceTags: undefined,
846
+ ResourceType: undefined,
847
+ RetentionPeriod: undefined,
848
+ Status: undefined,
849
+ };
850
+ _a = __expectNonNull;
851
+ _b = __expectObject;
852
+ return [4, parseBody(output.body, context)];
853
+ case 1:
854
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
855
+ if (data.Description !== undefined && data.Description !== null) {
856
+ contents.Description = __expectString(data.Description);
857
+ }
858
+ if (data.Identifier !== undefined && data.Identifier !== null) {
859
+ contents.Identifier = __expectString(data.Identifier);
860
+ }
861
+ if (data.ResourceTags !== undefined && data.ResourceTags !== null) {
862
+ contents.ResourceTags = deserializeAws_restJson1ResourceTags(data.ResourceTags, context);
863
+ }
864
+ if (data.ResourceType !== undefined && data.ResourceType !== null) {
865
+ contents.ResourceType = __expectString(data.ResourceType);
866
+ }
867
+ if (data.RetentionPeriod !== undefined && data.RetentionPeriod !== null) {
868
+ contents.RetentionPeriod = deserializeAws_restJson1RetentionPeriod(data.RetentionPeriod, context);
869
+ }
870
+ if (data.Status !== undefined && data.Status !== null) {
871
+ contents.Status = __expectString(data.Status);
872
+ }
873
+ return [2, Promise.resolve(contents)];
874
+ }
875
+ });
876
+ }); };
877
+ var deserializeAws_restJson1UpdateRuleCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
878
+ var parsedOutput, _a, response, errorCode, _b, _c, _d, _e, parsedBody, message;
879
+ var _f;
880
+ return __generator(this, function (_g) {
881
+ switch (_g.label) {
882
+ case 0:
883
+ _a = [__assign({}, output)];
884
+ _f = {};
885
+ return [4, parseBody(output.body, context)];
886
+ case 1:
887
+ parsedOutput = __assign.apply(void 0, _a.concat([(_f.body = _g.sent(), _f)]));
888
+ errorCode = "UnknownError";
889
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
890
+ _b = errorCode;
891
+ switch (_b) {
892
+ case "InternalServerException": return [3, 2];
893
+ case "com.amazonaws.rbin#InternalServerException": return [3, 2];
894
+ case "ResourceNotFoundException": return [3, 4];
895
+ case "com.amazonaws.rbin#ResourceNotFoundException": return [3, 4];
896
+ case "ValidationException": return [3, 6];
897
+ case "com.amazonaws.rbin#ValidationException": return [3, 6];
898
+ }
899
+ return [3, 8];
900
+ case 2:
901
+ _c = [{}];
902
+ return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
903
+ case 3:
904
+ response = __assign.apply(void 0, [__assign.apply(void 0, _c.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
905
+ return [3, 9];
906
+ case 4:
907
+ _d = [{}];
908
+ return [4, deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)];
909
+ case 5:
910
+ response = __assign.apply(void 0, [__assign.apply(void 0, _d.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
911
+ return [3, 9];
912
+ case 6:
913
+ _e = [{}];
914
+ return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
915
+ case 7:
916
+ response = __assign.apply(void 0, [__assign.apply(void 0, _e.concat([(_g.sent())])), { name: errorCode, $metadata: deserializeMetadata(output) }]);
917
+ return [3, 9];
918
+ case 8:
919
+ parsedBody = parsedOutput.body;
920
+ errorCode = parsedBody.code || parsedBody.Code || errorCode;
921
+ response = __assign(__assign({}, parsedBody), { name: "" + errorCode, message: parsedBody.message || parsedBody.Message || errorCode, $fault: "client", $metadata: deserializeMetadata(output) });
922
+ _g.label = 9;
923
+ case 9:
924
+ message = response.message || response.Message || errorCode;
925
+ response.message = message;
926
+ delete response.Message;
927
+ return [2, Promise.reject(Object.assign(new Error(message), response))];
928
+ }
929
+ });
930
+ }); };
931
+ var deserializeAws_restJson1InternalServerExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
932
+ var contents, data;
933
+ return __generator(this, function (_a) {
934
+ contents = {
935
+ name: "InternalServerException",
936
+ $fault: "server",
937
+ $metadata: deserializeMetadata(parsedOutput),
938
+ Message: undefined,
939
+ };
940
+ data = parsedOutput.body;
941
+ if (data.Message !== undefined && data.Message !== null) {
942
+ contents.Message = __expectString(data.Message);
943
+ }
944
+ return [2, contents];
945
+ });
946
+ }); };
947
+ var deserializeAws_restJson1ResourceNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
948
+ var contents, data;
949
+ return __generator(this, function (_a) {
950
+ contents = {
951
+ name: "ResourceNotFoundException",
952
+ $fault: "client",
953
+ $metadata: deserializeMetadata(parsedOutput),
954
+ Message: undefined,
955
+ Reason: undefined,
956
+ };
957
+ data = parsedOutput.body;
958
+ if (data.Message !== undefined && data.Message !== null) {
959
+ contents.Message = __expectString(data.Message);
960
+ }
961
+ if (data.Reason !== undefined && data.Reason !== null) {
962
+ contents.Reason = __expectString(data.Reason);
963
+ }
964
+ return [2, contents];
965
+ });
966
+ }); };
967
+ var deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
968
+ var contents, data;
969
+ return __generator(this, function (_a) {
970
+ contents = {
971
+ name: "ServiceQuotaExceededException",
972
+ $fault: "client",
973
+ $metadata: deserializeMetadata(parsedOutput),
974
+ Message: undefined,
975
+ Reason: undefined,
976
+ };
977
+ data = parsedOutput.body;
978
+ if (data.Message !== undefined && data.Message !== null) {
979
+ contents.Message = __expectString(data.Message);
980
+ }
981
+ if (data.Reason !== undefined && data.Reason !== null) {
982
+ contents.Reason = __expectString(data.Reason);
983
+ }
984
+ return [2, contents];
985
+ });
986
+ }); };
987
+ var deserializeAws_restJson1ValidationExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
988
+ var contents, data;
989
+ return __generator(this, function (_a) {
990
+ contents = {
991
+ name: "ValidationException",
992
+ $fault: "client",
993
+ $metadata: deserializeMetadata(parsedOutput),
994
+ Message: undefined,
995
+ Reason: undefined,
996
+ };
997
+ data = parsedOutput.body;
998
+ if (data.Message !== undefined && data.Message !== null) {
999
+ contents.Message = __expectString(data.Message);
1000
+ }
1001
+ if (data.Reason !== undefined && data.Reason !== null) {
1002
+ contents.Reason = __expectString(data.Reason);
1003
+ }
1004
+ return [2, contents];
1005
+ });
1006
+ }); };
1007
+ var serializeAws_restJson1ResourceTag = function (input, context) {
1008
+ return __assign(__assign({}, (input.ResourceTagKey !== undefined &&
1009
+ input.ResourceTagKey !== null && { ResourceTagKey: input.ResourceTagKey })), (input.ResourceTagValue !== undefined &&
1010
+ input.ResourceTagValue !== null && { ResourceTagValue: input.ResourceTagValue }));
1011
+ };
1012
+ var serializeAws_restJson1ResourceTags = function (input, context) {
1013
+ return input
1014
+ .filter(function (e) { return e != null; })
1015
+ .map(function (entry) {
1016
+ if (entry === null) {
1017
+ return null;
1018
+ }
1019
+ return serializeAws_restJson1ResourceTag(entry, context);
1020
+ });
1021
+ };
1022
+ var serializeAws_restJson1RetentionPeriod = function (input, context) {
1023
+ return __assign(__assign({}, (input.RetentionPeriodUnit !== undefined &&
1024
+ input.RetentionPeriodUnit !== null && { RetentionPeriodUnit: input.RetentionPeriodUnit })), (input.RetentionPeriodValue !== undefined &&
1025
+ input.RetentionPeriodValue !== null && { RetentionPeriodValue: input.RetentionPeriodValue }));
1026
+ };
1027
+ var serializeAws_restJson1Tag = function (input, context) {
1028
+ return __assign(__assign({}, (input.Key !== undefined && input.Key !== null && { Key: input.Key })), (input.Value !== undefined && input.Value !== null && { Value: input.Value }));
1029
+ };
1030
+ var serializeAws_restJson1TagList = function (input, context) {
1031
+ return input
1032
+ .filter(function (e) { return e != null; })
1033
+ .map(function (entry) {
1034
+ if (entry === null) {
1035
+ return null;
1036
+ }
1037
+ return serializeAws_restJson1Tag(entry, context);
1038
+ });
1039
+ };
1040
+ var deserializeAws_restJson1ResourceTag = function (output, context) {
1041
+ return {
1042
+ ResourceTagKey: __expectString(output.ResourceTagKey),
1043
+ ResourceTagValue: __expectString(output.ResourceTagValue),
1044
+ };
1045
+ };
1046
+ var deserializeAws_restJson1ResourceTags = function (output, context) {
1047
+ return (output || [])
1048
+ .filter(function (e) { return e != null; })
1049
+ .map(function (entry) {
1050
+ if (entry === null) {
1051
+ return null;
1052
+ }
1053
+ return deserializeAws_restJson1ResourceTag(entry, context);
1054
+ });
1055
+ };
1056
+ var deserializeAws_restJson1RetentionPeriod = function (output, context) {
1057
+ return {
1058
+ RetentionPeriodUnit: __expectString(output.RetentionPeriodUnit),
1059
+ RetentionPeriodValue: __expectInt32(output.RetentionPeriodValue),
1060
+ };
1061
+ };
1062
+ var deserializeAws_restJson1RuleSummary = function (output, context) {
1063
+ return {
1064
+ Description: __expectString(output.Description),
1065
+ Identifier: __expectString(output.Identifier),
1066
+ RetentionPeriod: output.RetentionPeriod !== undefined && output.RetentionPeriod !== null
1067
+ ? deserializeAws_restJson1RetentionPeriod(output.RetentionPeriod, context)
1068
+ : undefined,
1069
+ };
1070
+ };
1071
+ var deserializeAws_restJson1RuleSummaryList = function (output, context) {
1072
+ return (output || [])
1073
+ .filter(function (e) { return e != null; })
1074
+ .map(function (entry) {
1075
+ if (entry === null) {
1076
+ return null;
1077
+ }
1078
+ return deserializeAws_restJson1RuleSummary(entry, context);
1079
+ });
1080
+ };
1081
+ var deserializeAws_restJson1Tag = function (output, context) {
1082
+ return {
1083
+ Key: __expectString(output.Key),
1084
+ Value: __expectString(output.Value),
1085
+ };
1086
+ };
1087
+ var deserializeAws_restJson1TagList = function (output, context) {
1088
+ return (output || [])
1089
+ .filter(function (e) { return e != null; })
1090
+ .map(function (entry) {
1091
+ if (entry === null) {
1092
+ return null;
1093
+ }
1094
+ return deserializeAws_restJson1Tag(entry, context);
1095
+ });
1096
+ };
1097
+ var deserializeMetadata = function (output) {
1098
+ var _a;
1099
+ return ({
1100
+ httpStatusCode: output.statusCode,
1101
+ requestId: (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"],
1102
+ extendedRequestId: output.headers["x-amz-id-2"],
1103
+ cfId: output.headers["x-amz-cf-id"],
1104
+ });
1105
+ };
1106
+ var collectBody = function (streamBody, context) {
1107
+ if (streamBody === void 0) { streamBody = new Uint8Array(); }
1108
+ if (streamBody instanceof Uint8Array) {
1109
+ return Promise.resolve(streamBody);
1110
+ }
1111
+ return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
1112
+ };
1113
+ var collectBodyString = function (streamBody, context) {
1114
+ return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
1115
+ };
1116
+ var isSerializableHeaderValue = function (value) {
1117
+ return value !== undefined &&
1118
+ value !== null &&
1119
+ value !== "" &&
1120
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
1121
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
1122
+ };
1123
+ var parseBody = function (streamBody, context) {
1124
+ return collectBodyString(streamBody, context).then(function (encoded) {
1125
+ if (encoded.length) {
1126
+ return JSON.parse(encoded);
1127
+ }
1128
+ return {};
1129
+ });
1130
+ };
1131
+ var loadRestJsonErrorCode = function (output, data) {
1132
+ var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
1133
+ var sanitizeErrorCode = function (rawValue) {
1134
+ var cleanValue = rawValue;
1135
+ if (cleanValue.indexOf(":") >= 0) {
1136
+ cleanValue = cleanValue.split(":")[0];
1137
+ }
1138
+ if (cleanValue.indexOf("#") >= 0) {
1139
+ cleanValue = cleanValue.split("#")[1];
1140
+ }
1141
+ return cleanValue;
1142
+ };
1143
+ var headerKey = findKey(output.headers, "x-amzn-errortype");
1144
+ if (headerKey !== undefined) {
1145
+ return sanitizeErrorCode(output.headers[headerKey]);
1146
+ }
1147
+ if (data.code !== undefined) {
1148
+ return sanitizeErrorCode(data.code);
1149
+ }
1150
+ if (data["__type"] !== undefined) {
1151
+ return sanitizeErrorCode(data["__type"]);
1152
+ }
1153
+ return "";
1154
+ };