@aws-sdk/client-applicationcostprofiler 3.183.0 → 3.186.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,484 +1,658 @@
1
+ import { __assign, __awaiter, __generator } from "tslib";
1
2
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
3
  import { decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectNumber as __expectNumber, expectObject as __expectObject, expectString as __expectString, map as __map, parseEpochTimestamp as __parseEpochTimestamp, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
3
4
  import { ApplicationCostProfilerServiceException as __BaseException } from "../models/ApplicationCostProfilerServiceException";
4
5
  import { AccessDeniedException, InternalServerException, ServiceQuotaExceededException, ThrottlingException, ValidationException, } from "../models/models_0";
5
- export const serializeAws_restJson1DeleteReportDefinitionCommand = 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 || ""}` + "/reportDefinition/{reportId}";
9
- resolvedPath = __resolvedPath(resolvedPath, input, "reportId", () => input.reportId, "{reportId}", false);
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_restJson1DeleteReportDefinitionCommand = 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 || "") + "/reportDefinition/{reportId}";
15
+ resolvedPath = __resolvedPath(resolvedPath, input, "reportId", function () { return input.reportId; }, "{reportId}", false);
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_restJson1GetReportDefinitionCommand = 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 || ""}` + "/reportDefinition/{reportId}";
25
- resolvedPath = __resolvedPath(resolvedPath, input, "reportId", () => input.reportId, "{reportId}", false);
26
- let body;
27
- return new __HttpRequest({
28
- protocol,
29
- hostname,
30
- port,
31
- method: "GET",
32
- headers,
33
- path: resolvedPath,
34
- body,
27
+ }); };
28
+ export var serializeAws_restJson1GetReportDefinitionCommand = 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 || "") + "/reportDefinition/{reportId}";
37
+ resolvedPath = __resolvedPath(resolvedPath, input, "reportId", function () { return input.reportId; }, "{reportId}", false);
38
+ return [2, new __HttpRequest({
39
+ protocol: protocol,
40
+ hostname: hostname,
41
+ port: port,
42
+ method: "GET",
43
+ headers: headers,
44
+ path: resolvedPath,
45
+ body: body,
46
+ })];
47
+ }
35
48
  });
36
- };
37
- export const serializeAws_restJson1ImportApplicationUsageCommand = async (input, context) => {
38
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
39
- const headers = {
40
- "content-type": "application/json",
41
- };
42
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/importApplicationUsage";
43
- let body;
44
- body = JSON.stringify({
45
- ...(input.sourceS3Location != null && {
46
- sourceS3Location: serializeAws_restJson1SourceS3Location(input.sourceS3Location, context),
47
- }),
49
+ }); };
50
+ export var serializeAws_restJson1ImportApplicationUsageCommand = 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 = {
58
+ "content-type": "application/json",
59
+ };
60
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/importApplicationUsage";
61
+ body = JSON.stringify(__assign({}, (input.sourceS3Location != null && {
62
+ sourceS3Location: serializeAws_restJson1SourceS3Location(input.sourceS3Location, context),
63
+ })));
64
+ return [2, new __HttpRequest({
65
+ protocol: protocol,
66
+ hostname: hostname,
67
+ port: port,
68
+ method: "POST",
69
+ headers: headers,
70
+ path: resolvedPath,
71
+ body: body,
72
+ })];
73
+ }
48
74
  });
49
- return new __HttpRequest({
50
- protocol,
51
- hostname,
52
- port,
53
- method: "POST",
54
- headers,
55
- path: resolvedPath,
56
- body,
75
+ }); };
76
+ export var serializeAws_restJson1ListReportDefinitionsCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
77
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, query, body;
78
+ return __generator(this, function (_c) {
79
+ switch (_c.label) {
80
+ case 0: return [4, context.endpoint()];
81
+ case 1:
82
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
83
+ headers = {};
84
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/reportDefinition";
85
+ query = map({
86
+ nextToken: [, input.nextToken],
87
+ maxResults: [function () { return input.maxResults !== void 0; }, function () { return input.maxResults.toString(); }],
88
+ });
89
+ return [2, new __HttpRequest({
90
+ protocol: protocol,
91
+ hostname: hostname,
92
+ port: port,
93
+ method: "GET",
94
+ headers: headers,
95
+ path: resolvedPath,
96
+ query: query,
97
+ body: body,
98
+ })];
99
+ }
57
100
  });
58
- };
59
- export const serializeAws_restJson1ListReportDefinitionsCommand = async (input, context) => {
60
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
61
- const headers = {};
62
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/reportDefinition";
63
- const query = map({
64
- nextToken: [, input.nextToken],
65
- maxResults: [() => input.maxResults !== void 0, () => input.maxResults.toString()],
101
+ }); };
102
+ export var serializeAws_restJson1PutReportDefinitionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
103
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
104
+ return __generator(this, function (_c) {
105
+ switch (_c.label) {
106
+ case 0: return [4, context.endpoint()];
107
+ case 1:
108
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
109
+ headers = {
110
+ "content-type": "application/json",
111
+ };
112
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/reportDefinition";
113
+ body = JSON.stringify(__assign(__assign(__assign(__assign(__assign({}, (input.destinationS3Location != null && {
114
+ destinationS3Location: serializeAws_restJson1S3Location(input.destinationS3Location, context),
115
+ })), (input.format != null && { format: input.format })), (input.reportDescription != null && { reportDescription: input.reportDescription })), (input.reportFrequency != null && { reportFrequency: input.reportFrequency })), (input.reportId != null && { reportId: input.reportId })));
116
+ return [2, new __HttpRequest({
117
+ protocol: protocol,
118
+ hostname: hostname,
119
+ port: port,
120
+ method: "POST",
121
+ headers: headers,
122
+ path: resolvedPath,
123
+ body: body,
124
+ })];
125
+ }
66
126
  });
