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