@aws-sdk/client-sagemaker-featurestore-runtime 3.35.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 +13 -0
- package/dist-cjs/SageMakerFeatureStoreRuntime.js +0 -1
- package/dist-cjs/SageMakerFeatureStoreRuntimeClient.js +0 -1
- package/dist-cjs/commands/BatchGetRecordCommand.js +0 -1
- package/dist-cjs/commands/DeleteRecordCommand.js +0 -1
- package/dist-cjs/commands/GetRecordCommand.js +0 -1
- package/dist-cjs/commands/PutRecordCommand.js +0 -1
- package/dist-cjs/endpoints.js +0 -1
- package/dist-cjs/index.js +0 -1
- package/dist-cjs/models/index.js +0 -1
- package/dist-cjs/models/models_0.js +0 -1
- package/dist-cjs/protocols/Aws_restJson1.js +0 -1
- package/dist-cjs/runtimeConfig.browser.js +2 -3
- package/dist-cjs/runtimeConfig.js +3 -4
- package/dist-cjs/runtimeConfig.native.js +0 -1
- package/dist-cjs/runtimeConfig.shared.js +0 -1
- package/dist-es/SageMakerFeatureStoreRuntime.js +0 -1
- package/dist-es/SageMakerFeatureStoreRuntimeClient.js +0 -1
- package/dist-es/commands/BatchGetRecordCommand.js +0 -1
- package/dist-es/commands/DeleteRecordCommand.js +0 -1
- package/dist-es/commands/GetRecordCommand.js +0 -1
- package/dist-es/commands/PutRecordCommand.js +0 -1
- package/dist-es/endpoints.js +0 -1
- package/dist-es/index.js +0 -1
- package/dist-es/models/index.js +0 -1
- package/dist-es/models/models_0.js +0 -1
- package/dist-es/protocols/Aws_restJson1.js +0 -1
- package/dist-es/runtimeConfig.browser.js +1 -2
- package/dist-es/runtimeConfig.js +2 -3
- package/dist-es/runtimeConfig.native.js +0 -1
- package/dist-es/runtimeConfig.shared.js +0 -1
- package/package.json +33 -30
- package/dist-cjs/SageMakerFeatureStoreRuntime.js.map +0 -1
- package/dist-cjs/SageMakerFeatureStoreRuntimeClient.js.map +0 -1
- package/dist-cjs/commands/BatchGetRecordCommand.js.map +0 -1
- package/dist-cjs/commands/DeleteRecordCommand.js.map +0 -1
- package/dist-cjs/commands/GetRecordCommand.js.map +0 -1
- package/dist-cjs/commands/PutRecordCommand.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/protocols/Aws_restJson1.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/SageMakerFeatureStoreRuntime.js.map +0 -1
- package/dist-es/SageMakerFeatureStoreRuntimeClient.js.map +0 -1
- package/dist-es/commands/BatchGetRecordCommand.js.map +0 -1
- package/dist-es/commands/DeleteRecordCommand.js.map +0 -1
- package/dist-es/commands/GetRecordCommand.js.map +0 -1
- package/dist-es/commands/PutRecordCommand.js.map +0 -1
- package/dist-es/endpoints.js.map +0 -1
- package/dist-es/index.js.map +0 -1
- package/dist-es/models/index.js.map +0 -1
- package/dist-es/models/models_0.js.map +0 -1
- package/dist-es/protocols/Aws_restJson1.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/jest.config.js +0 -4
- package/src/SageMakerFeatureStoreRuntime.ts +0 -167
- package/src/SageMakerFeatureStoreRuntimeClient.ts +0 -275
- package/src/commands/BatchGetRecordCommand.ts +0 -99
- package/src/commands/DeleteRecordCommand.ts +0 -101
- package/src/commands/GetRecordCommand.ts +0 -101
- package/src/commands/PutRecordCommand.ts +0 -103
- package/src/endpoints.ts +0 -57
- package/src/index.ts +0 -7
- package/src/models/index.ts +0 -1
- package/src/models/models_0.ts +0 -360
- package/src/protocols/Aws_restJson1.ts +0 -835
- package/src/runtimeConfig.browser.ts +0 -41
- package/src/runtimeConfig.native.ts +0 -17
- package/src/runtimeConfig.shared.ts +0 -17
- package/src/runtimeConfig.ts +0 -46
- package/tsconfig.es.json +0 -10
- package/tsconfig.json +0 -33
- package/tsconfig.types.json +0 -9
|
@@ -1,835 +0,0 @@
|
|
|
1
|
-
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
|
|
2
|
-
import {
|
|
3
|
-
expectNonNull as __expectNonNull,
|
|
4
|
-
expectObject as __expectObject,
|
|
5
|
-
expectString as __expectString,
|
|
6
|
-
extendedEncodeURIComponent as __extendedEncodeURIComponent,
|
|
7
|
-
} from "@aws-sdk/smithy-client";
|
|
8
|
-
import {
|
|
9
|
-
Endpoint as __Endpoint,
|
|
10
|
-
MetadataBearer as __MetadataBearer,
|
|
11
|
-
ResponseMetadata as __ResponseMetadata,
|
|
12
|
-
SerdeContext as __SerdeContext,
|
|
13
|
-
SmithyException as __SmithyException,
|
|
14
|
-
} from "@aws-sdk/types";
|
|
15
|
-
|
|
16
|
-
import { BatchGetRecordCommandInput, BatchGetRecordCommandOutput } from "../commands/BatchGetRecordCommand";
|
|
17
|
-
import { DeleteRecordCommandInput, DeleteRecordCommandOutput } from "../commands/DeleteRecordCommand";
|
|
18
|
-
import { GetRecordCommandInput, GetRecordCommandOutput } from "../commands/GetRecordCommand";
|
|
19
|
-
import { PutRecordCommandInput, PutRecordCommandOutput } from "../commands/PutRecordCommand";
|
|
20
|
-
import {
|
|
21
|
-
AccessForbidden,
|
|
22
|
-
BatchGetRecordError,
|
|
23
|
-
BatchGetRecordIdentifier,
|
|
24
|
-
BatchGetRecordResultDetail,
|
|
25
|
-
FeatureValue,
|
|
26
|
-
InternalFailure,
|
|
27
|
-
ResourceNotFound,
|
|
28
|
-
ServiceUnavailable,
|
|
29
|
-
ValidationError,
|
|
30
|
-
} from "../models/models_0";
|
|
31
|
-
|
|
32
|
-
export const serializeAws_restJson1BatchGetRecordCommand = async (
|
|
33
|
-
input: BatchGetRecordCommandInput,
|
|
34
|
-
context: __SerdeContext
|
|
35
|
-
): Promise<__HttpRequest> => {
|
|
36
|
-
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
37
|
-
const headers: any = {
|
|
38
|
-
"content-type": "application/json",
|
|
39
|
-
};
|
|
40
|
-
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/BatchGetRecord";
|
|
41
|
-
let body: any;
|
|
42
|
-
body = JSON.stringify({
|
|
43
|
-
...(input.Identifiers !== undefined &&
|
|
44
|
-
input.Identifiers !== null && {
|
|
45
|
-
Identifiers: serializeAws_restJson1BatchGetRecordIdentifiers(input.Identifiers, context),
|
|
46
|
-
}),
|
|
47
|
-
});
|
|
48
|
-
return new __HttpRequest({
|
|
49
|
-
protocol,
|
|
50
|
-
hostname,
|
|
51
|
-
port,
|
|
52
|
-
method: "POST",
|
|
53
|
-
headers,
|
|
54
|
-
path: resolvedPath,
|
|
55
|
-
body,
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
export const serializeAws_restJson1DeleteRecordCommand = async (
|
|
60
|
-
input: DeleteRecordCommandInput,
|
|
61
|
-
context: __SerdeContext
|
|
62
|
-
): Promise<__HttpRequest> => {
|
|
63
|
-
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
64
|
-
const headers: any = {};
|
|
65
|
-
let resolvedPath =
|
|
66
|
-
`${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/FeatureGroup/{FeatureGroupName}";
|
|
67
|
-
if (input.FeatureGroupName !== undefined) {
|
|
68
|
-
const labelValue: string = input.FeatureGroupName;
|
|
69
|
-
if (labelValue.length <= 0) {
|
|
70
|
-
throw new Error("Empty value provided for input HTTP label: FeatureGroupName.");
|
|
71
|
-
}
|
|
72
|
-
resolvedPath = resolvedPath.replace("{FeatureGroupName}", __extendedEncodeURIComponent(labelValue));
|
|
73
|
-
} else {
|
|
74
|
-
throw new Error("No value provided for input HTTP label: FeatureGroupName.");
|
|
75
|
-
}
|
|
76
|
-
const query: any = {
|
|
77
|
-
...(input.RecordIdentifierValueAsString !== undefined && {
|
|
78
|
-
RecordIdentifierValueAsString: input.RecordIdentifierValueAsString,
|
|
79
|
-
}),
|
|
80
|
-
...(input.EventTime !== undefined && { EventTime: input.EventTime }),
|
|
81
|
-
};
|
|
82
|
-
let body: any;
|
|
83
|
-
return new __HttpRequest({
|
|
84
|
-
protocol,
|
|
85
|
-
hostname,
|
|
86
|
-
port,
|
|
87
|
-
method: "DELETE",
|
|
88
|
-
headers,
|
|
89
|
-
path: resolvedPath,
|
|
90
|
-
query,
|
|
91
|
-
body,
|
|
92
|
-
});
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
export const serializeAws_restJson1GetRecordCommand = async (
|
|
96
|
-
input: GetRecordCommandInput,
|
|
97
|
-
context: __SerdeContext
|
|
98
|
-
): Promise<__HttpRequest> => {
|
|
99
|
-
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
100
|
-
const headers: any = {};
|
|
101
|
-
let resolvedPath =
|
|
102
|
-
`${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/FeatureGroup/{FeatureGroupName}";
|
|
103
|
-
if (input.FeatureGroupName !== undefined) {
|
|
104
|
-
const labelValue: string = input.FeatureGroupName;
|
|
105
|
-
if (labelValue.length <= 0) {
|
|
106
|
-
throw new Error("Empty value provided for input HTTP label: FeatureGroupName.");
|
|
107
|
-
}
|
|
108
|
-
resolvedPath = resolvedPath.replace("{FeatureGroupName}", __extendedEncodeURIComponent(labelValue));
|
|
109
|
-
} else {
|
|
110
|
-
throw new Error("No value provided for input HTTP label: FeatureGroupName.");
|
|
111
|
-
}
|
|
112
|
-
const query: any = {
|
|
113
|
-
...(input.RecordIdentifierValueAsString !== undefined && {
|
|
114
|
-
RecordIdentifierValueAsString: input.RecordIdentifierValueAsString,
|
|
115
|
-
}),
|
|
116
|
-
...(input.FeatureNames !== undefined && { FeatureName: (input.FeatureNames || []).map((_entry) => _entry as any) }),
|
|
117
|
-
};
|
|
118
|
-
let body: any;
|
|
119
|
-
return new __HttpRequest({
|
|
120
|
-
protocol,
|
|
121
|
-
hostname,
|
|
122
|
-
port,
|
|
123
|
-
method: "GET",
|
|
124
|
-
headers,
|
|
125
|
-
path: resolvedPath,
|
|
126
|
-
query,
|
|
127
|
-
body,
|
|
128
|
-
});
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
export const serializeAws_restJson1PutRecordCommand = async (
|
|
132
|
-
input: PutRecordCommandInput,
|
|
133
|
-
context: __SerdeContext
|
|
134
|
-
): Promise<__HttpRequest> => {
|
|
135
|
-
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
136
|
-
const headers: any = {
|
|
137
|
-
"content-type": "application/json",
|
|
138
|
-
};
|
|
139
|
-
let resolvedPath =
|
|
140
|
-
`${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/FeatureGroup/{FeatureGroupName}";
|
|
141
|
-
if (input.FeatureGroupName !== undefined) {
|
|
142
|
-
const labelValue: string = input.FeatureGroupName;
|
|
143
|
-
if (labelValue.length <= 0) {
|
|
144
|
-
throw new Error("Empty value provided for input HTTP label: FeatureGroupName.");
|
|
145
|
-
}
|
|
146
|
-
resolvedPath = resolvedPath.replace("{FeatureGroupName}", __extendedEncodeURIComponent(labelValue));
|
|
147
|
-
} else {
|
|
148
|
-
throw new Error("No value provided for input HTTP label: FeatureGroupName.");
|
|
149
|
-
}
|
|
150
|
-
let body: any;
|
|
151
|
-
body = JSON.stringify({
|
|
152
|
-
...(input.Record !== undefined &&
|
|
153
|
-
input.Record !== null && { Record: serializeAws_restJson1Record(input.Record, context) }),
|
|
154
|
-
});
|
|
155
|
-
return new __HttpRequest({
|
|
156
|
-
protocol,
|
|
157
|
-
hostname,
|
|
158
|
-
port,
|
|
159
|
-
method: "PUT",
|
|
160
|
-
headers,
|
|
161
|
-
path: resolvedPath,
|
|
162
|
-
body,
|
|
163
|
-
});
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
export const deserializeAws_restJson1BatchGetRecordCommand = async (
|
|
167
|
-
output: __HttpResponse,
|
|
168
|
-
context: __SerdeContext
|
|
169
|
-
): Promise<BatchGetRecordCommandOutput> => {
|
|
170
|
-
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
171
|
-
return deserializeAws_restJson1BatchGetRecordCommandError(output, context);
|
|
172
|
-
}
|
|
173
|
-
const contents: BatchGetRecordCommandOutput = {
|
|
174
|
-
$metadata: deserializeMetadata(output),
|
|
175
|
-
Errors: undefined,
|
|
176
|
-
Records: undefined,
|
|
177
|
-
UnprocessedIdentifiers: undefined,
|
|
178
|
-
};
|
|
179
|
-
const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
180
|
-
if (data.Errors !== undefined && data.Errors !== null) {
|
|
181
|
-
contents.Errors = deserializeAws_restJson1BatchGetRecordErrors(data.Errors, context);
|
|
182
|
-
}
|
|
183
|
-
if (data.Records !== undefined && data.Records !== null) {
|
|
184
|
-
contents.Records = deserializeAws_restJson1BatchGetRecordResultDetails(data.Records, context);
|
|
185
|
-
}
|
|
186
|
-
if (data.UnprocessedIdentifiers !== undefined && data.UnprocessedIdentifiers !== null) {
|
|
187
|
-
contents.UnprocessedIdentifiers = deserializeAws_restJson1UnprocessedIdentifiers(
|
|
188
|
-
data.UnprocessedIdentifiers,
|
|
189
|
-
context
|
|
190
|
-
);
|
|
191
|
-
}
|
|
192
|
-
return Promise.resolve(contents);
|
|
193
|
-
};
|
|
194
|
-
|
|
195
|
-
const deserializeAws_restJson1BatchGetRecordCommandError = async (
|
|
196
|
-
output: __HttpResponse,
|
|
197
|
-
context: __SerdeContext
|
|
198
|
-
): Promise<BatchGetRecordCommandOutput> => {
|
|
199
|
-
const parsedOutput: any = {
|
|
200
|
-
...output,
|
|
201
|
-
body: await parseBody(output.body, context),
|
|
202
|
-
};
|
|
203
|
-
let response: __SmithyException & __MetadataBearer & { [key: string]: any };
|
|
204
|
-
let errorCode = "UnknownError";
|
|
205
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
206
|
-
switch (errorCode) {
|
|
207
|
-
case "AccessForbidden":
|
|
208
|
-
case "com.amazonaws.sagemakerfeaturestoreruntime#AccessForbidden":
|
|
209
|
-
response = {
|
|
210
|
-
...(await deserializeAws_restJson1AccessForbiddenResponse(parsedOutput, context)),
|
|
211
|
-
name: errorCode,
|
|
212
|
-
$metadata: deserializeMetadata(output),
|
|
213
|
-
};
|
|
214
|
-
break;
|
|
215
|
-
case "InternalFailure":
|
|
216
|
-
case "com.amazonaws.sagemakerfeaturestoreruntime#InternalFailure":
|
|
217
|
-
response = {
|
|
218
|
-
...(await deserializeAws_restJson1InternalFailureResponse(parsedOutput, context)),
|
|
219
|
-
name: errorCode,
|
|
220
|
-
$metadata: deserializeMetadata(output),
|
|
221
|
-
};
|
|
222
|
-
break;
|
|
223
|
-
case "ServiceUnavailable":
|
|
224
|
-
case "com.amazonaws.sagemakerfeaturestoreruntime#ServiceUnavailable":
|
|
225
|
-
response = {
|
|
226
|
-
...(await deserializeAws_restJson1ServiceUnavailableResponse(parsedOutput, context)),
|
|
227
|
-
name: errorCode,
|
|
228
|
-
$metadata: deserializeMetadata(output),
|
|
229
|
-
};
|
|
230
|
-
break;
|
|
231
|
-
case "ValidationError":
|
|
232
|
-
case "com.amazonaws.sagemakerfeaturestoreruntime#ValidationError":
|
|
233
|
-
response = {
|
|
234
|
-
...(await deserializeAws_restJson1ValidationErrorResponse(parsedOutput, context)),
|
|
235
|
-
name: errorCode,
|
|
236
|
-
$metadata: deserializeMetadata(output),
|
|
237
|
-
};
|
|
238
|
-
break;
|
|
239
|
-
default:
|
|
240
|
-
const parsedBody = parsedOutput.body;
|
|
241
|
-
errorCode = parsedBody.code || parsedBody.Code || errorCode;
|
|
242
|
-
response = {
|
|
243
|
-
...parsedBody,
|
|
244
|
-
name: `${errorCode}`,
|
|
245
|
-
message: parsedBody.message || parsedBody.Message || errorCode,
|
|
246
|
-
$fault: "client",
|
|
247
|
-
$metadata: deserializeMetadata(output),
|
|
248
|
-
} as any;
|
|
249
|
-
}
|
|
250
|
-
const message = response.message || response.Message || errorCode;
|
|
251
|
-
response.message = message;
|
|
252
|
-
delete response.Message;
|
|
253
|
-
return Promise.reject(Object.assign(new Error(message), response));
|
|
254
|
-
};
|
|
255
|
-
|
|
256
|
-
export const deserializeAws_restJson1DeleteRecordCommand = async (
|
|
257
|
-
output: __HttpResponse,
|
|
258
|
-
context: __SerdeContext
|
|
259
|
-
): Promise<DeleteRecordCommandOutput> => {
|
|
260
|
-
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
261
|
-
return deserializeAws_restJson1DeleteRecordCommandError(output, context);
|
|
262
|
-
}
|
|
263
|
-
const contents: DeleteRecordCommandOutput = {
|
|
264
|
-
$metadata: deserializeMetadata(output),
|
|
265
|
-
};
|
|
266
|
-
await collectBody(output.body, context);
|
|
267
|
-
return Promise.resolve(contents);
|
|
268
|
-
};
|
|
269
|
-
|
|
270
|
-
const deserializeAws_restJson1DeleteRecordCommandError = async (
|
|
271
|
-
output: __HttpResponse,
|
|
272
|
-
context: __SerdeContext
|
|
273
|
-
): Promise<DeleteRecordCommandOutput> => {
|
|
274
|
-
const parsedOutput: any = {
|
|
275
|
-
...output,
|
|
276
|
-
body: await parseBody(output.body, context),
|
|
277
|
-
};
|
|
278
|
-
let response: __SmithyException & __MetadataBearer & { [key: string]: any };
|
|
279
|
-
let errorCode = "UnknownError";
|
|
280
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
281
|
-
switch (errorCode) {
|
|
282
|
-
case "AccessForbidden":
|
|
283
|
-
case "com.amazonaws.sagemakerfeaturestoreruntime#AccessForbidden":
|
|
284
|
-
response = {
|
|
285
|
-
...(await deserializeAws_restJson1AccessForbiddenResponse(parsedOutput, context)),
|
|
286
|
-
name: errorCode,
|
|
287
|
-
$metadata: deserializeMetadata(output),
|
|
288
|
-
};
|
|
289
|
-
break;
|
|
290
|
-
case "InternalFailure":
|
|
291
|
-
case "com.amazonaws.sagemakerfeaturestoreruntime#InternalFailure":
|
|
292
|
-
response = {
|
|
293
|
-
...(await deserializeAws_restJson1InternalFailureResponse(parsedOutput, context)),
|
|
294
|
-
name: errorCode,
|
|
295
|
-
$metadata: deserializeMetadata(output),
|
|
296
|
-
};
|
|
297
|
-
break;
|
|
298
|
-
case "ServiceUnavailable":
|
|
299
|
-
case "com.amazonaws.sagemakerfeaturestoreruntime#ServiceUnavailable":
|
|
300
|
-
response = {
|
|
301
|
-
...(await deserializeAws_restJson1ServiceUnavailableResponse(parsedOutput, context)),
|
|
302
|
-
name: errorCode,
|
|
303
|
-
$metadata: deserializeMetadata(output),
|
|
304
|
-
};
|
|
305
|
-
break;
|
|
306
|
-
case "ValidationError":
|
|
307
|
-
case "com.amazonaws.sagemakerfeaturestoreruntime#ValidationError":
|
|
308
|
-
response = {
|
|
309
|
-
...(await deserializeAws_restJson1ValidationErrorResponse(parsedOutput, context)),
|
|
310
|
-
name: errorCode,
|
|
311
|
-
$metadata: deserializeMetadata(output),
|
|
312
|
-
};
|
|
313
|
-
break;
|
|
314
|
-
default:
|
|
315
|
-
const parsedBody = parsedOutput.body;
|
|
316
|
-
errorCode = parsedBody.code || parsedBody.Code || errorCode;
|
|
317
|
-
response = {
|
|
318
|
-
...parsedBody,
|
|
319
|
-
name: `${errorCode}`,
|
|
320
|
-
message: parsedBody.message || parsedBody.Message || errorCode,
|
|
321
|
-
$fault: "client",
|
|
322
|
-
$metadata: deserializeMetadata(output),
|
|
323
|
-
} as any;
|
|
324
|
-
}
|
|
325
|
-
const message = response.message || response.Message || errorCode;
|
|
326
|
-
response.message = message;
|
|
327
|
-
delete response.Message;
|
|
328
|
-
return Promise.reject(Object.assign(new Error(message), response));
|
|
329
|
-
};
|
|
330
|
-
|
|
331
|
-
export const deserializeAws_restJson1GetRecordCommand = async (
|
|
332
|
-
output: __HttpResponse,
|
|
333
|
-
context: __SerdeContext
|
|
334
|
-
): Promise<GetRecordCommandOutput> => {
|
|
335
|
-
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
336
|
-
return deserializeAws_restJson1GetRecordCommandError(output, context);
|
|
337
|
-
}
|
|
338
|
-
const contents: GetRecordCommandOutput = {
|
|
339
|
-
$metadata: deserializeMetadata(output),
|
|
340
|
-
Record: undefined,
|
|
341
|
-
};
|
|
342
|
-
const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
343
|
-
if (data.Record !== undefined && data.Record !== null) {
|
|
344
|
-
contents.Record = deserializeAws_restJson1Record(data.Record, context);
|
|
345
|
-
}
|
|
346
|
-
return Promise.resolve(contents);
|
|
347
|
-
};
|
|
348
|
-
|
|
349
|
-
const deserializeAws_restJson1GetRecordCommandError = async (
|
|
350
|
-
output: __HttpResponse,
|
|
351
|
-
context: __SerdeContext
|
|
352
|
-
): Promise<GetRecordCommandOutput> => {
|
|
353
|
-
const parsedOutput: any = {
|
|
354
|
-
...output,
|
|
355
|
-
body: await parseBody(output.body, context),
|
|
356
|
-
};
|
|
357
|
-
let response: __SmithyException & __MetadataBearer & { [key: string]: any };
|
|
358
|
-
let errorCode = "UnknownError";
|
|
359
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
360
|
-
switch (errorCode) {
|
|
361
|
-
case "AccessForbidden":
|
|
362
|
-
case "com.amazonaws.sagemakerfeaturestoreruntime#AccessForbidden":
|
|
363
|
-
response = {
|
|
364
|
-
...(await deserializeAws_restJson1AccessForbiddenResponse(parsedOutput, context)),
|
|
365
|
-
name: errorCode,
|
|
366
|
-
$metadata: deserializeMetadata(output),
|
|
367
|
-
};
|
|
368
|
-
break;
|
|
369
|
-
case "InternalFailure":
|
|
370
|
-
case "com.amazonaws.sagemakerfeaturestoreruntime#InternalFailure":
|
|
371
|
-
response = {
|
|
372
|
-
...(await deserializeAws_restJson1InternalFailureResponse(parsedOutput, context)),
|
|
373
|
-
name: errorCode,
|
|
374
|
-
$metadata: deserializeMetadata(output),
|
|
375
|
-
};
|
|
376
|
-
break;
|
|
377
|
-
case "ResourceNotFound":
|
|
378
|
-
case "com.amazonaws.sagemakerfeaturestoreruntime#ResourceNotFound":
|
|
379
|
-
response = {
|
|
380
|
-
...(await deserializeAws_restJson1ResourceNotFoundResponse(parsedOutput, context)),
|
|
381
|
-
name: errorCode,
|
|
382
|
-
$metadata: deserializeMetadata(output),
|
|
383
|
-
};
|
|
384
|
-
break;
|
|
385
|
-
case "ServiceUnavailable":
|
|
386
|
-
case "com.amazonaws.sagemakerfeaturestoreruntime#ServiceUnavailable":
|
|
387
|
-
response = {
|
|
388
|
-
...(await deserializeAws_restJson1ServiceUnavailableResponse(parsedOutput, context)),
|
|
389
|
-
name: errorCode,
|
|
390
|
-
$metadata: deserializeMetadata(output),
|
|
391
|
-
};
|
|
392
|
-
break;
|
|
393
|
-
case "ValidationError":
|
|
394
|
-
case "com.amazonaws.sagemakerfeaturestoreruntime#ValidationError":
|
|
395
|
-
response = {
|
|
396
|
-
...(await deserializeAws_restJson1ValidationErrorResponse(parsedOutput, context)),
|
|
397
|
-
name: errorCode,
|
|
398
|
-
$metadata: deserializeMetadata(output),
|
|
399
|
-
};
|
|
400
|
-
break;
|
|
401
|
-
default:
|
|
402
|
-
const parsedBody = parsedOutput.body;
|
|
403
|
-
errorCode = parsedBody.code || parsedBody.Code || errorCode;
|
|
404
|
-
response = {
|
|
405
|
-
...parsedBody,
|
|
406
|
-
name: `${errorCode}`,
|
|
407
|
-
message: parsedBody.message || parsedBody.Message || errorCode,
|
|
408
|
-
$fault: "client",
|
|
409
|
-
$metadata: deserializeMetadata(output),
|
|
410
|
-
} as any;
|
|
411
|
-
}
|
|
412
|
-
const message = response.message || response.Message || errorCode;
|
|
413
|
-
response.message = message;
|
|
414
|
-
delete response.Message;
|
|
415
|
-
return Promise.reject(Object.assign(new Error(message), response));
|
|
416
|
-
};
|
|
417
|
-
|
|
418
|
-
export const deserializeAws_restJson1PutRecordCommand = async (
|
|
419
|
-
output: __HttpResponse,
|
|
420
|
-
context: __SerdeContext
|
|
421
|
-
): Promise<PutRecordCommandOutput> => {
|
|
422
|
-
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
423
|
-
return deserializeAws_restJson1PutRecordCommandError(output, context);
|
|
424
|
-
}
|
|
425
|
-
const contents: PutRecordCommandOutput = {
|
|
426
|
-
$metadata: deserializeMetadata(output),
|
|
427
|
-
};
|
|
428
|
-
await collectBody(output.body, context);
|
|
429
|
-
return Promise.resolve(contents);
|
|
430
|
-
};
|
|
431
|
-
|
|
432
|
-
const deserializeAws_restJson1PutRecordCommandError = async (
|
|
433
|
-
output: __HttpResponse,
|
|
434
|
-
context: __SerdeContext
|
|
435
|
-
): Promise<PutRecordCommandOutput> => {
|
|
436
|
-
const parsedOutput: any = {
|
|
437
|
-
...output,
|
|
438
|
-
body: await parseBody(output.body, context),
|
|
439
|
-
};
|
|
440
|
-
let response: __SmithyException & __MetadataBearer & { [key: string]: any };
|
|
441
|
-
let errorCode = "UnknownError";
|
|
442
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
443
|
-
switch (errorCode) {
|
|
444
|
-
case "AccessForbidden":
|
|
445
|
-
case "com.amazonaws.sagemakerfeaturestoreruntime#AccessForbidden":
|
|
446
|
-
response = {
|
|
447
|
-
...(await deserializeAws_restJson1AccessForbiddenResponse(parsedOutput, context)),
|
|
448
|
-
name: errorCode,
|
|
449
|
-
$metadata: deserializeMetadata(output),
|
|
450
|
-
};
|
|
451
|
-
break;
|
|
452
|
-
case "InternalFailure":
|
|
453
|
-
case "com.amazonaws.sagemakerfeaturestoreruntime#InternalFailure":
|
|
454
|
-
response = {
|
|
455
|
-
...(await deserializeAws_restJson1InternalFailureResponse(parsedOutput, context)),
|
|
456
|
-
name: errorCode,
|
|
457
|
-
$metadata: deserializeMetadata(output),
|
|
458
|
-
};
|
|
459
|
-
break;
|
|
460
|
-
case "ServiceUnavailable":
|
|
461
|
-
case "com.amazonaws.sagemakerfeaturestoreruntime#ServiceUnavailable":
|
|
462
|
-
response = {
|
|
463
|
-
...(await deserializeAws_restJson1ServiceUnavailableResponse(parsedOutput, context)),
|
|
464
|
-
name: errorCode,
|
|
465
|
-
$metadata: deserializeMetadata(output),
|
|
466
|
-
};
|
|
467
|
-
break;
|
|
468
|
-
case "ValidationError":
|
|
469
|
-
case "com.amazonaws.sagemakerfeaturestoreruntime#ValidationError":
|
|
470
|
-
response = {
|
|
471
|
-
...(await deserializeAws_restJson1ValidationErrorResponse(parsedOutput, context)),
|
|
472
|
-
name: errorCode,
|
|
473
|
-
$metadata: deserializeMetadata(output),
|
|
474
|
-
};
|
|
475
|
-
break;
|
|
476
|
-
default:
|
|
477
|
-
const parsedBody = parsedOutput.body;
|
|
478
|
-
errorCode = parsedBody.code || parsedBody.Code || errorCode;
|
|
479
|
-
response = {
|
|
480
|
-
...parsedBody,
|
|
481
|
-
name: `${errorCode}`,
|
|
482
|
-
message: parsedBody.message || parsedBody.Message || errorCode,
|
|
483
|
-
$fault: "client",
|
|
484
|
-
$metadata: deserializeMetadata(output),
|
|
485
|
-
} as any;
|
|
486
|
-
}
|
|
487
|
-
const message = response.message || response.Message || errorCode;
|
|
488
|
-
response.message = message;
|
|
489
|
-
delete response.Message;
|
|
490
|
-
return Promise.reject(Object.assign(new Error(message), response));
|
|
491
|
-
};
|
|
492
|
-
|
|
493
|
-
const deserializeAws_restJson1AccessForbiddenResponse = async (
|
|
494
|
-
parsedOutput: any,
|
|
495
|
-
context: __SerdeContext
|
|
496
|
-
): Promise<AccessForbidden> => {
|
|
497
|
-
const contents: AccessForbidden = {
|
|
498
|
-
name: "AccessForbidden",
|
|
499
|
-
$fault: "client",
|
|
500
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
501
|
-
Message: undefined,
|
|
502
|
-
};
|
|
503
|
-
const data: any = parsedOutput.body;
|
|
504
|
-
if (data.Message !== undefined && data.Message !== null) {
|
|
505
|
-
contents.Message = __expectString(data.Message);
|
|
506
|
-
}
|
|
507
|
-
return contents;
|
|
508
|
-
};
|
|
509
|
-
|
|
510
|
-
const deserializeAws_restJson1InternalFailureResponse = async (
|
|
511
|
-
parsedOutput: any,
|
|
512
|
-
context: __SerdeContext
|
|
513
|
-
): Promise<InternalFailure> => {
|
|
514
|
-
const contents: InternalFailure = {
|
|
515
|
-
name: "InternalFailure",
|
|
516
|
-
$fault: "server",
|
|
517
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
518
|
-
Message: undefined,
|
|
519
|
-
};
|
|
520
|
-
const data: any = parsedOutput.body;
|
|
521
|
-
if (data.Message !== undefined && data.Message !== null) {
|
|
522
|
-
contents.Message = __expectString(data.Message);
|
|
523
|
-
}
|
|
524
|
-
return contents;
|
|
525
|
-
};
|
|
526
|
-
|
|
527
|
-
const deserializeAws_restJson1ResourceNotFoundResponse = async (
|
|
528
|
-
parsedOutput: any,
|
|
529
|
-
context: __SerdeContext
|
|
530
|
-
): Promise<ResourceNotFound> => {
|
|
531
|
-
const contents: ResourceNotFound = {
|
|
532
|
-
name: "ResourceNotFound",
|
|
533
|
-
$fault: "client",
|
|
534
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
535
|
-
Message: undefined,
|
|
536
|
-
};
|
|
537
|
-
const data: any = parsedOutput.body;
|
|
538
|
-
if (data.Message !== undefined && data.Message !== null) {
|
|
539
|
-
contents.Message = __expectString(data.Message);
|
|
540
|
-
}
|
|
541
|
-
return contents;
|
|
542
|
-
};
|
|
543
|
-
|
|
544
|
-
const deserializeAws_restJson1ServiceUnavailableResponse = async (
|
|
545
|
-
parsedOutput: any,
|
|
546
|
-
context: __SerdeContext
|
|
547
|
-
): Promise<ServiceUnavailable> => {
|
|
548
|
-
const contents: ServiceUnavailable = {
|
|
549
|
-
name: "ServiceUnavailable",
|
|
550
|
-
$fault: "server",
|
|
551
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
552
|
-
Message: undefined,
|
|
553
|
-
};
|
|
554
|
-
const data: any = parsedOutput.body;
|
|
555
|
-
if (data.Message !== undefined && data.Message !== null) {
|
|
556
|
-
contents.Message = __expectString(data.Message);
|
|
557
|
-
}
|
|
558
|
-
return contents;
|
|
559
|
-
};
|
|
560
|
-
|
|
561
|
-
const deserializeAws_restJson1ValidationErrorResponse = async (
|
|
562
|
-
parsedOutput: any,
|
|
563
|
-
context: __SerdeContext
|
|
564
|
-
): Promise<ValidationError> => {
|
|
565
|
-
const contents: ValidationError = {
|
|
566
|
-
name: "ValidationError",
|
|
567
|
-
$fault: "client",
|
|
568
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
569
|
-
Message: undefined,
|
|
570
|
-
};
|
|
571
|
-
const data: any = parsedOutput.body;
|
|
572
|
-
if (data.Message !== undefined && data.Message !== null) {
|
|
573
|
-
contents.Message = __expectString(data.Message);
|
|
574
|
-
}
|
|
575
|
-
return contents;
|
|
576
|
-
};
|
|
577
|
-
|
|
578
|
-
const serializeAws_restJson1BatchGetRecordIdentifier = (
|
|
579
|
-
input: BatchGetRecordIdentifier,
|
|
580
|
-
context: __SerdeContext
|
|
581
|
-
): any => {
|
|
582
|
-
return {
|
|
583
|
-
...(input.FeatureGroupName !== undefined &&
|
|
584
|
-
input.FeatureGroupName !== null && { FeatureGroupName: input.FeatureGroupName }),
|
|
585
|
-
...(input.FeatureNames !== undefined &&
|
|
586
|
-
input.FeatureNames !== null && { FeatureNames: serializeAws_restJson1FeatureNames(input.FeatureNames, context) }),
|
|
587
|
-
...(input.RecordIdentifiersValueAsString !== undefined &&
|
|
588
|
-
input.RecordIdentifiersValueAsString !== null && {
|
|
589
|
-
RecordIdentifiersValueAsString: serializeAws_restJson1RecordIdentifiers(
|
|
590
|
-
input.RecordIdentifiersValueAsString,
|
|
591
|
-
context
|
|
592
|
-
),
|
|
593
|
-
}),
|
|
594
|
-
};
|
|
595
|
-
};
|
|
596
|
-
|
|
597
|
-
const serializeAws_restJson1BatchGetRecordIdentifiers = (
|
|
598
|
-
input: BatchGetRecordIdentifier[],
|
|
599
|
-
context: __SerdeContext
|
|
600
|
-
): any => {
|
|
601
|
-
return input
|
|
602
|
-
.filter((e: any) => e != null)
|
|
603
|
-
.map((entry) => {
|
|
604
|
-
if (entry === null) {
|
|
605
|
-
return null as any;
|
|
606
|
-
}
|
|
607
|
-
return serializeAws_restJson1BatchGetRecordIdentifier(entry, context);
|
|
608
|
-
});
|
|
609
|
-
};
|
|
610
|
-
|
|
611
|
-
const serializeAws_restJson1FeatureNames = (input: string[], context: __SerdeContext): any => {
|
|
612
|
-
return input
|
|
613
|
-
.filter((e: any) => e != null)
|
|
614
|
-
.map((entry) => {
|
|
615
|
-
if (entry === null) {
|
|
616
|
-
return null as any;
|
|
617
|
-
}
|
|
618
|
-
return entry;
|
|
619
|
-
});
|
|
620
|
-
};
|
|
621
|
-
|
|
622
|
-
const serializeAws_restJson1FeatureValue = (input: FeatureValue, context: __SerdeContext): any => {
|
|
623
|
-
return {
|
|
624
|
-
...(input.FeatureName !== undefined && input.FeatureName !== null && { FeatureName: input.FeatureName }),
|
|
625
|
-
...(input.ValueAsString !== undefined && input.ValueAsString !== null && { ValueAsString: input.ValueAsString }),
|
|
626
|
-
};
|
|
627
|
-
};
|
|
628
|
-
|
|
629
|
-
const serializeAws_restJson1Record = (input: FeatureValue[], context: __SerdeContext): any => {
|
|
630
|
-
return input
|
|
631
|
-
.filter((e: any) => e != null)
|
|
632
|
-
.map((entry) => {
|
|
633
|
-
if (entry === null) {
|
|
634
|
-
return null as any;
|
|
635
|
-
}
|
|
636
|
-
return serializeAws_restJson1FeatureValue(entry, context);
|
|
637
|
-
});
|
|
638
|
-
};
|
|
639
|
-
|
|
640
|
-
const serializeAws_restJson1RecordIdentifiers = (input: string[], context: __SerdeContext): any => {
|
|
641
|
-
return input
|
|
642
|
-
.filter((e: any) => e != null)
|
|
643
|
-
.map((entry) => {
|
|
644
|
-
if (entry === null) {
|
|
645
|
-
return null as any;
|
|
646
|
-
}
|
|
647
|
-
return entry;
|
|
648
|
-
});
|
|
649
|
-
};
|
|
650
|
-
|
|
651
|
-
const deserializeAws_restJson1BatchGetRecordError = (output: any, context: __SerdeContext): BatchGetRecordError => {
|
|
652
|
-
return {
|
|
653
|
-
ErrorCode: __expectString(output.ErrorCode),
|
|
654
|
-
ErrorMessage: __expectString(output.ErrorMessage),
|
|
655
|
-
FeatureGroupName: __expectString(output.FeatureGroupName),
|
|
656
|
-
RecordIdentifierValueAsString: __expectString(output.RecordIdentifierValueAsString),
|
|
657
|
-
} as any;
|
|
658
|
-
};
|
|
659
|
-
|
|
660
|
-
const deserializeAws_restJson1BatchGetRecordErrors = (output: any, context: __SerdeContext): BatchGetRecordError[] => {
|
|
661
|
-
return (output || [])
|
|
662
|
-
.filter((e: any) => e != null)
|
|
663
|
-
.map((entry: any) => {
|
|
664
|
-
if (entry === null) {
|
|
665
|
-
return null as any;
|
|
666
|
-
}
|
|
667
|
-
return deserializeAws_restJson1BatchGetRecordError(entry, context);
|
|
668
|
-
});
|
|
669
|
-
};
|
|
670
|
-
|
|
671
|
-
const deserializeAws_restJson1BatchGetRecordIdentifier = (
|
|
672
|
-
output: any,
|
|
673
|
-
context: __SerdeContext
|
|
674
|
-
): BatchGetRecordIdentifier => {
|
|
675
|
-
return {
|
|
676
|
-
FeatureGroupName: __expectString(output.FeatureGroupName),
|
|
677
|
-
FeatureNames:
|
|
678
|
-
output.FeatureNames !== undefined && output.FeatureNames !== null
|
|
679
|
-
? deserializeAws_restJson1FeatureNames(output.FeatureNames, context)
|
|
680
|
-
: undefined,
|
|
681
|
-
RecordIdentifiersValueAsString:
|
|
682
|
-
output.RecordIdentifiersValueAsString !== undefined && output.RecordIdentifiersValueAsString !== null
|
|
683
|
-
? deserializeAws_restJson1RecordIdentifiers(output.RecordIdentifiersValueAsString, context)
|
|
684
|
-
: undefined,
|
|
685
|
-
} as any;
|
|
686
|
-
};
|
|
687
|
-
|
|
688
|
-
const deserializeAws_restJson1BatchGetRecordResultDetail = (
|
|
689
|
-
output: any,
|
|
690
|
-
context: __SerdeContext
|
|
691
|
-
): BatchGetRecordResultDetail => {
|
|
692
|
-
return {
|
|
693
|
-
FeatureGroupName: __expectString(output.FeatureGroupName),
|
|
694
|
-
Record:
|
|
695
|
-
output.Record !== undefined && output.Record !== null
|
|
696
|
-
? deserializeAws_restJson1Record(output.Record, context)
|
|
697
|
-
: undefined,
|
|
698
|
-
RecordIdentifierValueAsString: __expectString(output.RecordIdentifierValueAsString),
|
|
699
|
-
} as any;
|
|
700
|
-
};
|
|
701
|
-
|
|
702
|
-
const deserializeAws_restJson1BatchGetRecordResultDetails = (
|
|
703
|
-
output: any,
|
|
704
|
-
context: __SerdeContext
|
|
705
|
-
): BatchGetRecordResultDetail[] => {
|
|
706
|
-
return (output || [])
|
|
707
|
-
.filter((e: any) => e != null)
|
|
708
|
-
.map((entry: any) => {
|
|
709
|
-
if (entry === null) {
|
|
710
|
-
return null as any;
|
|
711
|
-
}
|
|
712
|
-
return deserializeAws_restJson1BatchGetRecordResultDetail(entry, context);
|
|
713
|
-
});
|
|
714
|
-
};
|
|
715
|
-
|
|
716
|
-
const deserializeAws_restJson1FeatureNames = (output: any, context: __SerdeContext): string[] => {
|
|
717
|
-
return (output || [])
|
|
718
|
-
.filter((e: any) => e != null)
|
|
719
|
-
.map((entry: any) => {
|
|
720
|
-
if (entry === null) {
|
|
721
|
-
return null as any;
|
|
722
|
-
}
|
|
723
|
-
return __expectString(entry) as any;
|
|
724
|
-
});
|
|
725
|
-
};
|
|
726
|
-
|
|
727
|
-
const deserializeAws_restJson1FeatureValue = (output: any, context: __SerdeContext): FeatureValue => {
|
|
728
|
-
return {
|
|
729
|
-
FeatureName: __expectString(output.FeatureName),
|
|
730
|
-
ValueAsString: __expectString(output.ValueAsString),
|
|
731
|
-
} as any;
|
|
732
|
-
};
|
|
733
|
-
|
|
734
|
-
const deserializeAws_restJson1Record = (output: any, context: __SerdeContext): FeatureValue[] => {
|
|
735
|
-
return (output || [])
|
|
736
|
-
.filter((e: any) => e != null)
|
|
737
|
-
.map((entry: any) => {
|
|
738
|
-
if (entry === null) {
|
|
739
|
-
return null as any;
|
|
740
|
-
}
|
|
741
|
-
return deserializeAws_restJson1FeatureValue(entry, context);
|
|
742
|
-
});
|
|
743
|
-
};
|
|
744
|
-
|
|
745
|
-
const deserializeAws_restJson1RecordIdentifiers = (output: any, context: __SerdeContext): string[] => {
|
|
746
|
-
return (output || [])
|
|
747
|
-
.filter((e: any) => e != null)
|
|
748
|
-
.map((entry: any) => {
|
|
749
|
-
if (entry === null) {
|
|
750
|
-
return null as any;
|
|
751
|
-
}
|
|
752
|
-
return __expectString(entry) as any;
|
|
753
|
-
});
|
|
754
|
-
};
|
|
755
|
-
|
|
756
|
-
const deserializeAws_restJson1UnprocessedIdentifiers = (
|
|
757
|
-
output: any,
|
|
758
|
-
context: __SerdeContext
|
|
759
|
-
): BatchGetRecordIdentifier[] => {
|
|
760
|
-
return (output || [])
|
|
761
|
-
.filter((e: any) => e != null)
|
|
762
|
-
.map((entry: any) => {
|
|
763
|
-
if (entry === null) {
|
|
764
|
-
return null as any;
|
|
765
|
-
}
|
|
766
|
-
return deserializeAws_restJson1BatchGetRecordIdentifier(entry, context);
|
|
767
|
-
});
|
|
768
|
-
};
|
|
769
|
-
|
|
770
|
-
const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
|
|
771
|
-
httpStatusCode: output.statusCode,
|
|
772
|
-
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
|
|
773
|
-
extendedRequestId: output.headers["x-amz-id-2"],
|
|
774
|
-
cfId: output.headers["x-amz-cf-id"],
|
|
775
|
-
});
|
|
776
|
-
|
|
777
|
-
// Collect low-level response body stream to Uint8Array.
|
|
778
|
-
const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
|
|
779
|
-
if (streamBody instanceof Uint8Array) {
|
|
780
|
-
return Promise.resolve(streamBody);
|
|
781
|
-
}
|
|
782
|
-
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
|
|
783
|
-
};
|
|
784
|
-
|
|
785
|
-
// Encode Uint8Array data into string with utf-8.
|
|
786
|
-
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
|
|
787
|
-
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
|
|
788
|
-
|
|
789
|
-
const isSerializableHeaderValue = (value: any): boolean =>
|
|
790
|
-
value !== undefined &&
|
|
791
|
-
value !== null &&
|
|
792
|
-
value !== "" &&
|
|
793
|
-
(!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
|
|
794
|
-
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
|
|
795
|
-
|
|
796
|
-
const parseBody = (streamBody: any, context: __SerdeContext): any =>
|
|
797
|
-
collectBodyString(streamBody, context).then((encoded) => {
|
|
798
|
-
if (encoded.length) {
|
|
799
|
-
return JSON.parse(encoded);
|
|
800
|
-
}
|
|
801
|
-
return {};
|
|
802
|
-
});
|
|
803
|
-
|
|
804
|
-
/**
|
|
805
|
-
* Load an error code for the aws.rest-json-1.1 protocol.
|
|
806
|
-
*/
|
|
807
|
-
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => {
|
|
808
|
-
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
809
|
-
|
|
810
|
-
const sanitizeErrorCode = (rawValue: string): string => {
|
|
811
|
-
let cleanValue = rawValue;
|
|
812
|
-
if (cleanValue.indexOf(":") >= 0) {
|
|
813
|
-
cleanValue = cleanValue.split(":")[0];
|
|
814
|
-
}
|
|
815
|
-
if (cleanValue.indexOf("#") >= 0) {
|
|
816
|
-
cleanValue = cleanValue.split("#")[1];
|
|
817
|
-
}
|
|
818
|
-
return cleanValue;
|
|
819
|
-
};
|
|
820
|
-
|
|
821
|
-
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
822
|
-
if (headerKey !== undefined) {
|
|
823
|
-
return sanitizeErrorCode(output.headers[headerKey]);
|
|
824
|
-
}
|
|
825
|
-
|
|
826
|
-
if (data.code !== undefined) {
|
|
827
|
-
return sanitizeErrorCode(data.code);
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
if (data["__type"] !== undefined) {
|
|
831
|
-
return sanitizeErrorCode(data["__type"]);
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
return "";
|
|
835
|
-
};
|