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