67
- let body;
68
- return new __HttpRequest({
69
- protocol,
70
- hostname,
71
- port,
72
- method: "GET",
73
- headers,
74
- path: resolvedPath,
75
- query,
76
- body,
127
+ }); };
128
+ export var serializeAws_restJson1UpdateReportDefinitionCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
129
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
130
+ return __generator(this, function (_c) {
131
+ switch (_c.label) {
132
+ case 0: return [4, context.endpoint()];
133
+ case 1:
134
+ _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
135
+ headers = {
136
+ "content-type": "application/json",
137
+ };
138
+ resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/reportDefinition/{reportId}";
139
+ resolvedPath = __resolvedPath(resolvedPath, input, "reportId", function () { return input.reportId; }, "{reportId}", false);
140
+ body = JSON.stringify(__assign(__assign(__assign(__assign({}, (input.destinationS3Location != null && {
141
+ destinationS3Location: serializeAws_restJson1S3Location(input.destinationS3Location, context),
142
+ })), (input.format != null && { format: input.format })), (input.reportDescription != null && { reportDescription: input.reportDescription })), (input.reportFrequency != null && { reportFrequency: input.reportFrequency })));
143
+ return [2, new __HttpRequest({
144
+ protocol: protocol,
145
+ hostname: hostname,
146
+ port: port,
147
+ method: "PUT",
148
+ headers: headers,
149
+ path: resolvedPath,
150
+ body: body,
151
+ })];
152
+ }
77
153
  });
78
- };
79
- export const serializeAws_restJson1PutReportDefinitionCommand = async (input, context) => {
80
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
81
- const headers = {
82
- "content-type": "application/json",
83
- };
84
- const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/reportDefinition";
85
- let body;
86
- body = JSON.stringify({
87
- ...(input.destinationS3Location != null && {
88
- destinationS3Location: serializeAws_restJson1S3Location(input.destinationS3Location, context),
89
- }),
90
- ...(input.format != null && { format: input.format }),
91
- ...(input.reportDescription != null && { reportDescription: input.reportDescription }),
92
- ...(input.reportFrequency != null && { reportFrequency: input.reportFrequency }),
93
- ...(input.reportId != null && { reportId: input.reportId }),
154
+ }); };
155
+ export var deserializeAws_restJson1DeleteReportDefinitionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
156
+ var contents, data, _a, _b;
157
+ return __generator(this, function (_c) {
158
+ switch (_c.label) {
159
+ case 0:
160
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
161
+ return [2, deserializeAws_restJson1DeleteReportDefinitionCommandError(output, context)];
162
+ }
163
+ contents = map({
164
+ $metadata: deserializeMetadata(output),
165
+ });
166
+ _a = __expectNonNull;
167
+ _b = __expectObject;
168
+ return [4, parseBody(output.body, context)];
169
+ case 1:
170
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
171
+ if (data.reportId != null) {
172
+ contents.reportId = __expectString(data.reportId);
173
+ }
174
+ return [2, contents];
175
+ }
94
176
  });
95
- return new __HttpRequest({
96
- protocol,
97
- hostname,
98
- port,
99
- method: "POST",
100
- headers,
101
- path: resolvedPath,
102
- body,
177
+ }); };
178
+ var deserializeAws_restJson1DeleteReportDefinitionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
179
+ var parsedOutput, _a, errorCode, _b, parsedBody;
180
+ var _c;
181
+ return __generator(this, function (_d) {
182
+ switch (_d.label) {
183
+ case 0:
184
+ _a = [__assign({}, output)];
185
+ _c = {};
186
+ return [4, parseErrorBody(output.body, context)];
187
+ case 1:
188
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
189
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
190
+ _b = errorCode;
191
+ switch (_b) {
192
+ case "AccessDeniedException": return [3, 2];
193
+ case "com.amazonaws.applicationcostprofiler#AccessDeniedException": return [3, 2];
194
+ case "InternalServerException": return [3, 4];
195
+ case "com.amazonaws.applicationcostprofiler#InternalServerException": return [3, 4];
196
+ case "ThrottlingException": return [3, 6];
197
+ case "com.amazonaws.applicationcostprofiler#ThrottlingException": return [3, 6];
198
+ case "ValidationException": return [3, 8];
199
+ case "com.amazonaws.applicationcostprofiler#ValidationException": return [3, 8];
200
+ }
201
+ return [3, 10];
202
+ case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
203
+ case 3: throw _d.sent();
204
+ case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
205
+ case 5: throw _d.sent();
206
+ case 6: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
207
+ case 7: throw _d.sent();
208
+ case 8: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
209
+ case 9: throw _d.sent();
210
+ case 10:
211
+ parsedBody = parsedOutput.body;
212
+ throwDefaultError({
213
+ output: output,
214
+ parsedBody: parsedBody,
215
+ exceptionCtor: __BaseException,
216
+ errorCode: errorCode,
217
+ });
218
+ _d.label = 11;
219
+ case 11: return [2];
220
+ }
103
221
  });
