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