@aws-sdk/client-mediastore-data 3.183.0 → 3.185.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.
@@ -1,372 +1,516 @@
1
+ import { __assign, __awaiter, __generator } from "tslib";
1
2
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
3
  import { decorateServiceException as __decorateServiceException, expectLong as __expectLong, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, map as __map, parseEpochTimestamp as __parseEpochTimestamp, parseRfc7231DateTime as __parseRfc7231DateTime, resolvedPath as __resolvedPath, strictParseLong as __strictParseLong, throwDefaultError, } from "@aws-sdk/smithy-client";
3
4
  import { MediaStoreDataServiceException as __BaseException } from "../models/MediaStoreDataServiceException";
4
5
  import { ContainerNotFoundException, InternalServerError, ObjectNotFoundException, RequestedRangeNotSatisfiableException, } from "../models/models_0";
5
- export const serializeAws_restJson1DeleteObjectCommand = async (input, context) => {
6
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
7
- const headers = {};
8
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Path+}";
9
- resolvedPath = __resolvedPath(resolvedPath, input, "Path", () => input.Path, "{Path+}", true);
10
- let body;
11
- return new __HttpRequest({
12
- protocol,
13
- hostname,
14
- port,
15
- method: "DELETE",
16
- headers,
17
- path: resolvedPath,
18
- body,
6
+ export var serializeAws_restJson1DeleteObjectCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
7
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
8
+ return __generator(this, function (_c) {
9
+ switch (_c.label) {
10
+ case 0: return [4, context.endpoint()];
11
+ case 1:
12
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
13
+ headers = {};
14
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Path+}";
15
+ resolvedPath = __resolvedPath(resolvedPath, input, "Path", function () { return input.Path; }, "{Path+}", true);
16
+ return [2, new __HttpRequest({
17
+ protocol: protocol,
18
+ hostname: hostname,
19
+ port: port,
20
+ method: "DELETE",
21
+ headers: headers,
22
+ path: resolvedPath,
23
+ body: body,
24
+ })];
25
+ }
19
26
  });
20
- };
21
- export const serializeAws_restJson1DescribeObjectCommand = async (input, context) => {
22
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
23
- const headers = {};
24
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Path+}";
25
- resolvedPath = __resolvedPath(resolvedPath, input, "Path", () => input.Path, "{Path+}", true);
26
- let body;
27
- return new __HttpRequest({
28
- protocol,
29
- hostname,
30
- port,
31
- method: "HEAD",
32
- headers,
33
- path: resolvedPath,
34
- body,
27
+ }); };
28
+ export var serializeAws_restJson1DescribeObjectCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
29
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
30
+ return __generator(this, function (_c) {
31
+ switch (_c.label) {
32
+ case 0: return [4, context.endpoint()];
33
+ case 1:
34
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
35
+ headers = {};
36
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Path+}";
37
+ resolvedPath = __resolvedPath(resolvedPath, input, "Path", function () { return input.Path; }, "{Path+}", true);
38
+ return [2, new __HttpRequest({
39
+ protocol: protocol,
40
+ hostname: hostname,
41
+ port: port,
42
+ method: "HEAD",
43
+ headers: headers,
44
+ path: resolvedPath,
45
+ body: body,
46
+ })];
47
+ }
35
48
  });
36
- };
37
- export const serializeAws_restJson1GetObjectCommand = async (input, context) => {
38
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
39
- const headers = map({}, isSerializableHeaderValue, {
40
- range: input.Range,
49
+ }); };
50
+ export var serializeAws_restJson1GetObjectCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
51
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
52
+ return __generator(this, function (_c) {
53
+ switch (_c.label) {
54
+ case 0: return [4, context.endpoint()];
55
+ case 1:
56
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
57
+ headers = map({}, isSerializableHeaderValue, {
58
+ range: input.Range,
59
+ });
60
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Path+}";
61
+ resolvedPath = __resolvedPath(resolvedPath, input, "Path", function () { return input.Path; }, "{Path+}", true);
62
+ return [2, new __HttpRequest({
63
+ protocol: protocol,
64
+ hostname: hostname,
65
+ port: port,
66
+ method: "GET",
67
+ headers: headers,
68
+ path: resolvedPath,
69
+ body: body,
70
+ })];
71
+ }
41
72
  });
42
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Path+}";
43
- resolvedPath = __resolvedPath(resolvedPath, input, "Path", () => input.Path, "{Path+}", true);
44
- let body;
45
- return new __HttpRequest({
46
- protocol,
47
- hostname,
48
- port,
49
- method: "GET",
50
- headers,
51
- path: resolvedPath,
52
- body,
73
+ }); };
74
+ export var serializeAws_restJson1ListItemsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
75
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
76
+ return __generator(this, function (_c) {
77
+ switch (_c.label) {
78
+ case 0: return [4, context.endpoint()];
79
+ case 1:
80
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
81
+ headers = {};
82
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/";
83
+ query = map({
84
+ Path: [, input.Path],
85
+ MaxResults: [function () { return input.MaxResults !== void 0; }, function () { return input.MaxResults.toString(); }],
86
+ NextToken: [, input.NextToken],
87
+ });
88
+ return [2, new __HttpRequest({
89
+ protocol: protocol,
90
+ hostname: hostname,
91
+ port: port,
92
+ method: "GET",
93
+ headers: headers,
94
+ path: resolvedPath,
95
+ query: query,
96
+ body: body,
97
+ })];
98
+ }
53
99
  });