104
- };
105
- export const serializeAws_restJson1UpdateReportDefinitionCommand = async (input, context) => {
106
- const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
107
- const headers = {
108
- "content-type": "application/json",
109
- };
110
- let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/reportDefinition/{reportId}";
111
- resolvedPath = __resolvedPath(resolvedPath, input, "reportId", () => input.reportId, "{reportId}", false);
112
- let body;
113
- body = JSON.stringify({
114
- ...(input.destinationS3Location != null && {
115
- destinationS3Location: serializeAws_restJson1S3Location(input.destinationS3Location, context),
116
- }),
117
- ...(input.format != null && { format: input.format }),
118
- ...(input.reportDescription != null && { reportDescription: input.reportDescription }),
119
- ...(input.reportFrequency != null && { reportFrequency: input.reportFrequency }),
222
+ }); };
223
+ export var deserializeAws_restJson1GetReportDefinitionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
224
+ var contents, data, _a, _b;
225
+ return __generator(this, function (_c) {
226
+ switch (_c.label) {
227
+ case 0:
228
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
229
+ return [2, deserializeAws_restJson1GetReportDefinitionCommandError(output, context)];
230
+ }
231
+ contents = map({
232
+ $metadata: deserializeMetadata(output),
233
+ });
234
+ _a = __expectNonNull;
235
+ _b = __expectObject;
236
+ return [4, parseBody(output.body, context)];
237
+ case 1:
238
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
239
+ if (data.createdAt != null) {
240
+ contents.createdAt = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.createdAt)));
241
+ }
242
+ if (data.destinationS3Location != null) {
243
+ contents.destinationS3Location = deserializeAws_restJson1S3Location(data.destinationS3Location, context);
244
+ }
245
+ if (data.format != null) {
246
+ contents.format = __expectString(data.format);
247
+ }
248
+ if (data.lastUpdated != null) {
249
+ contents.lastUpdated = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.lastUpdated)));
250
+ }
251
+ if (data.reportDescription != null) {
252
+ contents.reportDescription = __expectString(data.reportDescription);
253
+ }
254
+ if (data.reportFrequency != null) {
255
+ contents.reportFrequency = __expectString(data.reportFrequency);
256
+ }
257
+ if (data.reportId != null) {
258
+ contents.reportId = __expectString(data.reportId);
259
+ }
260
+ return [2, contents];
261
+ }
120
262
  });
121
- return new __HttpRequest({
122
- protocol,
123
- hostname,
124
- port,
125
- method: "PUT",
126
- headers,
127
- path: resolvedPath,
128
- body,
263
+ }); };
264
+ var deserializeAws_restJson1GetReportDefinitionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
265
+ var parsedOutput, _a, errorCode, _b, parsedBody;
266
+ var _c;
267
+ return __generator(this, function (_d) {
268
+ switch (_d.label) {
269
+ case 0:
270
+ _a = [__assign({}, output)];
271
+ _c = {};
272
+ return [4, parseErrorBody(output.body, context)];
273
+ case 1:
274
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
275
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
276
+ _b = errorCode;
277
+ switch (_b) {
278
+ case "AccessDeniedException": return [3, 2];
279
+ case "com.amazonaws.applicationcostprofiler#AccessDeniedException": return [3, 2];
280
+ case "InternalServerException": return [3, 4];
281
+ case "com.amazonaws.applicationcostprofiler#InternalServerException": return [3, 4];
282
+ case "ThrottlingException": return [3, 6];
283
+ case "com.amazonaws.applicationcostprofiler#ThrottlingException": return [3, 6];
284
+ case "ValidationException": return [3, 8];
285
+ case "com.amazonaws.applicationcostprofiler#ValidationException": return [3, 8];
286
+ }
287
+ return [3, 10];
288
+ case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
289
+ case 3: throw _d.sent();
290
+ case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
291
+ case 5: throw _d.sent();
292
+ case 6: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
293
+ case 7: throw _d.sent();
294
+ case 8: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
295
+ case 9: throw _d.sent();
296
+ case 10:
297
+ parsedBody = parsedOutput.body;
298
+ throwDefaultError({
299
+ output: output,
300
+ parsedBody: parsedBody,
301
+ exceptionCtor: __BaseException,
302
+ errorCode: errorCode,
303
+ });
304
+ _d.label = 11;
305
+ case 11: return [2];
306
+ }
129
307
  });
130
- };
131
- export const deserializeAws_restJson1DeleteReportDefinitionCommand = async (output, context) => {
132
- if (output.statusCode !== 200 && output.statusCode >= 300) {
133
- return deserializeAws_restJson1DeleteReportDefinitionCommandError(output, context);
134
- }
135
- const contents = map({
136
- $metadata: deserializeMetadata(output),
308
+ }); };
309
+ export var deserializeAws_restJson1ImportApplicationUsageCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
310
+ var contents, data, _a, _b;
311
+ return __generator(this, function (_c) {
312
+ switch (_c.label) {
313
+ case 0:
314
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
315
+ return [2, deserializeAws_restJson1ImportApplicationUsageCommandError(output, context)];
316
+ }
317
+ contents = map({
318
+ $metadata: deserializeMetadata(output),
319
+ });
320
+ _a = __expectNonNull;
321
+ _b = __expectObject;
322
+ return [4, parseBody(output.body, context)];
323
+ case 1:
324
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
325
+ if (data.importId != null) {
326
+ contents.importId = __expectString(data.importId);
327
+ }
328
+ return [2, contents];
329
+ }
137
330
  });
