@aws-sdk/client-sagemaker-runtime 3.141.0 → 3.142.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 CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [3.142.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.141.0...v3.142.0) (2022-08-02)
7
+
8
+
9
+ ### Features
10
+
11
+ * **codegen:** general data mapping function ([#3830](https://github.com/aws/aws-sdk-js-v3/issues/3830)) ([9417eae](https://github.com/aws/aws-sdk-js-v3/commit/9417eae722806799fb4c15c07921574268c1165c))
12
+
13
+
14
+
15
+
16
+
6
17
  # [3.141.0](https://github.com/aws/aws-sdk-js-v3/compare/v3.140.0...v3.141.0) (2022-08-01)
7
18
 
8
19
 
@@ -7,31 +7,17 @@ const models_0_1 = require("../models/models_0");
7
7
  const SageMakerRuntimeServiceException_1 = require("../models/SageMakerRuntimeServiceException");
8
8
  const serializeAws_restJson1InvokeEndpointCommand = async (input, context) => {
9
9
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
10
- const headers = {
11
- "content-type": "application/octet-stream",
12
- ...(isSerializableHeaderValue(input.ContentType) && { "content-type": input.ContentType }),
13
- ...(isSerializableHeaderValue(input.Accept) && { accept: input.Accept }),
14
- ...(isSerializableHeaderValue(input.CustomAttributes) && {
15
- "x-amzn-sagemaker-custom-attributes": input.CustomAttributes,
16
- }),
17
- ...(isSerializableHeaderValue(input.TargetModel) && { "x-amzn-sagemaker-target-model": input.TargetModel }),
18
- ...(isSerializableHeaderValue(input.TargetVariant) && { "x-amzn-sagemaker-target-variant": input.TargetVariant }),
19
- ...(isSerializableHeaderValue(input.TargetContainerHostname) && {
20
- "x-amzn-sagemaker-target-container-hostname": input.TargetContainerHostname,
21
- }),
22
- ...(isSerializableHeaderValue(input.InferenceId) && { "x-amzn-sagemaker-inference-id": input.InferenceId }),
23
- };
10
+ const headers = map({}, isSerializableHeaderValue, {
11
+ "content-type": input.ContentType || "application/octet-stream",
12
+ accept: input.Accept,
13
+ "x-amzn-sagemaker-custom-attributes": input.CustomAttributes,
14
+ "x-amzn-sagemaker-target-model": input.TargetModel,
15
+ "x-amzn-sagemaker-target-variant": input.TargetVariant,
16
+ "x-amzn-sagemaker-target-container-hostname": input.TargetContainerHostname,
17
+ "x-amzn-sagemaker-inference-id": input.InferenceId,
18
+ });
24
19
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` + "/endpoints/{EndpointName}/invocations";
25
- if (input.EndpointName !== undefined) {
26
- const labelValue = input.EndpointName;
27
- if (labelValue.length <= 0) {
28
- throw new Error("Empty value provided for input HTTP label: EndpointName.");
29
- }
30
- resolvedPath = resolvedPath.replace("{EndpointName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
31
- }
32
- else {
33
- throw new Error("No value provided for input HTTP label: EndpointName.");
34
- }
20
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "EndpointName", () => input.EndpointName, "{EndpointName}", false);
35
21
  let body;
36
22
  if (input.Body !== undefined) {
37
23
  body = input.Body;
@@ -49,30 +35,20 @@ const serializeAws_restJson1InvokeEndpointCommand = async (input, context) => {
49
35
  exports.serializeAws_restJson1InvokeEndpointCommand = serializeAws_restJson1InvokeEndpointCommand;
50
36
  const serializeAws_restJson1InvokeEndpointAsyncCommand = async (input, context) => {
51
37
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
52
- const headers = {
53
- ...(isSerializableHeaderValue(input.ContentType) && { "x-amzn-sagemaker-content-type": input.ContentType }),
54
- ...(isSerializableHeaderValue(input.Accept) && { "x-amzn-sagemaker-accept": input.Accept }),
55
- ...(isSerializableHeaderValue(input.CustomAttributes) && {
56
- "x-amzn-sagemaker-custom-attributes": input.CustomAttributes,
57
- }),
58
- ...(isSerializableHeaderValue(input.InferenceId) && { "x-amzn-sagemaker-inference-id": input.InferenceId }),
59
- ...(isSerializableHeaderValue(input.InputLocation) && { "x-amzn-sagemaker-inputlocation": input.InputLocation }),
60
- ...(isSerializableHeaderValue(input.RequestTTLSeconds) && {
61
- "x-amzn-sagemaker-requestttlseconds": input.RequestTTLSeconds.toString(),
62
- }),
63
- };
38
+ const headers = map({}, isSerializableHeaderValue, {
39
+ "x-amzn-sagemaker-content-type": input.ContentType,
40
+ "x-amzn-sagemaker-accept": input.Accept,
41
+ "x-amzn-sagemaker-custom-attributes": input.CustomAttributes,
42
+ "x-amzn-sagemaker-inference-id": input.InferenceId,
43
+ "x-amzn-sagemaker-inputlocation": input.InputLocation,
44
+ "x-amzn-sagemaker-requestttlseconds": [
45
+ () => isSerializableHeaderValue(input.RequestTTLSeconds),
46
+ () => input.RequestTTLSeconds.toString(),
47
+ ],
48
+ });
64
49
  let resolvedPath = `${(basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || ""}` +
65
50
  "/endpoints/{EndpointName}/async-invocations";
66
- if (input.EndpointName !== undefined) {
67
- const labelValue = input.EndpointName;
68
- if (labelValue.length <= 0) {
69
- throw new Error("Empty value provided for input HTTP label: EndpointName.");
70
- }
71
- resolvedPath = resolvedPath.replace("{EndpointName}", (0, smithy_client_1.extendedEncodeURIComponent)(labelValue));
72
- }
73
- else {
74
- throw new Error("No value provided for input HTTP label: EndpointName.");
75
- }
51
+ resolvedPath = (0, smithy_client_1.resolvedPath)(resolvedPath, input, "EndpointName", () => input.EndpointName, "{EndpointName}", false);
76
52
  let body;
77
53
  return new protocol_http_1.HttpRequest({
78
54
  protocol,
@@ -89,25 +65,15 @@ const deserializeAws_restJson1InvokeEndpointCommand = async (output, context) =>
89
65
  if (output.statusCode !== 200 && output.statusCode >= 300) {
90
66
  return deserializeAws_restJson1InvokeEndpointCommandError(output, context);
91
67
  }
92
- const contents = {
68
+ const contents = map({
93
69
  $metadata: deserializeMetadata(output),
94
- Body: undefined,
95
- ContentType: undefined,
96
- CustomAttributes: undefined,
97
- InvokedProductionVariant: undefined,
98
- };
99
- if (output.headers["content-type"] !== undefined) {
100
- contents.ContentType = output.headers["content-type"];
101
- }
102
- if (output.headers["x-amzn-invoked-production-variant"] !== undefined) {
103
- contents.InvokedProductionVariant = output.headers["x-amzn-invoked-production-variant"];
104
- }
105
- if (output.headers["x-amzn-sagemaker-custom-attributes"] !== undefined) {
106
- contents.CustomAttributes = output.headers["x-amzn-sagemaker-custom-attributes"];
107
- }
70
+ ContentType: [, output.headers["content-type"]],
71
+ InvokedProductionVariant: [, output.headers["x-amzn-invoked-production-variant"]],
72
+ CustomAttributes: [, output.headers["x-amzn-sagemaker-custom-attributes"]],
73
+ });
108
74
  const data = await collectBody(output.body, context);
109
75
  contents.Body = data;
110
- return Promise.resolve(contents);
76
+ return contents;
111
77
  };
112
78
  exports.deserializeAws_restJson1InvokeEndpointCommand = deserializeAws_restJson1InvokeEndpointCommand;
113
79
  const deserializeAws_restJson1InvokeEndpointCommandError = async (output, context) => {
@@ -115,7 +81,6 @@ const deserializeAws_restJson1InvokeEndpointCommandError = async (output, contex
115
81
  ...output,
116
82
  body: await parseBody(output.body, context),
117
83
  };
118
- let response;
119
84
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
120
85
  switch (errorCode) {
121
86
  case "InternalDependencyException":
@@ -138,33 +103,27 @@ const deserializeAws_restJson1InvokeEndpointCommandError = async (output, contex
138
103
  throw await deserializeAws_restJson1ValidationErrorResponse(parsedOutput, context);
139
104
  default:
140
105
  const parsedBody = parsedOutput.body;
141
- const $metadata = deserializeMetadata(output);
142
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
143
- response = new SageMakerRuntimeServiceException_1.SageMakerRuntimeServiceException({
144
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
145
- $fault: "client",
146
- $metadata,
106
+ (0, smithy_client_1.throwDefaultError)({
107
+ output,
108
+ parsedBody,
109
+ exceptionCtor: SageMakerRuntimeServiceException_1.SageMakerRuntimeServiceException,
110
+ errorCode,
147
111
  });
148
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
149
112
  }
150
113
  };
151
114
  const deserializeAws_restJson1InvokeEndpointAsyncCommand = async (output, context) => {
152
115
  if (output.statusCode !== 202 && output.statusCode >= 300) {
153
116
  return deserializeAws_restJson1InvokeEndpointAsyncCommandError(output, context);
154
117
  }
155
- const contents = {
118
+ const contents = map({
156
119
  $metadata: deserializeMetadata(output),
157
- InferenceId: undefined,
158
- OutputLocation: undefined,
159
- };
160
- if (output.headers["x-amzn-sagemaker-outputlocation"] !== undefined) {
161
- contents.OutputLocation = output.headers["x-amzn-sagemaker-outputlocation"];
162
- }
120
+ OutputLocation: [, output.headers["x-amzn-sagemaker-outputlocation"]],
121
+ });
163
122
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
164
- if (data.InferenceId !== undefined && data.InferenceId !== null) {
123
+ if (data.InferenceId != null) {
165
124
  contents.InferenceId = (0, smithy_client_1.expectString)(data.InferenceId);
166
125
  }
167
- return Promise.resolve(contents);
126
+ return contents;
168
127
  };
169
128
  exports.deserializeAws_restJson1InvokeEndpointAsyncCommand = deserializeAws_restJson1InvokeEndpointAsyncCommand;
170
129
  const deserializeAws_restJson1InvokeEndpointAsyncCommandError = async (output, context) => {
@@ -172,7 +131,6 @@ const deserializeAws_restJson1InvokeEndpointAsyncCommandError = async (output, c
172
131
  ...output,
173
132
  body: await parseBody(output.body, context),
174
133
  };
175
- let response;
176
134
  const errorCode = loadRestJsonErrorCode(output, parsedOutput.body);
177
135
  switch (errorCode) {
178
136
  case "InternalFailure":
@@ -186,20 +144,19 @@ const deserializeAws_restJson1InvokeEndpointAsyncCommandError = async (output, c
186
144
  throw await deserializeAws_restJson1ValidationErrorResponse(parsedOutput, context);
187
145
  default:
188
146
  const parsedBody = parsedOutput.body;
189
- const $metadata = deserializeMetadata(output);
190
- const statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
191
- response = new SageMakerRuntimeServiceException_1.SageMakerRuntimeServiceException({
192
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
193
- $fault: "client",
194
- $metadata,
147
+ (0, smithy_client_1.throwDefaultError)({
148
+ output,
149
+ parsedBody,
150
+ exceptionCtor: SageMakerRuntimeServiceException_1.SageMakerRuntimeServiceException,
151
+ errorCode,
195
152
  });
196
- throw (0, smithy_client_1.decorateServiceException)(response, parsedBody);
197
153
  }
198
154
  };
155
+ const map = smithy_client_1.map;
199
156
  const deserializeAws_restJson1InternalDependencyExceptionResponse = async (parsedOutput, context) => {
200
- const contents = {};
157
+ const contents = map({});
201
158
  const data = parsedOutput.body;
202
- if (data.Message !== undefined && data.Message !== null) {
159
+ if (data.Message != null) {
203
160
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
204
161
  }
205
162
  const exception = new models_0_1.InternalDependencyException({
@@ -209,9 +166,9 @@ const deserializeAws_restJson1InternalDependencyExceptionResponse = async (parse
209
166
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
210
167
  };
211
168
  const deserializeAws_restJson1InternalFailureResponse = async (parsedOutput, context) => {
212
- const contents = {};
169
+ const contents = map({});
213
170
  const data = parsedOutput.body;
214
- if (data.Message !== undefined && data.Message !== null) {
171
+ if (data.Message != null) {
215
172
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
216
173
  }
217
174
  const exception = new models_0_1.InternalFailure({
@@ -221,18 +178,18 @@ const deserializeAws_restJson1InternalFailureResponse = async (parsedOutput, con
221
178
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
222
179
  };
223
180
  const deserializeAws_restJson1ModelErrorResponse = async (parsedOutput, context) => {
224
- const contents = {};
181
+ const contents = map({});
225
182
  const data = parsedOutput.body;
226
- if (data.LogStreamArn !== undefined && data.LogStreamArn !== null) {
183
+ if (data.LogStreamArn != null) {
227
184
  contents.LogStreamArn = (0, smithy_client_1.expectString)(data.LogStreamArn);
228
185
  }
229
- if (data.Message !== undefined && data.Message !== null) {
186
+ if (data.Message != null) {
230
187
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
231
188
  }
232
- if (data.OriginalMessage !== undefined && data.OriginalMessage !== null) {
189
+ if (data.OriginalMessage != null) {
233
190
  contents.OriginalMessage = (0, smithy_client_1.expectString)(data.OriginalMessage);
234
191
  }
235
- if (data.OriginalStatusCode !== undefined && data.OriginalStatusCode !== null) {
192
+ if (data.OriginalStatusCode != null) {
236
193
  contents.OriginalStatusCode = (0, smithy_client_1.expectInt32)(data.OriginalStatusCode);
237
194
  }
238
195
  const exception = new models_0_1.ModelError({
@@ -242,9 +199,9 @@ const deserializeAws_restJson1ModelErrorResponse = async (parsedOutput, context)
242
199
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
243
200
  };
244
201
  const deserializeAws_restJson1ModelNotReadyExceptionResponse = async (parsedOutput, context) => {
245
- const contents = {};
202
+ const contents = map({});
246
203
  const data = parsedOutput.body;
247
- if (data.Message !== undefined && data.Message !== null) {
204
+ if (data.Message != null) {
248
205
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
249
206
  }
250
207
  const exception = new models_0_1.ModelNotReadyException({
@@ -254,9 +211,9 @@ const deserializeAws_restJson1ModelNotReadyExceptionResponse = async (parsedOutp
254
211
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
255
212
  };
256
213
  const deserializeAws_restJson1ServiceUnavailableResponse = async (parsedOutput, context) => {
257
- const contents = {};
214
+ const contents = map({});
258
215
  const data = parsedOutput.body;
259
- if (data.Message !== undefined && data.Message !== null) {
216
+ if (data.Message != null) {
260
217
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
261
218
  }
262
219
  const exception = new models_0_1.ServiceUnavailable({
@@ -266,9 +223,9 @@ const deserializeAws_restJson1ServiceUnavailableResponse = async (parsedOutput,
266
223
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
267
224
  };
268
225
  const deserializeAws_restJson1ValidationErrorResponse = async (parsedOutput, context) => {
269
- const contents = {};
226
+ const contents = map({});
270
227
  const data = parsedOutput.body;
271
- if (data.Message !== undefined && data.Message !== null) {
228
+ if (data.Message != null) {
272
229
  contents.Message = (0, smithy_client_1.expectString)(data.Message);
273
230
  }
274
231
  const exception = new models_0_1.ValidationError({
@@ -1,31 +1,26 @@
1
1
  import { __assign, __awaiter, __generator } from "tslib";
2
2
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
3
- import { decorateServiceException as __decorateServiceException, expectInt32 as __expectInt32, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, extendedEncodeURIComponent as __extendedEncodeURIComponent, } from "@aws-sdk/smithy-client";
3
+ 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
4
  import { InternalDependencyException, InternalFailure, ModelError, ModelNotReadyException, ServiceUnavailable, ValidationError, } from "../models/models_0";
5
5
  import { SageMakerRuntimeServiceException as __BaseException } from "../models/SageMakerRuntimeServiceException";
6
6
  export var serializeAws_restJson1InvokeEndpointCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
7
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
7
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
8
8
  return __generator(this, function (_c) {
9
9
  switch (_c.label) {
10
10
  case 0: return [4, context.endpoint()];
11
11
  case 1:
12
12
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
13
- headers = __assign(__assign(__assign(__assign(__assign(__assign(__assign({ "content-type": "application/octet-stream" }, (isSerializableHeaderValue(input.ContentType) && { "content-type": input.ContentType })), (isSerializableHeaderValue(input.Accept) && { accept: input.Accept })), (isSerializableHeaderValue(input.CustomAttributes) && {
13
+ headers = map({}, isSerializableHeaderValue, {
14
+ "content-type": input.ContentType || "application/octet-stream",
15
+ accept: input.Accept,
14
16
  "x-amzn-sagemaker-custom-attributes": input.CustomAttributes,
15
- })), (isSerializableHeaderValue(input.TargetModel) && { "x-amzn-sagemaker-target-model": input.TargetModel })), (isSerializableHeaderValue(input.TargetVariant) && { "x-amzn-sagemaker-target-variant": input.TargetVariant })), (isSerializableHeaderValue(input.TargetContainerHostname) && {
17
+ "x-amzn-sagemaker-target-model": input.TargetModel,
18
+ "x-amzn-sagemaker-target-variant": input.TargetVariant,
16
19
  "x-amzn-sagemaker-target-container-hostname": input.TargetContainerHostname,
17
- })), (isSerializableHeaderValue(input.InferenceId) && { "x-amzn-sagemaker-inference-id": input.InferenceId }));
20
+ "x-amzn-sagemaker-inference-id": input.InferenceId,
21
+ });
18
22
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") + "/endpoints/{EndpointName}/invocations";
19
- if (input.EndpointName !== undefined) {
20
- labelValue = input.EndpointName;
21
- if (labelValue.length <= 0) {
22
- throw new Error("Empty value provided for input HTTP label: EndpointName.");
23
- }
24
- resolvedPath = resolvedPath.replace("{EndpointName}", __extendedEncodeURIComponent(labelValue));
25
- }
26
- else {
27
- throw new Error("No value provided for input HTTP label: EndpointName.");
28
- }
23
+ resolvedPath = __resolvedPath(resolvedPath, input, "EndpointName", function () { return input.EndpointName; }, "{EndpointName}", false);
29
24
  if (input.Body !== undefined) {
30
25
  body = input.Body;
31
26
  }
@@ -42,29 +37,26 @@ export var serializeAws_restJson1InvokeEndpointCommand = function (input, contex
42
37
  });
43
38
  }); };
44
39
  export var serializeAws_restJson1InvokeEndpointAsyncCommand = function (input, context) { return __awaiter(void 0, void 0, void 0, function () {
45
- var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, labelValue, body;
40
+ var _a, hostname, _b, protocol, port, basePath, headers, resolvedPath, body;
46
41
  return __generator(this, function (_c) {
47
42
  switch (_c.label) {
48
43
  case 0: return [4, context.endpoint()];
49
44
  case 1:
50
45
  _a = _c.sent(), hostname = _a.hostname, _b = _a.protocol, protocol = _b === void 0 ? "https" : _b, port = _a.port, basePath = _a.path;
51
- headers = __assign(__assign(__assign(__assign(__assign(__assign({}, (isSerializableHeaderValue(input.ContentType) && { "x-amzn-sagemaker-content-type": input.ContentType })), (isSerializableHeaderValue(input.Accept) && { "x-amzn-sagemaker-accept": input.Accept })), (isSerializableHeaderValue(input.CustomAttributes) && {
46
+ headers = map({}, isSerializableHeaderValue, {
47
+ "x-amzn-sagemaker-content-type": input.ContentType,
48
+ "x-amzn-sagemaker-accept": input.Accept,
52
49
  "x-amzn-sagemaker-custom-attributes": input.CustomAttributes,
53
- })), (isSerializableHeaderValue(input.InferenceId) && { "x-amzn-sagemaker-inference-id": input.InferenceId })), (isSerializableHeaderValue(input.InputLocation) && { "x-amzn-sagemaker-inputlocation": input.InputLocation })), (isSerializableHeaderValue(input.RequestTTLSeconds) && {
54
- "x-amzn-sagemaker-requestttlseconds": input.RequestTTLSeconds.toString(),
55
- }));
50
+ "x-amzn-sagemaker-inference-id": input.InferenceId,
51
+ "x-amzn-sagemaker-inputlocation": input.InputLocation,
52
+ "x-amzn-sagemaker-requestttlseconds": [
53
+ function () { return isSerializableHeaderValue(input.RequestTTLSeconds); },
54
+ function () { return input.RequestTTLSeconds.toString(); },
55
+ ],
56
+ });
56
57
  resolvedPath = "".concat((basePath === null || basePath === void 0 ? void 0 : basePath.endsWith("/")) ? basePath.slice(0, -1) : basePath || "") +
57
58
  "/endpoints/{EndpointName}/async-invocations";
58
- if (input.EndpointName !== undefined) {
59
- labelValue = input.EndpointName;
60
- if (labelValue.length <= 0) {
61
- throw new Error("Empty value provided for input HTTP label: EndpointName.");
62
- }
63
- resolvedPath = resolvedPath.replace("{EndpointName}", __extendedEncodeURIComponent(labelValue));
64
- }
65
- else {
66
- throw new Error("No value provided for input HTTP label: EndpointName.");
67
- }
59
+ resolvedPath = __resolvedPath(resolvedPath, input, "EndpointName", function () { return input.EndpointName; }, "{EndpointName}", false);
68
60
  return [2, new __HttpRequest({
69
61
  protocol: protocol,
70
62
  hostname: hostname,
@@ -85,32 +77,22 @@ export var deserializeAws_restJson1InvokeEndpointCommand = function (output, con
85
77
  if (output.statusCode !== 200 && output.statusCode >= 300) {
86
78
  return [2, deserializeAws_restJson1InvokeEndpointCommandError(output, context)];
87
79
  }
88
- contents = {
80
+ contents = map({
89
81
  $metadata: deserializeMetadata(output),
90
- Body: undefined,
91
- ContentType: undefined,
92
- CustomAttributes: undefined,
93
- InvokedProductionVariant: undefined,
94
- };
95
- if (output.headers["content-type"] !== undefined) {
96
- contents.ContentType = output.headers["content-type"];
97
- }
98
- if (output.headers["x-amzn-invoked-production-variant"] !== undefined) {
99
- contents.InvokedProductionVariant = output.headers["x-amzn-invoked-production-variant"];
100
- }
101
- if (output.headers["x-amzn-sagemaker-custom-attributes"] !== undefined) {
102
- contents.CustomAttributes = output.headers["x-amzn-sagemaker-custom-attributes"];
103
- }
82
+ ContentType: [, output.headers["content-type"]],
83
+ InvokedProductionVariant: [, output.headers["x-amzn-invoked-production-variant"]],
84
+ CustomAttributes: [, output.headers["x-amzn-sagemaker-custom-attributes"]],
85
+ });
104
86
  return [4, collectBody(output.body, context)];
105
87
  case 1:
106
88
  data = _a.sent();
107
89
  contents.Body = data;
108
- return [2, Promise.resolve(contents)];
90
+ return [2, contents];
109
91
  }
110
92
  });
111
93
  }); };
112
94
  var deserializeAws_restJson1InvokeEndpointCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
113
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
95
+ var parsedOutput, _a, errorCode, _b, parsedBody;
114
96
  var _c;
115
97
  return __generator(this, function (_d) {
116
98
  switch (_d.label) {
@@ -151,14 +133,14 @@ var deserializeAws_restJson1InvokeEndpointCommandError = function (output, conte
151
133
  case 13: throw _d.sent();
152
134
  case 14:
153
135
  parsedBody = parsedOutput.body;
154
- $metadata = deserializeMetadata(output);
155
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
156
- response = new __BaseException({
157
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
158
- $fault: "client",
159
- $metadata: $metadata,
136
+ throwDefaultError({
137
+ output: output,
138
+ parsedBody: parsedBody,
139
+ exceptionCtor: __BaseException,
140
+ errorCode: errorCode,
160
141
  });
161
- throw __decorateServiceException(response, parsedBody);
142
+ _d.label = 15;
143
+ case 15: return [2];
162
144
  }
163
145
  });
164
146
  }); };
@@ -170,28 +152,24 @@ export var deserializeAws_restJson1InvokeEndpointAsyncCommand = function (output
170
152
  if (output.statusCode !== 202 && output.statusCode >= 300) {
171
153
  return [2, deserializeAws_restJson1InvokeEndpointAsyncCommandError(output, context)];
172
154
  }
173
- contents = {
155
+ contents = map({
174
156
  $metadata: deserializeMetadata(output),
175
- InferenceId: undefined,
176
- OutputLocation: undefined,
177
- };
178
- if (output.headers["x-amzn-sagemaker-outputlocation"] !== undefined) {
179
- contents.OutputLocation = output.headers["x-amzn-sagemaker-outputlocation"];
180
- }
157
+ OutputLocation: [, output.headers["x-amzn-sagemaker-outputlocation"]],
158
+ });
181
159
  _a = __expectNonNull;
182
160
  _b = __expectObject;
183
161
  return [4, parseBody(output.body, context)];
184
162
  case 1:
185
163
  data = _a.apply(void 0, [_b.apply(void 0, [_c.sent()]), "body"]);
186
- if (data.InferenceId !== undefined && data.InferenceId !== null) {
164
+ if (data.InferenceId != null) {
187
165
  contents.InferenceId = __expectString(data.InferenceId);
188
166
  }
189
- return [2, Promise.resolve(contents)];
167
+ return [2, contents];
190
168
  }
191
169
  });
192
170
  }); };
193
171
  var deserializeAws_restJson1InvokeEndpointAsyncCommandError = function (output, context) { return __awaiter(void 0, void 0, void 0, function () {
194
- var parsedOutput, _a, response, errorCode, _b, parsedBody, $metadata, statusCode;
172
+ var parsedOutput, _a, errorCode, _b, parsedBody;
195
173
  var _c;
196
174
  return __generator(this, function (_d) {
197
175
  switch (_d.label) {
@@ -220,23 +198,24 @@ var deserializeAws_restJson1InvokeEndpointAsyncCommandError = function (output,
220
198
  case 7: throw _d.sent();
221
199
  case 8:
222
200
  parsedBody = parsedOutput.body;
223
- $metadata = deserializeMetadata(output);
224
- statusCode = $metadata.httpStatusCode ? $metadata.httpStatusCode + "" : undefined;
225
- response = new __BaseException({
226
- name: parsedBody.code || parsedBody.Code || errorCode || statusCode || "UnknowError",
227
- $fault: "client",
228
- $metadata: $metadata,
201
+ throwDefaultError({
202
+ output: output,
203
+ parsedBody: parsedBody,
204
+ exceptionCtor: __BaseException,
205
+ errorCode: errorCode,
229
206
  });
230
- throw __decorateServiceException(response, parsedBody);
207
+ _d.label = 9;
208
+ case 9: return [2];
231
209
  }
232
210
  });
233
211
  }); };
212
+ var map = __map;
234
213
  var deserializeAws_restJson1InternalDependencyExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
235
214
  var contents, data, exception;
236
215
  return __generator(this, function (_a) {
237
- contents = {};
216
+ contents = map({});
238
217
  data = parsedOutput.body;
239
- if (data.Message !== undefined && data.Message !== null) {
218
+ if (data.Message != null) {
240
219
  contents.Message = __expectString(data.Message);
241
220
  }
242
221
  exception = new InternalDependencyException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -246,9 +225,9 @@ var deserializeAws_restJson1InternalDependencyExceptionResponse = function (pars
246
225
  var deserializeAws_restJson1InternalFailureResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
247
226
  var contents, data, exception;
248
227
  return __generator(this, function (_a) {
249
- contents = {};
228
+ contents = map({});
250
229
  data = parsedOutput.body;
251
- if (data.Message !== undefined && data.Message !== null) {
230
+ if (data.Message != null) {
252
231
  contents.Message = __expectString(data.Message);
253
232
  }
254
233
  exception = new InternalFailure(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -258,18 +237,18 @@ var deserializeAws_restJson1InternalFailureResponse = function (parsedOutput, co
258
237
  var deserializeAws_restJson1ModelErrorResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
259
238
  var contents, data, exception;
260
239
  return __generator(this, function (_a) {
261
- contents = {};
240
+ contents = map({});
262
241
  data = parsedOutput.body;
263
- if (data.LogStreamArn !== undefined && data.LogStreamArn !== null) {
242
+ if (data.LogStreamArn != null) {
264
243
  contents.LogStreamArn = __expectString(data.LogStreamArn);
265
244
  }
266
- if (data.Message !== undefined && data.Message !== null) {
245
+ if (data.Message != null) {
267
246
  contents.Message = __expectString(data.Message);
268
247
  }
269
- if (data.OriginalMessage !== undefined && data.OriginalMessage !== null) {
248
+ if (data.OriginalMessage != null) {
270
249
  contents.OriginalMessage = __expectString(data.OriginalMessage);
271
250
  }
272
- if (data.OriginalStatusCode !== undefined && data.OriginalStatusCode !== null) {
251
+ if (data.OriginalStatusCode != null) {
273
252
  contents.OriginalStatusCode = __expectInt32(data.OriginalStatusCode);
274
253
  }
275
254
  exception = new ModelError(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -279,9 +258,9 @@ var deserializeAws_restJson1ModelErrorResponse = function (parsedOutput, context
279
258
  var deserializeAws_restJson1ModelNotReadyExceptionResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
280
259
  var contents, data, exception;
281
260
  return __generator(this, function (_a) {
282
- contents = {};
261
+ contents = map({});
283
262
  data = parsedOutput.body;
284
- if (data.Message !== undefined && data.Message !== null) {
263
+ if (data.Message != null) {
285
264
  contents.Message = __expectString(data.Message);
286
265
  }
287
266
  exception = new ModelNotReadyException(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -291,9 +270,9 @@ var deserializeAws_restJson1ModelNotReadyExceptionResponse = function (parsedOut
291
270
  var deserializeAws_restJson1ServiceUnavailableResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
292
271
  var contents, data, exception;
293
272
  return __generator(this, function (_a) {
294
- contents = {};
273
+ contents = map({});
295
274
  data = parsedOutput.body;
296
- if (data.Message !== undefined && data.Message !== null) {
275
+ if (data.Message != null) {
297
276
  contents.Message = __expectString(data.Message);
298
277
  }
299
278
  exception = new ServiceUnavailable(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
@@ -303,9 +282,9 @@ var deserializeAws_restJson1ServiceUnavailableResponse = function (parsedOutput,
303
282
  var deserializeAws_restJson1ValidationErrorResponse = function (parsedOutput, context) { return __awaiter(void 0, void 0, void 0, function () {
304
283
  var contents, data, exception;
305
284
  return __generator(this, function (_a) {
306
- contents = {};
285
+ contents = map({});
307
286
  data = parsedOutput.body;
308
- if (data.Message !== undefined && data.Message !== null) {
287
+ if (data.Message != null) {
309
288
  contents.Message = __expectString(data.Message);
310
289
  }
311
290
  exception = new ValidationError(__assign({ $metadata: deserializeMetadata(parsedOutput) }, contents));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-sagemaker-runtime",
3
3
  "description": "AWS SDK for JavaScript Sagemaker Runtime Client for Node.js, Browser and React Native",
4
- "version": "3.141.0",
4
+ "version": "3.142.0",
5
5
  "scripts": {
6
6
  "build": "concurrently 'yarn:build:cjs' 'yarn:build:es' 'yarn:build:types'",
7
7
  "build:cjs": "tsc -p tsconfig.cjs.json",
@@ -18,9 +18,9 @@
18
18
  "dependencies": {
19
19
  "@aws-crypto/sha256-browser": "2.0.0",
20
20
  "@aws-crypto/sha256-js": "2.0.0",
21
- "@aws-sdk/client-sts": "3.141.0",
21
+ "@aws-sdk/client-sts": "3.142.0",
22
22
  "@aws-sdk/config-resolver": "3.130.0",
23
- "@aws-sdk/credential-provider-node": "3.141.0",
23
+ "@aws-sdk/credential-provider-node": "3.142.0",
24
24
  "@aws-sdk/fetch-http-handler": "3.131.0",
25
25
  "@aws-sdk/hash-node": "3.127.0",
26
26
  "@aws-sdk/invalid-dependency": "3.127.0",
@@ -36,15 +36,15 @@
36
36
  "@aws-sdk/node-config-provider": "3.127.0",
37
37
  "@aws-sdk/node-http-handler": "3.127.0",
38
38
  "@aws-sdk/protocol-http": "3.127.0",
39
- "@aws-sdk/smithy-client": "3.137.0",
39
+ "@aws-sdk/smithy-client": "3.142.0",
40
40
  "@aws-sdk/types": "3.127.0",
41
41
  "@aws-sdk/url-parser": "3.127.0",
42
42
  "@aws-sdk/util-base64-browser": "3.109.0",
43
43
  "@aws-sdk/util-base64-node": "3.55.0",
44
44
  "@aws-sdk/util-body-length-browser": "3.55.0",
45
45
  "@aws-sdk/util-body-length-node": "3.55.0",
46
- "@aws-sdk/util-defaults-mode-browser": "3.137.0",
47
- "@aws-sdk/util-defaults-mode-node": "3.137.0",
46
+ "@aws-sdk/util-defaults-mode-browser": "3.142.0",
47
+ "@aws-sdk/util-defaults-mode-node": "3.142.0",
48
48
  "@aws-sdk/util-user-agent-browser": "3.127.0",
49
49
  "@aws-sdk/util-user-agent-node": "3.127.0",
50
50
  "@aws-sdk/util-utf8-browser": "3.109.0",