54
- };
55
- export const serializeAws_restJson1ListItemsCommand = async (input, context) => {
56
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
57
- const headers = {};
58
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/";
59
- const query = map({
60
- Path: [, input.Path],
61
- MaxResults: [() => input.MaxResults !== void 0, () => input.MaxResults.toString()],
62
- NextToken: [, input.NextToken],
100
+ }); };
101
+ export var serializeAws_restJson1PutObjectCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
102
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
103
+ return __generator(this, function (_c) {
104
+ switch (_c.label) {
105
+ case 0: return [4, context.endpoint()];
106
+ case 1:
107
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
108
+ headers = map({}, isSerializableHeaderValue, {
109
+ "x-amz-content-sha256": "UNSIGNED-PAYLOAD",
110
+ "content-type": input.ContentType || "application/octet-stream",
111
+ "cache-control": input.CacheControl,
112
+ "x-amz-storage-class": input.StorageClass,
113
+ "x-amz-upload-availability": input.UploadAvailability,
114
+ });
115
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/{Path+}";
116
+ resolvedPath = __resolvedPath(resolvedPath, input, "Path", function () { return input.Path; }, "{Path+}", true);
117
+ if (input.Body !== undefined) {
118
+ body = input.Body;
119
+ }
120
+ return [2, new __HttpRequest({
121
+ protocol: protocol,
122
+ hostname: hostname,
123
+ port: port,
124
+ method: "PUT",
125
+ headers: headers,
126
+ path: resolvedPath,
127
+ body: body,
128
+ })];
129
+ }
63
130
  });
64
- let body;
65
- return new __HttpRequest({
66
- protocol,
67
- hostname,
68
- port,
69
- method: "GET",
70
- headers,
71
- path: resolvedPath,
72
- query,
73
- body,
131
+ }); };
132
+ export var deserializeAws_restJson1DeleteObjectCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
133
+ var contents;
134
+ return __generator(this, function (_a) {
135
+ switch (_a.label) {
136
+ case 0:
137
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
138
+ return [2, deserializeAws_restJson1DeleteObjectCommandError(output, context)];
139
+ }
140
+ contents = map({
141
+ $metadata: deserializeMetadata(output),
142
+ });
143
+ return [4, collectBody(output.body, context)];
144
+ case 1:
145
+ _a.sent();
146
+ return [2, contents];
147
+ }
74
148
  });
75
- };
76
- export const serializeAws_restJson1PutObjectCommand = async (input, context) => {
77
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
78
- const headers = map({}, isSerializableHeaderValue, {
79
- "x-amz-content-sha256": "UNSIGNED-PAYLOAD",
80
- "content-type": input.ContentType || "application/octet-stream",
81
- "cache-control": input.CacheControl,
82
- "x-amz-storage-class": input.StorageClass,
83
- "x-amz-upload-availability": input.UploadAvailability,
149
+ }); };
150
+ var deserializeAws_restJson1DeleteObjectCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
151
+ var parsedOutput, _a, errorCode, _b, parsedBody;
152
+ var _c;
153
+ return __generator(this, function (_d) {
154
+ switch (_d.label) {
155
+ case 0:
156
+ _a = [__assign({}, output)];
157
+ _c = {};
158
+ return [4, parseErrorBody(output.body, context)];
159
+ case 1:
160
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
161
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
162
+ _b = errorCode;
163
+ switch (_b) {
164
+ case "ContainerNotFoundException": return [3, 2];
165
+ case "com.amazonaws.mediastoredata#ContainerNotFoundException": return [3, 2];
166
+ case "InternalServerError": return [3, 4];
167
+ case "com.amazonaws.mediastoredata#InternalServerError": return [3, 4];
168
+ case "ObjectNotFoundException": return [3, 6];
169
+ case "com.amazonaws.mediastoredata#ObjectNotFoundException": return [3, 6];
170
+ }
171
+ return [3, 8];
172
+ case 2: return [4, deserializeAws_restJson1ContainerNotFoundExceptionResponse(parsedOutput, context)];
173
+ case 3: throw _d.sent();
174
+ case 4: return [4, deserializeAws_restJson1InternalServerErrorResponse(parsedOutput, context)];
175
+ case 5: throw _d.sent();
176
+ case 6: return [4, deserializeAws_restJson1ObjectNotFoundExceptionResponse(parsedOutput, context)];
177
+ case 7: throw _d.sent();
178
+ case 8:
179
+ parsedBody = parsedOutput.body;
180
+ throwDefaultError({
181
+ output: output,
182
+ parsedBody: parsedBody,
183
+ exceptionCtor: __BaseException,
184
+ errorCode: errorCode,
185
+ });
186
+ _d.label = 9;
187
+ case 9: return [2];
188
+ }
84
189
  });