138
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
139
- if (data.reportId != null) {
140
- contents.reportId = __expectString(data.reportId);
141
- }
142
- return contents;
143
- };
144
- const deserializeAws_restJson1DeleteReportDefinitionCommandError = async (output, context) => {
145
- const parsedOutput = {
146
- ...output,
147
- body: await parseErrorBody(output.body, context),
148
- };
149
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
150
- switch (errorCode) {
151
- case "AccessDeniedException":
152
- case "com.amazonaws.applicationcostprofiler#AccessDeniedException":
153
- throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
154
- case "InternalServerException":
155
- case "com.amazonaws.applicationcostprofiler#InternalServerException":
156
- throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
157
- case "ThrottlingException":
158
- case "com.amazonaws.applicationcostprofiler#ThrottlingException":
159
- throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
160
- case "ValidationException":
161
- case "com.amazonaws.applicationcostprofiler#ValidationException":
162
- throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
163
- default:
164
- const parsedBody = parsedOutput.body;
165
- throwDefaultError({
166
- output,
167
- parsedBody,
168
- exceptionCtor: __BaseException,
169
- errorCode,
170
- });
171
- }
172
- };
173
- export const deserializeAws_restJson1GetReportDefinitionCommand = async (output, context) => {
174
- if (output.statusCode !== 200 && output.statusCode >= 300) {
175
- return deserializeAws_restJson1GetReportDefinitionCommandError(output, context);
176
- }
177
- const contents = map({
178
- $metadata: deserializeMetadata(output),
331
+ }); };
332
+ var deserializeAws_restJson1ImportApplicationUsageCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
333
+ var parsedOutput, _a, errorCode, _b, parsedBody;
334
+ var _c;
335
+ return __generator(this, function (_d) {
336
+ switch (_d.label) {
337
+ case 0:
338
+ _a = [__assign({}, output)];
339
+ _c = {};
340
+ return [4, parseErrorBody(output.body, context)];
341
+ case 1:
342
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
343
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
344
+ _b = errorCode;
345
+ switch (_b) {
346
+ case "AccessDeniedException": return [3, 2];
347
+ case "com.amazonaws.applicationcostprofiler#AccessDeniedException": return [3, 2];
348
+ case "InternalServerException": return [3, 4];
349
+ case "com.amazonaws.applicationcostprofiler#InternalServerException": return [3, 4];
350
+ case "ThrottlingException": return [3, 6];
351
+ case "com.amazonaws.applicationcostprofiler#ThrottlingException": return [3, 6];
352
+ case "ValidationException": return [3, 8];
353
+ case "com.amazonaws.applicationcostprofiler#ValidationException": return [3, 8];
354
+ }
355
+ return [3, 10];
356
+ case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
357
+ case 3: throw _d.sent();
358
+ case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
359
+ case 5: throw _d.sent();
360
+ case 6: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
361
+ case 7: throw _d.sent();
362
+ case 8: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
363
+ case 9: throw _d.sent();
364
+ case 10:
365
+ parsedBody = parsedOutput.body;
366
+ throwDefaultError({
367
+ output: output,
368
+ parsedBody: parsedBody,
369
+ exceptionCtor: __BaseException,
370
+ errorCode: errorCode,
371
+ });
372
+ _d.label = 11;
373
+ case 11: return [2];
374
+ }
179
375
  });
180
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
181
- if (data.createdAt != null) {
182
- contents.createdAt = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.createdAt)));
183
- }
184
- if (data.destinationS3Location != null) {
185
- contents.destinationS3Location = deserializeAws_restJson1S3Location(data.destinationS3Location, context);
186
- }
187
- if (data.format != null) {
188
- contents.format = __expectString(data.format);
189
- }
190
- if (data.lastUpdated != null) {
191
- contents.lastUpdated = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.lastUpdated)));
192
- }
193
- if (data.reportDescription != null) {
194
- contents.reportDescription = __expectString(data.reportDescription);
195
- }
196
- if (data.reportFrequency != null) {
197
- contents.reportFrequency = __expectString(data.reportFrequency);
198
- }
199
- if (data.reportId != null) {
200
- contents.reportId = __expectString(data.reportId);
201
- }
202
- return contents;
203
- };
204
- const deserializeAws_restJson1GetReportDefinitionCommandError = async (output, context) => {
205
- const parsedOutput = {
206
- ...output,
207
- body: await parseErrorBody(output.body, context),
208
- };
209
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
210
- switch (errorCode) {
211
- case "AccessDeniedException":
212
- case "com.amazonaws.applicationcostprofiler#AccessDeniedException":
213
- throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
214
- case "InternalServerException":
215
- case "com.amazonaws.applicationcostprofiler#InternalServerException":
216
- throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
217
- case "ThrottlingException":
218
- case "com.amazonaws.applicationcostprofiler#ThrottlingException":
219
- throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
220
- case "ValidationException":
221
- case "com.amazonaws.applicationcostprofiler#ValidationException":
222
- throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
223
- default:
224
- const parsedBody = parsedOutput.body;
225
- throwDefaultError({
226
- output,
227
- parsedBody,
228
- exceptionCtor: __BaseException,
229
- errorCode,
230
- });
231
- }
232
- };
233
- export const deserializeAws_restJson1ImportApplicationUsageCommand = async (output, context) => {
234
- if (output.statusCode !== 200 && output.statusCode >= 300) {
235
- return deserializeAws_restJson1ImportApplicationUsageCommandError(output, context);
236
- }
237
- const contents = map({
238
- $metadata: deserializeMetadata(output),
376
+ }); };
377
+ export var deserializeAws_restJson1ListReportDefinitionsCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
378
+ var contents, data, _a, _b;
379
+ return __generator(this, function (_c) {
380
+ switch (_c.label) {
381
+ case 0:
382
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
383
+ return [2, deserializeAws_restJson1ListReportDefinitionsCommandError(output, context)];
384
+ }
385
+ contents = map({
386
+ $metadata: deserializeMetadata(output),
387
+ });
388
+ _a = __expectNonNull;
389
+ _b = __expectObject;
390
+ return [4, parseBody(output.body, context)];
391
+ case 1:
392
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
393
+ if (data.nextToken != null) {
394
+ contents.nextToken = __expectString(data.nextToken);
395
+ }
396
+ if (data.reportDefinitions != null) {
397
+ contents.reportDefinitions = deserializeAws_restJson1ReportDefinitionList(data.reportDefinitions, context);
398
+ }
399
+ return [2, contents];
400
+ }
239
401
  });
