@aws-sdk/client-sagemaker-runtime 3.35.0 → 3.38.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 +47 -0
- package/dist-cjs/SageMakerRuntime.js +0 -4
- package/dist-cjs/SageMakerRuntimeClient.js +0 -9
- package/dist-cjs/commands/InvokeEndpointAsyncCommand.js +0 -41
- package/dist-cjs/commands/InvokeEndpointCommand.js +0 -44
- package/dist-cjs/commands/index.js +5 -0
- package/dist-cjs/endpoints.js +1 -2
- package/dist-cjs/index.js +3 -5
- package/dist-cjs/models/index.js +0 -1
- package/dist-cjs/models/models_0.js +0 -25
- package/dist-cjs/protocols/Aws_restJson1.js +0 -6
- package/dist-cjs/runtimeConfig.browser.js +1 -6
- package/dist-cjs/runtimeConfig.js +2 -7
- package/dist-cjs/runtimeConfig.native.js +0 -4
- package/dist-cjs/runtimeConfig.shared.js +0 -4
- package/dist-es/SageMakerRuntime.js +0 -1
- package/dist-es/SageMakerRuntimeClient.js +0 -1
- package/dist-es/commands/InvokeEndpointAsyncCommand.js +0 -1
- package/dist-es/commands/InvokeEndpointCommand.js +0 -1
- package/dist-es/commands/index.js +2 -0
- package/dist-es/endpoints.js +1 -2
- package/dist-es/index.js +3 -5
- 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/dist-types/commands/index.d.ts +2 -0
- package/dist-types/index.d.ts +3 -4
- package/dist-types/ts3.4/SageMakerRuntime.d.ts +3 -44
- package/dist-types/ts3.4/SageMakerRuntimeClient.d.ts +24 -89
- package/dist-types/ts3.4/commands/InvokeEndpointAsyncCommand.d.ts +2 -36
- package/dist-types/ts3.4/commands/InvokeEndpointCommand.d.ts +2 -39
- package/dist-types/ts3.4/commands/index.d.ts +2 -0
- package/dist-types/ts3.4/index.d.ts +3 -4
- package/dist-types/ts3.4/models/models_0.d.ts +37 -175
- package/dist-types/ts3.4/runtimeConfig.browser.d.ts +1 -3
- package/dist-types/ts3.4/runtimeConfig.d.ts +1 -3
- package/dist-types/ts3.4/runtimeConfig.native.d.ts +1 -3
- package/dist-types/ts3.4/runtimeConfig.shared.d.ts +1 -3
- package/package.json +33 -30
- package/dist-cjs/SageMakerRuntime.js.map +0 -1
- package/dist-cjs/SageMakerRuntimeClient.js.map +0 -1
- package/dist-cjs/commands/InvokeEndpointAsyncCommand.js.map +0 -1
- package/dist-cjs/commands/InvokeEndpointCommand.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/SageMakerRuntime.js.map +0 -1
- package/dist-es/SageMakerRuntimeClient.js.map +0 -1
- package/dist-es/commands/InvokeEndpointAsyncCommand.js.map +0 -1
- package/dist-es/commands/InvokeEndpointCommand.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/SageMakerRuntime.ts +0 -117
- package/src/SageMakerRuntimeClient.ts +0 -241
- package/src/commands/InvokeEndpointAsyncCommand.ts +0 -111
- package/src/commands/InvokeEndpointCommand.ts +0 -114
- package/src/endpoints.ts +0 -82
- package/src/index.ts +0 -5
- package/src/models/index.ts +0 -1
- package/src/models/models_0.ts +0 -311
- package/src/protocols/Aws_restJson1.ts +0 -419
- 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,419 +0,0 @@
|
|
|
1
|
-
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
|
|
2
|
-
import {
|
|
3
|
-
expectInt32 as __expectInt32,
|
|
4
|
-
expectNonNull as __expectNonNull,
|
|
5
|
-
expectObject as __expectObject,
|
|
6
|
-
expectString as __expectString,
|
|
7
|
-
extendedEncodeURIComponent as __extendedEncodeURIComponent,
|
|
8
|
-
} from "@aws-sdk/smithy-client";
|
|
9
|
-
import {
|
|
10
|
-
Endpoint as __Endpoint,
|
|
11
|
-
MetadataBearer as __MetadataBearer,
|
|
12
|
-
ResponseMetadata as __ResponseMetadata,
|
|
13
|
-
SerdeContext as __SerdeContext,
|
|
14
|
-
SmithyException as __SmithyException,
|
|
15
|
-
} from "@aws-sdk/types";
|
|
16
|
-
|
|
17
|
-
import {
|
|
18
|
-
InvokeEndpointAsyncCommandInput,
|
|
19
|
-
InvokeEndpointAsyncCommandOutput,
|
|
20
|
-
} from "../commands/InvokeEndpointAsyncCommand";
|
|
21
|
-
import { InvokeEndpointCommandInput, InvokeEndpointCommandOutput } from "../commands/InvokeEndpointCommand";
|
|
22
|
-
import { InternalFailure, ModelError, ServiceUnavailable, ValidationError } from "../models/models_0";
|
|
23
|
-
|
|
24
|
-
export const serializeAws_restJson1InvokeEndpointCommand = async (
|
|
25
|
-
input: InvokeEndpointCommandInput,
|
|
26
|
-
context: __SerdeContext
|
|
27
|
-
): Promise<__HttpRequest> => {
|
|
28
|
-
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
29
|
-
const headers: any = {
|
|
30
|
-
"content-type": "application/octet-stream",
|
|
31
|
-
...(isSerializableHeaderValue(input.ContentType) && { "content-type": input.ContentType! }),
|
|
32
|
-
...(isSerializableHeaderValue(input.Accept) && { accept: input.Accept! }),
|
|
33
|
-
...(isSerializableHeaderValue(input.CustomAttributes) && {
|
|
34
|
-
"x-amzn-sagemaker-custom-attributes": input.CustomAttributes!,
|
|
35
|
-
}),
|
|
36
|
-
...(isSerializableHeaderValue(input.TargetModel) && { "x-amzn-sagemaker-target-model": input.TargetModel! }),
|
|
37
|
-
...(isSerializableHeaderValue(input.TargetVariant) && { "x-amzn-sagemaker-target-variant": input.TargetVariant! }),
|
|
38
|
-
...(isSerializableHeaderValue(input.TargetContainerHostname) && {
|
|
39
|
-
"x-amzn-sagemaker-target-container-hostname": input.TargetContainerHostname!,
|
|
40
|
-
}),
|
|
41
|
-
...(isSerializableHeaderValue(input.InferenceId) && { "x-amzn-sagemaker-inference-id": input.InferenceId! }),
|
|
42
|
-
};
|
|
43
|
-
let resolvedPath =
|
|
44
|
-
`${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/endpoints/{EndpointName}/invocations";
|
|
45
|
-
if (input.EndpointName !== undefined) {
|
|
46
|
-
const labelValue: string = input.EndpointName;
|
|
47
|
-
if (labelValue.length <= 0) {
|
|
48
|
-
throw new Error("Empty value provided for input HTTP label: EndpointName.");
|
|
49
|
-
}
|
|
50
|
-
resolvedPath = resolvedPath.replace("{EndpointName}", __extendedEncodeURIComponent(labelValue));
|
|
51
|
-
} else {
|
|
52
|
-
throw new Error("No value provided for input HTTP label: EndpointName.");
|
|
53
|
-
}
|
|
54
|
-
let body: any;
|
|
55
|
-
if (input.Body !== undefined) {
|
|
56
|
-
body = input.Body;
|
|
57
|
-
}
|
|
58
|
-
return new __HttpRequest({
|
|
59
|
-
protocol,
|
|
60
|
-
hostname,
|
|
61
|
-
port,
|
|
62
|
-
method: "POST",
|
|
63
|
-
headers,
|
|
64
|
-
path: resolvedPath,
|
|
65
|
-
body,
|
|
66
|
-
});
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
export const serializeAws_restJson1InvokeEndpointAsyncCommand = async (
|
|
70
|
-
input: InvokeEndpointAsyncCommandInput,
|
|
71
|
-
context: __SerdeContext
|
|
72
|
-
): Promise<__HttpRequest> => {
|
|
73
|
-
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
74
|
-
const headers: any = {
|
|
75
|
-
...(isSerializableHeaderValue(input.ContentType) && { "x-amzn-sagemaker-content-type": input.ContentType! }),
|
|
76
|
-
...(isSerializableHeaderValue(input.Accept) && { "x-amzn-sagemaker-accept": input.Accept! }),
|
|
77
|
-
...(isSerializableHeaderValue(input.CustomAttributes) && {
|
|
78
|
-
"x-amzn-sagemaker-custom-attributes": input.CustomAttributes!,
|
|
79
|
-
}),
|
|
80
|
-
...(isSerializableHeaderValue(input.InferenceId) && { "x-amzn-sagemaker-inference-id": input.InferenceId! }),
|
|
81
|
-
...(isSerializableHeaderValue(input.InputLocation) && { "x-amzn-sagemaker-inputlocation": input.InputLocation! }),
|
|
82
|
-
...(isSerializableHeaderValue(input.RequestTTLSeconds) && {
|
|
83
|
-
"x-amzn-sagemaker-requestttlseconds": input.RequestTTLSeconds!.toString(),
|
|
84
|
-
}),
|
|
85
|
-
};
|
|
86
|
-
let resolvedPath =
|
|
87
|
-
`${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
|
|
88
|
-
"/endpoints/{EndpointName}/async-invocations";
|
|
89
|
-
if (input.EndpointName !== undefined) {
|
|
90
|
-
const labelValue: string = input.EndpointName;
|
|
91
|
-
if (labelValue.length <= 0) {
|
|
92
|
-
throw new Error("Empty value provided for input HTTP label: EndpointName.");
|
|
93
|
-
}
|
|
94
|
-
resolvedPath = resolvedPath.replace("{EndpointName}", __extendedEncodeURIComponent(labelValue));
|
|
95
|
-
} else {
|
|
96
|
-
throw new Error("No value provided for input HTTP label: EndpointName.");
|
|
97
|
-
}
|
|
98
|
-
let body: any;
|
|
99
|
-
return new __HttpRequest({
|
|
100
|
-
protocol,
|
|
101
|
-
hostname,
|
|
102
|
-
port,
|
|
103
|
-
method: "POST",
|
|
104
|
-
headers,
|
|
105
|
-
path: resolvedPath,
|
|
106
|
-
body,
|
|
107
|
-
});
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
export const deserializeAws_restJson1InvokeEndpointCommand = async (
|
|
111
|
-
output: __HttpResponse,
|
|
112
|
-
context: __SerdeContext
|
|
113
|
-
): Promise<InvokeEndpointCommandOutput> => {
|
|
114
|
-
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
115
|
-
return deserializeAws_restJson1InvokeEndpointCommandError(output, context);
|
|
116
|
-
}
|
|
117
|
-
const contents: InvokeEndpointCommandOutput = {
|
|
118
|
-
$metadata: deserializeMetadata(output),
|
|
119
|
-
Body: undefined,
|
|
120
|
-
ContentType: undefined,
|
|
121
|
-
CustomAttributes: undefined,
|
|
122
|
-
InvokedProductionVariant: undefined,
|
|
123
|
-
};
|
|
124
|
-
if (output.headers["content-type"] !== undefined) {
|
|
125
|
-
contents.ContentType = output.headers["content-type"];
|
|
126
|
-
}
|
|
127
|
-
if (output.headers["x-amzn-invoked-production-variant"] !== undefined) {
|
|
128
|
-
contents.InvokedProductionVariant = output.headers["x-amzn-invoked-production-variant"];
|
|
129
|
-
}
|
|
130
|
-
if (output.headers["x-amzn-sagemaker-custom-attributes"] !== undefined) {
|
|
131
|
-
contents.CustomAttributes = output.headers["x-amzn-sagemaker-custom-attributes"];
|
|
132
|
-
}
|
|
133
|
-
const data: any = await collectBody(output.body, context);
|
|
134
|
-
contents.Body = data;
|
|
135
|
-
return Promise.resolve(contents);
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
const deserializeAws_restJson1InvokeEndpointCommandError = async (
|
|
139
|
-
output: __HttpResponse,
|
|
140
|
-
context: __SerdeContext
|
|
141
|
-
): Promise<InvokeEndpointCommandOutput> => {
|
|
142
|
-
const parsedOutput: any = {
|
|
143
|
-
...output,
|
|
144
|
-
body: await parseBody(output.body, context),
|
|
145
|
-
};
|
|
146
|
-
let response: __SmithyException & __MetadataBearer & { [key: string]: any };
|
|
147
|
-
let errorCode = "UnknownError";
|
|
148
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
149
|
-
switch (errorCode) {
|
|
150
|
-
case "InternalFailure":
|
|
151
|
-
case "com.amazonaws.sagemakerruntime#InternalFailure":
|
|
152
|
-
response = {
|
|
153
|
-
...(await deserializeAws_restJson1InternalFailureResponse(parsedOutput, context)),
|
|
154
|
-
name: errorCode,
|
|
155
|
-
$metadata: deserializeMetadata(output),
|
|
156
|
-
};
|
|
157
|
-
break;
|
|
158
|
-
case "ModelError":
|
|
159
|
-
case "com.amazonaws.sagemakerruntime#ModelError":
|
|
160
|
-
response = {
|
|
161
|
-
...(await deserializeAws_restJson1ModelErrorResponse(parsedOutput, context)),
|
|
162
|
-
name: errorCode,
|
|
163
|
-
$metadata: deserializeMetadata(output),
|
|
164
|
-
};
|
|
165
|
-
break;
|
|
166
|
-
case "ServiceUnavailable":
|
|
167
|
-
case "com.amazonaws.sagemakerruntime#ServiceUnavailable":
|
|
168
|
-
response = {
|
|
169
|
-
...(await deserializeAws_restJson1ServiceUnavailableResponse(parsedOutput, context)),
|
|
170
|
-
name: errorCode,
|
|
171
|
-
$metadata: deserializeMetadata(output),
|
|
172
|
-
};
|
|
173
|
-
break;
|
|
174
|
-
case "ValidationError":
|
|
175
|
-
case "com.amazonaws.sagemakerruntime#ValidationError":
|
|
176
|
-
response = {
|
|
177
|
-
...(await deserializeAws_restJson1ValidationErrorResponse(parsedOutput, context)),
|
|
178
|
-
name: errorCode,
|
|
179
|
-
$metadata: deserializeMetadata(output),
|
|
180
|
-
};
|
|
181
|
-
break;
|
|
182
|
-
default:
|
|
183
|
-
const parsedBody = parsedOutput.body;
|
|
184
|
-
errorCode = parsedBody.code || parsedBody.Code || errorCode;
|
|
185
|
-
response = {
|
|
186
|
-
...parsedBody,
|
|
187
|
-
name: `${errorCode}`,
|
|
188
|
-
message: parsedBody.message || parsedBody.Message || errorCode,
|
|
189
|
-
$fault: "client",
|
|
190
|
-
$metadata: deserializeMetadata(output),
|
|
191
|
-
} as any;
|
|
192
|
-
}
|
|
193
|
-
const message = response.message || response.Message || errorCode;
|
|
194
|
-
response.message = message;
|
|
195
|
-
delete response.Message;
|
|
196
|
-
return Promise.reject(Object.assign(new Error(message), response));
|
|
197
|
-
};
|
|
198
|
-
|
|
199
|
-
export const deserializeAws_restJson1InvokeEndpointAsyncCommand = async (
|
|
200
|
-
output: __HttpResponse,
|
|
201
|
-
context: __SerdeContext
|
|
202
|
-
): Promise<InvokeEndpointAsyncCommandOutput> => {
|
|
203
|
-
if (output.statusCode !== 202 && output.statusCode >= 300) {
|
|
204
|
-
return deserializeAws_restJson1InvokeEndpointAsyncCommandError(output, context);
|
|
205
|
-
}
|
|
206
|
-
const contents: InvokeEndpointAsyncCommandOutput = {
|
|
207
|
-
$metadata: deserializeMetadata(output),
|
|
208
|
-
InferenceId: undefined,
|
|
209
|
-
OutputLocation: undefined,
|
|
210
|
-
};
|
|
211
|
-
if (output.headers["x-amzn-sagemaker-outputlocation"] !== undefined) {
|
|
212
|
-
contents.OutputLocation = output.headers["x-amzn-sagemaker-outputlocation"];
|
|
213
|
-
}
|
|
214
|
-
const data: { [key: string]: any } = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
215
|
-
if (data.InferenceId !== undefined && data.InferenceId !== null) {
|
|
216
|
-
contents.InferenceId = __expectString(data.InferenceId);
|
|
217
|
-
}
|
|
218
|
-
return Promise.resolve(contents);
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
const deserializeAws_restJson1InvokeEndpointAsyncCommandError = async (
|
|
222
|
-
output: __HttpResponse,
|
|
223
|
-
context: __SerdeContext
|
|
224
|
-
): Promise<InvokeEndpointAsyncCommandOutput> => {
|
|
225
|
-
const parsedOutput: any = {
|
|
226
|
-
...output,
|
|
227
|
-
body: await parseBody(output.body, context),
|
|
228
|
-
};
|
|
229
|
-
let response: __SmithyException & __MetadataBearer & { [key: string]: any };
|
|
230
|
-
let errorCode = "UnknownError";
|
|
231
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
232
|
-
switch (errorCode) {
|
|
233
|
-
case "InternalFailure":
|
|
234
|
-
case "com.amazonaws.sagemakerruntime#InternalFailure":
|
|
235
|
-
response = {
|
|
236
|
-
...(await deserializeAws_restJson1InternalFailureResponse(parsedOutput, context)),
|
|
237
|
-
name: errorCode,
|
|
238
|
-
$metadata: deserializeMetadata(output),
|
|
239
|
-
};
|
|
240
|
-
break;
|
|
241
|
-
case "ServiceUnavailable":
|
|
242
|
-
case "com.amazonaws.sagemakerruntime#ServiceUnavailable":
|
|
243
|
-
response = {
|
|
244
|
-
...(await deserializeAws_restJson1ServiceUnavailableResponse(parsedOutput, context)),
|
|
245
|
-
name: errorCode,
|
|
246
|
-
$metadata: deserializeMetadata(output),
|
|
247
|
-
};
|
|
248
|
-
break;
|
|
249
|
-
case "ValidationError":
|
|
250
|
-
case "com.amazonaws.sagemakerruntime#ValidationError":
|
|
251
|
-
response = {
|
|
252
|
-
...(await deserializeAws_restJson1ValidationErrorResponse(parsedOutput, context)),
|
|
253
|
-
name: errorCode,
|
|
254
|
-
$metadata: deserializeMetadata(output),
|
|
255
|
-
};
|
|
256
|
-
break;
|
|
257
|
-
default:
|
|
258
|
-
const parsedBody = parsedOutput.body;
|
|
259
|
-
errorCode = parsedBody.code || parsedBody.Code || errorCode;
|
|
260
|
-
response = {
|
|
261
|
-
...parsedBody,
|
|
262
|
-
name: `${errorCode}`,
|
|
263
|
-
message: parsedBody.message || parsedBody.Message || errorCode,
|
|
264
|
-
$fault: "client",
|
|
265
|
-
$metadata: deserializeMetadata(output),
|
|
266
|
-
} as any;
|
|
267
|
-
}
|
|
268
|
-
const message = response.message || response.Message || errorCode;
|
|
269
|
-
response.message = message;
|
|
270
|
-
delete response.Message;
|
|
271
|
-
return Promise.reject(Object.assign(new Error(message), response));
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
const deserializeAws_restJson1InternalFailureResponse = async (
|
|
275
|
-
parsedOutput: any,
|
|
276
|
-
context: __SerdeContext
|
|
277
|
-
): Promise<InternalFailure> => {
|
|
278
|
-
const contents: InternalFailure = {
|
|
279
|
-
name: "InternalFailure",
|
|
280
|
-
$fault: "server",
|
|
281
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
282
|
-
Message: undefined,
|
|
283
|
-
};
|
|
284
|
-
const data: any = parsedOutput.body;
|
|
285
|
-
if (data.Message !== undefined && data.Message !== null) {
|
|
286
|
-
contents.Message = __expectString(data.Message);
|
|
287
|
-
}
|
|
288
|
-
return contents;
|
|
289
|
-
};
|
|
290
|
-
|
|
291
|
-
const deserializeAws_restJson1ModelErrorResponse = async (
|
|
292
|
-
parsedOutput: any,
|
|
293
|
-
context: __SerdeContext
|
|
294
|
-
): Promise<ModelError> => {
|
|
295
|
-
const contents: ModelError = {
|
|
296
|
-
name: "ModelError",
|
|
297
|
-
$fault: "client",
|
|
298
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
299
|
-
LogStreamArn: undefined,
|
|
300
|
-
Message: undefined,
|
|
301
|
-
OriginalMessage: undefined,
|
|
302
|
-
OriginalStatusCode: undefined,
|
|
303
|
-
};
|
|
304
|
-
const data: any = parsedOutput.body;
|
|
305
|
-
if (data.LogStreamArn !== undefined && data.LogStreamArn !== null) {
|
|
306
|
-
contents.LogStreamArn = __expectString(data.LogStreamArn);
|
|
307
|
-
}
|
|
308
|
-
if (data.Message !== undefined && data.Message !== null) {
|
|
309
|
-
contents.Message = __expectString(data.Message);
|
|
310
|
-
}
|
|
311
|
-
if (data.OriginalMessage !== undefined && data.OriginalMessage !== null) {
|
|
312
|
-
contents.OriginalMessage = __expectString(data.OriginalMessage);
|
|
313
|
-
}
|
|
314
|
-
if (data.OriginalStatusCode !== undefined && data.OriginalStatusCode !== null) {
|
|
315
|
-
contents.OriginalStatusCode = __expectInt32(data.OriginalStatusCode);
|
|
316
|
-
}
|
|
317
|
-
return contents;
|
|
318
|
-
};
|
|
319
|
-
|
|
320
|
-
const deserializeAws_restJson1ServiceUnavailableResponse = async (
|
|
321
|
-
parsedOutput: any,
|
|
322
|
-
context: __SerdeContext
|
|
323
|
-
): Promise<ServiceUnavailable> => {
|
|
324
|
-
const contents: ServiceUnavailable = {
|
|
325
|
-
name: "ServiceUnavailable",
|
|
326
|
-
$fault: "server",
|
|
327
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
328
|
-
Message: undefined,
|
|
329
|
-
};
|
|
330
|
-
const data: any = parsedOutput.body;
|
|
331
|
-
if (data.Message !== undefined && data.Message !== null) {
|
|
332
|
-
contents.Message = __expectString(data.Message);
|
|
333
|
-
}
|
|
334
|
-
return contents;
|
|
335
|
-
};
|
|
336
|
-
|
|
337
|
-
const deserializeAws_restJson1ValidationErrorResponse = async (
|
|
338
|
-
parsedOutput: any,
|
|
339
|
-
context: __SerdeContext
|
|
340
|
-
): Promise<ValidationError> => {
|
|
341
|
-
const contents: ValidationError = {
|
|
342
|
-
name: "ValidationError",
|
|
343
|
-
$fault: "client",
|
|
344
|
-
$metadata: deserializeMetadata(parsedOutput),
|
|
345
|
-
Message: undefined,
|
|
346
|
-
};
|
|
347
|
-
const data: any = parsedOutput.body;
|
|
348
|
-
if (data.Message !== undefined && data.Message !== null) {
|
|
349
|
-
contents.Message = __expectString(data.Message);
|
|
350
|
-
}
|
|
351
|
-
return contents;
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
const deserializeMetadata = (output: __HttpResponse): __ResponseMetadata => ({
|
|
355
|
-
httpStatusCode: output.statusCode,
|
|
356
|
-
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"],
|
|
357
|
-
extendedRequestId: output.headers["x-amz-id-2"],
|
|
358
|
-
cfId: output.headers["x-amz-cf-id"],
|
|
359
|
-
});
|
|
360
|
-
|
|
361
|
-
// Collect low-level response body stream to Uint8Array.
|
|
362
|
-
const collectBody = (streamBody: any = new Uint8Array(), context: __SerdeContext): Promise<Uint8Array> => {
|
|
363
|
-
if (streamBody instanceof Uint8Array) {
|
|
364
|
-
return Promise.resolve(streamBody);
|
|
365
|
-
}
|
|
366
|
-
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
|
|
367
|
-
};
|
|
368
|
-
|
|
369
|
-
// Encode Uint8Array data into string with utf-8.
|
|
370
|
-
const collectBodyString = (streamBody: any, context: __SerdeContext): Promise<string> =>
|
|
371
|
-
collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
|
|
372
|
-
|
|
373
|
-
const isSerializableHeaderValue = (value: any): boolean =>
|
|
374
|
-
value !== undefined &&
|
|
375
|
-
value !== null &&
|
|
376
|
-
value !== "" &&
|
|
377
|
-
(!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
|
|
378
|
-
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
|
|
379
|
-
|
|
380
|
-
const parseBody = (streamBody: any, context: __SerdeContext): any =>
|
|
381
|
-
collectBodyString(streamBody, context).then((encoded) => {
|
|
382
|
-
if (encoded.length) {
|
|
383
|
-
return JSON.parse(encoded);
|
|
384
|
-
}
|
|
385
|
-
return {};
|
|
386
|
-
});
|
|
387
|
-
|
|
388
|
-
/**
|
|
389
|
-
* Load an error code for the aws.rest-json-1.1 protocol.
|
|
390
|
-
*/
|
|
391
|
-
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string => {
|
|
392
|
-
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
393
|
-
|
|
394
|
-
const sanitizeErrorCode = (rawValue: string): string => {
|
|
395
|
-
let cleanValue = rawValue;
|
|
396
|
-
if (cleanValue.indexOf(":") >= 0) {
|
|
397
|
-
cleanValue = cleanValue.split(":")[0];
|
|
398
|
-
}
|
|
399
|
-
if (cleanValue.indexOf("#") >= 0) {
|
|
400
|
-
cleanValue = cleanValue.split("#")[1];
|
|
401
|
-
}
|
|
402
|
-
return cleanValue;
|
|
403
|
-
};
|
|
404
|
-
|
|
405
|
-
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
406
|
-
if (headerKey !== undefined) {
|
|
407
|
-
return sanitizeErrorCode(output.headers[headerKey]);
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
if (data.code !== undefined) {
|
|
411
|
-
return sanitizeErrorCode(data.code);
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
if (data["__type"] !== undefined) {
|
|
415
|
-
return sanitizeErrorCode(data["__type"]);
|
|
416
|
-
}
|
|
417
|
-
|
|
418
|
-
return "";
|
|
419
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Sha256 } from "@aws-crypto/sha256-browser";
|
|
2
|
-
import { FetchHttpHandler, streamCollector } from "@aws-sdk/fetch-http-handler";
|
|
3
|
-
import { invalidProvider } from "@aws-sdk/invalid-dependency";
|
|
4
|
-
import { DEFAULT_MAX_ATTEMPTS, DEFAULT_RETRY_MODE } from "@aws-sdk/middleware-retry";
|
|
5
|
-
import { fromBase64, toBase64 } from "@aws-sdk/util-base64-browser";
|
|
6
|
-
import { calculateBodyLength } from "@aws-sdk/util-body-length-browser";
|
|
7
|
-
import { defaultUserAgent } from "@aws-sdk/util-user-agent-browser";
|
|
8
|
-
import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-browser";
|
|
9
|
-
|
|
10
|
-
// @ts-ignore: package.json will be imported from dist folders
|
|
11
|
-
import packageInfo from "../package.json";
|
|
12
|
-
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
|
|
13
|
-
import { SageMakerRuntimeClientConfig } from "./SageMakerRuntimeClient";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* @internal
|
|
17
|
-
*/
|
|
18
|
-
export const getRuntimeConfig = (config: SageMakerRuntimeClientConfig) => {
|
|
19
|
-
const clientSharedValues = getSharedRuntimeConfig(config);
|
|
20
|
-
return {
|
|
21
|
-
...clientSharedValues,
|
|
22
|
-
...config,
|
|
23
|
-
runtime: "browser",
|
|
24
|
-
base64Decoder: config?.base64Decoder ?? fromBase64,
|
|
25
|
-
base64Encoder: config?.base64Encoder ?? toBase64,
|
|
26
|
-
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
27
|
-
credentialDefaultProvider:
|
|
28
|
-
config?.credentialDefaultProvider ?? ((_: unknown) => () => Promise.reject(new Error("Credential is missing"))),
|
|
29
|
-
defaultUserAgentProvider:
|
|
30
|
-
config?.defaultUserAgentProvider ??
|
|
31
|
-
defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
32
|
-
maxAttempts: config?.maxAttempts ?? DEFAULT_MAX_ATTEMPTS,
|
|
33
|
-
region: config?.region ?? invalidProvider("Region is missing"),
|
|
34
|
-
requestHandler: config?.requestHandler ?? new FetchHttpHandler(),
|
|
35
|
-
retryMode: config?.retryMode ?? (() => Promise.resolve(DEFAULT_RETRY_MODE)),
|
|
36
|
-
sha256: config?.sha256 ?? Sha256,
|
|
37
|
-
streamCollector: config?.streamCollector ?? streamCollector,
|
|
38
|
-
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
|
|
39
|
-
utf8Encoder: config?.utf8Encoder ?? toUtf8,
|
|
40
|
-
};
|
|
41
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Sha256 } from "@aws-crypto/sha256-js";
|
|
2
|
-
|
|
3
|
-
import { getRuntimeConfig as getBrowserRuntimeConfig } from "./runtimeConfig.browser";
|
|
4
|
-
import { SageMakerRuntimeClientConfig } from "./SageMakerRuntimeClient";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
export const getRuntimeConfig = (config: SageMakerRuntimeClientConfig) => {
|
|
10
|
-
const browserDefaults = getBrowserRuntimeConfig(config);
|
|
11
|
-
return {
|
|
12
|
-
...browserDefaults,
|
|
13
|
-
...config,
|
|
14
|
-
runtime: "react-native",
|
|
15
|
-
sha256: config?.sha256 ?? Sha256,
|
|
16
|
-
};
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Logger as __Logger } from "@aws-sdk/types";
|
|
2
|
-
import { parseUrl } from "@aws-sdk/url-parser";
|
|
3
|
-
|
|
4
|
-
import { defaultRegionInfoProvider } from "./endpoints";
|
|
5
|
-
import { SageMakerRuntimeClientConfig } from "./SageMakerRuntimeClient";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* @internal
|
|
9
|
-
*/
|
|
10
|
-
export const getRuntimeConfig = (config: SageMakerRuntimeClientConfig) => ({
|
|
11
|
-
apiVersion: "2017-05-13",
|
|
12
|
-
disableHostPrefix: config?.disableHostPrefix ?? false,
|
|
13
|
-
logger: config?.logger ?? ({} as __Logger),
|
|
14
|
-
regionInfoProvider: config?.regionInfoProvider ?? defaultRegionInfoProvider,
|
|
15
|
-
serviceId: config?.serviceId ?? "SageMaker Runtime",
|
|
16
|
-
urlParser: config?.urlParser ?? parseUrl,
|
|
17
|
-
});
|
package/src/runtimeConfig.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { decorateDefaultCredentialProvider } from "@aws-sdk/client-sts";
|
|
2
|
-
import { NODE_REGION_CONFIG_FILE_OPTIONS, NODE_REGION_CONFIG_OPTIONS } from "@aws-sdk/config-resolver";
|
|
3
|
-
import { defaultProvider as credentialDefaultProvider } from "@aws-sdk/credential-provider-node";
|
|
4
|
-
import { Hash } from "@aws-sdk/hash-node";
|
|
5
|
-
import { NODE_MAX_ATTEMPT_CONFIG_OPTIONS, NODE_RETRY_MODE_CONFIG_OPTIONS } from "@aws-sdk/middleware-retry";
|
|
6
|
-
import { loadConfig as loadNodeConfig } from "@aws-sdk/node-config-provider";
|
|
7
|
-
import { NodeHttpHandler, streamCollector } from "@aws-sdk/node-http-handler";
|
|
8
|
-
import { emitWarningIfUnsupportedVersion } from "@aws-sdk/smithy-client";
|
|
9
|
-
import { fromBase64, toBase64 } from "@aws-sdk/util-base64-node";
|
|
10
|
-
import { calculateBodyLength } from "@aws-sdk/util-body-length-node";
|
|
11
|
-
import { defaultUserAgent } from "@aws-sdk/util-user-agent-node";
|
|
12
|
-
import { fromUtf8, toUtf8 } from "@aws-sdk/util-utf8-node";
|
|
13
|
-
|
|
14
|
-
// @ts-ignore: package.json will be imported from dist folders
|
|
15
|
-
import packageInfo from "../package.json";
|
|
16
|
-
import { getRuntimeConfig as getSharedRuntimeConfig } from "./runtimeConfig.shared";
|
|
17
|
-
import { SageMakerRuntimeClientConfig } from "./SageMakerRuntimeClient";
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* @internal
|
|
21
|
-
*/
|
|
22
|
-
export const getRuntimeConfig = (config: SageMakerRuntimeClientConfig) => {
|
|
23
|
-
emitWarningIfUnsupportedVersion(process.version);
|
|
24
|
-
const clientSharedValues = getSharedRuntimeConfig(config);
|
|
25
|
-
return {
|
|
26
|
-
...clientSharedValues,
|
|
27
|
-
...config,
|
|
28
|
-
runtime: "node",
|
|
29
|
-
base64Decoder: config?.base64Decoder ?? fromBase64,
|
|
30
|
-
base64Encoder: config?.base64Encoder ?? toBase64,
|
|
31
|
-
bodyLengthChecker: config?.bodyLengthChecker ?? calculateBodyLength,
|
|
32
|
-
credentialDefaultProvider:
|
|
33
|
-
config?.credentialDefaultProvider ?? decorateDefaultCredentialProvider(credentialDefaultProvider),
|
|
34
|
-
defaultUserAgentProvider:
|
|
35
|
-
config?.defaultUserAgentProvider ??
|
|
36
|
-
defaultUserAgent({ serviceId: clientSharedValues.serviceId, clientVersion: packageInfo.version }),
|
|
37
|
-
maxAttempts: config?.maxAttempts ?? loadNodeConfig(NODE_MAX_ATTEMPT_CONFIG_OPTIONS),
|
|
38
|
-
region: config?.region ?? loadNodeConfig(NODE_REGION_CONFIG_OPTIONS, NODE_REGION_CONFIG_FILE_OPTIONS),
|
|
39
|
-
requestHandler: config?.requestHandler ?? new NodeHttpHandler(),
|
|
40
|
-
retryMode: config?.retryMode ?? loadNodeConfig(NODE_RETRY_MODE_CONFIG_OPTIONS),
|
|
41
|
-
sha256: config?.sha256 ?? Hash.bind(null, "sha256"),
|
|
42
|
-
streamCollector: config?.streamCollector ?? streamCollector,
|
|
43
|
-
utf8Decoder: config?.utf8Decoder ?? fromUtf8,
|
|
44
|
-
utf8Encoder: config?.utf8Encoder ?? toUtf8,
|
|
45
|
-
};
|
|
46
|
-
};
|
package/tsconfig.es.json
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "./tsconfig",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"target": "es5",
|
|
5
|
-
"module": "esnext",
|
|
6
|
-
"moduleResolution": "node",
|
|
7
|
-
"lib": ["dom", "es5", "es2015.promise", "es2015.collection", "es2015.iterable", "es2015.symbol.wellknown"],
|
|
8
|
-
"outDir": "dist-es"
|
|
9
|
-
}
|
|
10
|
-
}
|
package/tsconfig.json
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"alwaysStrict": true,
|
|
4
|
-
"target": "ES2018",
|
|
5
|
-
"module": "commonjs",
|
|
6
|
-
"strict": true,
|
|
7
|
-
"sourceMap": true,
|
|
8
|
-
"downlevelIteration": true,
|
|
9
|
-
"importHelpers": true,
|
|
10
|
-
"noEmitHelpers": true,
|
|
11
|
-
"incremental": true,
|
|
12
|
-
"resolveJsonModule": true,
|
|
13
|
-
"esModuleInterop": true,
|
|
14
|
-
"rootDir": "src",
|
|
15
|
-
"outDir": "dist-cjs",
|
|
16
|
-
"removeComments": true
|
|
17
|
-
},
|
|
18
|
-
"typedocOptions": {
|
|
19
|
-
"exclude": ["**/node_modules/**", "**/*.spec.ts", "**/protocols/*.ts", "**/e2e/*.ts", "**/endpoints.ts"],
|
|
20
|
-
"excludeNotExported": true,
|
|
21
|
-
"excludePrivate": true,
|
|
22
|
-
"hideGenerator": true,
|
|
23
|
-
"ignoreCompilerErrors": true,
|
|
24
|
-
"includeDeclarations": true,
|
|
25
|
-
"stripInternal": true,
|
|
26
|
-
"readme": "README.md",
|
|
27
|
-
"mode": "file",
|
|
28
|
-
"out": "docs",
|
|
29
|
-
"theme": "minimal",
|
|
30
|
-
"plugin": ["@aws-sdk/client-documentation-generator"]
|
|
31
|
-
},
|
|
32
|
-
"exclude": ["test/**/*"]
|
|
33
|
-
}
|