@aws-sdk/client-sagemaker-runtime 3.928.0 → 3.930.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,345 +0,0 @@
1
- import { loadRestJsonErrorCode, parseJsonBody as parseBody, parseJsonErrorBody as parseErrorBody } from "@aws-sdk/core";
2
- import { requestBuilder as rb } from "@smithy/core";
3
- import { collectBody, decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, isSerializableHeaderValue, map, take, withBaseException, } from "@smithy/smithy-client";
4
- import { InternalDependencyException, InternalFailure, InternalStreamFailure, ModelError, ModelNotReadyException, ModelStreamError, ServiceUnavailable, ValidationError, } from "../models/models_0";
5
- import { SageMakerRuntimeServiceException as __BaseException } from "../models/SageMakerRuntimeServiceException";
6
- export const se_InvokeEndpointCommand = async (input, context) => {
7
- const b = rb(input, context);
8
- const headers = map({}, isSerializableHeaderValue, {
9
- [_ct]: input[_CT] || "application/octet-stream",
10
- [_a]: input[_A],
11
- [_xasca]: input[_CA],
12
- [_xastm]: input[_TM],
13
- [_xastv]: input[_TV],
14
- [_xastch]: input[_TCH],
15
- [_xasii]: input[_II],
16
- [_xasee]: input[_EE],
17
- [_xasic]: input[_ICN],
18
- [_xassi]: input[_SI],
19
- });
20
- b.bp("/endpoints/{EndpointName}/invocations");
21
- b.p("EndpointName", () => input.EndpointName, "{EndpointName}", false);
22
- let body;
23
- if (input.Body !== undefined) {
24
- body = input.Body;
25
- }
26
- b.m("POST").h(headers).b(body);
27
- return b.build();
28
- };
29
- export const se_InvokeEndpointAsyncCommand = async (input, context) => {
30
- const b = rb(input, context);
31
- const headers = map({}, isSerializableHeaderValue, {
32
- [_xasct]: input[_CT],
33
- [_xasa]: input[_A],
34
- [_xasca]: input[_CA],
35
- [_xasii]: input[_II],
36
- [_xasi]: input[_IL],
37
- [_xasr]: [() => isSerializableHeaderValue(input[_RTTLS]), () => input[_RTTLS].toString()],
38
- [_xasi_]: [() => isSerializableHeaderValue(input[_ITS]), () => input[_ITS].toString()],
39
- });
40
- b.bp("/endpoints/{EndpointName}/async-invocations");
41
- b.p("EndpointName", () => input.EndpointName, "{EndpointName}", false);
42
- let body;
43
- b.m("POST").h(headers).b(body);
44
- return b.build();
45
- };
46
- export const se_InvokeEndpointWithResponseStreamCommand = async (input, context) => {
47
- const b = rb(input, context);
48
- const headers = map({}, isSerializableHeaderValue, {
49
- [_ct]: input[_CT] || "application/octet-stream",
50
- [_xasa]: input[_A],
51
- [_xasca]: input[_CA],
52
- [_xastv]: input[_TV],
53
- [_xastch]: input[_TCH],
54
- [_xasii]: input[_II],
55
- [_xasic]: input[_ICN],
56
- [_xassi]: input[_SI],
57
- });
58
- b.bp("/endpoints/{EndpointName}/invocations-response-stream");
59
- b.p("EndpointName", () => input.EndpointName, "{EndpointName}", false);
60
- let body;
61
- if (input.Body !== undefined) {
62
- body = input.Body;
63
- }
64
- b.m("POST").h(headers).b(body);
65
- return b.build();
66
- };
67
- export const de_InvokeEndpointCommand = async (output, context) => {
68
- if (output.statusCode !== 200 && output.statusCode >= 300) {
69
- return de_CommandError(output, context);
70
- }
71
- const contents = map({
72
- $metadata: deserializeMetadata(output),
73
- [_CT]: [, output.headers[_ct]],
74
- [_IPV]: [, output.headers[_xaipv]],
75
- [_CA]: [, output.headers[_xasca]],
76
- [_NSI]: [, output.headers[_xasnsi]],
77
- [_CSI]: [, output.headers[_xascsi]],
78
- });
79
- const data = await collectBody(output.body, context);
80
- contents.Body = data;
81
- return contents;
82
- };
83
- export const de_InvokeEndpointAsyncCommand = async (output, context) => {
84
- if (output.statusCode !== 202 && output.statusCode >= 300) {
85
- return de_CommandError(output, context);
86
- }
87
- const contents = map({
88
- $metadata: deserializeMetadata(output),
89
- [_OL]: [, output.headers[_xaso]],
90
- [_FL]: [, output.headers[_xasf]],
91
- });
92
- const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
93
- const doc = take(data, {
94
- InferenceId: __expectString,
95
- });
96
- Object.assign(contents, doc);
97
- return contents;
98
- };
99
- export const de_InvokeEndpointWithResponseStreamCommand = async (output, context) => {
100
- if (output.statusCode !== 200 && output.statusCode >= 300) {
101
- return de_CommandError(output, context);
102
- }
103
- const contents = map({
104
- $metadata: deserializeMetadata(output),
105
- [_CT]: [, output.headers[_xasct]],
106
- [_IPV]: [, output.headers[_xaipv]],
107
- [_CA]: [, output.headers[_xasca]],
108
- });
109
- const data = output.body;
110
- contents.Body = de_ResponseStream(data, context);
111
- return contents;
112
- };
113
- const de_CommandError = async (output, context) => {
114
- const parsedOutput = {
115
- ...output,
116
- body: await parseErrorBody(output.body, context),
117
- };
118
- const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
119
- switch (errorCode) {
120
- case "InternalDependencyException":
121
- case "com.amazonaws.sagemakerruntime#InternalDependencyException":
122
- throw await de_InternalDependencyExceptionRes(parsedOutput, context);
123
- case "InternalFailure":
124
- case "com.amazonaws.sagemakerruntime#InternalFailure":
125
- throw await de_InternalFailureRes(parsedOutput, context);
126
- case "ModelError":
127
- case "com.amazonaws.sagemakerruntime#ModelError":
128
- throw await de_ModelErrorRes(parsedOutput, context);
129
- case "ModelNotReadyException":
130
- case "com.amazonaws.sagemakerruntime#ModelNotReadyException":
131
- throw await de_ModelNotReadyExceptionRes(parsedOutput, context);
132
- case "ServiceUnavailable":
133
- case "com.amazonaws.sagemakerruntime#ServiceUnavailable":
134
- throw await de_ServiceUnavailableRes(parsedOutput, context);
135
- case "ValidationError":
136
- case "com.amazonaws.sagemakerruntime#ValidationError":
137
- throw await de_ValidationErrorRes(parsedOutput, context);
138
- case "InternalStreamFailure":
139
- case "com.amazonaws.sagemakerruntime#InternalStreamFailure":
140
- throw await de_InternalStreamFailureRes(parsedOutput, context);
141
- case "ModelStreamError":
142
- case "com.amazonaws.sagemakerruntime#ModelStreamError":
143
- throw await de_ModelStreamErrorRes(parsedOutput, context);
144
- default:
145
- const parsedBody = parsedOutput.body;
146
- return throwDefaultError({
147
- output,
148
- parsedBody,
149
- errorCode,
150
- });
151
- }
152
- };
153
- const throwDefaultError = withBaseException(__BaseException);
154
- const de_InternalDependencyExceptionRes = async (parsedOutput, context) => {
155
- const contents = map({});
156
- const data = parsedOutput.body;
157
- const doc = take(data, {
158
- Message: __expectString,
159
- });
160
- Object.assign(contents, doc);
161
- const exception = new InternalDependencyException({
162
- $metadata: deserializeMetadata(parsedOutput),
163
- ...contents,
164
- });
165
- return __decorateServiceException(exception, parsedOutput.body);
166
- };
167
- const de_InternalFailureRes = async (parsedOutput, context) => {
168
- const contents = map({});
169
- const data = parsedOutput.body;
170
- const doc = take(data, {
171
- Message: __expectString,
172
- });
173
- Object.assign(contents, doc);
174
- const exception = new InternalFailure({
175
- $metadata: deserializeMetadata(parsedOutput),
176
- ...contents,
177
- });
178
- return __decorateServiceException(exception, parsedOutput.body);
179
- };
180
- const de_InternalStreamFailureRes = async (parsedOutput, context) => {
181
- const contents = map({});
182
- const data = parsedOutput.body;
183
- const doc = take(data, {
184
- Message: __expectString,
185
- });
186
- Object.assign(contents, doc);
187
- const exception = new InternalStreamFailure({
188
- $metadata: deserializeMetadata(parsedOutput),
189
- ...contents,
190
- });
191
- return __decorateServiceException(exception, parsedOutput.body);
192
- };
193
- const de_ModelErrorRes = async (parsedOutput, context) => {
194
- const contents = map({});
195
- const data = parsedOutput.body;
196
- const doc = take(data, {
197
- LogStreamArn: __expectString,
198
- Message: __expectString,
199
- OriginalMessage: __expectString,
200
- OriginalStatusCode: __expectInt32,
201
- });
202
- Object.assign(contents, doc);
203
- const exception = new ModelError({
204
- $metadata: deserializeMetadata(parsedOutput),
205
- ...contents,
206
- });
207
- return __decorateServiceException(exception, parsedOutput.body);
208
- };
209
- const de_ModelNotReadyExceptionRes = async (parsedOutput, context) => {
210
- const contents = map({});
211
- const data = parsedOutput.body;
212
- const doc = take(data, {
213
- Message: __expectString,
214
- });
215
- Object.assign(contents, doc);
216
- const exception = new ModelNotReadyException({
217
- $metadata: deserializeMetadata(parsedOutput),
218
- ...contents,
219
- });
220
- return __decorateServiceException(exception, parsedOutput.body);
221
- };
222
- const de_ModelStreamErrorRes = async (parsedOutput, context) => {
223
- const contents = map({});
224
- const data = parsedOutput.body;
225
- const doc = take(data, {
226
- ErrorCode: __expectString,
227
- Message: __expectString,
228
- });
229
- Object.assign(contents, doc);
230
- const exception = new ModelStreamError({
231
- $metadata: deserializeMetadata(parsedOutput),
232
- ...contents,
233
- });
234
- return __decorateServiceException(exception, parsedOutput.body);
235
- };
236
- const de_ServiceUnavailableRes = async (parsedOutput, context) => {
237
- const contents = map({});
238
- const data = parsedOutput.body;
239
- const doc = take(data, {
240
- Message: __expectString,
241
- });
242
- Object.assign(contents, doc);
243
- const exception = new ServiceUnavailable({
244
- $metadata: deserializeMetadata(parsedOutput),
245
- ...contents,
246
- });
247
- return __decorateServiceException(exception, parsedOutput.body);
248
- };
249
- const de_ValidationErrorRes = async (parsedOutput, context) => {
250
- const contents = map({});
251
- const data = parsedOutput.body;
252
- const doc = take(data, {
253
- Message: __expectString,
254
- });
255
- Object.assign(contents, doc);
256
- const exception = new ValidationError({
257
- $metadata: deserializeMetadata(parsedOutput),
258
- ...contents,
259
- });
260
- return __decorateServiceException(exception, parsedOutput.body);
261
- };
262
- const de_ResponseStream = (output, context) => {
263
- return context.eventStreamMarshaller.deserialize(output, async (event) => {
264
- if (event["PayloadPart"] != null) {
265
- return {
266
- PayloadPart: await de_PayloadPart_event(event["PayloadPart"], context),
267
- };
268
- }
269
- if (event["ModelStreamError"] != null) {
270
- return {
271
- ModelStreamError: await de_ModelStreamError_event(event["ModelStreamError"], context),
272
- };
273
- }
274
- if (event["InternalStreamFailure"] != null) {
275
- return {
276
- InternalStreamFailure: await de_InternalStreamFailure_event(event["InternalStreamFailure"], context),
277
- };
278
- }
279
- return { $unknown: event };
280
- });
281
- };
282
- const de_InternalStreamFailure_event = async (output, context) => {
283
- const parsedOutput = {
284
- ...output,
285
- body: await parseBody(output.body, context),
286
- };
287
- return de_InternalStreamFailureRes(parsedOutput, context);
288
- };
289
- const de_ModelStreamError_event = async (output, context) => {
290
- const parsedOutput = {
291
- ...output,
292
- body: await parseBody(output.body, context),
293
- };
294
- return de_ModelStreamErrorRes(parsedOutput, context);
295
- };
296
- const de_PayloadPart_event = async (output, context) => {
297
- const contents = {};
298
- contents.Bytes = output.body;
299
- return contents;
300
- };
301
- const deserializeMetadata = (output) => ({
302
- httpStatusCode: output.statusCode,
303
- requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
304
- extendedRequestId: output.headers["x-amz-id-2"],
305
- cfId: output.headers["x-amz-cf-id"],
306
- });
307
- const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
308
- const _A = "Accept";
309
- const _CA = "CustomAttributes";
310
- const _CSI = "ClosedSessionId";
311
- const _CT = "ContentType";
312
- const _EE = "EnableExplanations";
313
- const _FL = "FailureLocation";
314
- const _ICN = "InferenceComponentName";
315
- const _II = "InferenceId";
316
- const _IL = "InputLocation";
317
- const _IPV = "InvokedProductionVariant";
318
- const _ITS = "InvocationTimeoutSeconds";
319
- const _NSI = "NewSessionId";
320
- const _OL = "OutputLocation";
321
- const _RTTLS = "RequestTTLSeconds";
322
- const _SI = "SessionId";
323
- const _TCH = "TargetContainerHostname";
324
- const _TM = "TargetModel";
325
- const _TV = "TargetVariant";
326
- const _a = "accept";
327
- const _ct = "content-type";
328
- const _xaipv = "x-amzn-invoked-production-variant";
329
- const _xasa = "x-amzn-sagemaker-accept";
330
- const _xasca = "x-amzn-sagemaker-custom-attributes";
331
- const _xascsi = "x-amzn-sagemaker-closed-session-id";
332
- const _xasct = "x-amzn-sagemaker-content-type";
333
- const _xasee = "x-amzn-sagemaker-enable-explanations";
334
- const _xasf = "x-amzn-sagemaker-failurelocation";
335
- const _xasi = "x-amzn-sagemaker-inputlocation";
336
- const _xasi_ = "x-amzn-sagemaker-invocationtimeoutseconds";
337
- const _xasic = "x-amzn-sagemaker-inference-component";
338
- const _xasii = "x-amzn-sagemaker-inference-id";
339
- const _xasnsi = "x-amzn-sagemaker-new-session-id";
340
- const _xaso = "x-amzn-sagemaker-outputlocation";
341
- const _xasr = "x-amzn-sagemaker-requestttlseconds";
342
- const _xassi = "x-amzn-sagemaker-session-id";
343
- const _xastch = "x-amzn-sagemaker-target-container-hostname";
344
- const _xastm = "x-amzn-sagemaker-target-model";
345
- const _xastv = "x-amzn-sagemaker-target-variant";
@@ -1,29 +0,0 @@
1
- import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@smithy/protocol-http";
2
- import { EventStreamSerdeContext as __EventStreamSerdeContext, SerdeContext as __SerdeContext } from "@smithy/types";
3
- import { InvokeEndpointAsyncCommandInput, InvokeEndpointAsyncCommandOutput } from "../commands/InvokeEndpointAsyncCommand";
4
- import { InvokeEndpointCommandInput, InvokeEndpointCommandOutput } from "../commands/InvokeEndpointCommand";
5
- import { InvokeEndpointWithResponseStreamCommandInput, InvokeEndpointWithResponseStreamCommandOutput } from "../commands/InvokeEndpointWithResponseStreamCommand";
6
- /**
7
- * serializeAws_restJson1InvokeEndpointCommand
8
- */
9
- export declare const se_InvokeEndpointCommand: (input: InvokeEndpointCommandInput, context: __SerdeContext) => Promise<__HttpRequest>;
10
- /**
11
- * serializeAws_restJson1InvokeEndpointAsyncCommand
12
- */
13
- export declare const se_InvokeEndpointAsyncCommand: (input: InvokeEndpointAsyncCommandInput, context: __SerdeContext) => Promise<__HttpRequest>;
14
- /**
15
- * serializeAws_restJson1InvokeEndpointWithResponseStreamCommand
16
- */
17
- export declare const se_InvokeEndpointWithResponseStreamCommand: (input: InvokeEndpointWithResponseStreamCommandInput, context: __SerdeContext) => Promise<__HttpRequest>;
18
- /**
19
- * deserializeAws_restJson1InvokeEndpointCommand
20
- */
21
- export declare const de_InvokeEndpointCommand: (output: __HttpResponse, context: __SerdeContext) => Promise<InvokeEndpointCommandOutput>;
22
- /**
23
- * deserializeAws_restJson1InvokeEndpointAsyncCommand
24
- */
25
- export declare const de_InvokeEndpointAsyncCommand: (output: __HttpResponse, context: __SerdeContext) => Promise<InvokeEndpointAsyncCommandOutput>;
26
- /**
27
- * deserializeAws_restJson1InvokeEndpointWithResponseStreamCommand
28
- */
29
- export declare const de_InvokeEndpointWithResponseStreamCommand: (output: __HttpResponse, context: __SerdeContext & __EventStreamSerdeContext) => Promise<InvokeEndpointWithResponseStreamCommandOutput>;
@@ -1,44 +0,0 @@
1
- import {
2
- HttpRequest as __HttpRequest,
3
- HttpResponse as __HttpResponse,
4
- } from "@smithy/protocol-http";
5
- import {
6
- EventStreamSerdeContext as __EventStreamSerdeContext,
7
- SerdeContext as __SerdeContext,
8
- } from "@smithy/types";
9
- import {
10
- InvokeEndpointAsyncCommandInput,
11
- InvokeEndpointAsyncCommandOutput,
12
- } from "../commands/InvokeEndpointAsyncCommand";
13
- import {
14
- InvokeEndpointCommandInput,
15
- InvokeEndpointCommandOutput,
16
- } from "../commands/InvokeEndpointCommand";
17
- import {
18
- InvokeEndpointWithResponseStreamCommandInput,
19
- InvokeEndpointWithResponseStreamCommandOutput,
20
- } from "../commands/InvokeEndpointWithResponseStreamCommand";
21
- export declare const se_InvokeEndpointCommand: (
22
- input: InvokeEndpointCommandInput,
23
- context: __SerdeContext
24
- ) => Promise<__HttpRequest>;
25
- export declare const se_InvokeEndpointAsyncCommand: (
26
- input: InvokeEndpointAsyncCommandInput,
27
- context: __SerdeContext
28
- ) => Promise<__HttpRequest>;
29
- export declare const se_InvokeEndpointWithResponseStreamCommand: (
30
- input: InvokeEndpointWithResponseStreamCommandInput,
31
- context: __SerdeContext
32
- ) => Promise<__HttpRequest>;
33
- export declare const de_InvokeEndpointCommand: (
34
- output: __HttpResponse,
35
- context: __SerdeContext
36
- ) => Promise<InvokeEndpointCommandOutput>;
37
- export declare const de_InvokeEndpointAsyncCommand: (
38
- output: __HttpResponse,
39
- context: __SerdeContext
40
- ) => Promise<InvokeEndpointAsyncCommandOutput>;
41
- export declare const de_InvokeEndpointWithResponseStreamCommand: (
42
- output: __HttpResponse,
43
- context: __SerdeContext & __EventStreamSerdeContext
44
- ) => Promise<InvokeEndpointWithResponseStreamCommandOutput>;