240
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
241
- if (data.importId != null) {
242
- contents.importId = __expectString(data.importId);
243
- }
244
- return contents;
245
- };
246
- const deserializeAws_restJson1ImportApplicationUsageCommandError = async (output, context) => {
247
- const parsedOutput = {
248
- ...output,
249
- body: await parseErrorBody(output.body, context),
250
- };
251
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
252
- switch (errorCode) {
253
- case "AccessDeniedException":
254
- case "com.amazonaws.applicationcostprofiler#AccessDeniedException":
255
- throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
256
- case "InternalServerException":
257
- case "com.amazonaws.applicationcostprofiler#InternalServerException":
258
- throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
259
- case "ThrottlingException":
260
- case "com.amazonaws.applicationcostprofiler#ThrottlingException":
261
- throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
262
- case "ValidationException":
263
- case "com.amazonaws.applicationcostprofiler#ValidationException":
264
- throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
265
- default:
266
- const parsedBody = parsedOutput.body;
267
- throwDefaultError({
268
- output,
269
- parsedBody,
270
- exceptionCtor: __BaseException,
271
- errorCode,
272
- });
273
- }
274
- };
275
- export const deserializeAws_restJson1ListReportDefinitionsCommand = async (output, context) => {
276
- if (output.statusCode !== 200 && output.statusCode >= 300) {
277
- return deserializeAws_restJson1ListReportDefinitionsCommandError(output, context);
278
- }
279
- const contents = map({
280
- $metadata: deserializeMetadata(output),
402
+ }); };
403
+ var deserializeAws_restJson1ListReportDefinitionsCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
404
+ var parsedOutput, _a, errorCode, _b, parsedBody;
405
+ var _c;
406
+ return __generator(this, function (_d) {
407
+ switch (_d.label) {
408
+ case 0:
409
+ _a = [__assign({}, output)];
410
+ _c = {};
411
+ return [4, parseErrorBody(output.body, context)];
412
+ case 1:
413
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
414
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
415
+ _b = errorCode;
416
+ switch (_b) {
417
+ case "AccessDeniedException": return [3, 2];
418
+ case "com.amazonaws.applicationcostprofiler#AccessDeniedException": return [3, 2];
419
+ case "InternalServerException": return [3, 4];
420
+ case "com.amazonaws.applicationcostprofiler#InternalServerException": return [3, 4];
421
+ case "ThrottlingException": return [3, 6];
422
+ case "com.amazonaws.applicationcostprofiler#ThrottlingException": return [3, 6];
423
+ case "ValidationException": return [3, 8];
424
+ case "com.amazonaws.applicationcostprofiler#ValidationException": return [3, 8];
425
+ }
426
+ return [3, 10];
427
+ case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
428
+ case 3: throw _d.sent();
429
+ case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
430
+ case 5: throw _d.sent();
431
+ case 6: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
432
+ case 7: throw _d.sent();
433
+ case 8: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
434
+ case 9: throw _d.sent();
435
+ case 10:
436
+ parsedBody = parsedOutput.body;
437
+ throwDefaultError({
438
+ output: output,
439
+ parsedBody: parsedBody,
440
+ exceptionCtor: __BaseException,
441
+ errorCode: errorCode,
442
+ });
443
+ _d.label = 11;
444
+ case 11: return [2];
445
+ }
281
446
  });
282
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
283
- if (data.nextToken != null) {
284
- contents.nextToken = __expectString(data.nextToken);
285
- }
286
- if (data.reportDefinitions != null) {
287
- contents.reportDefinitions = deserializeAws_restJson1ReportDefinitionList(data.reportDefinitions, context);
288
- }
289
- return contents;
290
- };
291
- const deserializeAws_restJson1ListReportDefinitionsCommandError = async (output, context) => {
292
- const parsedOutput = {
293
- ...output,
294
- body: await parseErrorBody(output.body, context),
295
- };
296
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
297
- switch (errorCode) {
298
- case "AccessDeniedException":
299
- case "com.amazonaws.applicationcostprofiler#AccessDeniedException":
300
- throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
301
- case "InternalServerException":
302
- case "com.amazonaws.applicationcostprofiler#InternalServerException":
303
- throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
304
- case "ThrottlingException":
305
- case "com.amazonaws.applicationcostprofiler#ThrottlingException":
306
- throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
307
- case "ValidationException":
308
- case "com.amazonaws.applicationcostprofiler#ValidationException":
309
- throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
310
- default:
311
- const parsedBody = parsedOutput.body;
312
- throwDefaultError({
313
- output,
314
- parsedBody,
315
- exceptionCtor: __BaseException,
316
- errorCode,
317
- });
318
- }
319
- };
320
- export const deserializeAws_restJson1PutReportDefinitionCommand = async (output, context) => {
321
- if (output.statusCode !== 200 && output.statusCode >= 300) {
322
- return deserializeAws_restJson1PutReportDefinitionCommandError(output, context);
323
- }
324
- const contents = map({
325
- $metadata: deserializeMetadata(output),
447
+ }); };
448
+ export var deserializeAws_restJson1PutReportDefinitionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
449
+ var contents, data, _a, _b;
450
+ return __generator(this, function (_c) {
451
+ switch (_c.label) {
452
+ case 0:
453
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
454
+ return [2, deserializeAws_restJson1PutReportDefinitionCommandError(output, context)];
455
+ }
456
+ contents = map({
457
+ $metadata: deserializeMetadata(output),
458
+ });
459
+ _a = __expectNonNull;
460
+ _b = __expectObject;
461
+ return [4, parseBody(output.body, context)];
462
+ case 1:
463
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
464
+ if (data.reportId != null) {
465
+ contents.reportId = __expectString(data.reportId);
466
+ }
467
+ return [2, contents];
468
+ }
326
469
  });