85
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/{Path+}";
86
- resolvedPath = __resolvedPath(resolvedPath, input, "Path", () => input.Path, "{Path+}", true);
87
- let body;
88
- if (input.Body !== undefined) {
89
- body = input.Body;
90
- }
91
- return new __HttpRequest({
92
- protocol,
93
- hostname,
94
- port,
95
- method: "PUT",
96
- headers,
97
- path: resolvedPath,
98
- body,
190
+ }); };
191
+ export var deserializeAws_restJson1DescribeObjectCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
192
+ var contents;
193
+ return __generator(this, function (_a) {
194
+ switch (_a.label) {
195
+ case 0:
196
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
197
+ return [2, deserializeAws_restJson1DescribeObjectCommandError(output, context)];
198
+ }
199
+ contents = map({
200
+ $metadata: deserializeMetadata(output),
201
+ ETag: [, output.headers["etag"]],
202
+ ContentType: [, output.headers["content-type"]],
203
+ ContentLength: [
204
+ function () { return void 0 !== output.headers["content-length"]; },
205
+ function () { return __strictParseLong(output.headers["content-length"]); },
206
+ ],
207
+ CacheControl: [, output.headers["cache-control"]],
208
+ LastModified: [
209
+ function () { return void 0 !== output.headers["last-modified"]; },
210
+ function () { return __expectNonNull(__parseRfc7231DateTime(output.headers["last-modified"])); },
211
+ ],
212
+ });
213
+ return [4, collectBody(output.body, context)];
214
+ case 1:
215
+ _a.sent();
216
+ return [2, contents];
217
+ }
99
218
  });
100
- };
101
- export const deserializeAws_restJson1DeleteObjectCommand = async (output, context) => {
102
- if (output.statusCode !== 200 && output.statusCode >= 300) {
103
- return deserializeAws_restJson1DeleteObjectCommandError(output, context);
104
- }
105
- const contents = map({
106
- $metadata: deserializeMetadata(output),
219
+ }); };
220
+ var deserializeAws_restJson1DescribeObjectCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
221
+ var parsedOutput, _a, errorCode, _b, parsedBody;
222
+ var _c;
223
+ return __generator(this, function (_d) {
224
+ switch (_d.label) {
225
+ case 0:
226
+ _a = [__assign({}, output)];
227
+ _c = {};
228
+ return [4, parseErrorBody(output.body, context)];
229
+ case 1:
230
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
231
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
232
+ _b = errorCode;
233
+ switch (_b) {
234
+ case "ContainerNotFoundException": return [3, 2];
235
+ case "com.amazonaws.mediastoredata#ContainerNotFoundException": return [3, 2];
236
+ case "InternalServerError": return [3, 4];
237
+ case "com.amazonaws.mediastoredata#InternalServerError": return [3, 4];
238
+ case "ObjectNotFoundException": return [3, 6];
239
+ case "com.amazonaws.mediastoredata#ObjectNotFoundException": return [3, 6];
240
+ }
241
+ return [3, 8];
242
+ case 2: return [4, deserializeAws_restJson1ContainerNotFoundExceptionResponse(parsedOutput, context)];
243
+ case 3: throw _d.sent();
244
+ case 4: return [4, deserializeAws_restJson1InternalServerErrorResponse(parsedOutput, context)];
245
+ case 5: throw _d.sent();
246
+ case 6: return [4, deserializeAws_restJson1ObjectNotFoundExceptionResponse(parsedOutput, context)];
247
+ case 7: throw _d.sent();
248
+ case 8:
249
+ parsedBody = parsedOutput.body;
250
+ throwDefaultError({
251
+ output: output,
252
+ parsedBody: parsedBody,
253
+ exceptionCtor: __BaseException,
254
+ errorCode: errorCode,
255
+ });
256
+ _d.label = 9;
257
+ case 9: return [2];
258
+ }
107
259
  });
