@aws-sdk/client-cost-and-usage-report-service 3.32.0 → 3.36.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.
- package/CHANGELOG.md +44 -0
- package/{dist/cjs → dist-cjs}/CostAndUsageReportService.js +1 -2
- package/{dist/cjs → dist-cjs}/CostAndUsageReportServiceClient.js +8 -9
- package/{dist/cjs → dist-cjs}/commands/DeleteReportDefinitionCommand.js +2 -3
- package/{dist/cjs → dist-cjs}/commands/DescribeReportDefinitionsCommand.js +2 -3
- package/{dist/cjs → dist-cjs}/commands/ModifyReportDefinitionCommand.js +2 -3
- package/{dist/cjs → dist-cjs}/commands/PutReportDefinitionCommand.js +2 -3
- package/{dist/cjs → dist-cjs}/endpoints.js +0 -1
- package/{dist/cjs → dist-cjs}/index.js +0 -1
- package/{dist/cjs → dist-cjs}/models/index.js +0 -1
- package/{dist/cjs → dist-cjs}/models/models_0.js +0 -1
- package/{dist/cjs → dist-cjs}/pagination/DescribeReportDefinitionsPaginator.js +1 -2
- package/{dist/cjs → dist-cjs}/pagination/Interfaces.js +0 -1
- package/{dist/cjs → dist-cjs}/protocols/Aws_json1_1.js +0 -1
- package/{dist/cjs → dist-cjs}/runtimeConfig.browser.js +2 -2
- package/{dist/cjs → dist-cjs}/runtimeConfig.js +2 -2
- package/{dist/cjs → dist-cjs}/runtimeConfig.native.js +0 -1
- package/{dist/cjs → dist-cjs}/runtimeConfig.shared.js +1 -2
- package/{dist/es → dist-es}/CostAndUsageReportService.js +2 -23
- package/{dist/es → dist-es}/CostAndUsageReportServiceClient.js +2 -28
- package/{dist/es → dist-es}/commands/DeleteReportDefinitionCommand.js +4 -30
- package/{dist/es → dist-es}/commands/DescribeReportDefinitionsCommand.js +4 -30
- package/{dist/es → dist-es}/commands/ModifyReportDefinitionCommand.js +4 -30
- package/{dist/es → dist-es}/commands/PutReportDefinitionCommand.js +4 -30
- package/{dist/es → dist-es}/endpoints.js +1 -2
- package/{dist/types/index.d.ts → dist-es/index.js} +0 -0
- package/{dist/types/models/index.d.ts → dist-es/models/index.js} +0 -0
- package/{dist/es → dist-es}/models/models_0.js +0 -40
- package/{dist/es → dist-es}/pagination/DescribeReportDefinitionsPaginator.js +17 -30
- package/dist-es/pagination/Interfaces.js +1 -0
- package/{dist/es → dist-es}/protocols/Aws_json1_1.js +70 -76
- package/{dist/es → dist-es}/runtimeConfig.browser.js +1 -5
- package/{dist/es → dist-es}/runtimeConfig.js +1 -5
- package/{dist/es → dist-es}/runtimeConfig.native.js +0 -4
- package/{dist/es → dist-es}/runtimeConfig.shared.js +1 -5
- package/{dist/types → dist-types}/CostAndUsageReportService.d.ts +2 -2
- package/{dist/types → dist-types}/CostAndUsageReportServiceClient.d.ts +5 -5
- package/{dist/types → dist-types}/commands/DeleteReportDefinitionCommand.d.ts +2 -2
- package/{dist/types → dist-types}/commands/DescribeReportDefinitionsCommand.d.ts +2 -2
- package/{dist/types → dist-types}/commands/ModifyReportDefinitionCommand.d.ts +2 -2
- package/{dist/types → dist-types}/commands/PutReportDefinitionCommand.d.ts +2 -2
- package/{dist/types → dist-types}/endpoints.d.ts +0 -0
- package/{index.ts → dist-types/index.d.ts} +0 -0
- package/{models/index.ts → dist-types/models/index.d.ts} +0 -0
- package/{dist/types → dist-types}/models/models_0.d.ts +0 -0
- package/{dist/types → dist-types}/pagination/DescribeReportDefinitionsPaginator.d.ts +1 -1
- package/{dist/types → dist-types}/pagination/Interfaces.d.ts +1 -1
- package/{dist/types → dist-types}/protocols/Aws_json1_1.d.ts +2 -2
- package/{dist/types/ts3.4 → dist-types}/runtimeConfig.browser.d.ts +37 -36
- package/{dist/types/ts3.4 → dist-types}/runtimeConfig.d.ts +37 -36
- package/{dist/types → dist-types}/runtimeConfig.native.d.ts +1 -0
- package/{dist/types → dist-types}/runtimeConfig.shared.d.ts +0 -0
- package/{dist/types → dist-types}/ts3.4/CostAndUsageReportService.d.ts +2 -2
- package/{dist/types → dist-types}/ts3.4/CostAndUsageReportServiceClient.d.ts +5 -5
- package/{dist/types → dist-types}/ts3.4/commands/DeleteReportDefinitionCommand.d.ts +2 -2
- package/{dist/types → dist-types}/ts3.4/commands/DescribeReportDefinitionsCommand.d.ts +2 -2
- package/{dist/types → dist-types}/ts3.4/commands/ModifyReportDefinitionCommand.d.ts +2 -2
- package/{dist/types → dist-types}/ts3.4/commands/PutReportDefinitionCommand.d.ts +2 -2
- package/{dist/types → dist-types}/ts3.4/endpoints.d.ts +0 -0
- package/{dist/types → dist-types}/ts3.4/index.d.ts +0 -0
- package/{dist/types → dist-types}/ts3.4/models/index.d.ts +0 -0
- package/{dist/types → dist-types}/ts3.4/models/models_0.d.ts +0 -0
- package/{dist/types → dist-types}/ts3.4/pagination/DescribeReportDefinitionsPaginator.d.ts +1 -1
- package/{dist/types → dist-types}/ts3.4/pagination/Interfaces.d.ts +1 -1
- package/{dist/types → dist-types}/ts3.4/protocols/Aws_json1_1.d.ts +2 -2
- package/{dist/types → dist-types/ts3.4}/runtimeConfig.browser.d.ts +37 -36
- package/{dist/types → dist-types/ts3.4}/runtimeConfig.d.ts +37 -36
- package/{dist/types → dist-types}/ts3.4/runtimeConfig.native.d.ts +1 -0
- package/{dist/types → dist-types}/ts3.4/runtimeConfig.shared.d.ts +0 -0
- package/package.json +52 -49
- package/CostAndUsageReportService.ts +0 -172
- package/CostAndUsageReportServiceClient.ts +0 -277
- package/commands/DeleteReportDefinitionCommand.ts +0 -98
- package/commands/DescribeReportDefinitionsCommand.ts +0 -101
- package/commands/ModifyReportDefinitionCommand.ts +0 -98
- package/commands/PutReportDefinitionCommand.ts +0 -98
- package/dist/cjs/CostAndUsageReportService.js.map +0 -1
- package/dist/cjs/CostAndUsageReportServiceClient.js.map +0 -1
- package/dist/cjs/commands/DeleteReportDefinitionCommand.js.map +0 -1
- package/dist/cjs/commands/DescribeReportDefinitionsCommand.js.map +0 -1
- package/dist/cjs/commands/ModifyReportDefinitionCommand.js.map +0 -1
- package/dist/cjs/commands/PutReportDefinitionCommand.js.map +0 -1
- package/dist/cjs/endpoints.js.map +0 -1
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/models/index.js.map +0 -1
- package/dist/cjs/models/models_0.js.map +0 -1
- package/dist/cjs/package.json +0 -91
- package/dist/cjs/pagination/DescribeReportDefinitionsPaginator.js.map +0 -1
- package/dist/cjs/pagination/Interfaces.js.map +0 -1
- package/dist/cjs/protocols/Aws_json1_1.js.map +0 -1
- package/dist/cjs/runtimeConfig.browser.js.map +0 -1
- package/dist/cjs/runtimeConfig.js.map +0 -1
- package/dist/cjs/runtimeConfig.native.js.map +0 -1
- package/dist/cjs/runtimeConfig.shared.js.map +0 -1
- package/dist/es/CostAndUsageReportService.js.map +0 -1
- package/dist/es/CostAndUsageReportServiceClient.js.map +0 -1
- package/dist/es/commands/DeleteReportDefinitionCommand.js.map +0 -1
- package/dist/es/commands/DescribeReportDefinitionsCommand.js.map +0 -1
- package/dist/es/commands/ModifyReportDefinitionCommand.js.map +0 -1
- package/dist/es/commands/PutReportDefinitionCommand.js.map +0 -1
- package/dist/es/endpoints.js.map +0 -1
- package/dist/es/index.js +0 -10
- package/dist/es/index.js.map +0 -1
- package/dist/es/models/index.js +0 -2
- package/dist/es/models/index.js.map +0 -1
- package/dist/es/models/models_0.js.map +0 -1
- package/dist/es/package.json +0 -91
- package/dist/es/pagination/DescribeReportDefinitionsPaginator.js.map +0 -1
- package/dist/es/pagination/Interfaces.js +0 -2
- package/dist/es/pagination/Interfaces.js.map +0 -1
- package/dist/es/protocols/Aws_json1_1.js.map +0 -1
- package/dist/es/runtimeConfig.browser.js.map +0 -1
- package/dist/es/runtimeConfig.js.map +0 -1
- package/dist/es/runtimeConfig.native.js.map +0 -1
- package/dist/es/runtimeConfig.shared.js.map +0 -1
- package/endpoints.ts +0 -57
- package/jest.config.js +0 -4
- package/models/models_0.ts +0 -382
- package/pagination/DescribeReportDefinitionsPaginator.ts +0 -58
- package/pagination/Interfaces.ts +0 -7
- package/protocols/Aws_json1_1.ts +0 -716
- package/runtimeConfig.browser.ts +0 -40
- package/runtimeConfig.native.ts +0 -16
- package/runtimeConfig.shared.ts +0 -16
- package/runtimeConfig.ts +0 -45
- package/tsconfig.es.json +0 -12
- package/tsconfig.json +0 -32
package/protocols/Aws_json1_1.ts
DELETED
|
@@ -1,716 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DeleteReportDefinitionCommandInput,
|
|
3
|
-
DeleteReportDefinitionCommandOutput,
|
|
4
|
-
} from "../commands/DeleteReportDefinitionCommand";
|
|
5
|
-
import {
|
|
6
|
-
DescribeReportDefinitionsCommandInput,
|
|
7
|
-
DescribeReportDefinitionsCommandOutput,
|
|
8
|
-
} from "../commands/DescribeReportDefinitionsCommand";
|
|
9
|
-
import {
|
|
10
|
-
ModifyReportDefinitionCommandInput,
|
|
11
|
-
ModifyReportDefinitionCommandOutput,
|
|
12
|
-
} from "../commands/ModifyReportDefinitionCommand";
|
|
13
|
-
import {
|
|
14
|
-
PutReportDefinitionCommandInput,
|
|
15
|
-
PutReportDefinitionCommandOutput,
|
|
16
|
-
} from "../commands/PutReportDefinitionCommand";
|
|
17
|
-
import {
|
|
18
|
-
AdditionalArtifact,
|
|
19
|
-
DeleteReportDefinitionRequest,
|
|
20
|
-
DeleteReportDefinitionResponse,
|
|
21
|
-
DescribeReportDefinitionsRequest,
|
|
22
|
-
DescribeReportDefinitionsResponse,
|
|
23
|
-
DuplicateReportNameException,
|
|
24
|
-
InternalErrorException,
|
|
25
|
-
ModifyReportDefinitionRequest,
|
|
26
|
-
ModifyReportDefinitionResponse,
|
|
27
|
-
PutReportDefinitionRequest,
|
|
28
|
-
PutReportDefinitionResponse,
|
|
29
|
-
ReportDefinition,
|
|
30
|
-
ReportLimitReachedException,
|
|
31
|
-
SchemaElement,
|
|
32
|
-
ValidationException,
|
|
33
|
-
} from "../models/models_0";
|
|
34
|
-
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
|
|
35
|
-
import { expectBoolean as __expectBoolean, expectString as __expectString } from "@aws-sdk/smithy-client";
|
|
36
|
-
import {
|
|
37
|
-
Endpoint as __Endpoint,
|
|
38
|
-
HeaderBag as __HeaderBag,
|
|
39
|
-
MetadataBearer as __MetadataBearer,
|
|
40
|
-
ResponseMetadata as __ResponseMetadata,
|
|
41
|
-
SerdeContext as __SerdeContext,
|
|
42
|
-
SmithyException as __SmithyException,
|
|
43
|
-
} from "@aws-sdk/types";
|
|
44
|
-
|
|
45
|
-
export const serializeAws_json1_1DeleteReportDefinitionCommand = async (
|
|
46
|
-
input: DeleteReportDefinitionCommandInput,
|
|
47
|
-
context: __SerdeContext
|
|
48
|
-
): Promise<__HttpRequest> => {
|
|
49
|
-
const headers: __HeaderBag = {
|
|
50
|
-
"content-type": "application/x-amz-json-1.1",
|
|
51
|
-
"x-amz-target": "AWSOrigamiServiceGatewayService.DeleteReportDefinition",
|
|
52
|
-
};
|
|
53
|
-
let body: any;
|
|
54
|
-
body = JSON.stringify(serializeAws_json1_1DeleteReportDefinitionRequest(input, context));
|
|
55
|
-
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const serializeAws_json1_1DescribeReportDefinitionsCommand = async (
|
|
59
|
-
input: DescribeReportDefinitionsCommandInput,
|
|
60
|
-
context: __SerdeContext
|
|
61
|
-
): Promise<__HttpRequest> => {
|
|
62
|
-
const headers: __HeaderBag = {
|
|
63
|
-
"content-type": "application/x-amz-json-1.1",
|
|
64
|
-
"x-amz-target": "AWSOrigamiServiceGatewayService.DescribeReportDefinitions",
|
|
65
|
-
};
|
|
66
|
-
let body: any;
|
|
67
|
-
body = JSON.stringify(serializeAws_json1_1DescribeReportDefinitionsRequest(input, context));
|
|
68
|
-
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export const serializeAws_json1_1ModifyReportDefinitionCommand = async (
|
|
72
|
-
input: ModifyReportDefinitionCommandInput,
|
|
73
|
-
context: __SerdeContext
|
|
74
|
-
): Promise<__HttpRequest> => {
|
|
75
|
-
const headers: __HeaderBag = {
|
|
76
|
-
"content-type": "application/x-amz-json-1.1",
|
|
77
|
-
"x-amz-target": "AWSOrigamiServiceGatewayService.ModifyReportDefinition",
|
|
78
|
-
};
|
|
79
|
-
let body: any;
|
|
80
|
-
body = JSON.stringify(serializeAws_json1_1ModifyReportDefinitionRequest(input, context));
|
|
81
|
-
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export const serializeAws_json1_1PutReportDefinitionCommand = async (
|
|
85
|
-
input: PutReportDefinitionCommandInput,
|
|
86
|
-
context: __SerdeContext
|
|
87
|
-
): Promise<__HttpRequest> => {
|
|
88
|
-
const headers: __HeaderBag = {
|
|
89
|
-
"content-type": "application/x-amz-json-1.1",
|
|
90
|
-
"x-amz-target": "AWSOrigamiServiceGatewayService.PutReportDefinition",
|
|
91
|
-
};
|
|
92
|
-
let body: any;
|
|
93
|
-
body = JSON.stringify(serializeAws_json1_1PutReportDefinitionRequest(input, context));
|
|
94
|
-
return buildHttpRpcRequest(context, headers, "/", undefined, body);
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
export const deserializeAws_json1_1DeleteReportDefinitionCommand = async (
|
|
98
|
-
output: __HttpResponse,
|
|
99
|
-
context: __SerdeContext
|
|
100
|
-
): Promise<DeleteReportDefinitionCommandOutput> => {
|
|
101
|
-
if (output.statusCode >= 300) {
|
|
102
|
-
return deserializeAws_json1_1DeleteReportDefinitionCommandError(output, context);
|
|
103
|
-
}
|
|
104
|
-
const data: any = await parseBody(output.body, context);
|
|
105
|
-
let contents: any = {};
|
|
106
|
-
contents = deserializeAws_json1_1DeleteReportDefinitionResponse(data, context);
|
|
107
|
-
const response: DeleteReportDefinitionCommandOutput = {
|
|
108
|
-
$metadata: deserializeMetadata(output),
|
|
109
|
-
...contents,
|
|
110
|
-
};
|
|
111
|
-
return Promise.resolve(response);
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
const deserializeAws_json1_1DeleteReportDefinitionCommandError = async (
|
|
115
|
-
output: __HttpResponse,
|
|
116
|
-
context: __SerdeContext
|
|
117
|
-
): Promise<DeleteReportDefinitionCommandOutput> => {
|
|
118
|
-
const parsedOutput: any = {
|
|
119
|
-
...output,
|
|
120
|
-
body: await parseBody(output.body, context),
|
|
121
|
-
};
|
|
122
|
-
let response: __SmithyException & __MetadataBearer & { [key: string]: any };
|
|
123
|
-
let errorCode: string = "UnknownError";
|
|
124
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
125
|
-
switch (errorCode) {
|
|
126
|
-
case "InternalErrorException":
|
|
127
|
-
case "com.amazonaws.costandusagereportservice#InternalErrorException":
|
|
128
|
-
response = {
|
|
129
|
-
...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),
|
|
130
|
-
name: errorCode,
|
|
131
|
-
$metadata: deserializeMetadata(output),
|
|
132
|
-
};
|
|
133
|
-
break;
|
|
134
|
-
case "ValidationException":
|
|
135
|
-
case "com.amazonaws.costandusagereportservice#ValidationException":
|
|
136
|
-
response = {
|
|
137
|
-
...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
|
|
138
|
-
name: errorCode,
|
|
139
|
-
$metadata: deserializeMetadata(output),
|
|
140
|
-
};
|
|
141
|
-
break;
|
|
142
|
-
default:
|
|
143
|
-
const parsedBody = parsedOutput.body;
|
|
144
|
-
errorCode = parsedBody.code || parsedBody.Code || errorCode;
|
|
145
|
-
response = {
|
|
146
|
-
...parsedBody,
|
|
147
|
-
name: `${errorCode}`,
|
|
148
|
-
message: parsedBody.message || parsedBody.Message || errorCode,
|
|
149
|
-
$fault: "client",
|
|
150
|
-
$metadata: deserializeMetadata(output),
|
|
151
|
-
} as any;
|
|
152
|
-
}
|
|
153
|
-
const message = response.message || response.Message || errorCode;
|
|
154
|
-
response.message = message;
|
|
155
|
-
delete response.Message;
|
|
156
|
-
return Promise.reject(Object.assign(new Error(message), response));
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
export const deserializeAws_json1_1DescribeReportDefinitionsCommand = async (
|
|
160
|
-
output: __HttpResponse,
|
|
161
|
-
context: __SerdeContext
|
|
162
|
-
): Promise<DescribeReportDefinitionsCommandOutput> => {
|
|
163
|
-
if (output.statusCode >= 300) {
|
|
164
|
-
return deserializeAws_json1_1DescribeReportDefinitionsCommandError(output, context);
|
|
165
|
-
}
|
|
166
|
-
const data: any = await parseBody(output.body, context);
|
|
167
|
-
let contents: any = {};
|
|
168
|
-
contents = deserializeAws_json1_1DescribeReportDefinitionsResponse(data, context);
|
|
169
|
-
const response: DescribeReportDefinitionsCommandOutput = {
|
|
170
|
-
$metadata: deserializeMetadata(output),
|
|
171
|
-
...contents,
|
|
172
|
-
};
|
|
173
|
-
return Promise.resolve(response);
|
|
174
|
-
};
|
|
175
|
-
|
|
176
|
-
const deserializeAws_json1_1DescribeReportDefinitionsCommandError = async (
|
|
177
|
-
output: __HttpResponse,
|
|
178
|
-
context: __SerdeContext
|
|
179
|
-
): Promise<DescribeReportDefinitionsCommandOutput> => {
|
|
180
|
-
const parsedOutput: any = {
|
|
181
|
-
...output,
|
|
182
|
-
body: await parseBody(output.body, context),
|
|
183
|
-
};
|
|
184
|
-
let response: __SmithyException & __MetadataBearer & { [key: string]: any };
|
|
185
|
-
let errorCode: string = "UnknownError";
|
|
186
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
187
|
-
switch (errorCode) {
|
|
188
|
-
case "InternalErrorException":
|
|
189
|
-
case "com.amazonaws.costandusagereportservice#InternalErrorException":
|
|
190
|
-
response = {
|
|
191
|
-
...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),
|
|
192
|
-
name: errorCode,
|
|
193
|
-
$metadata: deserializeMetadata(output),
|
|
194
|
-
};
|
|
195
|
-
break;
|
|
196
|
-
default:
|
|
197
|
-
const parsedBody = parsedOutput.body;
|
|
198
|
-
errorCode = parsedBody.code || parsedBody.Code || errorCode;
|
|
199
|
-
response = {
|
|
200
|
-
...parsedBody,
|
|
201
|
-
name: `${errorCode}`,
|
|
202
|
-
message: parsedBody.message || parsedBody.Message || errorCode,
|
|
203
|
-
$fault: "client",
|
|
204
|
-
$metadata: deserializeMetadata(output),
|
|
205
|
-
} as any;
|
|
206
|
-
}
|
|
207
|
-
const message = response.message || response.Message || errorCode;
|
|
208
|
-
response.message = message;
|
|
209
|
-
delete response.Message;
|
|
210
|
-
return Promise.reject(Object.assign(new Error(message), response));
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
export const deserializeAws_json1_1ModifyReportDefinitionCommand = async (
|
|
214
|
-
output: __HttpResponse,
|
|
215
|
-
context: __SerdeContext
|
|
216
|
-
): Promise<ModifyReportDefinitionCommandOutput> => {
|
|
217
|
-
if (output.statusCode >= 300) {
|
|
218
|
-
return deserializeAws_json1_1ModifyReportDefinitionCommandError(output, context);
|
|
219
|
-
}
|
|
220
|
-
const data: any = await parseBody(output.body, context);
|
|
221
|
-
let contents: any = {};
|
|
222
|
-
contents = deserializeAws_json1_1ModifyReportDefinitionResponse(data, context);
|
|
223
|
-
const response: ModifyReportDefinitionCommandOutput = {
|
|
224
|
-
$metadata: deserializeMetadata(output),
|
|
225
|
-
...contents,
|
|
226
|
-
};
|
|
227
|
-
return Promise.resolve(response);
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
const deserializeAws_json1_1ModifyReportDefinitionCommandError = async (
|
|
231
|
-
output: __HttpResponse,
|
|
232
|
-
context: __SerdeContext
|
|
233
|
-
): Promise<ModifyReportDefinitionCommandOutput> => {
|
|
234
|
-
const parsedOutput: any = {
|
|
235
|
-
...output,
|
|
236
|
-
body: await parseBody(output.body, context),
|
|
237
|
-
};
|
|
238
|
-
let response: __SmithyException & __MetadataBearer & { [key: string]: any };
|
|
239
|
-
let errorCode: string = "UnknownError";
|
|
240
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
241
|
-
switch (errorCode) {
|
|
242
|
-
case "InternalErrorException":
|
|
243
|
-
case "com.amazonaws.costandusagereportservice#InternalErrorException":
|
|
244
|
-
response = {
|
|
245
|
-
...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),
|
|
246
|
-
name: errorCode,
|
|
247
|
-
$metadata: deserializeMetadata(output),
|
|
248
|
-
};
|
|
249
|
-
break;
|
|
250
|
-
case "ValidationException":
|
|
251
|
-
case "com.amazonaws.costandusagereportservice#ValidationException":
|
|
252
|
-
response = {
|
|
253
|
-
...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
|
|
254
|
-
name: errorCode,
|
|
255
|
-
$metadata: deserializeMetadata(output),
|
|
256
|
-
};
|
|
257
|
-
break;
|
|
258
|
-
default:
|
|
259
|
-
const parsedBody = parsedOutput.body;
|
|
260
|
-
errorCode = parsedBody.code || parsedBody.Code || errorCode;
|
|
261
|
-
response = {
|
|
262
|
-
...parsedBody,
|
|
263
|
-
name: `${errorCode}`,
|
|
264
|
-
message: parsedBody.message || parsedBody.Message || errorCode,
|
|
265
|
-
$fault: "client",
|
|
266
|
-
$metadata: deserializeMetadata(output),
|
|
267
|
-
} as any;
|
|
268
|
-
}
|
|
269
|
-
const message = response.message || response.Message || errorCode;
|
|
270
|
-
response.message = message;
|
|
271
|
-
delete response.Message;
|
|
272
|
-
return Promise.reject(Object.assign(new Error(message), response));
|
|
273
|
-
};
|
|
274
|
-
|
|
275
|
-
export const deserializeAws_json1_1PutReportDefinitionCommand = async (
|
|
276
|
-
output: __HttpResponse,
|
|
277
|
-
context: __SerdeContext
|
|
278
|
-
): Promise<PutReportDefinitionCommandOutput> => {
|
|
279
|
-
if (output.statusCode >= 300) {
|
|
280
|
-
return deserializeAws_json1_1PutReportDefinitionCommandError(output, context);
|
|
281
|
-
}
|
|
282
|
-
const data: any = await parseBody(output.body, context);
|
|
283
|
-
let contents: any = {};
|
|
284
|
-
contents = deserializeAws_json1_1PutReportDefinitionResponse(data, context);
|
|
285
|
-
const response: PutReportDefinitionCommandOutput = {
|
|
286
|
-
$metadata: deserializeMetadata(output),
|
|
287
|
-
...contents,
|
|
288
|
-
};
|
|
289
|
-
return Promise.resolve(response);
|
|
290
|
-
};
|
|
291
|
-
|
|
292
|
-
const deserializeAws_json1_1PutReportDefinitionCommandError = async (
|
|
293
|
-
output: __HttpResponse,
|
|
294
|
-
context: __SerdeContext
|
|
295
|
-
): Promise<PutReportDefinitionCommandOutput> => {
|
|
296
|
-
const parsedOutput: any = {
|
|
297
|
-
...output,
|
|
298
|
-
body: await parseBody(output.body, context),
|
|
299
|
-
};
|
|
300
|
-
let response: __SmithyException & __MetadataBearer & { [key: string]: any };
|
|
301
|
-
let errorCode: string = "UnknownError";
|
|
302
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
303
|
-
switch (errorCode) {
|
|
304
|
-
case "DuplicateReportNameException":
|
|
305
|
-
case "com.amazonaws.costandusagereportservice#DuplicateReportNameException":
|
|
306
|
-
response = {
|
|
307
|
-
...(await deserializeAws_json1_1DuplicateReportNameExceptionResponse(parsedOutput, context)),
|
|
308
|
-
name: errorCode,
|
|
309
|
-
$metadata: deserializeMetadata(output),
|
|
310
|
-
};
|
|
311
|
-
break;
|
|
312
|
-
case "InternalErrorException":
|
|
313
|
-
case "com.amazonaws.costandusagereportservice#InternalErrorException":
|
|
314
|
-
response = {
|
|
315
|
-
...(await deserializeAws_json1_1InternalErrorExceptionResponse(parsedOutput, context)),
|
|
316
|
-
name: errorCode,
|
|
317
|
-
$metadata: deserializeMetadata(output),
|
|
318
|
-
};
|
|
319
|
-
break;
|
|
320
|
-
case "ReportLimitReachedException":
|
|
321
|
-
case "com.amazonaws.costandusagereportservice#ReportLimitReachedException":
|
|
322
|
-
response = {
|
|
323
|
-
...(await deserializeAws_json1_1ReportLimitReachedExceptionResponse(parsedOutput, context)),
|
|
324
|
-
name: errorCode,
|
|
325
|
-
$metadata: deserializeMetadata(output),
|
|
326
|
-
};
|
|
327
|
-
break;
|
|
328
|
-
case "ValidationException":
|
|
329
|
-
case "com.amazonaws.costandusagereportservice#ValidationException":
|
|
330
|
-
response = {
|
|
331
|
-
...(await deserializeAws_json1_1ValidationExceptionResponse(parsedOutput, context)),
|
|
332
|
-
name: errorCode,
|
|
333
|
-
$metadata: deserializeMetadata(output),
|
|
334
|
-
};
|
|
335
|
-
break;
|
|
336
|
-
default:
|
|
337
|
-
const parsedBody = parsedOutput.body;
|
|
338
|
-
errorCode = parsedBody.code || parsedBody.Code || errorCode;
|
|
339
|
-
response = {
|
|
340
|
-
...parsedBody,
|
|
341
|
-
name: `${errorCode}`,
|
|
342
|
-
message: parsedBody.message || parsedBody.Message || errorCode,
|
|
343
|
-
$fault: "client",
|
|
344
|
-
$metadata: deserializeMetadata(output),
|
|
345
|
-
} as any;
|
|
346
|
-
}
|
|
347
|
-
const message = response.message || response.Message || errorCode;
|
|
348
|
-
response.message = message;
|
|
349
|
-
delete response.Message;
|
|
350
|
-
return Promise.reject(Object.assign(new Error(message), response));
|
|
351
|
-
};
|
|
352
|
-
|
|
353
|
-
const deserializeAws_json1_1DuplicateReportNameExceptionResponse = async (
|
|
354
|
-
parsedOutput: any,
|
|
355
|
-
context: __SerdeContext
|
|
356
|
-
): Promise<DuplicateReportNameException> => {
|
|
357
|
-
const body = parsedOutput.body;
|
|
358
|
-
const deserialized: any = deserializeAws_json1_1DuplicateReportNameException(body, context);
|
|
359
|
-
const contents: DuplicateReportNameException = {
|
|
360
|
-
name: "DuplicateReportNameException",
|
|
361
|
-
$fault: "client",
|
|
362
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
363
|
-
...deserialized,
|
|
364
|
-
};
|
|
365
|
-
return contents;
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
const deserializeAws_json1_1InternalErrorExceptionResponse = async (
|
|
369
|
-
parsedOutput: any,
|
|
370
|
-
context: __SerdeContext
|
|
371
|
-
): Promise<InternalErrorException> => {
|
|
372
|
-
const body = parsedOutput.body;
|
|
373
|
-
const deserialized: any = deserializeAws_json1_1InternalErrorException(body, context);
|
|
374
|
-
const contents: InternalErrorException = {
|
|
375
|
-
name: "InternalErrorException",
|
|
376
|
-
$fault: "server",
|
|
377
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
378
|
-
...deserialized,
|
|
379
|
-
};
|
|
380
|
-
return contents;
|
|
381
|
-
};
|
|
382
|
-
|
|
383
|
-
const deserializeAws_json1_1ReportLimitReachedExceptionResponse = async (
|
|
384
|
-
parsedOutput: any,
|
|
385
|
-
context: __SerdeContext
|
|
386
|
-
): Promise<ReportLimitReachedException> => {
|
|
387
|
-
const body = parsedOutput.body;
|
|
388
|
-
const deserialized: any = deserializeAws_json1_1ReportLimitReachedException(body, context);
|
|
389
|
-
const contents: ReportLimitReachedException = {
|
|
390
|
-
name: "ReportLimitReachedException",
|
|
391
|
-
$fault: "client",
|
|
392
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
393
|
-
...deserialized,
|
|
394
|
-
};
|
|
395
|
-
return contents;
|
|
396
|
-
};
|
|
397
|
-
|
|
398
|
-
const deserializeAws_json1_1ValidationExceptionResponse = async (
|
|
399
|
-
parsedOutput: any,
|
|
400
|
-
context: __SerdeContext
|
|
401
|
-
): Promise<ValidationException> => {
|
|
402
|
-
const body = parsedOutput.body;
|
|
403
|
-
const deserialized: any = deserializeAws_json1_1ValidationException(body, context);
|
|
404
|
-
const contents: ValidationException = {
|
|
405
|
-
name: "ValidationException",
|
|
406
|
-
$fault: "client",
|
|
407
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
408
|
-
...deserialized,
|
|
409
|
-
};
|
|
410
|
-
return contents;
|
|
411
|
-
};
|
|
412
|
-
|
|
413
|
-
const serializeAws_json1_1AdditionalArtifactList = (
|
|
414
|
-
input: (AdditionalArtifact | string)[],
|
|
415
|
-
context: __SerdeContext
|
|
416
|
-
): any => {
|
|
417
|
-
return input
|
|
418
|
-
.filter((e: any) => e != null)
|
|
419
|
-
.map((entry) => {
|
|
420
|
-
if (entry === null) {
|
|
421
|
-
return null as any;
|
|
422
|
-
}
|
|
423
|
-
return entry;
|
|
424
|
-
});
|
|
425
|
-
};
|
|
426
|
-
|
|
427
|
-
const serializeAws_json1_1DeleteReportDefinitionRequest = (
|
|
428
|
-
input: DeleteReportDefinitionRequest,
|
|
429
|
-
context: __SerdeContext
|
|
430
|
-
): any => {
|
|
431
|
-
return {
|
|
432
|
-
...(input.ReportName !== undefined && input.ReportName !== null && { ReportName: input.ReportName }),
|
|
433
|
-
};
|
|
434
|
-
};
|
|
435
|
-
|
|
436
|
-
const serializeAws_json1_1DescribeReportDefinitionsRequest = (
|
|
437
|
-
input: DescribeReportDefinitionsRequest,
|
|
438
|
-
context: __SerdeContext
|
|
439
|
-
): any => {
|
|
440
|
-
return {
|
|
441
|
-
...(input.MaxResults !== undefined && input.MaxResults !== null && { MaxResults: input.MaxResults }),
|
|
442
|
-
...(input.NextToken !== undefined && input.NextToken !== null && { NextToken: input.NextToken }),
|
|
443
|
-
};
|
|
444
|
-
};
|
|
445
|
-
|
|
446
|
-
const serializeAws_json1_1ModifyReportDefinitionRequest = (
|
|
447
|
-
input: ModifyReportDefinitionRequest,
|
|
448
|
-
context: __SerdeContext
|
|
449
|
-
): any => {
|
|
450
|
-
return {
|
|
451
|
-
...(input.ReportDefinition !== undefined &&
|
|
452
|
-
input.ReportDefinition !== null && {
|
|
453
|
-
ReportDefinition: serializeAws_json1_1ReportDefinition(input.ReportDefinition, context),
|
|
454
|
-
}),
|
|
455
|
-
...(input.ReportName !== undefined && input.ReportName !== null && { ReportName: input.ReportName }),
|
|
456
|
-
};
|
|
457
|
-
};
|
|
458
|
-
|
|
459
|
-
const serializeAws_json1_1PutReportDefinitionRequest = (
|
|
460
|
-
input: PutReportDefinitionRequest,
|
|
461
|
-
context: __SerdeContext
|
|
462
|
-
): any => {
|
|
463
|
-
return {
|
|
464
|
-
...(input.ReportDefinition !== undefined &&
|
|
465
|
-
input.ReportDefinition !== null && {
|
|
466
|
-
ReportDefinition: serializeAws_json1_1ReportDefinition(input.ReportDefinition, context),
|
|
467
|
-
}),
|
|
468
|
-
};
|
|
469
|
-
};
|
|
470
|
-
|
|
471
|
-
const serializeAws_json1_1ReportDefinition = (input: ReportDefinition, context: __SerdeContext): any => {
|
|
472
|
-
return {
|
|
473
|
-
...(input.AdditionalArtifacts !== undefined &&
|
|
474
|
-
input.AdditionalArtifacts !== null && {
|
|
475
|
-
AdditionalArtifacts: serializeAws_json1_1AdditionalArtifactList(input.AdditionalArtifacts, context),
|
|
476
|
-
}),
|
|
477
|
-
...(input.AdditionalSchemaElements !== undefined &&
|
|
478
|
-
input.AdditionalSchemaElements !== null && {
|
|
479
|
-
AdditionalSchemaElements: serializeAws_json1_1SchemaElementList(input.AdditionalSchemaElements, context),
|
|
480
|
-
}),
|
|
481
|
-
...(input.BillingViewArn !== undefined &&
|
|
482
|
-
input.BillingViewArn !== null && { BillingViewArn: input.BillingViewArn }),
|
|
483
|
-
...(input.Compression !== undefined && input.Compression !== null && { Compression: input.Compression }),
|
|
484
|
-
...(input.Format !== undefined && input.Format !== null && { Format: input.Format }),
|
|
485
|
-
...(input.RefreshClosedReports !== undefined &&
|
|
486
|
-
input.RefreshClosedReports !== null && { RefreshClosedReports: input.RefreshClosedReports }),
|
|
487
|
-
...(input.ReportName !== undefined && input.ReportName !== null && { ReportName: input.ReportName }),
|
|
488
|
-
...(input.ReportVersioning !== undefined &&
|
|
489
|
-
input.ReportVersioning !== null && { ReportVersioning: input.ReportVersioning }),
|
|
490
|
-
...(input.S3Bucket !== undefined && input.S3Bucket !== null && { S3Bucket: input.S3Bucket }),
|
|
491
|
-
...(input.S3Prefix !== undefined && input.S3Prefix !== null && { S3Prefix: input.S3Prefix }),
|
|
492
|
-
...(input.S3Region !== undefined && input.S3Region !== null && { S3Region: input.S3Region }),
|
|
493
|
-
...(input.TimeUnit !== undefined && input.TimeUnit !== null && { TimeUnit: input.TimeUnit }),
|
|
494
|
-
};
|
|
495
|
-
};
|
|
496
|
-
|
|
497
|
-
const serializeAws_json1_1SchemaElementList = (input: (SchemaElement | string)[], context: __SerdeContext): any => {
|
|
498
|
-
return input
|
|
499
|
-
.filter((e: any) => e != null)
|
|
500
|
-
.map((entry) => {
|
|
501
|
-
if (entry === null) {
|
|
502
|
-
return null as any;
|
|
503
|
-
}
|
|
504
|
-
return entry;
|
|
505
|
-
});
|
|
506
|
-
};
|
|
507
|
-
|
|
508
|
-
const deserializeAws_json1_1AdditionalArtifactList = (
|
|
509
|
-
output: any,
|
|
510
|
-
context: __SerdeContext
|
|
511
|
-
): (AdditionalArtifact | string)[] => {
|
|
512
|
-
return (output || [])
|
|
513
|
-
.filter((e: any) => e != null)
|
|
514
|
-
.map((entry: any) => {
|
|
515
|
-
if (entry === null) {
|
|
516
|
-
return null as any;
|
|
517
|
-
}
|
|
518
|
-
return __expectString(entry) as any;
|
|
519
|
-
});
|
|
520
|
-
};
|
|
521
|
-
|
|
522
|
-
const deserializeAws_json1_1DeleteReportDefinitionResponse = (
|
|
523
|
-
output: any,
|
|
524
|
-
context: __SerdeContext
|
|
525
|
-
): DeleteReportDefinitionResponse => {
|
|
526
|
-
return {
|
|
527
|
-
ResponseMessage: __expectString(output.ResponseMessage),
|
|
528
|
-
} as any;
|
|
529
|
-
};
|
|
530
|
-
|
|
531
|
-
const deserializeAws_json1_1DescribeReportDefinitionsResponse = (
|
|
532
|
-
output: any,
|
|
533
|
-
context: __SerdeContext
|
|
534
|
-
): DescribeReportDefinitionsResponse => {
|
|
535
|
-
return {
|
|
536
|
-
NextToken: __expectString(output.NextToken),
|
|
537
|
-
ReportDefinitions:
|
|
538
|
-
output.ReportDefinitions !== undefined && output.ReportDefinitions !== null
|
|
539
|
-
? deserializeAws_json1_1ReportDefinitionList(output.ReportDefinitions, context)
|
|
540
|
-
: undefined,
|
|
541
|
-
} as any;
|
|
542
|
-
};
|
|
543
|
-
|
|
544
|
-
const deserializeAws_json1_1DuplicateReportNameException = (
|
|
545
|
-
output: any,
|
|
546
|
-
context: __SerdeContext
|
|
547
|
-
): DuplicateReportNameException => {
|
|
548
|
-
return {
|
|
549
|
-
Message: __expectString(output.Message),
|
|
550
|
-
} as any;
|
|
551
|
-
};
|
|
552
|
-
|
|
553
|
-
const deserializeAws_json1_1InternalErrorException = (output: any, context: __SerdeContext): InternalErrorException => {
|
|
554
|
-
return {
|
|
555
|
-
Message: __expectString(output.Message),
|
|
556
|
-
} as any;
|
|
557
|
-
};
|
|
558
|
-
|
|
559
|
-
const deserializeAws_json1_1ModifyReportDefinitionResponse = (
|
|
560
|
-
output: any,
|
|
561
|
-
context: __SerdeContext
|
|
562
|
-
): ModifyReportDefinitionResponse => {
|
|
563
|
-
return {} as any;
|
|
564
|
-
};
|
|
565
|
-
|
|
566
|
-
const deserializeAws_json1_1PutReportDefinitionResponse = (
|
|
567
|
-
output: any,
|
|
568
|
-
context: __SerdeContext
|
|
569
|
-
): PutReportDefinitionResponse => {
|
|
570
|
-
return {} as any;
|
|
571
|
-
};
|
|
572
|
-
|
|
573
|
-
const deserializeAws_json1_1ReportDefinition = (output: any, context: __SerdeContext): ReportDefinition => {
|
|
574
|
-
return {
|
|
575
|
-
AdditionalArtifacts:
|
|
576
|
-
output.AdditionalArtifacts !== undefined && output.AdditionalArtifacts !== null
|
|
577
|
-
? deserializeAws_json1_1AdditionalArtifactList(output.AdditionalArtifacts, context)
|
|
578
|
-
: undefined,
|
|
579
|
-
AdditionalSchemaElements:
|
|
580
|
-
output.AdditionalSchemaElements !== undefined && output.AdditionalSchemaElements !== null
|
|
581
|
-
? deserializeAws_json1_1SchemaElementList(output.AdditionalSchemaElements, context)
|
|
582
|
-
: undefined,
|
|
583
|
-
BillingViewArn: __expectString(output.BillingViewArn),
|
|
584
|
-
Compression: __expectString(output.Compression),
|
|
585
|
-
Format: __expectString(output.Format),
|
|
586
|
-
RefreshClosedReports: __expectBoolean(output.RefreshClosedReports),
|
|
587
|
-
ReportName: __expectString(output.ReportName),
|
|
588
|
-
ReportVersioning: __expectString(output.ReportVersioning),
|
|
589
|
-
S3Bucket: __expectString(output.S3Bucket),
|
|
590
|
-
S3Prefix: __expectString(output.S3Prefix),
|
|
591
|
-
S3Region: __expectString(output.S3Region),
|
|
592
|
-
TimeUnit: __expectString(output.TimeUnit),
|
|
593
|
-
} as any;
|
|
594
|
-
};
|
|
595
|
-
|
|
596
|
-
const deserializeAws_json1_1ReportDefinitionList = (output: any, context: __SerdeContext): ReportDefinition[] => {
|
|
597
|
-
return (output || [])
|
|
598
|
-
.filter((e: any) => e != null)
|
|
599
|
-
.map((entry: any) => {
|
|
600
|
-
if (entry === null) {
|
|
601
|
-
return null as any;
|
|
602
|
-
}
|
|
603
|
-
return deserializeAws_json1_1ReportDefinition(entry, context);
|
|
604
|
-
});
|
|
605
|
-
};
|
|
606
|
-
|
|
607
|
-
const deserializeAws_json1_1ReportLimitReachedException = (
|
|
608
|
-
output: any,
|
|
609
|
-
context: __SerdeContext
|
|
610
|
-
): ReportLimitReachedException => {
|
|
611
|
-
return {
|
|
612
|
-
Message: __expectString(output.Message),
|
|
613
|
-
} as any;
|
|
614
|
-
};
|
|
615
|
-
|
|
616
|
-
const deserializeAws_json1_1SchemaElementList = (output: any, context: __SerdeContext): (SchemaElement | string)[] => {
|
|
617
|
-
return (output || [])
|
|
618
|
-
.filter((e: any) => e != null)
|
|
619
|
-
.map((entry: any) => {
|
|
620
|
-
if (entry === null) {
|
|
621
|
-
return null as any;
|
|
622
|
-
}
|
|
623
|
-
return __expectString(entry) as any;
|
|
624
|
-
});
|
|
625
|
-
};
|
|
626
|
-
|
|
627
|
-
const deserializeAws_json1_1ValidationException = (output: any, context: __SerdeContext): ValidationException => {
|
|
628
|
-
return {
|
|
629
|
-
Message: __expectString(output.Message),
|
|
630
|
-
} as any;
|
|
631
|
-
};
|
|
632
|
-
|
|
633
|
-
const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
|
|
634
|
-
httpStatusCode: output.statusCode,
|
|
635
|
-
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
|
|
636
|
-
extendedRequestId: output.headers["x-amz-id-2"],
|
|
637
|
-
cfId: output.headers["x-amz-cf-id"],
|
|
638
|
-
});
|
|
639
|
-
|
|
640
|
-
// Collect low-level response body stream to Uint8Array.
|
|
641
|
-
const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
|
|
642
|
-
if (streamBody instanceof Uint8Array) {
|
|
643
|
-
return Promise.resolve(streamBody);
|
|
644
|
-
}
|
|
645
|
-
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
|
|
646
|
-
};
|
|
647
|
-
|
|
648
|
-
// Encode Uint8Array data into string with utf-8.
|
|
649
|
-
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
|
|
650
|
-
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
|
|
651
|
-
|
|
652
|
-
const buildHttpRpcRequest = async (
|
|
653
|
-
context: __SerdeContext,
|
|
654
|
-
headers: __HeaderBag,
|
|
655
|
-
path: string,
|
|
656
|
-
resolvedHostname: string | undefined,
|
|
657
|
-
body: any
|
|
658
|
-
): Promise<__HttpRequest> => {
|
|
659
|
-
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
660
|
-
const contents: any = {
|
|
661
|
-
protocol,
|
|
662
|
-
hostname,
|
|
663
|
-
port,
|
|
664
|
-
method: "POST",
|
|
665
|
-
path: basePath.endsWith("/") ? basePath.slice(0, -1) + path : basePath + path,
|
|
666
|
-
headers,
|
|
667
|
-
};
|
|
668
|
-
if (resolvedHostname !== undefined) {
|
|
669
|
-
contents.hostname = resolvedHostname;
|
|
670
|
-
}
|
|
671
|
-
if (body !== undefined) {
|
|
672
|
-
contents.body = body;
|
|
673
|
-
}
|
|
674
|
-
return new __HttpRequest(contents);
|
|
675
|
-
};
|
|
676
|
-
|
|
677
|
-
const parseBody = (streamBody: any, context: __SerdeContext): any =>
|
|
678
|
-
collectBodyString(streamBody, context).then((encoded) => {
|
|
679
|
-
if (encoded.length) {
|
|
680
|
-
return JSON.parse(encoded);
|
|
681
|
-
}
|
|
682
|
-
return {};
|
|
683
|
-
});
|
|
684
|
-
|
|
685
|
-
/**
|
|
686
|
-
* Load an error code for the aws.rest-json-1.1 protocol.
|
|
687
|
-
*/
|
|
688
|
-
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => {
|
|
689
|
-
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
690
|
-
|
|
691
|
-
const sanitizeErrorCode = (rawValue: string): string => {
|
|
692
|
-
let cleanValue = rawValue;
|
|
693
|
-
if (cleanValue.indexOf(":") >= 0) {
|
|
694
|
-
cleanValue = cleanValue.split(":")[0];
|
|
695
|
-
}
|
|
696
|
-
if (cleanValue.indexOf("#") >= 0) {
|
|
697
|
-
cleanValue = cleanValue.split("#")[1];
|
|
698
|
-
}
|
|
699
|
-
return cleanValue;
|
|
700
|
-
};
|
|
701
|
-
|
|
702
|
-
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
703
|
-
if (headerKey !== undefined) {
|
|
704
|
-
return sanitizeErrorCode(output.headers[headerKey]);
|
|
705
|
-
}
|
|
706
|
-
|
|
707
|
-
if (data.code !== undefined) {
|
|
708
|
-
return sanitizeErrorCode(data.code);
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
if (data["__type"] !== undefined) {
|
|
712
|
-
return sanitizeErrorCode(data["__type"]);
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
return "";
|
|
716
|
-
};
|