327
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
328
- if (data.reportId != null) {
329
- contents.reportId = __expectString(data.reportId);
330
- }
331
- return contents;
332
- };
333
- const deserializeAws_restJson1PutReportDefinitionCommandError = async (output, context) => {
334
- const parsedOutput = {
335
- ...output,
336
- body: await parseErrorBody(output.body, context),
337
- };
338
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
339
- switch (errorCode) {
340
- case "AccessDeniedException":
341
- case "com.amazonaws.applicationcostprofiler#AccessDeniedException":
342
- throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
343
- case "InternalServerException":
344
- case "com.amazonaws.applicationcostprofiler#InternalServerException":
345
- throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
346
- case "ServiceQuotaExceededException":
347
- case "com.amazonaws.applicationcostprofiler#ServiceQuotaExceededException":
348
- throw await deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context);
349
- case "ThrottlingException":
350
- case "com.amazonaws.applicationcostprofiler#ThrottlingException":
351
- throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
352
- case "ValidationException":
353
- case "com.amazonaws.applicationcostprofiler#ValidationException":
354
- throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
355
- default:
356
- const parsedBody = parsedOutput.body;
357
- throwDefaultError({
358
- output,
359
- parsedBody,
360
- exceptionCtor: __BaseException,
361
- errorCode,
362
- });
363
- }
364
- };
365
- export const deserializeAws_restJson1UpdateReportDefinitionCommand = async (output, context) => {
366
- if (output.statusCode !== 200 && output.statusCode >= 300) {
367
- return deserializeAws_restJson1UpdateReportDefinitionCommandError(output, context);
368
- }
369
- const contents = map({
370
- $metadata: deserializeMetadata(output),
470
+ }); };
471
+ var deserializeAws_restJson1PutReportDefinitionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
472
+ var parsedOutput, _a, errorCode, _b, parsedBody;
473
+ var _c;
474
+ return __generator(this, function (_d) {
475
+ switch (_d.label) {
476
+ case 0:
477
+ _a = [__assign({}, output)];
478
+ _c = {};
479
+ return [4, parseErrorBody(output.body, context)];
480
+ case 1:
481
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
482
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
483
+ _b = errorCode;
484
+ switch (_b) {
485
+ case "AccessDeniedException": return [3, 2];
486
+ case "com.amazonaws.applicationcostprofiler#AccessDeniedException": return [3, 2];
487
+ case "InternalServerException": return [3, 4];
488
+ case "com.amazonaws.applicationcostprofiler#InternalServerException": return [3, 4];
489
+ case "ServiceQuotaExceededException": return [3, 6];
490
+ case "com.amazonaws.applicationcostprofiler#ServiceQuotaExceededException": return [3, 6];
491
+ case "ThrottlingException": return [3, 8];
492
+ case "com.amazonaws.applicationcostprofiler#ThrottlingException": return [3, 8];
493
+ case "ValidationException": return [3, 10];
494
+ case "com.amazonaws.applicationcostprofiler#ValidationException": return [3, 10];
495
+ }
496
+ return [3, 12];
497
+ case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
498
+ case 3: throw _d.sent();
499
+ case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
500
+ case 5: throw _d.sent();
501
+ case 6: return [4, deserializeAws_restJson1ServiceQuotaExceededExceptionResponse(parsedOutput, context)];
502
+ case 7: throw _d.sent();
503
+ case 8: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
504
+ case 9: throw _d.sent();
505
+ case 10: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
506
+ case 11: throw _d.sent();
507
+ case 12:
508
+ parsedBody = parsedOutput.body;
509
+ throwDefaultError({
510
+ output: output,
511
+ parsedBody: parsedBody,
512
+ exceptionCtor: __BaseException,
513
+ errorCode: errorCode,
514
+ });
515
+ _d.label = 13;
516
+ case 13: return [2];
517
+ }
371
518
  });
372
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
373
- if (data.reportId != null) {
374
- contents.reportId = __expectString(data.reportId);
375
- }
376
- return contents;
377
- };
378
- const deserializeAws_restJson1UpdateReportDefinitionCommandError = async (output, context) => {
379
- const parsedOutput = {
380
- ...output,
381
- body: await parseErrorBody(output.body, context),
382
- };
383
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
384
- switch (errorCode) {
385
- case "AccessDeniedException":
386
- case "com.amazonaws.applicationcostprofiler#AccessDeniedException":
387
- throw await deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context);
388
- case "InternalServerException":
389
- case "com.amazonaws.applicationcostprofiler#InternalServerException":
390
- throw await deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context);
391
- case "ThrottlingException":
392
- case "com.amazonaws.applicationcostprofiler#ThrottlingException":
393
- throw await deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context);
394
- case "ValidationException":
395
- case "com.amazonaws.applicationcostprofiler#ValidationException":
396
- throw await deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context);
397
- default:
398
- const parsedBody = parsedOutput.body;
399
- throwDefaultError({
400
- output,
401
- parsedBody,
402
- exceptionCtor: __BaseException,
403
- errorCode,
404
- });
405
- }
406
- };
407
- const map = __map;
408
- const deserializeAws_restJson1AccessDeniedExceptionResponse = async (parsedOutput, context) => {
409
- const contents = map({});
410
- const data = parsedOutput.body;
411
- if (data.message != null) {
412
- contents.message = __expectString(data.message);
413
- }
414
- const exception = new AccessDeniedException({
415
- $metadata: deserializeMetadata(parsedOutput),
416
- ...contents,
519
+ }); };
520
+ export var deserializeAws_restJson1UpdateReportDefinitionCommand = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
521
+ var contents, data, _a, _b;
522
+ return __generator(this, function (_c) {
523
+ switch (_c.label) {
524
+ case 0:
525
+ if (output.statusCode !== 200 && output.statusCode >= 300) {
526
+ return [2, deserializeAws_restJson1UpdateReportDefinitionCommandError(output, context)];
527
+ }
528
+ contents = map({
529
+ $metadata: deserializeMetadata(output),
530
+ });
531
+ _a = __expectNonNull;
532
+ _b = __expectObject;
533
+ return [4, parseBody(output.body, context)];
534
+ case 1:
535
+ data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
536
+ if (data.reportId != null) {
537
+ contents.reportId = __expectString(data.reportId);
538
+ }
539
+ return [2, contents];
540
+ }
417
541
  });