108
- await collectBody(output.body, context);
109
- return contents;
110
- };
111
- const deserializeAws_restJson1DeleteObjectCommandError = async (output, context) => {
112
- const parsedOutput = {
113
- ...output,
114
- body: await parseErrorBody(output.body, context),
115
- };
116
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
117
- switch (errorCode) {
118
- case "ContainerNotFoundException":
119
- case "com.amazonaws.mediastoredata#ContainerNotFoundException":
120
- throw await deserializeAws_restJson1ContainerNotFoundExceptionResponse(parsedOutput, context);
121
- case "InternalServerError":
122
- case "com.amazonaws.mediastoredata#InternalServerError":
123
- throw await deserializeAws_restJson1InternalServerErrorResponse(parsedOutput, context);
124
- case "ObjectNotFoundException":
125
- case "com.amazonaws.mediastoredata#ObjectNotFoundException":
126
- throw await deserializeAws_restJson1ObjectNotFoundExceptionResponse(parsedOutput, context);
127
- default:
128
- const parsedBody = parsedOutput.body;
129
- throwDefaultError({
130
- output,
131
- parsedBody,
132
- exceptionCtor: __BaseException,
133
- errorCode,
134
- });
135
- }
136
- };
137
- export const deserializeAws_restJson1DescribeObjectCommand = async (output, context) => {
138
- if (output.statusCode !== 200 && output.statusCode >= 300) {
139
- return deserializeAws_restJson1DescribeObjectCommandError(output, context);
140
- }
141
- const contents = map({
142
- $metadata: deserializeMetadata(output),
143
- ETag: [, output.headers["etag"]],
144
- ContentType: [, output.headers["content-type"]],
145
- ContentLength: [
146
- () => void 0 !== output.headers["content-length"],
147
- () => __strictParseLong(output.headers["content-length"]),
148
- ],
149
- CacheControl: [, output.headers["cache-control"]],
150
- LastModified: [
151
- () => void 0 !== output.headers["last-modified"],
152
- () => __expectNonNull(__parseRfc7231DateTime(output.headers["last-modified"])),
153
- ],
260
+ }); };
261
+ export var deserializeAws_restJson1GetObjectCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
262
+ var contents, data;
263
+ return __generator(this, function (_a) {
264
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
265
+ return [2, deserializeAws_restJson1GetObjectCommandError(output, context)];
266
+ }
267
+ contents = map({
268
+ $metadata: deserializeMetadata(output),
269
+ CacheControl: [, output.headers["cache-control"]],
270
+ ContentRange: [, output.headers["content-range"]],
271
+ ContentLength: [
272
+ function () { return void 0 !== output.headers["content-length"]; },
273
+ function () { return __strictParseLong(output.headers["content-length"]); },
274
+ ],
275
+ ContentType: [, output.headers["content-type"]],
276
+ ETag: [, output.headers["etag"]],
277
+ LastModified: [
278
+ function () { return void 0 !== output.headers["last-modified"]; },
279
+ function () { return __expectNonNull(__parseRfc7231DateTime(output.headers["last-modified"])); },
280
+ ],
281
+ });
282
+ data = output.body;
283
+ contents.Body = data;
284
+ map(contents, {
285
+ StatusCode: [, output.statusCode],
286
+ });
287
+ return [2, contents];
154
288
  });
155
- await collectBody(output.body, context);
156
- return contents;
157
- };
158
- const deserializeAws_restJson1DescribeObjectCommandError = async (output, context) => {
159
- const parsedOutput = {
160
- ...output,
161
- body: await parseErrorBody(output.body, context),
162
- };
163
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
164
- switch (errorCode) {
165
- case "ContainerNotFoundException":
166
- case "com.amazonaws.mediastoredata#ContainerNotFoundException":
167
- throw await deserializeAws_restJson1ContainerNotFoundExceptionResponse(parsedOutput, context);
168
- case "InternalServerError":
169
- case "com.amazonaws.mediastoredata#InternalServerError":
170
- throw await deserializeAws_restJson1InternalServerErrorResponse(parsedOutput, context);
171
- case "ObjectNotFoundException":
172
- case "com.amazonaws.mediastoredata#ObjectNotFoundException":
173
- throw await deserializeAws_restJson1ObjectNotFoundExceptionResponse(parsedOutput, context);
174
- default:
175
- const parsedBody = parsedOutput.body;
176
- throwDefaultError({
177
- output,
178
- parsedBody,
179
- exceptionCtor: __BaseException,
180
- errorCode,
181
- });
182
- }
183
- };
184
- export const deserializeAws_restJson1GetObjectCommand = async (output, context) => {
185
- if (output.statusCode !== 200 && output.statusCode >= 300) {
186
- return deserializeAws_restJson1GetObjectCommandError(output, context);
187
- }
188
- const contents = map({
189
- $metadata: deserializeMetadata(output),
190
- CacheControl: [, output.headers["cache-control"]],
191
- ContentRange: [, output.headers["content-range"]],
192
- ContentLength: [
193
- () => void 0 !== output.headers["content-length"],
194
- () => __strictParseLong(output.headers["content-length"]),
195
- ],
196
- ContentType: [, output.headers["content-type"]],
197
- ETag: [, output.headers["etag"]],
198
- LastModified: [
199
- () => void 0 !== output.headers["last-modified"],
200
- () => __expectNonNull(__parseRfc7231DateTime(output.headers["last-modified"])),
201
- ],
289
+ }); };
290
+ var deserializeAws_restJson1GetObjectCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
291
+ var parsedOutput, _a, errorCode, _b, parsedBody;
292
+ var _c;
293
+ return __generator(this, function (_d) {
294
+ switch (_d.label) {
295
+ case 0:
296
+ _a = [__assign({}, output)];
297
+ _c = {};
298
+ return [4, parseErrorBody(output.body, context)];
299
+ case 1:
300
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
301
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
302
+ _b = errorCode;
303
+ switch (_b) {
304
+ case "ContainerNotFoundException": return [3, 2];
305
+ case "com.amazonaws.mediastoredata#ContainerNotFoundException": return [3, 2];
306
+ case "InternalServerError": return [3, 4];
307
+ case "com.amazonaws.mediastoredata#InternalServerError": return [3, 4];
308
+ case "ObjectNotFoundException": return [3, 6];
309
+ case "com.amazonaws.mediastoredata#ObjectNotFoundException": return [3, 6];
310
+ case "RequestedRangeNotSatisfiableException": return [3, 8];
311
+ case "com.amazonaws.mediastoredata#RequestedRangeNotSatisfiableException": return [3, 8];
312
+ }
313
+ return [3, 10];
314
+ case 2: return [4, deserializeAws_restJson1ContainerNotFoundExceptionResponse(parsedOutput, context)];
315
+ case 3: throw _d.sent();
316
+ case 4: return [4, deserializeAws_restJson1InternalServerErrorResponse(parsedOutput, context)];
317
+ case 5: throw _d.sent();
318
+ case 6: return [4, deserializeAws_restJson1ObjectNotFoundExceptionResponse(parsedOutput, context)];
319
+ case 7: throw _d.sent();
320
+ case 8: return [4, deserializeAws_restJson1RequestedRangeNotSatisfiableExceptionResponse(parsedOutput, context)];
321
+ case 9: throw _d.sent();
322
+ case 10:
323
+ parsedBody = parsedOutput.body;
324
+ throwDefaultError({
325
+ output: output,
326
+ parsedBody: parsedBody,
327
+ exceptionCtor: __BaseException,
328
+ errorCode: errorCode,
329
+ });
330
+ _d.label = 11;
331
+ case 11: return [2];
332
+ }
202
333
  });
