@aws-sdk/client-ebs 3.35.0 → 3.38.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 (129) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist-cjs/EBS.js +0 -23
  3. package/dist-cjs/EBSClient.js +0 -28
  4. package/dist-cjs/commands/CompleteSnapshotCommand.js +0 -27
  5. package/dist-cjs/commands/GetSnapshotBlockCommand.js +0 -25
  6. package/dist-cjs/commands/ListChangedBlocksCommand.js +0 -26
  7. package/dist-cjs/commands/ListSnapshotBlocksCommand.js +0 -25
  8. package/dist-cjs/commands/PutSnapshotBlockCommand.js +0 -28
  9. package/dist-cjs/commands/StartSnapshotCommand.js +0 -28
  10. package/dist-cjs/commands/index.js +9 -0
  11. package/dist-cjs/endpoints.js +1 -2
  12. package/dist-cjs/index.js +4 -12
  13. package/dist-cjs/models/index.js +0 -1
  14. package/dist-cjs/models/models_0.js +0 -70
  15. package/dist-cjs/pagination/Interfaces.js +0 -1
  16. package/dist-cjs/pagination/ListChangedBlocksPaginator.js +0 -11
  17. package/dist-cjs/pagination/ListSnapshotBlocksPaginator.js +0 -11
  18. package/dist-cjs/pagination/index.js +6 -0
  19. package/dist-cjs/protocols/Aws_restJson1.js +0 -6
  20. package/dist-cjs/runtimeConfig.browser.js +1 -6
  21. package/dist-cjs/runtimeConfig.js +2 -7
  22. package/dist-cjs/runtimeConfig.native.js +0 -4
  23. package/dist-cjs/runtimeConfig.shared.js +0 -4
  24. package/dist-es/EBS.js +0 -1
  25. package/dist-es/EBSClient.js +0 -1
  26. package/dist-es/commands/CompleteSnapshotCommand.js +0 -1
  27. package/dist-es/commands/GetSnapshotBlockCommand.js +0 -1
  28. package/dist-es/commands/ListChangedBlocksCommand.js +0 -1
  29. package/dist-es/commands/ListSnapshotBlocksCommand.js +0 -1
  30. package/dist-es/commands/PutSnapshotBlockCommand.js +0 -1
  31. package/dist-es/commands/StartSnapshotCommand.js +0 -1
  32. package/dist-es/commands/index.js +6 -0
  33. package/dist-es/endpoints.js +1 -2
  34. package/dist-es/index.js +4 -12
  35. package/dist-es/models/index.js +0 -1
  36. package/dist-es/models/models_0.js +0 -1
  37. package/dist-es/pagination/Interfaces.js +0 -1
  38. package/dist-es/pagination/ListChangedBlocksPaginator.js +0 -1
  39. package/dist-es/pagination/ListSnapshotBlocksPaginator.js +0 -1
  40. package/dist-es/pagination/index.js +3 -0
  41. package/dist-es/protocols/Aws_restJson1.js +0 -1
  42. package/dist-es/runtimeConfig.browser.js +1 -2
  43. package/dist-es/runtimeConfig.js +2 -3
  44. package/dist-es/runtimeConfig.native.js +0 -1
  45. package/dist-es/runtimeConfig.shared.js +0 -1
  46. package/dist-types/commands/index.d.ts +6 -0
  47. package/dist-types/index.d.ts +4 -11
  48. package/dist-types/pagination/index.d.ts +3 -0
  49. package/dist-types/ts3.4/EBS.d.ts +7 -49
  50. package/dist-types/ts3.4/EBSClient.d.ts +24 -108
  51. package/dist-types/ts3.4/commands/CompleteSnapshotCommand.d.ts +2 -22
  52. package/dist-types/ts3.4/commands/GetSnapshotBlockCommand.d.ts +2 -20
  53. package/dist-types/ts3.4/commands/ListChangedBlocksCommand.d.ts +2 -21
  54. package/dist-types/ts3.4/commands/ListSnapshotBlocksCommand.d.ts +2 -20
  55. package/dist-types/ts3.4/commands/PutSnapshotBlockCommand.d.ts +5 -30
  56. package/dist-types/ts3.4/commands/StartSnapshotCommand.d.ts +2 -23
  57. package/dist-types/ts3.4/commands/index.d.ts +6 -0
  58. package/dist-types/ts3.4/index.d.ts +4 -11
  59. package/dist-types/ts3.4/models/models_0.d.ts +106 -416
  60. package/dist-types/ts3.4/pagination/index.d.ts +3 -0
  61. package/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -3
  62. package/dist-types/ts3.4/runtimeConfig.d.ts +1 -3
  63. package/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -3
  64. package/dist-types/ts3.4/runtimeConfig.shared.d.ts +1 -3
  65. package/package.json +33 -30
  66. package/dist-cjs/EBS.js.map +0 -1
  67. package/dist-cjs/EBSClient.js.map +0 -1
  68. package/dist-cjs/commands/CompleteSnapshotCommand.js.map +0 -1
  69. package/dist-cjs/commands/GetSnapshotBlockCommand.js.map +0 -1
  70. package/dist-cjs/commands/ListChangedBlocksCommand.js.map +0 -1
  71. package/dist-cjs/commands/ListSnapshotBlocksCommand.js.map +0 -1
  72. package/dist-cjs/commands/PutSnapshotBlockCommand.js.map +0 -1
  73. package/dist-cjs/commands/StartSnapshotCommand.js.map +0 -1
  74. package/dist-cjs/endpoints.js.map +0 -1
  75. package/dist-cjs/index.js.map +0 -1
  76. package/dist-cjs/models/index.js.map +0 -1
  77. package/dist-cjs/models/models_0.js.map +0 -1
  78. package/dist-cjs/pagination/Interfaces.js.map +0 -1
  79. package/dist-cjs/pagination/ListChangedBlocksPaginator.js.map +0 -1
  80. package/dist-cjs/pagination/ListSnapshotBlocksPaginator.js.map +0 -1
  81. package/dist-cjs/protocols/Aws_restJson1.js.map +0 -1
  82. package/dist-cjs/runtimeConfig.browser.js.map +0 -1
  83. package/dist-cjs/runtimeConfig.js.map +0 -1
  84. package/dist-cjs/runtimeConfig.native.js.map +0 -1
  85. package/dist-cjs/runtimeConfig.shared.js.map +0 -1
  86. package/dist-es/EBS.js.map +0 -1
  87. package/dist-es/EBSClient.js.map +0 -1
  88. package/dist-es/commands/CompleteSnapshotCommand.js.map +0 -1
  89. package/dist-es/commands/GetSnapshotBlockCommand.js.map +0 -1
  90. package/dist-es/commands/ListChangedBlocksCommand.js.map +0 -1
  91. package/dist-es/commands/ListSnapshotBlocksCommand.js.map +0 -1
  92. package/dist-es/commands/PutSnapshotBlockCommand.js.map +0 -1
  93. package/dist-es/commands/StartSnapshotCommand.js.map +0 -1
  94. package/dist-es/endpoints.js.map +0 -1
  95. package/dist-es/index.js.map +0 -1
  96. package/dist-es/models/index.js.map +0 -1
  97. package/dist-es/models/models_0.js.map +0 -1
  98. package/dist-es/pagination/Interfaces.js.map +0 -1
  99. package/dist-es/pagination/ListChangedBlocksPaginator.js.map +0 -1
  100. package/dist-es/pagination/ListSnapshotBlocksPaginator.js.map +0 -1
  101. package/dist-es/protocols/Aws_restJson1.js.map +0 -1
  102. package/dist-es/runtimeConfig.browser.js.map +0 -1
  103. package/dist-es/runtimeConfig.js.map +0 -1
  104. package/dist-es/runtimeConfig.native.js.map +0 -1
  105. package/dist-es/runtimeConfig.shared.js.map +0 -1
  106. package/jest.config.js +0 -4
  107. package/src/EBS.ts +0 -258
  108. package/src/EBSClient.ts +0 -273
  109. package/src/commands/CompleteSnapshotCommand.ts +0 -97
  110. package/src/commands/GetSnapshotBlockCommand.ts +0 -95
  111. package/src/commands/ListChangedBlocksCommand.ts +0 -96
  112. package/src/commands/ListSnapshotBlocksCommand.ts +0 -95
  113. package/src/commands/PutSnapshotBlockCommand.ts +0 -107
  114. package/src/commands/StartSnapshotCommand.ts +0 -98
  115. package/src/endpoints.ts +0 -83
  116. package/src/index.ts +0 -12
  117. package/src/models/index.ts +0 -1
  118. package/src/models/models_0.ts +0 -824
  119. package/src/pagination/Interfaces.ts +0 -8
  120. package/src/pagination/ListChangedBlocksPaginator.ts +0 -59
  121. package/src/pagination/ListSnapshotBlocksPaginator.ts +0 -59
  122. package/src/protocols/Aws_restJson1.ts +0 -1238
  123. package/src/runtimeConfig.browser.ts +0 -41
  124. package/src/runtimeConfig.native.ts +0 -17
  125. package/src/runtimeConfig.shared.ts +0 -17
  126. package/src/runtimeConfig.ts +0 -46
  127. package/tsconfig.es.json +0 -10
  128. package/tsconfig.json +0 -33
  129. package/tsconfig.types.json +0 -9