418
- return __decorateServiceException(exception, parsedOutput.body);
419
- };
420
- const deserializeAws_restJson1InternalServerExceptionResponse = async (parsedOutput, context) => {
421
- const contents = map({});
422
- const data = parsedOutput.body;
423
- if (data.message != null) {
424
- contents.message = __expectString(data.message);
425
- }
426
- const exception = new InternalServerException({
427
- $metadata: deserializeMetadata(parsedOutput),
428
- ...contents,
542
+ }); };
543
+ var deserializeAws_restJson1UpdateReportDefinitionCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
544
+ var parsedOutput, _a, errorCode, _b, parsedBody;
545
+ var _c;
546
+ return __generator(this, function (_d) {
547
+ switch (_d.label) {
548
+ case 0:
549
+ _a = [__assign({}, output)];
550
+ _c = {};
551
+ return [4, parseErrorBody(output.body, context)];
552
+ case 1:
553
+ parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
554
+ errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
555
+ _b = errorCode;
556
+ switch (_b) {
557
+ case "AccessDeniedException": return [3, 2];
558
+ case "com.amazonaws.applicationcostprofiler#AccessDeniedException": return [3, 2];
559
+ case "InternalServerException": return [3, 4];
560
+ case "com.amazonaws.applicationcostprofiler#InternalServerException": return [3, 4];
561
+ case "ThrottlingException": return [3, 6];
562
+ case "com.amazonaws.applicationcostprofiler#ThrottlingException": return [3, 6];
563
+ case "ValidationException": return [3, 8];
564
+ case "com.amazonaws.applicationcostprofiler#ValidationException": return [3, 8];
565
+ }
566
+ return [3, 10];
567
+ case 2: return [4, deserializeAws_restJson1AccessDeniedExceptionResponse(parsedOutput, context)];
568
+ case 3: throw _d.sent();
569
+ case 4: return [4, deserializeAws_restJson1InternalServerExceptionResponse(parsedOutput, context)];
570
+ case 5: throw _d.sent();
571
+ case 6: return [4, deserializeAws_restJson1ThrottlingExceptionResponse(parsedOutput, context)];
572
+ case 7: throw _d.sent();
573
+ case 8: return [4, deserializeAws_restJson1ValidationExceptionResponse(parsedOutput, context)];
574
+ case 9: throw _d.sent();
575
+ case 10:
576
+ parsedBody = parsedOutput.body;
577
+ throwDefaultError({
578
+ output: output,
579
+ parsedBody: parsedBody,
580
+ exceptionCtor: __BaseException,
581
+ errorCode: errorCode,
582
+ });
583
+ _d.label = 11;
584
+ case 11: return [2];
585
+ }
429
586
  });
430
- return __decorateServiceException(exception, parsedOutput.body);
431
- };
432
- const deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = async (parsedOutput, context) => {
433
- const contents = map({});
434
- const data = parsedOutput.body;
435
- if (data.message != null) {
436
- contents.message = __expectString(data.message);
437
- }
438
- const exception = new ServiceQuotaExceededException({
439
- $metadata: deserializeMetadata(parsedOutput),
440
- ...contents,
587
+ }); };
588
+ var map = __map;
589
+ var deserializeAws_restJson1AccessDeniedExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
590
+ var contents, data, exception;
591
+ return __generator(this, function (_a) {
592
+ contents = map({});
593
+ data = parsedOutput.body;
594
+ if (data.message != null) {
595
+ contents.message = __expectString(data.message);
596
+ }
597
+ exception = new AccessDeniedException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
598
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
441
599
  });
442
- return __decorateServiceException(exception, parsedOutput.body);
443
- };
444
- const deserializeAws_restJson1ThrottlingExceptionResponse = async (parsedOutput, context) => {
445
- const contents = map({});
446
- const data = parsedOutput.body;
447
- if (data.message != null) {
448
- contents.message = __expectString(data.message);
449
- }
450
- const exception = new ThrottlingException({
451
- $metadata: deserializeMetadata(parsedOutput),
452
- ...contents,
600
+ }); };
601
+ var deserializeAws_restJson1InternalServerExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
602
+ var contents, data, exception;
603
+ return __generator(this, function (_a) {
604
+ contents = map({});
605
+ data = parsedOutput.body;
606
+ if (data.message != null) {
607
+ contents.message = __expectString(data.message);
608
+ }
609
+ exception = new InternalServerException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
610
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
453
611
  });
454
- return __decorateServiceException(exception, parsedOutput.body);
455
- };
456
- const deserializeAws_restJson1ValidationExceptionResponse = async (parsedOutput, context) => {
457
- const contents = map({});
458
- const data = parsedOutput.body;
459
- if (data.message != null) {
460
- contents.message = __expectString(data.message);
461
- }
462
- const exception = new ValidationException({
463
- $metadata: deserializeMetadata(parsedOutput),
464
- ...contents,
612
+ }); };
613
+ var deserializeAws_restJson1ServiceQuotaExceededExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
614
+ var contents, data, exception;
615
+ return __generator(this, function (_a) {
616
+ contents = map({});
617
+ data = parsedOutput.body;
618
+ if (data.message != null) {
619
+ contents.message = __expectString(data.message);
620
+ }
621
+ exception = new ServiceQuotaExceededException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
622
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
465
623
  });
466
- return __decorateServiceException(exception, parsedOutput.body);
467
- };
468
- const serializeAws_restJson1S3Location = (input, context) => {
469
- return {
470
- ...(input.bucket != null && { bucket: input.bucket }),
471
- ...(input.prefix != null && { prefix: input.prefix }),
472
- };
624
+ }); };
625
+ var deserializeAws_restJson1ThrottlingExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
626
+ var contents, data, exception;
627
+ return __generator(this, function (_a) {
628
+ contents = map({});
629
+ data = parsedOutput.body;
630
+ if (data.message != null) {
631
+ contents.message = __expectString(data.message);
632
+ }
633
+ exception = new ThrottlingException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
634
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
635
+ });
636
+ }); };
637
+ var deserializeAws_restJson1ValidationExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
638
+ var contents, data, exception;
639
+ return __generator(this, function (_a) {
640
+ contents = map({});
641
+ data = parsedOutput.body;
642
+ if (data.message != null) {
643
+ contents.message = __expectString(data.message);
644
+ }
645
+ exception = new ValidationException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
646
+ return [2, __decorateServiceException(exception, parsedOutput.body)];
647
+ });
648
+ }); };
649
+ var serializeAws_restJson1S3Location = function (input, context) {
650
+ return __assign(__assign({}, (input.bucket != null && { bucket: input.bucket })), (input.prefix != null && { prefix: input.prefix }));
473
651
  };