203
- const data = output.body;
204
- contents.Body = data;
205
- map(contents, {
206
- StatusCode: [, output.statusCode],
334
+ }); };
335
+ export var deserializeAws_restJson1ListItemsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
336
+ var contents, data, _a, _b;
337
+ return __generator(this, function (_c) {
338
+ switch (_c.label) {
339
+ case 0:
340
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
341
+ return [2, deserializeAws_restJson1ListItemsCommandError(output, context)];
342
+ }
343
+ contents = map({
344
+ $metadata: deserializeMetadata(output),
345
+ });
346
+ _a = __expectNonNull;
347
+ _b = __expectObject;
348
+ return [4, parseBody(output.body, context)];
349
+ case 1:
350
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
351
+ if (data.Items != null) {
352
+ contents.Items = deserializeAws_restJson1ItemList(data.Items, context);
353
+ }
354
+ if (data.NextToken != null) {
355
+ contents.NextToken = __expectString(data.NextToken);
356
+ }
357
+ return [2, contents];
358
+ }
207
359
  });
208
- return contents;
209
- };
210
- const deserializeAws_restJson1GetObjectCommandError = async (output, context) => {
211
- const parsedOutput = {
212
- ...output,
213
- body: await parseErrorBody(output.body, context),
214
- };
215
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
216
- switch (errorCode) {
217
- case "ContainerNotFoundException":
218
- case "com.amazonaws.mediastoredata#ContainerNotFoundException":
219
- throw await deserializeAws_restJson1ContainerNotFoundExceptionResponse(parsedOutput, context);
220
- case "InternalServerError":
221
- case "com.amazonaws.mediastoredata#InternalServerError":
222
- throw await deserializeAws_restJson1InternalServerErrorResponse(parsedOutput, context);
223
- case "ObjectNotFoundException":
224
- case "com.amazonaws.mediastoredata#ObjectNotFoundException":
225
- throw await deserializeAws_restJson1ObjectNotFoundExceptionResponse(parsedOutput, context);
226
- case "RequestedRangeNotSatisfiableException":
227
- case "com.amazonaws.mediastoredata#RequestedRangeNotSatisfiableException":
228
- throw await deserializeAws_restJson1RequestedRangeNotSatisfiableExceptionResponse(parsedOutput, context);
229
- default:
230
- const parsedBody = parsedOutput.body;
231
- throwDefaultError({
232
- output,
233
- parsedBody,
234
- exceptionCtor: __BaseException,
235
- errorCode,
236
- });
237
- }
238
- };
239
- export const deserializeAws_restJson1ListItemsCommand = async (output, context) => {
240
- if (output.statusCode !== 200 && output.statusCode >= 300) {
241
- return deserializeAws_restJson1ListItemsCommandError(output, context);
242
- }
243
- const contents = map({
244
- $metadata: deserializeMetadata(output),
360
+ }); };
361
+ var deserializeAws_restJson1ListItemsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
362
+ var parsedOutput, _a, errorCode, _b, parsedBody;
363
+ var _c;
364
+ return __generator(this, function (_d) {
365
+ switch (_d.label) {
366
+ case 0:
367
+ _a = [__assign({}, output)];
368
+ _c = {};
369
+ return [4, parseErrorBody(output.body, context)];
370
+ case 1:
371
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
372
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
373
+ _b = errorCode;
374
+ switch (_b) {
375
+ case "ContainerNotFoundException": return [3, 2];
376
+ case "com.amazonaws.mediastoredata#ContainerNotFoundException": return [3, 2];
377
+ case "InternalServerError": return [3, 4];
378
+ case "com.amazonaws.mediastoredata#InternalServerError": return [3, 4];
379
+ }
380
+ return [3, 6];
381
+ case 2: return [4, deserializeAws_restJson1ContainerNotFoundExceptionResponse(parsedOutput, context)];
382
+ case 3: throw _d.sent();
383
+ case 4: return [4, deserializeAws_restJson1InternalServerErrorResponse(parsedOutput, context)];
384
+ case 5: throw _d.sent();
385
+ case 6:
386
+ parsedBody = parsedOutput.body;
387
+ throwDefaultError({
388
+ output: output,
389
+ parsedBody: parsedBody,
390
+ exceptionCtor: __BaseException,
391
+ errorCode: errorCode,
392
+ });
393
+ _d.label = 7;
394
+ case 7: return [2];
395
+ }
245
396
  });
