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