474
- const serializeAws_restJson1SourceS3Location = (input, context) => {
475
- return {
476
- ...(input.bucket != null && { bucket: input.bucket }),
477
- ...(input.key != null && { key: input.key }),
478
- ...(input.region != null && { region: input.region }),
479
- };
652
+ var serializeAws_restJson1SourceS3Location = function (input, context) {
653
+ return __assign(__assign(__assign({}, (input.bucket != null && { bucket: input.bucket })), (input.key != null && { key: input.key })), (input.region != null && { region: input.region }));
480
654
  };
481
- const deserializeAws_restJson1ReportDefinition = (output, context) => {
655
+ var deserializeAws_restJson1ReportDefinition = function (output, context) {
482
656
  return {
483
657
  createdAt: output.createdAt != null ? __expectNonNull(__parseEpochTimestamp(__expectNumber(output.createdAt))) : undefined,
484
658
  destinationS3Location: output.destinationS3Location != null
@@ -493,10 +667,10 @@ const deserializeAws_restJson1ReportDefinition = (output, context) => {
493
667
  reportId: __expectString(output.reportId),
494
668
  };
495
669
  };
496
- const deserializeAws_restJson1ReportDefinitionList = (output, context) => {
497
- const retVal = (output || [])
498
- .filter((e) => e != null)
499
- .map((entry) => {
670
+ var deserializeAws_restJson1ReportDefinitionList = function (output, context) {
671
+ var retVal = (output || [])
672
+ .filter(function (e) { return e != null; })
673
+ .map(function (entry) {
500
674
  if (entry === null) {
501
675
  return null;
502
676
  }
@@ -504,45 +678,63 @@ const deserializeAws_restJson1ReportDefinitionList = (output, context) => {
504
678
  });
505
679
  return retVal;
506
680
  };
507
- const deserializeAws_restJson1S3Location = (output, context) => {
681
+ var deserializeAws_restJson1S3Location = function (output, context) {
508
682
  return {
509
683
  bucket: __expectString(output.bucket),
510
684
  prefix: __expectString(output.prefix),
511
685
  };
512
686
  };
513
- const deserializeMetadata = (output) => ({
514
- httpStatusCode: output.statusCode,
515
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
516
- extendedRequestId: output.headers["x-amz-id-2"],
517
- cfId: output.headers["x-amz-cf-id"],
518
- });
519
- const collectBody = (streamBody = new Uint8Array(), context) => {
687
+ var deserializeMetadata = function (output) {
688
+ var _a, _b;
689
+ return ({
690
+ httpStatusCode: output.statusCode,
691
+ 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"],
692
+ extendedRequestId: output.headers["x-amz-id-2"],
693
+ cfId: output.headers["x-amz-cf-id"],
694
+ });
695
+ };
696
+ var collectBody = function (streamBody, context) {
697
+ if (streamBody === void 0) { streamBody = new Uint8Array(); }
520
698
  if (streamBody instanceof Uint8Array) {
521
699
  return Promise.resolve(streamBody);
522
700
  }
523
701
  return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
524
702
  };
525
- const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
526
- const isSerializableHeaderValue = (value) => value !== undefined &&
527
- value !== null &&
528
- value !== "" &&
529
- (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
530
- (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
531
- const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
532
- if (encoded.length) {
533
- return JSON.parse(encoded);
534
- }
535
- return {};
536
- });
537
- const parseErrorBody = async (errorBody, context) => {
538
- const value = await parseBody(errorBody, context);
539
- value.message = value.message ?? value.Message;
540
- return value;
703
+ var collectBodyString = function (streamBody, context) {
704
+ return collectBody(streamBody, context).then(function (body) { return context.utf8Encoder(body); });
541
705
  };
542
- const loadRestJsonErrorCode = (output, data) => {
543
- const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
544
- const sanitizeErrorCode = (rawValue) => {
545
- let cleanValue = rawValue;
706
+ var isSerializableHeaderValue = function (value) {
707
+ return value !== undefined &&
708
+ value !== null &&
709
+ value !== "" &&
710
+ (!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
711
+ (!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
712
+ };
713
+ var parseBody = function (streamBody, context) {
714
+ return collectBodyString(streamBody, context).then(function (encoded) {
715
+ if (encoded.length) {
716
+ return JSON.parse(encoded);
717
+ }
718
+ return {};
719
+ });
720
+ };
721
+ var parseErrorBody = function (errorBody, context) { return __awaiter(void 0, void 0, void 0, function () {
722
+ var value;
723
+ var _a;
724
+ return __generator(this, function (_b) {
725
+ switch (_b.label) {
726
+ case 0: return [4, parseBody(errorBody, context)];
727
+ case 1:
728
+ value = _b.sent();
729
+ value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
730
+ return [2, value];
731
+ }
732
+ });
733
+ }); };
734
+ var loadRestJsonErrorCode = function (output, data) {
735
+ var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
736
+ var sanitizeErrorCode = function (rawValue) {
737
+ var cleanValue = rawValue;
546
738
  if (typeof cleanValue === "number") {
547
739
  cleanValue = cleanValue.toString();
548
740
  }
@@ -557,7 +749,7 @@ const loadRestJsonErrorCode = (output, data) => {
557
749
  }
558
750
  return cleanValue;
559
751
  };
560
- const headerKey = findKey(output.headers, "x-amzn-errortype");
752
+ var headerKey = findKey(output.headers, "x-amzn-errortype");
561
753
  if (headerKey !== undefined) {
562
754
  return sanitizeErrorCode(output.headers[headerKey]);
563
755
  }