246
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
247
- if (data.Items != null) {
248
- contents.Items = deserializeAws_restJson1ItemList(data.Items, context);
249
- }
250
- if (data.NextToken != null) {
251
- contents.NextToken = __expectString(data.NextToken);
252
- }
253
- return contents;
254
- };
255
- const deserializeAws_restJson1ListItemsCommandError = async (output, context) => {
256
- const parsedOutput = {
257
- ...output,
258
- body: await parseErrorBody(output.body, context),
259
- };
260
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
261
- switch (errorCode) {
262
- case "ContainerNotFoundException":
263
- case "com.amazonaws.mediastoredata#ContainerNotFoundException":
264
- throw await deserializeAws_restJson1ContainerNotFoundExceptionResponse(parsedOutput, context);
265
- case "InternalServerError":
266
- case "com.amazonaws.mediastoredata#InternalServerError":
267
- throw await deserializeAws_restJson1InternalServerErrorResponse(parsedOutput, context);
268
- default:
269
- const parsedBody = parsedOutput.body;
270
- throwDefaultError({
271
- output,
272
- parsedBody,
273
- exceptionCtor: __BaseException,
274
- errorCode,
275
- });
276
- }
277
- };
278
- export const deserializeAws_restJson1PutObjectCommand = async (output, context) => {
279
- if (output.statusCode !== 200 && output.statusCode >= 300) {
280
- return deserializeAws_restJson1PutObjectCommandError(output, context);
281
- }
282
- const contents = map({
283
- $metadata: deserializeMetadata(output),
397
+ }); };
398
+ export var deserializeAws_restJson1PutObjectCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
399
+ var contents, data, _a, _b;
400
+ return __generator(this, function (_c) {
401
+ switch (_c.label) {
402
+ case 0:
403
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
404
+ return [2, deserializeAws_restJson1PutObjectCommandError(output, context)];
405
+ }
406
+ contents = map({
407
+ $metadata: deserializeMetadata(output),
408
+ });
409
+ _a = __expectNonNull;
410
+ _b = __expectObject;
411
+ return [4, parseBody(output.body, context)];
412
+ case 1:
413
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
414
+ if (data.ContentSHA256 != null) {
415
+ contents.ContentSHA256 = __expectString(data.ContentSHA256);
416
+ }
417
+ if (data.ETag != null) {
418
+ contents.ETag = __expectString(data.ETag);
419
+ }
420
+ if (data.StorageClass != null) {
421
+ contents.StorageClass = __expectString(data.StorageClass);
422
+ }
423
+ return [2, contents];
424
+ }
284
425
  });
