@aws-sdk/client-sagemaker-runtime 3.186.0 → 3.190.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 +16 -0
- package/dist-es/SageMakerRuntime.js +10 -17
- package/dist-es/SageMakerRuntimeClient.js +22 -28
- package/dist-es/commands/InvokeEndpointAsyncCommand.js +21 -28
- package/dist-es/commands/InvokeEndpointCommand.js +21 -28
- package/dist-es/endpoints.js +8 -8
- package/dist-es/models/SageMakerRuntimeServiceException.js +5 -10
- package/dist-es/models/models_0.js +92 -80
- package/dist-es/protocols/Aws_restJson1.js +241 -323
- package/dist-es/runtimeConfig.browser.js +26 -12
- package/dist-es/runtimeConfig.js +30 -12
- package/dist-es/runtimeConfig.native.js +8 -5
- package/dist-es/runtimeConfig.shared.js +8 -11
- package/package.json +33 -33
|
@@ -1,348 +1,266 @@
|
|
|
1
|
-
import { __assign, __awaiter, __generator } from "tslib";
|
|
2
1
|
import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
|
|
3
2
|
import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map as __map, resolvedPath as __resolvedPath, throwDefaultError, } from "@aws-sdk/smithy-client";
|
|
4
3
|
import { InternalDependencyException, InternalFailure, ModelError, ModelNotReadyException, ServiceUnavailable, ValidationError, } from "../models/models_0";
|
|
5
4
|
import { SageMakerRuntimeServiceException as __BaseException } from "../models/SageMakerRuntimeServiceException";
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
"x-amzn-sagemaker-target-model": input.TargetModel,
|
|
18
|
-
"x-amzn-sagemaker-target-variant": input.TargetVariant,
|
|
19
|
-
"x-amzn-sagemaker-target-container-hostname": input.TargetContainerHostname,
|
|
20
|
-
"x-amzn-sagemaker-inference-id": input.InferenceId,
|
|
21
|
-
"x-amzn-sagemaker-enable-explanations": input.EnableExplanations,
|
|
22
|
-
});
|
|
23
|
-
resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/endpoints/{EndpointName}/invocations";
|
|
24
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "EndpointName", function () { return input.EndpointName; }, "{EndpointName}", false);
|
|
25
|
-
if (input.Body !== undefined) {
|
|
26
|
-
body = input.Body;
|
|
27
|
-
}
|
|
28
|
-
return [2, new __HttpRequest({
|
|
29
|
-
protocol: protocol,
|
|
30
|
-
hostname: hostname,
|
|
31
|
-
port: port,
|
|
32
|
-
method: "POST",
|
|
33
|
-
headers: headers,
|
|
34
|
-
path: resolvedPath,
|
|
35
|
-
body: body,
|
|
36
|
-
})];
|
|
37
|
-
}
|
|
5
|
+
export const serializeAws_restJson1InvokeEndpointCommand = async (input, context) => {
|
|
6
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
7
|
+
const headers = map({}, isSerializableHeaderValue, {
|
|
8
|
+
"content-type": input.ContentType || "application/octet-stream",
|
|
9
|
+
accept: input.Accept,
|
|
10
|
+
"x-amzn-sagemaker-custom-attributes": input.CustomAttributes,
|
|
11
|
+
"x-amzn-sagemaker-target-model": input.TargetModel,
|
|
12
|
+
"x-amzn-sagemaker-target-variant": input.TargetVariant,
|
|
13
|
+
"x-amzn-sagemaker-target-container-hostname": input.TargetContainerHostname,
|
|
14
|
+
"x-amzn-sagemaker-inference-id": input.InferenceId,
|
|
15
|
+
"x-amzn-sagemaker-enable-explanations": input.EnableExplanations,
|
|
38
16
|
});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
"x-amzn-sagemaker-requestttlseconds": [
|
|
54
|
-
function () { return isSerializableHeaderValue(input.RequestTTLSeconds); },
|
|
55
|
-
function () { return input.RequestTTLSeconds.toString(); },
|
|
56
|
-
],
|
|
57
|
-
});
|
|
58
|
-
resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
|
|
59
|
-
"/endpoints/{EndpointName}/async-invocations";
|
|
60
|
-
resolvedPath = __resolvedPath(resolvedPath, input, "EndpointName", function () { return input.EndpointName; }, "{EndpointName}", false);
|
|
61
|
-
return [2, new __HttpRequest({
|
|
62
|
-
protocol: protocol,
|
|
63
|
-
hostname: hostname,
|
|
64
|
-
port: port,
|
|
65
|
-
method: "POST",
|
|
66
|
-
headers: headers,
|
|
67
|
-
path: resolvedPath,
|
|
68
|
-
body: body,
|
|
69
|
-
})];
|
|
70
|
-
}
|
|
17
|
+
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/endpoints/{EndpointName}/invocations";
|
|
18
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "EndpointName", () => input.EndpointName, "{EndpointName}", false);
|
|
19
|
+
let body;
|
|
20
|
+
if (input.Body !== undefined) {
|
|
21
|
+
body = input.Body;
|
|
22
|
+
}
|
|
23
|
+
return new __HttpRequest({
|
|
24
|
+
protocol,
|
|
25
|
+
hostname,
|
|
26
|
+
port,
|
|
27
|
+
method: "POST",
|
|
28
|
+
headers,
|
|
29
|
+
path: resolvedPath,
|
|
30
|
+
body,
|
|
71
31
|
});
|
|
72
|
-
}
|
|
73
|
-
export
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
CustomAttributes: [, output.headers["x-amzn-sagemaker-custom-attributes"]],
|
|
86
|
-
});
|
|
87
|
-
return [4, collectBody(output.body, context)];
|
|
88
|
-
case 1:
|
|
89
|
-
data = _a.sent();
|
|
90
|
-
contents.Body = data;
|
|
91
|
-
return [2, contents];
|
|
92
|
-
}
|
|
32
|
+
};
|
|
33
|
+
export const serializeAws_restJson1InvokeEndpointAsyncCommand = async (input, context) => {
|
|
34
|
+
const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
|
|
35
|
+
const headers = map({}, isSerializableHeaderValue, {
|
|
36
|
+
"x-amzn-sagemaker-content-type": input.ContentType,
|
|
37
|
+
"x-amzn-sagemaker-accept": input.Accept,
|
|
38
|
+
"x-amzn-sagemaker-custom-attributes": input.CustomAttributes,
|
|
39
|
+
"x-amzn-sagemaker-inference-id": input.InferenceId,
|
|
40
|
+
"x-amzn-sagemaker-inputlocation": input.InputLocation,
|
|
41
|
+
"x-amzn-sagemaker-requestttlseconds": [
|
|
42
|
+
() => isSerializableHeaderValue(input.RequestTTLSeconds),
|
|
43
|
+
() => input.RequestTTLSeconds.toString(),
|
|
44
|
+
],
|
|
93
45
|
});
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
return
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
107
|
-
_b = errorCode;
|
|
108
|
-
switch (_b) {
|
|
109
|
-
case "InternalDependencyException": return [3, 2];
|
|
110
|
-
case "com.amazonaws.sagemakerruntime#InternalDependencyException": return [3, 2];
|
|
111
|
-
case "InternalFailure": return [3, 4];
|
|
112
|
-
case "com.amazonaws.sagemakerruntime#InternalFailure": return [3, 4];
|
|
113
|
-
case "ModelError": return [3, 6];
|
|
114
|
-
case "com.amazonaws.sagemakerruntime#ModelError": return [3, 6];
|
|
115
|
-
case "ModelNotReadyException": return [3, 8];
|
|
116
|
-
case "com.amazonaws.sagemakerruntime#ModelNotReadyException": return [3, 8];
|
|
117
|
-
case "ServiceUnavailable": return [3, 10];
|
|
118
|
-
case "com.amazonaws.sagemakerruntime#ServiceUnavailable": return [3, 10];
|
|
119
|
-
case "ValidationError": return [3, 12];
|
|
120
|
-
case "com.amazonaws.sagemakerruntime#ValidationError": return [3, 12];
|
|
121
|
-
}
|
|
122
|
-
return [3, 14];
|
|
123
|
-
case 2: return [4, deserializeAws_restJson1InternalDependencyExceptionResponse(parsedOutput, context)];
|
|
124
|
-
case 3: throw _d.sent();
|
|
125
|
-
case 4: return [4, deserializeAws_restJson1InternalFailureResponse(parsedOutput, context)];
|
|
126
|
-
case 5: throw _d.sent();
|
|
127
|
-
case 6: return [4, deserializeAws_restJson1ModelErrorResponse(parsedOutput, context)];
|
|
128
|
-
case 7: throw _d.sent();
|
|
129
|
-
case 8: return [4, deserializeAws_restJson1ModelNotReadyExceptionResponse(parsedOutput, context)];
|
|
130
|
-
case 9: throw _d.sent();
|
|
131
|
-
case 10: return [4, deserializeAws_restJson1ServiceUnavailableResponse(parsedOutput, context)];
|
|
132
|
-
case 11: throw _d.sent();
|
|
133
|
-
case 12: return [4, deserializeAws_restJson1ValidationErrorResponse(parsedOutput, context)];
|
|
134
|
-
case 13: throw _d.sent();
|
|
135
|
-
case 14:
|
|
136
|
-
parsedBody = parsedOutput.body;
|
|
137
|
-
throwDefaultError({
|
|
138
|
-
output: output,
|
|
139
|
-
parsedBody: parsedBody,
|
|
140
|
-
exceptionCtor: __BaseException,
|
|
141
|
-
errorCode: errorCode,
|
|
142
|
-
});
|
|
143
|
-
_d.label = 15;
|
|
144
|
-
case 15: return [2];
|
|
145
|
-
}
|
|
46
|
+
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` +
|
|
47
|
+
"/endpoints/{EndpointName}/async-invocations";
|
|
48
|
+
resolvedPath = __resolvedPath(resolvedPath, input, "EndpointName", () => input.EndpointName, "{EndpointName}", false);
|
|
49
|
+
let body;
|
|
50
|
+
return new __HttpRequest({
|
|
51
|
+
protocol,
|
|
52
|
+
hostname,
|
|
53
|
+
port,
|
|
54
|
+
method: "POST",
|
|
55
|
+
headers,
|
|
56
|
+
path: resolvedPath,
|
|
57
|
+
body,
|
|
146
58
|
});
|
|
147
|
-
}
|
|
148
|
-
export
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
$metadata: deserializeMetadata(output),
|
|
158
|
-
OutputLocation: [, output.headers["x-amzn-sagemaker-outputlocation"]],
|
|
159
|
-
});
|
|
160
|
-
_a = __expectNonNull;
|
|
161
|
-
_b = __expectObject;
|
|
162
|
-
return [4, parseBody(output.body, context)];
|
|
163
|
-
case 1:
|
|
164
|
-
data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
|
|
165
|
-
if (data.InferenceId != null) {
|
|
166
|
-
contents.InferenceId = __expectString(data.InferenceId);
|
|
167
|
-
}
|
|
168
|
-
return [2, contents];
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
}); };
|
|
172
|
-
var deserializeAws_restJson1InvokeEndpointAsyncCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
|
|
173
|
-
var parsedOutput, _a, errorCode, _b, parsedBody;
|
|
174
|
-
var _c;
|
|
175
|
-
return __generator(this, function (_d) {
|
|
176
|
-
switch (_d.label) {
|
|
177
|
-
case 0:
|
|
178
|
-
_a = [__assign({}, output)];
|
|
179
|
-
_c = {};
|
|
180
|
-
return [4, parseErrorBody(output.body, context)];
|
|
181
|
-
case 1:
|
|
182
|
-
parsedOutput = __assign.apply(void 0, _a.concat([(_c.body = _d.sent(), _c)]));
|
|
183
|
-
errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
184
|
-
_b = errorCode;
|
|
185
|
-
switch (_b) {
|
|
186
|
-
case "InternalFailure": return [3, 2];
|
|
187
|
-
case "com.amazonaws.sagemakerruntime#InternalFailure": return [3, 2];
|
|
188
|
-
case "ServiceUnavailable": return [3, 4];
|
|
189
|
-
case "com.amazonaws.sagemakerruntime#ServiceUnavailable": return [3, 4];
|
|
190
|
-
case "ValidationError": return [3, 6];
|
|
191
|
-
case "com.amazonaws.sagemakerruntime#ValidationError": return [3, 6];
|
|
192
|
-
}
|
|
193
|
-
return [3, 8];
|
|
194
|
-
case 2: return [4, deserializeAws_restJson1InternalFailureResponse(parsedOutput, context)];
|
|
195
|
-
case 3: throw _d.sent();
|
|
196
|
-
case 4: return [4, deserializeAws_restJson1ServiceUnavailableResponse(parsedOutput, context)];
|
|
197
|
-
case 5: throw _d.sent();
|
|
198
|
-
case 6: return [4, deserializeAws_restJson1ValidationErrorResponse(parsedOutput, context)];
|
|
199
|
-
case 7: throw _d.sent();
|
|
200
|
-
case 8:
|
|
201
|
-
parsedBody = parsedOutput.body;
|
|
202
|
-
throwDefaultError({
|
|
203
|
-
output: output,
|
|
204
|
-
parsedBody: parsedBody,
|
|
205
|
-
exceptionCtor: __BaseException,
|
|
206
|
-
errorCode: errorCode,
|
|
207
|
-
});
|
|
208
|
-
_d.label = 9;
|
|
209
|
-
case 9: return [2];
|
|
210
|
-
}
|
|
59
|
+
};
|
|
60
|
+
export const deserializeAws_restJson1InvokeEndpointCommand = async (output, context) => {
|
|
61
|
+
if (output.statusCode !== 200 && output.statusCode >= 300) {
|
|
62
|
+
return deserializeAws_restJson1InvokeEndpointCommandError(output, context);
|
|
63
|
+
}
|
|
64
|
+
const contents = map({
|
|
65
|
+
$metadata: deserializeMetadata(output),
|
|
66
|
+
ContentType: [, output.headers["content-type"]],
|
|
67
|
+
InvokedProductionVariant: [, output.headers["x-amzn-invoked-production-variant"]],
|
|
68
|
+
CustomAttributes: [, output.headers["x-amzn-sagemaker-custom-attributes"]],
|
|
211
69
|
});
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
70
|
+
const data = await collectBody(output.body, context);
|
|
71
|
+
contents.Body = data;
|
|
72
|
+
return contents;
|
|
73
|
+
};
|
|
74
|
+
const deserializeAws_restJson1InvokeEndpointCommandError = async (output, context) => {
|
|
75
|
+
const parsedOutput = {
|
|
76
|
+
...output,
|
|
77
|
+
body: await parseErrorBody(output.body, context),
|
|
78
|
+
};
|
|
79
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
80
|
+
switch (errorCode) {
|
|
81
|
+
case "InternalDependencyException":
|
|
82
|
+
case "com.amazonaws.sagemakerruntime#InternalDependencyException":
|
|
83
|
+
throw await deserializeAws_restJson1InternalDependencyExceptionResponse(parsedOutput, context);
|
|
84
|
+
case "InternalFailure":
|
|
85
|
+
case "com.amazonaws.sagemakerruntime#InternalFailure":
|
|
86
|
+
throw await deserializeAws_restJson1InternalFailureResponse(parsedOutput, context);
|
|
87
|
+
case "ModelError":
|
|
88
|
+
case "com.amazonaws.sagemakerruntime#ModelError":
|
|
89
|
+
throw await deserializeAws_restJson1ModelErrorResponse(parsedOutput, context);
|
|
90
|
+
case "ModelNotReadyException":
|
|
91
|
+
case "com.amazonaws.sagemakerruntime#ModelNotReadyException":
|
|
92
|
+
throw await deserializeAws_restJson1ModelNotReadyExceptionResponse(parsedOutput, context);
|
|
93
|
+
case "ServiceUnavailable":
|
|
94
|
+
case "com.amazonaws.sagemakerruntime#ServiceUnavailable":
|
|
95
|
+
throw await deserializeAws_restJson1ServiceUnavailableResponse(parsedOutput, context);
|
|
96
|
+
case "ValidationError":
|
|
97
|
+
case "com.amazonaws.sagemakerruntime#ValidationError":
|
|
98
|
+
throw await deserializeAws_restJson1ValidationErrorResponse(parsedOutput, context);
|
|
99
|
+
default:
|
|
100
|
+
const parsedBody = parsedOutput.body;
|
|
101
|
+
throwDefaultError({
|
|
102
|
+
output,
|
|
103
|
+
parsedBody,
|
|
104
|
+
exceptionCtor: __BaseException,
|
|
105
|
+
errorCode,
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
export const deserializeAws_restJson1InvokeEndpointAsyncCommand = async (output, context) => {
|
|
110
|
+
if (output.statusCode !== 202 && output.statusCode >= 300) {
|
|
111
|
+
return deserializeAws_restJson1InvokeEndpointAsyncCommandError(output, context);
|
|
112
|
+
}
|
|
113
|
+
const contents = map({
|
|
114
|
+
$metadata: deserializeMetadata(output),
|
|
115
|
+
OutputLocation: [, output.headers["x-amzn-sagemaker-outputlocation"]],
|
|
224
116
|
});
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
117
|
+
const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
|
|
118
|
+
if (data.InferenceId != null) {
|
|
119
|
+
contents.InferenceId = __expectString(data.InferenceId);
|
|
120
|
+
}
|
|
121
|
+
return contents;
|
|
122
|
+
};
|
|
123
|
+
const deserializeAws_restJson1InvokeEndpointAsyncCommandError = async (output, context) => {
|
|
124
|
+
const parsedOutput = {
|
|
125
|
+
...output,
|
|
126
|
+
body: await parseErrorBody(output.body, context),
|
|
127
|
+
};
|
|
128
|
+
const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
|
|
129
|
+
switch (errorCode) {
|
|
130
|
+
case "InternalFailure":
|
|
131
|
+
case "com.amazonaws.sagemakerruntime#InternalFailure":
|
|
132
|
+
throw await deserializeAws_restJson1InternalFailureResponse(parsedOutput, context);
|
|
133
|
+
case "ServiceUnavailable":
|
|
134
|
+
case "com.amazonaws.sagemakerruntime#ServiceUnavailable":
|
|
135
|
+
throw await deserializeAws_restJson1ServiceUnavailableResponse(parsedOutput, context);
|
|
136
|
+
case "ValidationError":
|
|
137
|
+
case "com.amazonaws.sagemakerruntime#ValidationError":
|
|
138
|
+
throw await deserializeAws_restJson1ValidationErrorResponse(parsedOutput, context);
|
|
139
|
+
default:
|
|
140
|
+
const parsedBody = parsedOutput.body;
|
|
141
|
+
throwDefaultError({
|
|
142
|
+
output,
|
|
143
|
+
parsedBody,
|
|
144
|
+
exceptionCtor: __BaseException,
|
|
145
|
+
errorCode,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
const map = __map;
|
|
150
|
+
const deserializeAws_restJson1InternalDependencyExceptionResponse = async (parsedOutput, context) => {
|
|
151
|
+
const contents = map({});
|
|
152
|
+
const data = parsedOutput.body;
|
|
153
|
+
if (data.Message != null) {
|
|
154
|
+
contents.Message = __expectString(data.Message);
|
|
155
|
+
}
|
|
156
|
+
const exception = new InternalDependencyException({
|
|
157
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
158
|
+
...contents,
|
|
236
159
|
});
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
if (data.OriginalMessage != null) {
|
|
250
|
-
contents.OriginalMessage = __expectString(data.OriginalMessage);
|
|
251
|
-
}
|
|
252
|
-
if (data.OriginalStatusCode != null) {
|
|
253
|
-
contents.OriginalStatusCode = __expectInt32(data.OriginalStatusCode);
|
|
254
|
-
}
|
|
255
|
-
exception = new ModelError(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
|
|
256
|
-
return [2, __decorateServiceException(exception, parsedOutput.body)];
|
|
160
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
161
|
+
};
|
|
162
|
+
const deserializeAws_restJson1InternalFailureResponse = async (parsedOutput, context) => {
|
|
163
|
+
const contents = map({});
|
|
164
|
+
const data = parsedOutput.body;
|
|
165
|
+
if (data.Message != null) {
|
|
166
|
+
contents.Message = __expectString(data.Message);
|
|
167
|
+
}
|
|
168
|
+
const exception = new InternalFailure({
|
|
169
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
170
|
+
...contents,
|
|
257
171
|
});
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
172
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
173
|
+
};
|
|
174
|
+
const deserializeAws_restJson1ModelErrorResponse = async (parsedOutput, context) => {
|
|
175
|
+
const contents = map({});
|
|
176
|
+
const data = parsedOutput.body;
|
|
177
|
+
if (data.LogStreamArn != null) {
|
|
178
|
+
contents.LogStreamArn = __expectString(data.LogStreamArn);
|
|
179
|
+
}
|
|
180
|
+
if (data.Message != null) {
|
|
181
|
+
contents.Message = __expectString(data.Message);
|
|
182
|
+
}
|
|
183
|
+
if (data.OriginalMessage != null) {
|
|
184
|
+
contents.OriginalMessage = __expectString(data.OriginalMessage);
|
|
185
|
+
}
|
|
186
|
+
if (data.OriginalStatusCode != null) {
|
|
187
|
+
contents.OriginalStatusCode = __expectInt32(data.OriginalStatusCode);
|
|
188
|
+
}
|
|
189
|
+
const exception = new ModelError({
|
|
190
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
191
|
+
...contents,
|
|
269
192
|
});
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
193
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
194
|
+
};
|
|
195
|
+
const deserializeAws_restJson1ModelNotReadyExceptionResponse = async (parsedOutput, context) => {
|
|
196
|
+
const contents = map({});
|
|
197
|
+
const data = parsedOutput.body;
|
|
198
|
+
if (data.Message != null) {
|
|
199
|
+
contents.Message = __expectString(data.Message);
|
|
200
|
+
}
|
|
201
|
+
const exception = new ModelNotReadyException({
|
|
202
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
203
|
+
...contents,
|
|
281
204
|
});
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
205
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
206
|
+
};
|
|
207
|
+
const deserializeAws_restJson1ServiceUnavailableResponse = async (parsedOutput, context) => {
|
|
208
|
+
const contents = map({});
|
|
209
|
+
const data = parsedOutput.body;
|
|
210
|
+
if (data.Message != null) {
|
|
211
|
+
contents.Message = __expectString(data.Message);
|
|
212
|
+
}
|
|
213
|
+
const exception = new ServiceUnavailable({
|
|
214
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
215
|
+
...contents,
|
|
293
216
|
});
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
217
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
218
|
+
};
|
|
219
|
+
const deserializeAws_restJson1ValidationErrorResponse = async (parsedOutput, context) => {
|
|
220
|
+
const contents = map({});
|
|
221
|
+
const data = parsedOutput.body;
|
|
222
|
+
if (data.Message != null) {
|
|
223
|
+
contents.Message = __expectString(data.Message);
|
|
224
|
+
}
|
|
225
|
+
const exception = new ValidationError({
|
|
226
|
+
$metadata: deserializeMetadata(parsedOutput),
|
|
227
|
+
...contents,
|
|
302
228
|
});
|
|
229
|
+
return __decorateServiceException(exception, parsedOutput.body);
|
|
303
230
|
};
|
|
304
|
-
|
|
305
|
-
|
|
231
|
+
const deserializeMetadata = (output) => ({
|
|
232
|
+
httpStatusCode: output.statusCode,
|
|
233
|
+
requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
|
|
234
|
+
extendedRequestId: output.headers["x-amz-id-2"],
|
|
235
|
+
cfId: output.headers["x-amz-cf-id"],
|
|
236
|
+
});
|
|
237
|
+
const collectBody = (streamBody = new Uint8Array(), context) => {
|
|
306
238
|
if (streamBody instanceof Uint8Array) {
|
|
307
239
|
return Promise.resolve(streamBody);
|
|
308
240
|
}
|
|
309
241
|
return context.streamCollector(streamBody) || Promise.resolve(new Uint8Array());
|
|
310
242
|
};
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
});
|
|
243
|
+
const collectBodyString = (streamBody, context) => collectBody(streamBody, context).then((body) => context.utf8Encoder(body));
|
|
244
|
+
const isSerializableHeaderValue = (value) => value !== undefined &&
|
|
245
|
+
value !== null &&
|
|
246
|
+
value !== "" &&
|
|
247
|
+
(!Object.getOwnPropertyNames(value).includes("length") || value.length != 0) &&
|
|
248
|
+
(!Object.getOwnPropertyNames(value).includes("size") || value.size != 0);
|
|
249
|
+
const parseBody = (streamBody, context) => collectBodyString(streamBody, context).then((encoded) => {
|
|
250
|
+
if (encoded.length) {
|
|
251
|
+
return JSON.parse(encoded);
|
|
252
|
+
}
|
|
253
|
+
return {};
|
|
254
|
+
});
|
|
255
|
+
const parseErrorBody = async (errorBody, context) => {
|
|
256
|
+
const value = await parseBody(errorBody, context);
|
|
257
|
+
value.message = value.message ?? value.Message;
|
|
258
|
+
return value;
|
|
328
259
|
};
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
switch (_b.label) {
|
|
334
|
-
case 0: return [4, parseBody(errorBody, context)];
|
|
335
|
-
case 1:
|
|
336
|
-
value = _b.sent();
|
|
337
|
-
value.message = (_a = value.message) !== null && _a !== void 0 ? _a : value.Message;
|
|
338
|
-
return [2, value];
|
|
339
|
-
}
|
|
340
|
-
});
|
|
341
|
-
}); };
|
|
342
|
-
var loadRestJsonErrorCode = function (output, data) {
|
|
343
|
-
var findKey = function (object, key) { return Object.keys(object).find(function (k) { return k.toLowerCase() === key.toLowerCase(); }); };
|
|
344
|
-
var sanitizeErrorCode = function (rawValue) {
|
|
345
|
-
var cleanValue = rawValue;
|
|
260
|
+
const loadRestJsonErrorCode = (output, data) => {
|
|
261
|
+
const findKey = (object, key) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());
|
|
262
|
+
const sanitizeErrorCode = (rawValue) => {
|
|
263
|
+
let cleanValue = rawValue;
|
|
346
264
|
if (typeof cleanValue === "number") {
|
|
347
265
|
cleanValue = cleanValue.toString();
|
|
348
266
|
}
|
|
@@ -357,7 +275,7 @@ var loadRestJsonErrorCode = function (output, data) {
|
|
|
357
275
|
}
|
|
358
276
|
return cleanValue;
|
|
359
277
|
};
|
|
360
|
-
|
|
278
|
+
const headerKey = findKey(output.headers, "x-amzn-errortype");
|
|
361
279
|
if (headerKey !== undefined) {
|
|
362
280
|
return sanitizeErrorCode(output.headers[headerKey]);
|
|
363
281
|
}
|