@@ -1,1238 +0,0 @@
1
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
2
- import {
3
- expectInt32 as __expectInt32,
4
- expectLong as __expectLong,
5
- expectNonNull as __expectNonNull,
6
- expectNumber as __expectNumber,
7
- expectObject as __expectObject,
8
- expectString as __expectString,
9
- extendedEncodeURIComponent as __extendedEncodeURIComponent,
10
- parseEpochTimestamp as __parseEpochTimestamp,
11
- strictParseInt32 as __strictParseInt32,
12
- } from "@aws-sdk/smithy-client";
13
- import {
14
- Endpoint as __Endpoint,
15
- MetadataBearer as __MetadataBearer,
16
- ResponseMetadata as __ResponseMetadata,
17
- SerdeContext as __SerdeContext,
18
- SmithyException as __SmithyException,
19
- } from "@aws-sdk/types";
20
- import { v4 as generateIdempotencyToken } from "uuid";
21
-
22
- import { CompleteSnapshotCommandInput, CompleteSnapshotCommandOutput } from "../commands/CompleteSnapshotCommand";
23
- import { GetSnapshotBlockCommandInput, GetSnapshotBlockCommandOutput } from "../commands/GetSnapshotBlockCommand";
24
- import { ListChangedBlocksCommandInput, ListChangedBlocksCommandOutput } from "../commands/ListChangedBlocksCommand";
25
- import { ListSnapshotBlocksCommandInput, ListSnapshotBlocksCommandOutput } from "../commands/ListSnapshotBlocksCommand";
26
- import { PutSnapshotBlockCommandInput, PutSnapshotBlockCommandOutput } from "../commands/PutSnapshotBlockCommand";
27
- import { StartSnapshotCommandInput, StartSnapshotCommandOutput } from "../commands/StartSnapshotCommand";
28
- import {
29
- AccessDeniedException,
30
- Block,
31
- ChangedBlock,
32
- ConcurrentLimitExceededException,
33
- ConflictException,
34
- InternalServerException,
35
- RequestThrottledException,
36
- ResourceNotFoundException,
37
- ServiceQuotaExceededException,
38
- Tag,
39
- ValidationException,
40
- } from "../models/models_0";
41
-
42
- export const serializeAws_restJson1CompleteSnapshotCommand = async (
43
- input: CompleteSnapshotCommandInput,
44
- context: __SerdeContext
45
- ): Promise<__HttpRequest> => {
46
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
47
- const headers: any = {
48
- ...(isSerializableHeaderValue(input.ChangedBlocksCount) && {
49
- "x-amz-changedblockscount": input.ChangedBlocksCount!.toString(),
50
- }),
51
- ...(isSerializableHeaderValue(input.Checksum) && { "x-amz-checksum": input.Checksum! }),
52
- ...(isSerializableHeaderValue(input.ChecksumAlgorithm) && { "x-amz-checksum-algorithm": input.ChecksumAlgorithm! }),
53
- ...(isSerializableHeaderValue(input.ChecksumAggregationMethod) && {
54
- "x-amz-checksum-aggregation-method": input.ChecksumAggregationMethod!,
55
- }),
56
- };
57
- let resolvedPath =
58
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/snapshots/completion/{SnapshotId}";
59
- if (input.SnapshotId !== undefined) {
60
- const labelValue: string = input.SnapshotId;
61
- if (labelValue.length <= 0) {
62
- throw new Error("Empty value provided for input HTTP label: SnapshotId.");
63
- }
64
- resolvedPath = resolvedPath.replace("{SnapshotId}", __extendedEncodeURIComponent(labelValue));
65
- } else {
66
- throw new Error("No value provided for input HTTP label: SnapshotId.");
67
- }
68
- let body: any;
69
- return new __HttpRequest({
70
- protocol,
71
- hostname,
72
- port,
73
- method: "POST",
74
- headers,
75
- path: resolvedPath,
76
- body,
77
- });
78
- };
79
-
80
- export const serializeAws_restJson1GetSnapshotBlockCommand = async (
81
- input: GetSnapshotBlockCommandInput,
82
- context: __SerdeContext
83
- ): Promise<__HttpRequest> => {
84
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
85
- const headers: any = {};
86
- let resolvedPath =
87
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
88
- "/snapshots/{SnapshotId}/blocks/{BlockIndex}";
89
- if (input.SnapshotId !== undefined) {
90
- const labelValue: string = input.SnapshotId;
91
- if (labelValue.length <= 0) {
92
- throw new Error("Empty value provided for input HTTP label: SnapshotId.");
93
- }
94
- resolvedPath = resolvedPath.replace("{SnapshotId}", __extendedEncodeURIComponent(labelValue));
95
- } else {
96
- throw new Error("No value provided for input HTTP label: SnapshotId.");
97
- }
98
- if (input.BlockIndex !== undefined) {
99
- const labelValue: string = input.BlockIndex.toString();
100
- if (labelValue.length <= 0) {
101
- throw new Error("Empty value provided for input HTTP label: BlockIndex.");
102
- }
103
- resolvedPath = resolvedPath.replace("{BlockIndex}", __extendedEncodeURIComponent(labelValue));
104
- } else {
105
- throw new Error("No value provided for input HTTP label: BlockIndex.");
106
- }
107
- const query: any = {
108
- ...(input.BlockToken !== undefined && { blockToken: input.BlockToken }),
109
- };
110
- let body: any;
111
- return new __HttpRequest({
112
- protocol,
113
- hostname,
114
- port,
115
- method: "GET",
116
- headers,
117
- path: resolvedPath,
118
- query,
119
- body,
120
- });
121
- };
122
-
123
- export const serializeAws_restJson1ListChangedBlocksCommand = async (
124
- input: ListChangedBlocksCommandInput,
125
- context: __SerdeContext
126
- ): Promise<__HttpRequest> => {
127
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
128
- const headers: any = {};
129
- let resolvedPath =
130
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
131
- "/snapshots/{SecondSnapshotId}/changedblocks";
132
- if (input.SecondSnapshotId !== undefined) {
133
- const labelValue: string = input.SecondSnapshotId;
134
- if (labelValue.length <= 0) {
135
- throw new Error("Empty value provided for input HTTP label: SecondSnapshotId.");
136
- }
137
- resolvedPath = resolvedPath.replace("{SecondSnapshotId}", __extendedEncodeURIComponent(labelValue));
138
- } else {
139
- throw new Error("No value provided for input HTTP label: SecondSnapshotId.");
140
- }
141
- const query: any = {
142
- ...(input.FirstSnapshotId !== undefined && { firstSnapshotId: input.FirstSnapshotId }),
143
- ...(input.NextToken !== undefined && { pageToken: input.NextToken }),
144
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
145
- ...(input.StartingBlockIndex !== undefined && { startingBlockIndex: input.StartingBlockIndex.toString() }),
146
- };
147
- let body: any;
148
- return new __HttpRequest({
149
- protocol,
150
- hostname,
151
- port,
152
- method: "GET",
153
- headers,
154
- path: resolvedPath,
155
- query,
156
- body,
157
- });
158
- };
159
-
160
- export const serializeAws_restJson1ListSnapshotBlocksCommand = async (
161
- input: ListSnapshotBlocksCommandInput,
162
- context: __SerdeContext
163
- ): Promise<__HttpRequest> => {
164
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
165
- const headers: any = {};
166
- let resolvedPath =
167
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/snapshots/{SnapshotId}/blocks";
168
- if (input.SnapshotId !== undefined) {
169
- const labelValue: string = input.SnapshotId;
170
- if (labelValue.length <= 0) {
171
- throw new Error("Empty value provided for input HTTP label: SnapshotId.");
172
- }
173
- resolvedPath = resolvedPath.replace("{SnapshotId}", __extendedEncodeURIComponent(labelValue));
174
- } else {
175
- throw new Error("No value provided for input HTTP label: SnapshotId.");
176
- }
177
- const query: any = {
178
- ...(input.NextToken !== undefined && { pageToken: input.NextToken }),
179
- ...(input.MaxResults !== undefined && { maxResults: input.MaxResults.toString() }),
180
- ...(input.StartingBlockIndex !== undefined && { startingBlockIndex: input.StartingBlockIndex.toString() }),
181
- };
182
- let body: any;
183
- return new __HttpRequest({
184
- protocol,
185
- hostname,
186
- port,
187
- method: "GET",
188
- headers,
189
- path: resolvedPath,
190
- query,
191
- body,
192
- });
193
- };
194
-
195
- export const serializeAws_restJson1PutSnapshotBlockCommand = async (
196
- input: PutSnapshotBlockCommandInput,
197
- context: __SerdeContext
198
- ): Promise<__HttpRequest> => {
199
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
200
- const headers: any = {
201
- "content-type": "application/octet-stream",
202
- "x-amz-content-sha256": "UNSIGNED-PAYLOAD",
203
- ...(isSerializableHeaderValue(input.DataLength) && { "x-amz-data-length": input.DataLength!.toString() }),
204
- ...(isSerializableHeaderValue(input.Progress) && { "x-amz-progress": input.Progress!.toString() }),
205
- ...(isSerializableHeaderValue(input.Checksum) && { "x-amz-checksum": input.Checksum! }),
206
- ...(isSerializableHeaderValue(input.ChecksumAlgorithm) && { "x-amz-checksum-algorithm": input.ChecksumAlgorithm! }),
207
- };
208
- let resolvedPath =
209
- `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
210
- "/snapshots/{SnapshotId}/blocks/{BlockIndex}";
211
- if (input.SnapshotId !== undefined) {
212
- const labelValue: string = input.SnapshotId;
213
- if (labelValue.length <= 0) {
214
- throw new Error("Empty value provided for input HTTP label: SnapshotId.");
215
- }
216
- resolvedPath = resolvedPath.replace("{SnapshotId}", __extendedEncodeURIComponent(labelValue));
217
- } else {
218
- throw new Error("No value provided for input HTTP label: SnapshotId.");
219
- }
220
- if (input.BlockIndex !== undefined) {
221
- const labelValue: string = input.BlockIndex.toString();
222
- if (labelValue.length <= 0) {
223
- throw new Error("Empty value provided for input HTTP label: BlockIndex.");
224
- }
225
- resolvedPath = resolvedPath.replace("{BlockIndex}", __extendedEncodeURIComponent(labelValue));
226
- } else {
227
- throw new Error("No value provided for input HTTP label: BlockIndex.");
228
- }
229
- let body: any;
230
- if (input.BlockData !== undefined) {
231
- body = input.BlockData;
232
- }
233
- return new __HttpRequest({
234
- protocol,
235
- hostname,
236
- port,
237
- method: "PUT",
238
- headers,
239
- path: resolvedPath,
240
- body,
241
- });
242
- };
243
-
244
- export const serializeAws_restJson1StartSnapshotCommand = async (
245
- input: StartSnapshotCommandInput,
246
- context: __SerdeContext
247
- ): Promise<__HttpRequest> => {
248
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
249
- const headers: any = {
250
- "content-type": "application/json",
251
- };
252
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/snapshots";
253
- let body: any;
254
- body = JSON.stringify({
255
- ClientToken: input.ClientToken ?? generateIdempotencyToken(),
256
- ...(input.Description !== undefined && input.Description !== null && { Description: input.Description }),
257
- ...(input.Encrypted !== undefined && input.Encrypted !== null && { Encrypted: input.Encrypted }),
258
- ...(input.KmsKeyArn !== undefined && input.KmsKeyArn !== null && { KmsKeyArn: input.KmsKeyArn }),
259
- ...(input.ParentSnapshotId !== undefined &&
260
- input.ParentSnapshotId !== null && { ParentSnapshotId: input.ParentSnapshotId }),
261
- ...(input.Tags !== undefined && input.Tags !== null && { Tags: serializeAws_restJson1Tags(input.Tags, context) }),
262
- ...(input.Timeout !== undefined && input.Timeout !== null && { Timeout: input.Timeout }),
263
- ...(input.VolumeSize !== undefined && input.VolumeSize !== null && { VolumeSize: input.VolumeSize }),
264
- });
265
- return new __HttpRequest({
266
- protocol,
267
- hostname,
268
- port,
269
- method: "POST",
270
- headers,
271
- path: resolvedPath,
272
- body,
273
- });
274
- };
275
-
276
- export const deserializeAws_restJson1CompleteSnapshotCommand = async (
277
- output: __HttpResponse,
278
- context: __SerdeContext
279
- ): Promise<CompleteSnapshotCommandOutput> => {
280
- if (output.statusCode !== 202 && output.statusCode >= 300) {
281
- return deserializeAws_restJson1CompleteSnapshotCommandError(output, context);
282
- }
283
- const contents: CompleteSnapshotCommandOutput = {
284
- $metadata: deserializeMetadata(output),
285
- Status: undefined,
286
- };
287
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
288
- if (data.Status !== undefined && data.Status !== null) {
289
- contents.Status = __expectString(data.Status);
290
- }
291
- return Promise.resolve(contents);
292
- };
293
-
294
- const deserializeAws_restJson1CompleteSnapshotCommandError = async (
295
- output: __HttpResponse,
296
- context: __SerdeContext
297
- ): Promise<CompleteSnapshotCommandOutput> => {
298
- const parsedOutput: any = {
299
- ...output,
300
- body: await parseBody(output.body, context),
301
- };
302
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
303
- let errorCode = "UnknownError";
304
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
305
- switch (errorCode) {
306
- case "AccessDeniedException":
307
- case "com.amazonaws.ebs#AccessDeniedException":
308
- response = {
309
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
310
- name: errorCode,
311
- $metadata: deserializeMetadata(output),
312
- };
313
- break;
314
- case "InternalServerException":
315
- case "com.amazonaws.ebs#InternalServerException":
316
- response = {
317
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
318
- name: errorCode,
319
- $metadata: deserializeMetadata(output),
320
- };
321
- break;
322
- case "RequestThrottledException":
323
- case "com.amazonaws.ebs#RequestThrottledException":
324
- response = {
325
- ...(await deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context)),
326
- name: errorCode,
327
- $metadata: deserializeMetadata(output),
328
- };
329
- break;
330
- case "ResourceNotFoundException":
331
- case "com.amazonaws.ebs#ResourceNotFoundException":
332
- response = {
333
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
334
- name: errorCode,
335
- $metadata: deserializeMetadata(output),
336
- };
337
- break;
338
- case "ServiceQuotaExceededException":
339
- case "com.amazonaws.ebs#ServiceQuotaExceededException":
340
- response = {
341
- ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
342
- name: errorCode,
343
- $metadata: deserializeMetadata(output),
344
- };
345
- break;
346
- case "ValidationException":
347
- case "com.amazonaws.ebs#ValidationException":
348
- response = {
349
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
350
- name: errorCode,
351
- $metadata: deserializeMetadata(output),
352
- };
353
- break;
354
- default:
355
- const parsedBody = parsedOutput.body;
356
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
357
- response = {
358
- ...parsedBody,
359
- name: `${errorCode}`,
360
- message: parsedBody.message || parsedBody.Message || errorCode,
361
- $fault: "client",
362
- $metadata: deserializeMetadata(output),
363
- } as any;
364
- }
365
- const message = response.message || response.Message || errorCode;
366
- response.message = message;
367
- delete response.Message;
368
- return Promise.reject(Object.assign(new Error(message), response));
369
- };
370
-
371
- export const deserializeAws_restJson1GetSnapshotBlockCommand = async (
372
- output: __HttpResponse,
373
- context: __SerdeContext
374
- ): Promise<GetSnapshotBlockCommandOutput> => {
375
- if (output.statusCode !== 200 && output.statusCode >= 300) {
376
- return deserializeAws_restJson1GetSnapshotBlockCommandError(output, context);
377
- }
378
- const contents: GetSnapshotBlockCommandOutput = {
379
- $metadata: deserializeMetadata(output),
380
- BlockData: undefined,
381
- Checksum: undefined,
382
- ChecksumAlgorithm: undefined,
383
- DataLength: undefined,
384
- };
385
- if (output.headers["x-amz-data-length"] !== undefined) {
386
- contents.DataLength = __strictParseInt32(output.headers["x-amz-data-length"]);
387
- }
388
- if (output.headers["x-amz-checksum"] !== undefined) {
389
- contents.Checksum = output.headers["x-amz-checksum"];
390
- }
391
- if (output.headers["x-amz-checksum-algorithm"] !== undefined) {
392
- contents.ChecksumAlgorithm = output.headers["x-amz-checksum-algorithm"];
393
- }
394
- const data: any = output.body;
395
- contents.BlockData = data;
396
- return Promise.resolve(contents);
397
- };
398
-
399
- const deserializeAws_restJson1GetSnapshotBlockCommandError = async (
400
- output: __HttpResponse,
401
- context: __SerdeContext
402
- ): Promise<GetSnapshotBlockCommandOutput> => {
403
- const parsedOutput: any = {
404
- ...output,
405
- body: await parseBody(output.body, context),
406
- };
407
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
408
- let errorCode = "UnknownError";
409
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
410
- switch (errorCode) {
411
- case "AccessDeniedException":
412
- case "com.amazonaws.ebs#AccessDeniedException":
413
- response = {
414
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
415
- name: errorCode,
416
- $metadata: deserializeMetadata(output),
417
- };
418
- break;
419
- case "InternalServerException":
420
- case "com.amazonaws.ebs#InternalServerException":
421
- response = {
422
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
423
- name: errorCode,
424
- $metadata: deserializeMetadata(output),
425
- };
426
- break;
427
- case "RequestThrottledException":
428
- case "com.amazonaws.ebs#RequestThrottledException":
429
- response = {
430
- ...(await deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context)),
431
- name: errorCode,
432
- $metadata: deserializeMetadata(output),
433
- };
434
- break;
435
- case "ResourceNotFoundException":
436
- case "com.amazonaws.ebs#ResourceNotFoundException":
437
- response = {
438
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
439
- name: errorCode,
440
- $metadata: deserializeMetadata(output),
441
- };
442
- break;
443
- case "ServiceQuotaExceededException":
444
- case "com.amazonaws.ebs#ServiceQuotaExceededException":
445
- response = {
446
- ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
447
- name: errorCode,
448
- $metadata: deserializeMetadata(output),
449
- };
450
- break;
451
- case "ValidationException":
452
- case "com.amazonaws.ebs#ValidationException":
453
- response = {
454
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
455
- name: errorCode,
456
- $metadata: deserializeMetadata(output),
457
- };
458
- break;
459
- default:
460
- const parsedBody = parsedOutput.body;
461
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
462
- response = {
463
- ...parsedBody,
464
- name: `${errorCode}`,
465
- message: parsedBody.message || parsedBody.Message || errorCode,
466
- $fault: "client",
467
- $metadata: deserializeMetadata(output),
468
- } as any;
469
- }
470
- const message = response.message || response.Message || errorCode;
471
- response.message = message;
472
- delete response.Message;
473
- return Promise.reject(Object.assign(new Error(message), response));
474
- };
475
-
476
- export const deserializeAws_restJson1ListChangedBlocksCommand = async (
477
- output: __HttpResponse,
478
- context: __SerdeContext
479
- ): Promise<ListChangedBlocksCommandOutput> => {
480
- if (output.statusCode !== 200 && output.statusCode >= 300) {
481
- return deserializeAws_restJson1ListChangedBlocksCommandError(output, context);
482
- }
483
- const contents: ListChangedBlocksCommandOutput = {
484
- $metadata: deserializeMetadata(output),
485
- BlockSize: undefined,
486
- ChangedBlocks: undefined,
487
- ExpiryTime: undefined,
488
- NextToken: undefined,
489
- VolumeSize: undefined,
490
- };
491
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
492
- if (data.BlockSize !== undefined && data.BlockSize !== null) {
493
- contents.BlockSize = __expectInt32(data.BlockSize);
494
- }
495
- if (data.ChangedBlocks !== undefined && data.ChangedBlocks !== null) {
496
- contents.ChangedBlocks = deserializeAws_restJson1ChangedBlocks(data.ChangedBlocks, context);
497
- }
498
- if (data.ExpiryTime !== undefined && data.ExpiryTime !== null) {
499
- contents.ExpiryTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.ExpiryTime)));
500
- }
501
- if (data.NextToken !== undefined && data.NextToken !== null) {
502
- contents.NextToken = __expectString(data.NextToken);
503
- }
504
- if (data.VolumeSize !== undefined && data.VolumeSize !== null) {
505
- contents.VolumeSize = __expectLong(data.VolumeSize);
506
- }
507
- return Promise.resolve(contents);
508
- };
509
-
510
- const deserializeAws_restJson1ListChangedBlocksCommandError = async (
511
- output: __HttpResponse,
512
- context: __SerdeContext
513
- ): Promise<ListChangedBlocksCommandOutput> => {
514
- const parsedOutput: any = {
515
- ...output,
516
- body: await parseBody(output.body, context),
517
- };
518
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
519
- let errorCode = "UnknownError";
520
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
521
- switch (errorCode) {
522
- case "AccessDeniedException":
523
- case "com.amazonaws.ebs#AccessDeniedException":
524
- response = {
525
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
526
- name: errorCode,
527
- $metadata: deserializeMetadata(output),
528
- };
529
- break;
530
- case "InternalServerException":
531
- case "com.amazonaws.ebs#InternalServerException":
532
- response = {
533
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
534
- name: errorCode,
535
- $metadata: deserializeMetadata(output),
536
- };
537
- break;
538
- case "RequestThrottledException":
539
- case "com.amazonaws.ebs#RequestThrottledException":
540
- response = {
541
- ...(await deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context)),
542
- name: errorCode,
543
- $metadata: deserializeMetadata(output),
544
- };
545
- break;
546
- case "ResourceNotFoundException":
547
- case "com.amazonaws.ebs#ResourceNotFoundException":
548
- response = {
549
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
550
- name: errorCode,
551
- $metadata: deserializeMetadata(output),
552
- };
553
- break;
554
- case "ServiceQuotaExceededException":
555
- case "com.amazonaws.ebs#ServiceQuotaExceededException":
556
- response = {
557
- ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
558
- name: errorCode,
559
- $metadata: deserializeMetadata(output),
560
- };
561
- break;
562
- case "ValidationException":
563
- case "com.amazonaws.ebs#ValidationException":
564
- response = {
565
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
566
- name: errorCode,
567
- $metadata: deserializeMetadata(output),
568
- };
569
- break;
570
- default:
571
- const parsedBody = parsedOutput.body;
572
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
573
- response = {
574
- ...parsedBody,
575
- name: `${errorCode}`,
576
- message: parsedBody.message || parsedBody.Message || errorCode,
577
- $fault: "client",
578
- $metadata: deserializeMetadata(output),
579
- } as any;
580
- }
581
- const message = response.message || response.Message || errorCode;
582
- response.message = message;
583
- delete response.Message;
584
- return Promise.reject(Object.assign(new Error(message), response));
585
- };
586
-
587
- export const deserializeAws_restJson1ListSnapshotBlocksCommand = async (
588
- output: __HttpResponse,
589
- context: __SerdeContext
590
- ): Promise<ListSnapshotBlocksCommandOutput> => {
591
- if (output.statusCode !== 200 && output.statusCode >= 300) {
592
- return deserializeAws_restJson1ListSnapshotBlocksCommandError(output, context);
593
- }
594
- const contents: ListSnapshotBlocksCommandOutput = {
595
- $metadata: deserializeMetadata(output),
596
- BlockSize: undefined,
597
- Blocks: undefined,
598
- ExpiryTime: undefined,
599
- NextToken: undefined,
600
- VolumeSize: undefined,
601
- };
602
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
603
- if (data.BlockSize !== undefined && data.BlockSize !== null) {
604
- contents.BlockSize = __expectInt32(data.BlockSize);
605
- }
606
- if (data.Blocks !== undefined && data.Blocks !== null) {
607
- contents.Blocks = deserializeAws_restJson1Blocks(data.Blocks, context);
608
- }
609
- if (data.ExpiryTime !== undefined && data.ExpiryTime !== null) {
610
- contents.ExpiryTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.ExpiryTime)));
611
- }
612
- if (data.NextToken !== undefined && data.NextToken !== null) {
613
- contents.NextToken = __expectString(data.NextToken);
614
- }
615
- if (data.VolumeSize !== undefined && data.VolumeSize !== null) {
616
- contents.VolumeSize = __expectLong(data.VolumeSize);
617
- }
618
- return Promise.resolve(contents);
619
- };
620
-
621
- const deserializeAws_restJson1ListSnapshotBlocksCommandError = async (
622
- output: __HttpResponse,
623
- context: __SerdeContext
624
- ): Promise<ListSnapshotBlocksCommandOutput> => {
625
- const parsedOutput: any = {
626
- ...output,
627
- body: await parseBody(output.body, context),
628
- };
629
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
630
- let errorCode = "UnknownError";
631
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
632
- switch (errorCode) {
633
- case "AccessDeniedException":
634
- case "com.amazonaws.ebs#AccessDeniedException":
635
- response = {
636
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
637
- name: errorCode,
638
- $metadata: deserializeMetadata(output),
639
- };
640
- break;
641
- case "InternalServerException":
642
- case "com.amazonaws.ebs#InternalServerException":
643
- response = {
644
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
645
- name: errorCode,
646
- $metadata: deserializeMetadata(output),
647
- };
648
- break;
649
- case "RequestThrottledException":
650
- case "com.amazonaws.ebs#RequestThrottledException":
651
- response = {
652
- ...(await deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context)),
653
- name: errorCode,
654
- $metadata: deserializeMetadata(output),
655
- };
656
- break;
657
- case "ResourceNotFoundException":
658
- case "com.amazonaws.ebs#ResourceNotFoundException":
659
- response = {
660
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
661
- name: errorCode,
662
- $metadata: deserializeMetadata(output),
663
- };
664
- break;
665
- case "ServiceQuotaExceededException":
666
- case "com.amazonaws.ebs#ServiceQuotaExceededException":
667
- response = {
668
- ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
669
- name: errorCode,
670
- $metadata: deserializeMetadata(output),
671
- };
672
- break;
673
- case "ValidationException":
674
- case "com.amazonaws.ebs#ValidationException":
675
- response = {
676
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
677
- name: errorCode,
678
- $metadata: deserializeMetadata(output),
679
- };
680
- break;
681
- default:
682
- const parsedBody = parsedOutput.body;
683
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
684
- response = {
685
- ...parsedBody,
686
- name: `${errorCode}`,
687
- message: parsedBody.message || parsedBody.Message || errorCode,
688
- $fault: "client",
689
- $metadata: deserializeMetadata(output),
690
- } as any;
691
- }
692
- const message = response.message || response.Message || errorCode;
693
- response.message = message;
694
- delete response.Message;
695
- return Promise.reject(Object.assign(new Error(message), response));
696
- };
697
-
698
- export const deserializeAws_restJson1PutSnapshotBlockCommand = async (
699
- output: __HttpResponse,
700
- context: __SerdeContext
701
- ): Promise<PutSnapshotBlockCommandOutput> => {
702
- if (output.statusCode !== 201 && output.statusCode >= 300) {
703
- return deserializeAws_restJson1PutSnapshotBlockCommandError(output, context);
704
- }
705
- const contents: PutSnapshotBlockCommandOutput = {
706
- $metadata: deserializeMetadata(output),
707
- Checksum: undefined,
708
- ChecksumAlgorithm: undefined,
709
- };
710
- if (output.headers["x-amz-checksum"] !== undefined) {
711
- contents.Checksum = output.headers["x-amz-checksum"];
712
- }
713
- if (output.headers["x-amz-checksum-algorithm"] !== undefined) {
714
- contents.ChecksumAlgorithm = output.headers["x-amz-checksum-algorithm"];
715
- }
716
- await collectBody(output.body, context);
717
- return Promise.resolve(contents);
718
- };
719
-
720
- const deserializeAws_restJson1PutSnapshotBlockCommandError = async (
721
- output: __HttpResponse,
722
- context: __SerdeContext
723
- ): Promise<PutSnapshotBlockCommandOutput> => {
724
- const parsedOutput: any = {
725
- ...output,
726
- body: await parseBody(output.body, context),
727
- };
728
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
729
- let errorCode = "UnknownError";
730
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
731
- switch (errorCode) {
732
- case "AccessDeniedException":
733
- case "com.amazonaws.ebs#AccessDeniedException":
734
- response = {
735
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
736
- name: errorCode,
737
- $metadata: deserializeMetadata(output),
738
- };
739
- break;
740
- case "InternalServerException":
741
- case "com.amazonaws.ebs#InternalServerException":
742
- response = {
743
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
744
- name: errorCode,
745
- $metadata: deserializeMetadata(output),
746
- };
747
- break;
748
- case "RequestThrottledException":
749
- case "com.amazonaws.ebs#RequestThrottledException":
750
- response = {
751
- ...(await deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context)),
752
- name: errorCode,
753
- $metadata: deserializeMetadata(output),
754
- };
755
- break;
756
- case "ResourceNotFoundException":
757
- case "com.amazonaws.ebs#ResourceNotFoundException":
758
- response = {
759
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
760
- name: errorCode,
761
- $metadata: deserializeMetadata(output),
762
- };
763
- break;
764
- case "ServiceQuotaExceededException":
765
- case "com.amazonaws.ebs#ServiceQuotaExceededException":
766
- response = {
767
- ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
768
- name: errorCode,
769
- $metadata: deserializeMetadata(output),
770
- };
771
- break;
772
- case "ValidationException":
773
- case "com.amazonaws.ebs#ValidationException":
774
- response = {
775
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
776
- name: errorCode,
777
- $metadata: deserializeMetadata(output),
778
- };
779
- break;
780
- default:
781
- const parsedBody = parsedOutput.body;
782
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
783
- response = {
784
- ...parsedBody,
785
- name: `${errorCode}`,
786
- message: parsedBody.message || parsedBody.Message || errorCode,
787
- $fault: "client",
788
- $metadata: deserializeMetadata(output),
789
- } as any;
790
- }
791
- const message = response.message || response.Message || errorCode;
792
- response.message = message;
793
- delete response.Message;
794
- return Promise.reject(Object.assign(new Error(message), response));
795
- };
796
-
797
- export const deserializeAws_restJson1StartSnapshotCommand = async (
798
- output: __HttpResponse,
799
- context: __SerdeContext
800
- ): Promise<StartSnapshotCommandOutput> => {
801
- if (output.statusCode !== 201 && output.statusCode >= 300) {
802
- return deserializeAws_restJson1StartSnapshotCommandError(output, context);
803
- }
804
- const contents: StartSnapshotCommandOutput = {
805
- $metadata: deserializeMetadata(output),
806
- BlockSize: undefined,
807
- Description: undefined,
808
- KmsKeyArn: undefined,
809
- OwnerId: undefined,
810
- ParentSnapshotId: undefined,
811
- SnapshotId: undefined,
812
- StartTime: undefined,
813
- Status: undefined,
814
- Tags: undefined,
815
- VolumeSize: undefined,
816
- };
817
- const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
818
- if (data.BlockSize !== undefined && data.BlockSize !== null) {
819
- contents.BlockSize = __expectInt32(data.BlockSize);
820
- }
821
- if (data.Description !== undefined && data.Description !== null) {
822
- contents.Description = __expectString(data.Description);
823
- }
824
- if (data.KmsKeyArn !== undefined && data.KmsKeyArn !== null) {
825
- contents.KmsKeyArn = __expectString(data.KmsKeyArn);
826
- }
827
- if (data.OwnerId !== undefined && data.OwnerId !== null) {
828
- contents.OwnerId = __expectString(data.OwnerId);
829
- }
830
- if (data.ParentSnapshotId !== undefined && data.ParentSnapshotId !== null) {
831
- contents.ParentSnapshotId = __expectString(data.ParentSnapshotId);
832
- }
833
- if (data.SnapshotId !== undefined && data.SnapshotId !== null) {
834
- contents.SnapshotId = __expectString(data.SnapshotId);
835
- }
836
- if (data.StartTime !== undefined && data.StartTime !== null) {
837
- contents.StartTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.StartTime)));
838
- }
839
- if (data.Status !== undefined && data.Status !== null) {
840
- contents.Status = __expectString(data.Status);
841
- }
842
- if (data.Tags !== undefined && data.Tags !== null) {
843
- contents.Tags = deserializeAws_restJson1Tags(data.Tags, context);
844
- }
845
- if (data.VolumeSize !== undefined && data.VolumeSize !== null) {
846
- contents.VolumeSize = __expectLong(data.VolumeSize);
847
- }
848
- return Promise.resolve(contents);
849
- };
850
-
851
- const deserializeAws_restJson1StartSnapshotCommandError = async (
852
- output: __HttpResponse,
853
- context: __SerdeContext
854
- ): Promise<StartSnapshotCommandOutput> => {
855
- const parsedOutput: any = {
856
- ...output,
857
- body: await parseBody(output.body, context),
858
- };
859
- let response: __SmithyException & __MetadataBearer & { [key: string]: any };
860
- let errorCode = "UnknownError";
861
- errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
862
- switch (errorCode) {
863
- case "AccessDeniedException":
864
- case "com.amazonaws.ebs#AccessDeniedException":
865
- response = {
866
- ...(await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)),
867
- name: errorCode,
868
- $metadata: deserializeMetadata(output),
869
- };
870
- break;
871
- case "ConcurrentLimitExceededException":
872
- case "com.amazonaws.ebs#ConcurrentLimitExceededException":
873
- response = {
874
- ...(await deserializeAws_restJson1ConcurrentLimitExceededExceptionResponse(parsedOutput, context)),
875
- name: errorCode,
876
- $metadata: deserializeMetadata(output),
877
- };
878
- break;
879
- case "ConflictException":
880
- case "com.amazonaws.ebs#ConflictException":
881
- response = {
882
- ...(await deserializeAws_restJson1ConflictExceptionResponse(parsedOutput, context)),
883
- name: errorCode,
884
- $metadata: deserializeMetadata(output),
885
- };
886
- break;
887
- case "InternalServerException":
888
- case "com.amazonaws.ebs#InternalServerException":
889
- response = {
890
- ...(await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)),
891
- name: errorCode,
892
- $metadata: deserializeMetadata(output),
893
- };
894
- break;
895
- case "RequestThrottledException":
896
- case "com.amazonaws.ebs#RequestThrottledException":
897
- response = {
898
- ...(await deserializeAws_restJson1RequestThrottledExceptionResponse(parsedOutput, context)),
899
- name: errorCode,
900
- $metadata: deserializeMetadata(output),
901
- };
902
- break;
903
- case "ResourceNotFoundException":
904
- case "com.amazonaws.ebs#ResourceNotFoundException":
905
- response = {
906
- ...(await deserializeAws_restJson1ResourceNotFoundExceptionResponse(parsedOutput, context)),
907
- name: errorCode,
908
- $metadata: deserializeMetadata(output),
909
- };
910
- break;
911
- case "ServiceQuotaExceededException":
912
- case "com.amazonaws.ebs#ServiceQuotaExceededException":
913
- response = {
914
- ...(await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)),
915
- name: errorCode,
916
- $metadata: deserializeMetadata(output),
917
- };
918
- break;
919
- case "ValidationException":
920
- case "com.amazonaws.ebs#ValidationException":
921
- response = {
922
- ...(await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)),
923
- name: errorCode,
924
- $metadata: deserializeMetadata(output),
925
- };
926
- break;
927
- default:
928
- const parsedBody = parsedOutput.body;
929
- errorCode = parsedBody.code || parsedBody.Code || errorCode;
930
- response = {
931
- ...parsedBody,
932
- name: `${errorCode}`,
933
- message: parsedBody.message || parsedBody.Message || errorCode,
934
- $fault: "client",
935
- $metadata: deserializeMetadata(output),
936
- } as any;
937
- }
938
- const message = response.message || response.Message || errorCode;
939
- response.message = message;
940
- delete response.Message;
941
- return Promise.reject(Object.assign(new Error(message), response));
942
- };
943
-
944
- const deserializeAws_restJson1AccessDeniedExceptionResponse = async (
945
- parsedOutput: any,
946
- context: __SerdeContext
947
- ): Promise<AccessDeniedException> => {
948
- const contents: AccessDeniedException = {
949
- name: "AccessDeniedException",
950
- $fault: "client",
951
- $metadata: deserializeMetadata(parsedOutput),
952
- Message: undefined,
953
- Reason: undefined,
954
- };
955
- const data: any = parsedOutput.body;
956
- if (data.Message !== undefined && data.Message !== null) {
957
- contents.Message = __expectString(data.Message);
958
- }
959
- if (data.Reason !== undefined && data.Reason !== null) {
960
- contents.Reason = __expectString(data.Reason);
961
- }
962
- return contents;
963
- };
964
-
965
- const deserializeAws_restJson1ConcurrentLimitExceededExceptionResponse = async (
966
- parsedOutput: any,
967
- context: __SerdeContext
968
- ): Promise<ConcurrentLimitExceededException> => {
969
- const contents: ConcurrentLimitExceededException = {
970
- name: "ConcurrentLimitExceededException",
971
- $fault: "client",
972
- $metadata: deserializeMetadata(parsedOutput),
973
- Message: undefined,
974
- };
975
- const data: any = parsedOutput.body;
976
- if (data.Message !== undefined && data.Message !== null) {
977
- contents.Message = __expectString(data.Message);
978
- }
979
- return contents;
980
- };
981
-
982
- const deserializeAws_restJson1ConflictExceptionResponse = async (
983
- parsedOutput: any,
984
- context: __SerdeContext
985
- ): Promise<ConflictException> => {
986
- const contents: ConflictException = {
987
- name: "ConflictException",
988
- $fault: "server",
989
- $metadata: deserializeMetadata(parsedOutput),
990
- Message: undefined,
991
- };
992
- const data: any = parsedOutput.body;
993
- if (data.Message !== undefined && data.Message !== null) {
994
- contents.Message = __expectString(data.Message);
995
- }
996
- return contents;
997
- };
998
-
999
- const deserializeAws_restJson1InternalServerExceptionResponse = async (
1000
- parsedOutput: any,
1001
- context: __SerdeContext
1002
- ): Promise<InternalServerException> => {
1003
- const contents: InternalServerException = {
1004
- name: "InternalServerException",
1005
- $fault: "server",
1006
- $metadata: deserializeMetadata(parsedOutput),
1007
- Message: undefined,
1008
- };
1009
- const data: any = parsedOutput.body;
1010
- if (data.Message !== undefined && data.Message !== null) {
1011
- contents.Message = __expectString(data.Message);
1012
- }
1013
- return contents;
1014
- };
1015
-
1016
- const deserializeAws_restJson1RequestThrottledExceptionResponse = async (
1017
- parsedOutput: any,
1018
- context: __SerdeContext
1019
- ): Promise<RequestThrottledException> => {
1020
- const contents: RequestThrottledException = {
1021
- name: "RequestThrottledException",
1022
- $fault: "client",
1023
- $metadata: deserializeMetadata(parsedOutput),
1024
- Message: undefined,
1025
- Reason: undefined,
1026
- };
1027
- const data: any = parsedOutput.body;
1028
- if (data.Message !== undefined && data.Message !== null) {
1029
- contents.Message = __expectString(data.Message);
1030
- }
1031
- if (data.Reason !== undefined && data.Reason !== null) {
1032
- contents.Reason = __expectString(data.Reason);
1033
- }
1034
- return contents;
1035
- };
1036
-
1037
- const deserializeAws_restJson1ResourceNotFoundExceptionResponse = async (
1038
- parsedOutput: any,
1039
- context: __SerdeContext
1040
- ): Promise<ResourceNotFoundException> => {
1041
- const contents: ResourceNotFoundException = {
1042
- name: "ResourceNotFoundException",
1043
- $fault: "client",
1044
- $metadata: deserializeMetadata(parsedOutput),
1045
- Message: undefined,
1046
- Reason: undefined,
1047
- };
1048
- const data: any = parsedOutput.body;
1049
- if (data.Message !== undefined && data.Message !== null) {
1050
- contents.Message = __expectString(data.Message);
1051
- }
1052
- if (data.Reason !== undefined && data.Reason !== null) {
1053
- contents.Reason = __expectString(data.Reason);
1054
- }
1055
- return contents;
1056
- };
1057
-
1058
- const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (
1059
- parsedOutput: any,
1060
- context: __SerdeContext
1061
- ): Promise<ServiceQuotaExceededException> => {
1062
- const contents: ServiceQuotaExceededException = {
1063
- name: "ServiceQuotaExceededException",
1064
- $fault: "client",
1065
- $metadata: deserializeMetadata(parsedOutput),
1066
- Message: undefined,
1067
- Reason: undefined,
1068
- };
1069
- const data: any = parsedOutput.body;
1070
- if (data.Message !== undefined && data.Message !== null) {
1071
- contents.Message = __expectString(data.Message);
1072
- }
1073
- if (data.Reason !== undefined && data.Reason !== null) {
1074
- contents.Reason = __expectString(data.Reason);
1075
- }
1076
- return contents;
1077
- };
1078
-
1079
- const deserializeAws_restJson1ValidationExceptionResponse = async (
1080
- parsedOutput: any,
1081
- context: __SerdeContext
1082
- ): Promise<ValidationException> => {
1083
- const contents: ValidationException = {
1084
- name: "ValidationException",
1085
- $fault: "client",
1086
- $metadata: deserializeMetadata(parsedOutput),
1087
- Message: undefined,
1088
- Reason: undefined,
1089
- };
1090
- const data: any = parsedOutput.body;
1091
- if (data.Message !== undefined && data.Message !== null) {
1092
- contents.Message = __expectString(data.Message);
1093
- }
1094
- if (data.Reason !== undefined && data.Reason !== null) {
1095
- contents.Reason = __expectString(data.Reason);
1096
- }
1097
- return contents;
1098
- };
1099
-
1100
- const serializeAws_restJson1Tag = (input: Tag, context: __SerdeContext): any => {
1101
- return {
1102
- ...(input.Key !== undefined && input.Key !== null && { Key: input.Key }),
1103
- ...(input.Value !== undefined && input.Value !== null && { Value: input.Value }),
1104
- };
1105
- };
1106
-
1107
- const serializeAws_restJson1Tags = (input: Tag[], context: __SerdeContext): any => {
1108
- return input
1109
- .filter((e: any) => e != null)
1110
- .map((entry) => {
1111
- if (entry === null) {
1112
- return null as any;
1113
- }
1114
- return serializeAws_restJson1Tag(entry, context);
1115
- });
1116
- };
1117
-
1118
- const deserializeAws_restJson1Block = (output: any, context: __SerdeContext): Block => {
1119
- return {
1120
- BlockIndex: __expectInt32(output.BlockIndex),
1121
- BlockToken: __expectString(output.BlockToken),
1122
- } as any;
1123
- };
1124
-
1125
- const deserializeAws_restJson1Blocks = (output: any, context: __SerdeContext): Block[] => {
1126
- return (output || [])
1127
- .filter((e: any) => e != null)
1128
- .map((entry: any) => {
1129
- if (entry === null) {
1130
- return null as any;
1131
- }
1132
- return deserializeAws_restJson1Block(entry, context);
1133
- });
1134
- };
1135
-
1136
- const deserializeAws_restJson1ChangedBlock = (output: any, context: __SerdeContext): ChangedBlock => {
1137
- return {
1138
- BlockIndex: __expectInt32(output.BlockIndex),
1139
- FirstBlockToken: __expectString(output.FirstBlockToken),
1140
- SecondBlockToken: __expectString(output.SecondBlockToken),
1141
- } as any;
1142
- };
1143
-
1144
- const deserializeAws_restJson1ChangedBlocks = (output: any, context: __SerdeContext): ChangedBlock[] => {
1145
- return (output || [])
1146
- .filter((e: any) => e != null)
1147
- .map((entry: any) => {
1148
- if (entry === null) {
1149
- return null as any;
1150
- }
1151
- return deserializeAws_restJson1ChangedBlock(entry, context);
1152
- });
1153
- };
1154
-
1155
- const deserializeAws_restJson1Tag = (output: any, context: __SerdeContext): Tag => {
1156
- return {
1157
- Key: __expectString(output.Key),
1158
- Value: __expectString(output.Value),
1159
- } as any;
1160
- };
1161
-
1162
- const deserializeAws_restJson1Tags = (output: any, context: __SerdeContext): Tag[] => {
1163
- return (output || [])
1164
- .filter((e: any) => e != null)
1165
- .map((entry: any) => {
1166
- if (entry === null) {
1167
- return null as any;
1168
- }
1169
- return deserializeAws_restJson1Tag(entry, context);
1170
- });
1171
- };
1172
-
1173
- const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
1174
- httpStatusCode: output.statusCode,
1175
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
1176
- extendedRequestId: output.headers["x-amz-id-2"],
1177
- cfId: output.headers["x-amz-cf-id"],
1178
- });
1179
-
1180
- // Collect low-level response body stream to Uint8Array.
1181
- const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
1182
- if (streamBody instanceof Uint8Array) {
1183
- return Promise.resolve(streamBody);
1184
- }
1185
- return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
1186
- };
1187
-
1188
- // Encode Uint8Array data into string with utf-8.
1189
- const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
1190
- collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
1191
-
1192
- const isSerializableHeaderValue = (value: any): boolean =>
1193
- value !== undefined &&
1194
- value !== null &&
1195
- value !== "" &&
1196
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
1197
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
1198
-
1199
- const parseBody = (streamBody: any, context: __SerdeContext): any =>
1200
- collectBodyString(streamBody, context).then((encoded) => {
1201
- if (encoded.length) {
1202
- return JSON.parse(encoded);
1203
- }
1204
- return {};
1205
- });
1206
-
1207
- /**
1208
- * Load an error code for the aws.rest-json-1.1 protocol.
1209
- */
1210
- const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => {
1211
- const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
1212
-
1213
- const sanitizeErrorCode = (rawValue: string): string => {
1214
- let cleanValue = rawValue;
1215
- if (cleanValue.indexOf(":") >= 0) {
1216
- cleanValue = cleanValue.split(":")[0];
1217
- }
1218
- if (cleanValue.indexOf("#") >= 0) {
1219
- cleanValue = cleanValue.split("#")[1];
1220
- }
1221
- return cleanValue;
1222
- };
1223
-
1224
- const headerKey = findKey(output.headers, "x-amzn-errortype");
1225
- if (headerKey !== undefined) {
1226
- return sanitizeErrorCode(output.headers[headerKey]);
1227
- }
1228
-
1229
- if (data.code !== undefined) {
1230
- return sanitizeErrorCode(data.code);
1231
- }
1232
-
1233
- if (data["__type"] !== undefined) {
1234
- return sanitizeErrorCode(data["__type"]);
1235
- }
1236
-
1237
- return "";
1238
- };