285
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
286
- if (data.ContentSHA256 != null) {
287
- contents.ContentSHA256 = __expectString(data.ContentSHA256);
288
- }
289
- if (data.ETag != null) {
290
- contents.ETag = __expectString(data.ETag);
291
- }
292
- if (data.StorageClass != null) {
293
- contents.StorageClass = __expectString(data.StorageClass);
294
- }
295
- return contents;
296
- };
297
- const deserializeAws_restJson1PutObjectCommandError = async (output, context) => {
298
- const parsedOutput = {
299
- ...output,
300
- body: await parseErrorBody(output.body, context),
301
- };
302
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
303
- switch (errorCode) {
304
- case "ContainerNotFoundException":
305
- case "com.amazonaws.mediastoredata#ContainerNotFoundException":
306
- throw await deserializeAws_restJson1ContainerNotFoundExceptionResponse(parsedOutput, context);
307
- case "InternalServerError":
308
- case "com.amazonaws.mediastoredata#InternalServerError":
309
- throw await deserializeAws_restJson1InternalServerErrorResponse(parsedOutput, context);
310
- default:
311
- const parsedBody = parsedOutput.body;
312
- throwDefaultError({
313
- output,
314
- parsedBody,
315
- exceptionCtor: __BaseException,
316
- errorCode,
317
- });
318
- }
319
- };
320
- const map = __map;
321
- const deserializeAws_restJson1ContainerNotFoundExceptionResponse = async (parsedOutput, context) => {
322
- const contents = map({});
323
- const data = parsedOutput.body;
324
- if (data.Message != null) {
325
- contents.Message = __expectString(data.Message);
326
- }
327
- const exception = new ContainerNotFoundException({
328
- $metadata: deserializeMetadata(parsedOutput),
329
- ...contents,
426
+ }); };
427
+ var deserializeAws_restJson1PutObjectCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
428
+ var parsedOutput, _a, errorCode, _b, parsedBody;
429
+ var _c;
430
+ return __generator(this, function (_d) {
431
+ switch (_d.label) {
432
+ case 0:
433
+ _a = [__assign({}, output)];
434
+ _c = {};
435
+ return [4, parseErrorBody(output.body, context)];
436
+ case 1:
437
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
438
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
439
+ _b = errorCode;
440
+ switch (_b) {
441
+ case "ContainerNotFoundException": return [3, 2];
442
+ case "com.amazonaws.mediastoredata#ContainerNotFoundException": return [3, 2];
443
+ case "InternalServerError": return [3, 4];
444
+ case "com.amazonaws.mediastoredata#InternalServerError": return [3, 4];
445
+ }
446
+ return [3, 6];
447
+ case 2: return [4, deserializeAws_restJson1ContainerNotFoundExceptionResponse(parsedOutput, context)];
448
+ case 3: throw _d.sent();
449
+ case 4: return [4, deserializeAws_restJson1InternalServerErrorResponse(parsedOutput, context)];
450
+ case 5: throw _d.sent();
451
+ case 6:
452
+ parsedBody = parsedOutput.body;
453
+ throwDefaultError({
454
+ output: output,
455
+ parsedBody: parsedBody,
456
+ exceptionCtor: __BaseException,
457
+ errorCode: errorCode,
458
+ });
459
+ _d.label = 7;
460
+ case 7: return [2];
461
+ }
330
462
  });
331
- return __decorateServiceException(exception, parsedOutput.body);
332
- };
333
- const deserializeAws_restJson1InternalServerErrorResponse = async (parsedOutput, context) => {
334
- const contents = map({});
335
- const data = parsedOutput.body;
336
- if (data.Message != null) {
337
- contents.Message = __expectString(data.Message);
338
- }
339
- const exception = new InternalServerError({
340
- $metadata: deserializeMetadata(parsedOutput),
341
- ...contents,
463
+ }); };
464
+ var map = __map;
465
+ var deserializeAws_restJson1ContainerNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
466
+ var contents, data, exception;
467
+ return __generator(this, function (_a) {
468
+ contents = map({});
469
+ data = parsedOutput.body;
470
+ if (data.Message != null) {
471
+ contents.Message = __expectString(data.Message);
472
+ }
473
+ exception = new ContainerNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
474
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
342
475
  });
343
- return __decorateServiceException(exception, parsedOutput.body);
344
- };
345
- const deserializeAws_restJson1ObjectNotFoundExceptionResponse = async (parsedOutput, context) => {
346
- const contents = map({});
347
- const data = parsedOutput.body;
348
- if (data.Message != null) {
349
- contents.Message = __expectString(data.Message);
350
- }
351
- const exception = new ObjectNotFoundException({
352
- $metadata: deserializeMetadata(parsedOutput),
353
- ...contents,
476
+ }); };
477
+ var deserializeAws_restJson1InternalServerErrorResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
478
+ var contents, data, exception;
479
+ return __generator(this, function (_a) {
480
+ contents = map({});
481
+ data = parsedOutput.body;
482
+ if (data.Message != null) {
483
+ contents.Message = __expectString(data.Message);
484
+ }
485
+ exception = new InternalServerError(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
486
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
354
487
  });
355
- return __decorateServiceException(exception, parsedOutput.body);
356
- };
357
- const deserializeAws_restJson1RequestedRangeNotSatisfiableExceptionResponse = async (parsedOutput, context) => {
358
- const contents = map({});
359
- const data = parsedOutput.body;
360
- if (data.Message != null) {
361
- contents.Message = __expectString(data.Message);
362
- }
363
- const exception = new RequestedRangeNotSatisfiableException({
364
- $metadata: deserializeMetadata(parsedOutput),
365
- ...contents,
488
+ }); };
489
+ var deserializeAws_restJson1ObjectNotFoundExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
490
+ var contents, data, exception;
491
+ return __generator(this, function (_a) {
492
+ contents = map({});
493
+ data = parsedOutput.body;
494
+ if (data.Message != null) {
495
+ contents.Message = __expectString(data.Message);
496
+ }
497
+ exception = new ObjectNotFoundException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
498
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
366
499
  });
367
- return __decorateServiceException(exception, parsedOutput.body);
368
- };
369
- const deserializeAws_restJson1Item = (output, context) => {
500
+ }); };
501
+ var deserializeAws_restJson1RequestedRangeNotSatisfiableExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
502
+ var contents, data, exception;
503
+ return __generator(this, function (_a) {
504
+ contents = map({});
505
+ data = parsedOutput.body;
506
+ if (data.Message != null) {
507
+ contents.Message = __expectString(data.Message);
508
+ }
509
+ exception = new RequestedRangeNotSatisfiableException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
510
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
511
+ });
512
+ }); };
513
+ var deserializeAws_restJson1Item = function (output, context) {
370
514
  return {
371
515
  ContentLength: __expectLong(output.ContentLength),
372
516
  ContentType: __expectString(output.ContentType),
@@ -378,10 +522,10 @@ const deserializeAws_restJson1Item = (output, context) => {
378
522
  Type: __expectString(output.Type),
379
523
  };
380
524
  };
381
- const deserializeAws_restJson1ItemList = (output, context) => {
382
- const retVal = (output || [])
383
- .filter((e) => e != null)
384
- .map((entry) => {
525
+ var deserializeAws_restJson1ItemList = function (output, context) {
526
+ var retVal = (output || [])
527
+ .filter(function (e) { return e != null; })
528
+ .map(function (entry) {
385
529
  if (entry === null) {
386
530
  return null;
387
531
  }
@@ -389,39 +533,57 @@ const deserializeAws_restJson1ItemList = (output, context) => {
389
533
  });
390
534
  return retVal;
391
535
  };
392
- const deserializeMetadata = (output) => ({
393
- httpStatusCode: output.statusCode,
394
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
395
- extendedRequestId: output.headers["x-amz-id-2"],
396
- cfId: output.headers["x-amz-cf-id"],
397
- });
398
- const collectBody = (streamBody = new Uint8Array(), context) => {
536
+ var deserializeMetadata = function (output) {
537
+ var _a, _b;
538
+ return ({
539
+ httpStatusCode: output.statusCode,
540
+ requestId: (_b = (_a = output.headers["x-amzn-requestid"]) !== null && _a !== void 0 ? _a : output.headers["x-amzn-request-id"]) !== null && _b !== void 0 ? _b : output.headers["x-amz-request-id"],
541
+ extendedRequestId: output.headers["x-amz-id-2"],
542
+ cfId: output.headers["x-amz-cf-id"],
543
+ });
544
+ };
545
+ var collectBody = function (streamBody, context) {
546
+ if (streamBody === void 0) { streamBody = new Uint8Array(); }
399
547
  if (streamBody instanceof Uint8Array) {
400
548
  return Promise.resolve(streamBody);
401
549
  }
402
550
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
403
551
  };
404
- const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
405
- const isSerializableHeaderValue = (value) => value !== undefined &&
406
- value !== null &&
407
- value !== "" &&
408
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
409
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
410
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
411
- if (encoded.length) {
412
- return JSON.parse(encoded);
413
- }
414
- return {};
415
- });
416
- const parseErrorBody = async (errorBody, context) => {
417
- const value = await parseBody(errorBody, context);
418
- value.message = value.message ?? value.Message;
419
- return value;
552
+ var collectBodyString = function (streamBody, context) {
553
+ return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
420
554
  };
421
- const loadRestJsonErrorCode = (output, data) => {
422
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
423
- const sanitizeErrorCode = (rawValue) => {
424
- let cleanValue = rawValue;
555
+ var isSerializableHeaderValue = function (value) {
556
+ return value !== undefined &&
557
+ value !== null &&
558
+ value !== "" &&
559
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
560
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
561
+ };
562
+ var parseBody = function (streamBody, context) {
563
+ return collectBodyString(streamBody, context).then(function (encoded) {
564
+ if (encoded.length) {
565
+ return JSON.parse(encoded);
566
+ }
567
+ return {};
568
+ });
569
+ };
570
+ var parseErrorBody = function (errorBody, context) { return __awaiter(void 0, void 0, void 0, function () {
571
+ var value;
572
+ var _a;
573
+ return __generator(this, function (_b) {
574
+ switch (_b.label) {
575
+ case 0: return [4, parseBody(errorBody, context)];
576
+ case 1:
577
+ value = _b.sent();
578
+ value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
579
+ return [2, value];
580
+ }
581
+ });
582
+ }); };
583
+ var loadRestJsonErrorCode = function (output, data) {
584
+ var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
585
+ var sanitizeErrorCode = function (rawValue) {
586
+ var cleanValue = rawValue;
425
587
  if (typeof cleanValue === "number") {
426
588
  cleanValue = cleanValue.toString();
427
589
  }
@@ -436,7 +598,7 @@ const loadRestJsonErrorCode = (output, data) => {
436
598
  }
437
599
  return cleanValue;
438
600
  };
439
- const headerKey = findKey(output.headers, "x-amzn-errortype");
601
+ var headerKey = findKey(output.headers, "x-amzn-errortype");
440
602
  if (headerKey !== undefined) {
441
603
  return sanitizeErrorCode(output.headers[headerKey]);
442
604
  }