@aws-sdk/client-sagemaker-edge 3.312.0 → 3.316.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,52 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SagemakerEdge = void 0;
4
+ const smithy_client_1 = require("@aws-sdk/smithy-client");
4
5
  const GetDeploymentsCommand_1 = require("./commands/GetDeploymentsCommand");
5
6
  const GetDeviceRegistrationCommand_1 = require("./commands/GetDeviceRegistrationCommand");
6
7
  const SendHeartbeatCommand_1 = require("./commands/SendHeartbeatCommand");
7
8
  const SagemakerEdgeClient_1 = require("./SagemakerEdgeClient");
9
+ const commands = {
10
+ GetDeploymentsCommand: GetDeploymentsCommand_1.GetDeploymentsCommand,
11
+ GetDeviceRegistrationCommand: GetDeviceRegistrationCommand_1.GetDeviceRegistrationCommand,
12
+ SendHeartbeatCommand: SendHeartbeatCommand_1.SendHeartbeatCommand,
13
+ };
8
14
  class SagemakerEdge extends SagemakerEdgeClient_1.SagemakerEdgeClient {
9
- getDeployments(args, optionsOrCb, cb) {
10
- const command = new GetDeploymentsCommand_1.GetDeploymentsCommand(args);
11
- if (typeof optionsOrCb === "function") {
12
- this.send(command, optionsOrCb);
13
- }
14
- else if (typeof cb === "function") {
15
- if (typeof optionsOrCb !== "object")
16
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
17
- this.send(command, optionsOrCb || {}, cb);
18
- }
19
- else {
20
- return this.send(command, optionsOrCb);
21
- }
22
- }
23
- getDeviceRegistration(args, optionsOrCb, cb) {
24
- const command = new GetDeviceRegistrationCommand_1.GetDeviceRegistrationCommand(args);
25
- if (typeof optionsOrCb === "function") {
26
- this.send(command, optionsOrCb);
27
- }
28
- else if (typeof cb === "function") {
29
- if (typeof optionsOrCb !== "object")
30
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
31
- this.send(command, optionsOrCb || {}, cb);
32
- }
33
- else {
34
- return this.send(command, optionsOrCb);
35
- }
36
- }
37
- sendHeartbeat(args, optionsOrCb, cb) {
38
- const command = new SendHeartbeatCommand_1.SendHeartbeatCommand(args);
39
- if (typeof optionsOrCb === "function") {
40
- this.send(command, optionsOrCb);
41
- }
42
- else if (typeof cb === "function") {
43
- if (typeof optionsOrCb !== "object")
44
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
45
- this.send(command, optionsOrCb || {}, cb);
46
- }
47
- else {
48
- return this.send(command, optionsOrCb);
49
- }
50
- }
51
15
  }
52
16
  exports.SagemakerEdge = SagemakerEdge;
17
+ (0, smithy_client_1.createAggregatedClient)(commands, SagemakerEdge);
@@ -12,10 +12,10 @@ const se_GetDeploymentsCommand = async (input, context) => {
12
12
  };
13
13
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetDeployments";
14
14
  let body;
15
- body = JSON.stringify({
16
- ...(input.DeviceFleetName != null && { DeviceFleetName: input.DeviceFleetName }),
17
- ...(input.DeviceName != null && { DeviceName: input.DeviceName }),
18
- });
15
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
16
+ DeviceFleetName: [],
17
+ DeviceName: [],
18
+ }));
19
19
  return new protocol_http_1.HttpRequest({
20
20
  protocol,
21
21
  hostname,
@@ -34,10 +34,10 @@ const se_GetDeviceRegistrationCommand = async (input, context) => {
34
34
  };
35
35
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetDeviceRegistration";
36
36
  let body;
37
- body = JSON.stringify({
38
- ...(input.DeviceFleetName != null && { DeviceFleetName: input.DeviceFleetName }),
39
- ...(input.DeviceName != null && { DeviceName: input.DeviceName }),
40
- });
37
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
38
+ DeviceFleetName: [],
39
+ DeviceName: [],
40
+ }));
41
41
  return new protocol_http_1.HttpRequest({
42
42
  protocol,
43
43
  hostname,
@@ -56,14 +56,14 @@ const se_SendHeartbeatCommand = async (input, context) => {
56
56
  };
57
57
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/SendHeartbeat";
58
58
  let body;
59
- body = JSON.stringify({
60
- ...(input.AgentMetrics != null && { AgentMetrics: se_EdgeMetrics(input.AgentMetrics, context) }),
61
- ...(input.AgentVersion != null && { AgentVersion: input.AgentVersion }),
62
- ...(input.DeploymentResult != null && { DeploymentResult: se_DeploymentResult(input.DeploymentResult, context) }),
63
- ...(input.DeviceFleetName != null && { DeviceFleetName: input.DeviceFleetName }),
64
- ...(input.DeviceName != null && { DeviceName: input.DeviceName }),
65
- ...(input.Models != null && { Models: se_Models(input.Models, context) }),
66
- });
59
+ body = JSON.stringify((0, smithy_client_1.take)(input, {
60
+ AgentMetrics: (_) => se_EdgeMetrics(_, context),
61
+ AgentVersion: [],
62
+ DeploymentResult: (_) => se_DeploymentResult(_, context),
63
+ DeviceFleetName: [],
64
+ DeviceName: [],
65
+ Models: (_) => se_Models(_, context),
66
+ }));
67
67
  return new protocol_http_1.HttpRequest({
68
68
  protocol,
69
69
  hostname,
@@ -79,13 +79,14 @@ const de_GetDeploymentsCommand = async (output, context) => {
79
79
  if (output.statusCode !== 200 && output.statusCode >= 300) {
80
80
  return de_GetDeploymentsCommandError(output, context);
81
81
  }
82
- const contents = map({
82
+ const contents = (0, smithy_client_1.map)({
83
83
  $metadata: deserializeMetadata(output),
84
84
  });
85
85
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
86
- if (data.Deployments != null) {
87
- contents.Deployments = de_EdgeDeployments(data.Deployments, context);
88
- }
86
+ const doc = (0, smithy_client_1.take)(data, {
87
+ Deployments: smithy_client_1._json,
88
+ });
89
+ Object.assign(contents, doc);
89
90
  return contents;
90
91
  };
91
92
  exports.de_GetDeploymentsCommand = de_GetDeploymentsCommand;
@@ -101,10 +102,9 @@ const de_GetDeploymentsCommandError = async (output, context) => {
101
102
  throw await de_InternalServiceExceptionRes(parsedOutput, context);
102
103
  default:
103
104
  const parsedBody = parsedOutput.body;
104
- (0, smithy_client_1.throwDefaultError)({
105
+ return throwDefaultError({
105
106
  output,
106
107
  parsedBody,
107
- exceptionCtor: SagemakerEdgeServiceException_1.SagemakerEdgeServiceException,
108
108
  errorCode,
109
109
  });
110
110
  }
@@ -113,16 +113,15 @@ const de_GetDeviceRegistrationCommand = async (output, context) => {
113
113
  if (output.statusCode !== 200 && output.statusCode >= 300) {
114
114
  return de_GetDeviceRegistrationCommandError(output, context);
115
115
  }
116
- const contents = map({
116
+ const contents = (0, smithy_client_1.map)({
117
117
  $metadata: deserializeMetadata(output),
118
118
  });
119
119
  const data = (0, smithy_client_1.expectNonNull)((0, smithy_client_1.expectObject)(await parseBody(output.body, context)), "body");
120
- if (data.CacheTTL != null) {
121
- contents.CacheTTL = (0, smithy_client_1.expectString)(data.CacheTTL);
122
- }
123
- if (data.DeviceRegistration != null) {
124
- contents.DeviceRegistration = (0, smithy_client_1.expectString)(data.DeviceRegistration);
125
- }
120
+ const doc = (0, smithy_client_1.take)(data, {
121
+ CacheTTL: smithy_client_1.expectString,
122
+ DeviceRegistration: smithy_client_1.expectString,
123
+ });
124
+ Object.assign(contents, doc);
126
125
  return contents;
127
126
  };
128
127
  exports.de_GetDeviceRegistrationCommand = de_GetDeviceRegistrationCommand;
@@ -138,10 +137,9 @@ const de_GetDeviceRegistrationCommandError = async (output, context) => {
138
137
  throw await de_InternalServiceExceptionRes(parsedOutput, context);
139
138
  default:
140
139
  const parsedBody = parsedOutput.body;
141
- (0, smithy_client_1.throwDefaultError)({
140
+ return throwDefaultError({
142
141
  output,
143
142
  parsedBody,
144
- exceptionCtor: SagemakerEdgeServiceException_1.SagemakerEdgeServiceException,
145
143
  errorCode,
146
144
  });
147
145
  }
@@ -150,7 +148,7 @@ const de_SendHeartbeatCommand = async (output, context) => {
150
148
  if (output.statusCode !== 200 && output.statusCode >= 300) {
151
149
  return de_SendHeartbeatCommandError(output, context);
152
150
  }
153
- const contents = map({
151
+ const contents = (0, smithy_client_1.map)({
154
152
  $metadata: deserializeMetadata(output),
155
153
  });
156
154
  await collectBody(output.body, context);
@@ -169,65 +167,44 @@ const de_SendHeartbeatCommandError = async (output, context) => {
169
167
  throw await de_InternalServiceExceptionRes(parsedOutput, context);
170
168
  default:
171
169
  const parsedBody = parsedOutput.body;
172
- (0, smithy_client_1.throwDefaultError)({
170
+ return throwDefaultError({
173
171
  output,
174
172
  parsedBody,
175
- exceptionCtor: SagemakerEdgeServiceException_1.SagemakerEdgeServiceException,
176
173
  errorCode,
177
174
  });
178
175
  }
179
176
  };
180
- const map = smithy_client_1.map;
177
+ const throwDefaultError = (0, smithy_client_1.withBaseException)(SagemakerEdgeServiceException_1.SagemakerEdgeServiceException);
181
178
  const de_InternalServiceExceptionRes = async (parsedOutput, context) => {
182
- const contents = map({});
179
+ const contents = (0, smithy_client_1.map)({});
183
180
  const data = parsedOutput.body;
184
- if (data.Message != null) {
185
- contents.Message = (0, smithy_client_1.expectString)(data.Message);
186
- }
181
+ const doc = (0, smithy_client_1.take)(data, {
182
+ Message: smithy_client_1.expectString,
183
+ });
184
+ Object.assign(contents, doc);
187
185
  const exception = new models_0_1.InternalServiceException({
188
186
  $metadata: deserializeMetadata(parsedOutput),
189
187
  ...contents,
190
188
  });
191
189
  return (0, smithy_client_1.decorateServiceException)(exception, parsedOutput.body);
192
190
  };
193
- const se_DeploymentModel = (input, context) => {
194
- return {
195
- ...(input.DesiredState != null && { DesiredState: input.DesiredState }),
196
- ...(input.ModelHandle != null && { ModelHandle: input.ModelHandle }),
197
- ...(input.ModelName != null && { ModelName: input.ModelName }),
198
- ...(input.ModelVersion != null && { ModelVersion: input.ModelVersion }),
199
- ...(input.RollbackFailureReason != null && { RollbackFailureReason: input.RollbackFailureReason }),
200
- ...(input.State != null && { State: input.State }),
201
- ...(input.Status != null && { Status: input.Status }),
202
- ...(input.StatusReason != null && { StatusReason: input.StatusReason }),
203
- };
204
- };
205
- const se_DeploymentModels = (input, context) => {
206
- return input
207
- .filter((e) => e != null)
208
- .map((entry) => {
209
- return se_DeploymentModel(entry, context);
210
- });
211
- };
212
191
  const se_DeploymentResult = (input, context) => {
213
- return {
214
- ...(input.DeploymentEndTime != null && { DeploymentEndTime: Math.round(input.DeploymentEndTime.getTime() / 1000) }),
215
- ...(input.DeploymentModels != null && { DeploymentModels: se_DeploymentModels(input.DeploymentModels, context) }),
216
- ...(input.DeploymentName != null && { DeploymentName: input.DeploymentName }),
217
- ...(input.DeploymentStartTime != null && {
218
- DeploymentStartTime: Math.round(input.DeploymentStartTime.getTime() / 1000),
219
- }),
220
- ...(input.DeploymentStatus != null && { DeploymentStatus: input.DeploymentStatus }),
221
- ...(input.DeploymentStatusMessage != null && { DeploymentStatusMessage: input.DeploymentStatusMessage }),
222
- };
192
+ return (0, smithy_client_1.take)(input, {
193
+ DeploymentEndTime: (_) => Math.round(_.getTime() / 1000),
194
+ DeploymentModels: smithy_client_1._json,
195
+ DeploymentName: [],
196
+ DeploymentStartTime: (_) => Math.round(_.getTime() / 1000),
197
+ DeploymentStatus: [],
198
+ DeploymentStatusMessage: [],
199
+ });
223
200
  };
224
201
  const se_EdgeMetric = (input, context) => {
225
- return {
226
- ...(input.Dimension != null && { Dimension: input.Dimension }),
227
- ...(input.MetricName != null && { MetricName: input.MetricName }),
228
- ...(input.Timestamp != null && { Timestamp: Math.round(input.Timestamp.getTime() / 1000) }),
229
- ...(input.Value != null && { Value: (0, smithy_client_1.serializeFloat)(input.Value) }),
230
- };
202
+ return (0, smithy_client_1.take)(input, {
203
+ Dimension: [],
204
+ MetricName: [],
205
+ Timestamp: (_) => Math.round(_.getTime() / 1000),
206
+ Value: smithy_client_1.serializeFloat,
207
+ });
231
208
  };
232
209
  const se_EdgeMetrics = (input, context) => {
233
210
  return input
@@ -237,13 +214,13 @@ const se_EdgeMetrics = (input, context) => {
237
214
  });
238
215
  };
239
216
  const se_Model = (input, context) => {
240
- return {
241
- ...(input.LatestInference != null && { LatestInference: Math.round(input.LatestInference.getTime() / 1000) }),
242
- ...(input.LatestSampleTime != null && { LatestSampleTime: Math.round(input.LatestSampleTime.getTime() / 1000) }),
243
- ...(input.ModelMetrics != null && { ModelMetrics: se_EdgeMetrics(input.ModelMetrics, context) }),
244
- ...(input.ModelName != null && { ModelName: input.ModelName }),
245
- ...(input.ModelVersion != null && { ModelVersion: input.ModelVersion }),
246
- };
217
+ return (0, smithy_client_1.take)(input, {
218
+ LatestInference: (_) => Math.round(_.getTime() / 1000),
219
+ LatestSampleTime: (_) => Math.round(_.getTime() / 1000),
220
+ ModelMetrics: (_) => se_EdgeMetrics(_, context),
221
+ ModelName: [],
222
+ ModelVersion: [],
223
+ });
247
224
  };
248
225
  const se_Models = (input, context) => {
249
226
  return input
@@ -252,50 +229,6 @@ const se_Models = (input, context) => {
252
229
  return se_Model(entry, context);
253
230
  });
254
231
  };
255
- const de_Checksum = (output, context) => {
256
- return {
257
- Sum: (0, smithy_client_1.expectString)(output.Sum),
258
- Type: (0, smithy_client_1.expectString)(output.Type),
259
- };
260
- };
261
- const de_Definition = (output, context) => {
262
- return {
263
- Checksum: output.Checksum != null ? de_Checksum(output.Checksum, context) : undefined,
264
- ModelHandle: (0, smithy_client_1.expectString)(output.ModelHandle),
265
- S3Url: (0, smithy_client_1.expectString)(output.S3Url),
266
- State: (0, smithy_client_1.expectString)(output.State),
267
- };
268
- };
269
- const de_Definitions = (output, context) => {
270
- const retVal = (output || [])
271
- .filter((e) => e != null)
272
- .map((entry) => {
273
- if (entry === null) {
274
- return null;
275
- }
276
- return de_Definition(entry, context);
277
- });
278
- return retVal;
279
- };
280
- const de_EdgeDeployment = (output, context) => {
281
- return {
282
- Definitions: output.Definitions != null ? de_Definitions(output.Definitions, context) : undefined,
283
- DeploymentName: (0, smithy_client_1.expectString)(output.DeploymentName),
284
- FailureHandlingPolicy: (0, smithy_client_1.expectString)(output.FailureHandlingPolicy),
285
- Type: (0, smithy_client_1.expectString)(output.Type),
286
- };
287
- };
288
- const de_EdgeDeployments = (output, context) => {
289
- const retVal = (output || [])
290
- .filter((e) => e != null)
291
- .map((entry) => {
292
- if (entry === null) {
293
- return null;
294
- }
295
- return de_EdgeDeployment(entry, context);
296
- });
297
- return retVal;
298
- };
299
232
  const deserializeMetadata = (output) => ({
300
233
  httpStatusCode: output.statusCode,
301
234
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
@@ -1,48 +1,13 @@
1
+ import { createAggregatedClient } from "@aws-sdk/smithy-client";
1
2
  import { GetDeploymentsCommand, } from "./commands/GetDeploymentsCommand";
2
3
  import { GetDeviceRegistrationCommand, } from "./commands/GetDeviceRegistrationCommand";
3
4
  import { SendHeartbeatCommand, } from "./commands/SendHeartbeatCommand";
4
5
  import { SagemakerEdgeClient } from "./SagemakerEdgeClient";
6
+ const commands = {
7
+ GetDeploymentsCommand,
8
+ GetDeviceRegistrationCommand,
9
+ SendHeartbeatCommand,
10
+ };
5
11
  export class SagemakerEdge extends SagemakerEdgeClient {
6
- getDeployments(args, optionsOrCb, cb) {
7
- const command = new GetDeploymentsCommand(args);
8
- if (typeof optionsOrCb === "function") {
9
- this.send(command, optionsOrCb);
10
- }
11
- else if (typeof cb === "function") {
12
- if (typeof optionsOrCb !== "object")
13
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
14
- this.send(command, optionsOrCb || {}, cb);
15
- }
16
- else {
17
- return this.send(command, optionsOrCb);
18
- }
19
- }
20
- getDeviceRegistration(args, optionsOrCb, cb) {
21
- const command = new GetDeviceRegistrationCommand(args);
22
- if (typeof optionsOrCb === "function") {
23
- this.send(command, optionsOrCb);
24
- }
25
- else if (typeof cb === "function") {
26
- if (typeof optionsOrCb !== "object")
27
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
28
- this.send(command, optionsOrCb || {}, cb);
29
- }
30
- else {
31
- return this.send(command, optionsOrCb);
32
- }
33
- }
34
- sendHeartbeat(args, optionsOrCb, cb) {
35
- const command = new SendHeartbeatCommand(args);
36
- if (typeof optionsOrCb === "function") {
37
- this.send(command, optionsOrCb);
38
- }
39
- else if (typeof cb === "function") {
40
- if (typeof optionsOrCb !== "object")
41
- throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
42
- this.send(command, optionsOrCb || {}, cb);
43
- }
44
- else {
45
- return this.send(command, optionsOrCb);
46
- }
47
- }
48
12
  }
13
+ createAggregatedClient(commands, SagemakerEdge);
@@ -1,6 +1,6 @@
1
1
  import { HttpRequest as __HttpRequest } from "@aws-sdk/protocol-http";
2
- import { decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map as __map, serializeFloat as __serializeFloat, throwDefaultError, } from "@aws-sdk/smithy-client";
3
- import { InternalServiceException, } from "../models/models_0";
2
+ import { _json, decorateServiceException as __decorateServiceException, expectNonNull as __expectNonNull, expectObject as __expectObject, expectString as __expectString, map, serializeFloat as __serializeFloat, take, withBaseException, } from "@aws-sdk/smithy-client";
3
+ import { InternalServiceException } from "../models/models_0";
4
4
  import { SagemakerEdgeServiceException as __BaseException } from "../models/SagemakerEdgeServiceException";
5
5
  export const se_GetDeploymentsCommand = async (input, context) => {
6
6
  const { hostname, protocol = "https", port, path: basePath } = await context.endpoint();
@@ -9,10 +9,10 @@ export const se_GetDeploymentsCommand = async (input, context) => {
9
9
  };
10
10
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetDeployments";
11
11
  let body;
12
- body = JSON.stringify({
13
- ...(input.DeviceFleetName != null && { DeviceFleetName: input.DeviceFleetName }),
14
- ...(input.DeviceName != null && { DeviceName: input.DeviceName }),
15
- });
12
+ body = JSON.stringify(take(input, {
13
+ DeviceFleetName: [],
14
+ DeviceName: [],
15
+ }));
16
16
  return new __HttpRequest({
17
17
  protocol,
18
18
  hostname,
@@ -30,10 +30,10 @@ export const se_GetDeviceRegistrationCommand = async (input, context) => {
30
30
  };
31
31
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/GetDeviceRegistration";
32
32
  let body;
33
- body = JSON.stringify({
34
- ...(input.DeviceFleetName != null && { DeviceFleetName: input.DeviceFleetName }),
35
- ...(input.DeviceName != null && { DeviceName: input.DeviceName }),
36
- });
33
+ body = JSON.stringify(take(input, {
34
+ DeviceFleetName: [],
35
+ DeviceName: [],
36
+ }));
37
37
  return new __HttpRequest({
38
38
  protocol,
39
39
  hostname,
@@ -51,14 +51,14 @@ export const se_SendHeartbeatCommand = async (input, context) => {
51
51
  };
52
52
  const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/SendHeartbeat";
53
53
  let body;
54
- body = JSON.stringify({
55
- ...(input.AgentMetrics != null && { AgentMetrics: se_EdgeMetrics(input.AgentMetrics, context) }),
56
- ...(input.AgentVersion != null && { AgentVersion: input.AgentVersion }),
57
- ...(input.DeploymentResult != null && { DeploymentResult: se_DeploymentResult(input.DeploymentResult, context) }),
58
- ...(input.DeviceFleetName != null && { DeviceFleetName: input.DeviceFleetName }),
59
- ...(input.DeviceName != null && { DeviceName: input.DeviceName }),
60
- ...(input.Models != null && { Models: se_Models(input.Models, context) }),
61
- });
54
+ body = JSON.stringify(take(input, {
55
+ AgentMetrics: (_) => se_EdgeMetrics(_, context),
56
+ AgentVersion: [],
57
+ DeploymentResult: (_) => se_DeploymentResult(_, context),
58
+ DeviceFleetName: [],
59
+ DeviceName: [],
60
+ Models: (_) => se_Models(_, context),
61
+ }));
62
62
  return new __HttpRequest({
63
63
  protocol,
64
64
  hostname,
@@ -77,9 +77,10 @@ export const de_GetDeploymentsCommand = async (output, context) => {
77
77
  $metadata: deserializeMetadata(output),
78
78
  });
79
79
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
80
- if (data.Deployments != null) {
81
- contents.Deployments = de_EdgeDeployments(data.Deployments, context);
82
- }
80
+ const doc = take(data, {
81
+ Deployments: _json,
82
+ });
83
+ Object.assign(contents, doc);
83
84
  return contents;
84
85
  };
85
86
  const de_GetDeploymentsCommandError = async (output, context) => {
@@ -94,10 +95,9 @@ const de_GetDeploymentsCommandError = async (output, context) => {
94
95
  throw await de_InternalServiceExceptionRes(parsedOutput, context);
95
96
  default:
96
97
  const parsedBody = parsedOutput.body;
97
- throwDefaultError({
98
+ return throwDefaultError({
98
99
  output,
99
100
  parsedBody,
100
- exceptionCtor: __BaseException,
101
101
  errorCode,
102
102
  });
103
103
  }
@@ -110,12 +110,11 @@ export const de_GetDeviceRegistrationCommand = async (output, context) => {
110
110
  $metadata: deserializeMetadata(output),
111
111
  });
112
112
  const data = __expectNonNull(__expectObject(await parseBody(output.body, context)), "body");
113
- if (data.CacheTTL != null) {
114
- contents.CacheTTL = __expectString(data.CacheTTL);
115
- }
116
- if (data.DeviceRegistration != null) {
117
- contents.DeviceRegistration = __expectString(data.DeviceRegistration);
118
- }
113
+ const doc = take(data, {
114
+ CacheTTL: __expectString,
115
+ DeviceRegistration: __expectString,
116
+ });
117
+ Object.assign(contents, doc);
119
118
  return contents;
120
119
  };
121
120
  const de_GetDeviceRegistrationCommandError = async (output, context) => {
@@ -130,10 +129,9 @@ const de_GetDeviceRegistrationCommandError = async (output, context) => {
130
129
  throw await de_InternalServiceExceptionRes(parsedOutput, context);
131
130
  default:
132
131
  const parsedBody = parsedOutput.body;
133
- throwDefaultError({
132
+ return throwDefaultError({
134
133
  output,
135
134
  parsedBody,
136
- exceptionCtor: __BaseException,
137
135
  errorCode,
138
136
  });
139
137
  }
@@ -160,65 +158,44 @@ const de_SendHeartbeatCommandError = async (output, context) => {
160
158
  throw await de_InternalServiceExceptionRes(parsedOutput, context);
161
159
  default:
162
160
  const parsedBody = parsedOutput.body;
163
- throwDefaultError({
161
+ return throwDefaultError({
164
162
  output,
165
163
  parsedBody,
166
- exceptionCtor: __BaseException,
167
164
  errorCode,
168
165
  });
169
166
  }
170
167
  };
171
- const map = __map;
168
+ const throwDefaultError = withBaseException(__BaseException);
172
169
  const de_InternalServiceExceptionRes = async (parsedOutput, context) => {
173
170
  const contents = map({});
174
171
  const data = parsedOutput.body;
175
- if (data.Message != null) {
176
- contents.Message = __expectString(data.Message);
177
- }
172
+ const doc = take(data, {
173
+ Message: __expectString,
174
+ });
175
+ Object.assign(contents, doc);
178
176
  const exception = new InternalServiceException({
179
177
  $metadata: deserializeMetadata(parsedOutput),
180
178
  ...contents,
181
179
  });
182
180
  return __decorateServiceException(exception, parsedOutput.body);
183
181
  };
184
- const se_DeploymentModel = (input, context) => {
185
- return {
186
- ...(input.DesiredState != null && { DesiredState: input.DesiredState }),
187
- ...(input.ModelHandle != null && { ModelHandle: input.ModelHandle }),
188
- ...(input.ModelName != null && { ModelName: input.ModelName }),
189
- ...(input.ModelVersion != null && { ModelVersion: input.ModelVersion }),
190
- ...(input.RollbackFailureReason != null && { RollbackFailureReason: input.RollbackFailureReason }),
191
- ...(input.State != null && { State: input.State }),
192
- ...(input.Status != null && { Status: input.Status }),
193
- ...(input.StatusReason != null && { StatusReason: input.StatusReason }),
194
- };
195
- };
196
- const se_DeploymentModels = (input, context) => {
197
- return input
198
- .filter((e) => e != null)
199
- .map((entry) => {
200
- return se_DeploymentModel(entry, context);
201
- });
202
- };
203
182
  const se_DeploymentResult = (input, context) => {
204
- return {
205
- ...(input.DeploymentEndTime != null && { DeploymentEndTime: Math.round(input.DeploymentEndTime.getTime() / 1000) }),
206
- ...(input.DeploymentModels != null && { DeploymentModels: se_DeploymentModels(input.DeploymentModels, context) }),
207
- ...(input.DeploymentName != null && { DeploymentName: input.DeploymentName }),
208
- ...(input.DeploymentStartTime != null && {
209
- DeploymentStartTime: Math.round(input.DeploymentStartTime.getTime() / 1000),
210
- }),
211
- ...(input.DeploymentStatus != null && { DeploymentStatus: input.DeploymentStatus }),
212
- ...(input.DeploymentStatusMessage != null && { DeploymentStatusMessage: input.DeploymentStatusMessage }),
213
- };
183
+ return take(input, {
184
+ DeploymentEndTime: (_) => Math.round(_.getTime() / 1000),
185
+ DeploymentModels: _json,
186
+ DeploymentName: [],
187
+ DeploymentStartTime: (_) => Math.round(_.getTime() / 1000),
188
+ DeploymentStatus: [],
189
+ DeploymentStatusMessage: [],
190
+ });
214
191
  };
215
192
  const se_EdgeMetric = (input, context) => {
216
- return {
217
- ...(input.Dimension != null && { Dimension: input.Dimension }),
218
- ...(input.MetricName != null && { MetricName: input.MetricName }),
219
- ...(input.Timestamp != null && { Timestamp: Math.round(input.Timestamp.getTime() / 1000) }),
220
- ...(input.Value != null && { Value: __serializeFloat(input.Value) }),
221
- };
193
+ return take(input, {
194
+ Dimension: [],
195
+ MetricName: [],
196
+ Timestamp: (_) => Math.round(_.getTime() / 1000),
197
+ Value: __serializeFloat,
198
+ });
222
199
  };
223
200
  const se_EdgeMetrics = (input, context) => {
224
201
  return input
@@ -228,13 +205,13 @@ const se_EdgeMetrics = (input, context) => {
228
205
  });
229
206
  };
230
207
  const se_Model = (input, context) => {
231
- return {
232
- ...(input.LatestInference != null && { LatestInference: Math.round(input.LatestInference.getTime() / 1000) }),
233
- ...(input.LatestSampleTime != null && { LatestSampleTime: Math.round(input.LatestSampleTime.getTime() / 1000) }),
234
- ...(input.ModelMetrics != null && { ModelMetrics: se_EdgeMetrics(input.ModelMetrics, context) }),
235
- ...(input.ModelName != null && { ModelName: input.ModelName }),
236
- ...(input.ModelVersion != null && { ModelVersion: input.ModelVersion }),
237
- };
208
+ return take(input, {
209
+ LatestInference: (_) => Math.round(_.getTime() / 1000),
210
+ LatestSampleTime: (_) => Math.round(_.getTime() / 1000),
211
+ ModelMetrics: (_) => se_EdgeMetrics(_, context),
212
+ ModelName: [],
213
+ ModelVersion: [],
214
+ });
238
215
  };
239
216
  const se_Models = (input, context) => {
240
217
  return input
@@ -243,50 +220,6 @@ const se_Models = (input, context) => {
243
220
  return se_Model(entry, context);
244
221
  });
245
222
  };
246
- const de_Checksum = (output, context) => {
247
- return {
248
- Sum: __expectString(output.Sum),
249
- Type: __expectString(output.Type),
250
- };
251
- };
252
- const de_Definition = (output, context) => {
253
- return {
254
- Checksum: output.Checksum != null ? de_Checksum(output.Checksum, context) : undefined,
255
- ModelHandle: __expectString(output.ModelHandle),
256
- S3Url: __expectString(output.S3Url),
257
- State: __expectString(output.State),
258
- };
259
- };
260
- const de_Definitions = (output, context) => {
261
- const retVal = (output || [])
262
- .filter((e) => e != null)
263
- .map((entry) => {
264
- if (entry === null) {
265
- return null;
266
- }
267
- return de_Definition(entry, context);
268
- });
269
- return retVal;
270
- };
271
- const de_EdgeDeployment = (output, context) => {
272
- return {
273
- Definitions: output.Definitions != null ? de_Definitions(output.Definitions, context) : undefined,
274
- DeploymentName: __expectString(output.DeploymentName),
275
- FailureHandlingPolicy: __expectString(output.FailureHandlingPolicy),
276
- Type: __expectString(output.Type),
277
- };
278
- };
279
- const de_EdgeDeployments = (output, context) => {
280
- const retVal = (output || [])
281
- .filter((e) => e != null)
282
- .map((entry) => {
283
- if (entry === null) {
284
- return null;
285
- }
286
- return de_EdgeDeployment(entry, context);
287
- });
288
- return retVal;
289
- };
290
223
  const deserializeMetadata = (output) => ({
291
224
  httpStatusCode: output.statusCode,
292
225
  requestId: output.headers["x-amzn-requestid"] ?? output.headers["x-amzn-request-id"] ?? output.headers["x-amz-request-id"],
@@ -3,30 +3,29 @@ import { GetDeploymentsCommandInput, GetDeploymentsCommandOutput } from "./comma
3
3
  import { GetDeviceRegistrationCommandInput, GetDeviceRegistrationCommandOutput } from "./commands/GetDeviceRegistrationCommand";
4
4
  import { SendHeartbeatCommandInput, SendHeartbeatCommandOutput } from "./commands/SendHeartbeatCommand";
5
5
  import { SagemakerEdgeClient } from "./SagemakerEdgeClient";
6
- /**
7
- * @public
8
- * <p>SageMaker Edge Manager dataplane service for communicating with active agents.</p>
9
- */
10
- export declare class SagemakerEdge extends SagemakerEdgeClient {
6
+ export interface SagemakerEdge {
11
7
  /**
12
- * @public
13
- * <p>Use to get the active deployments from a device.</p>
8
+ * @see {@link GetDeploymentsCommand}
14
9
  */
15
10
  getDeployments(args: GetDeploymentsCommandInput, options?: __HttpHandlerOptions): Promise<GetDeploymentsCommandOutput>;
16
11
  getDeployments(args: GetDeploymentsCommandInput, cb: (err: any, data?: GetDeploymentsCommandOutput) => void): void;
17
12
  getDeployments(args: GetDeploymentsCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: GetDeploymentsCommandOutput) => void): void;
18
13
  /**
19
- * @public
20
- * <p>Use to check if a device is registered with SageMaker Edge Manager.</p>
14
+ * @see {@link GetDeviceRegistrationCommand}
21
15
  */
22
16
  getDeviceRegistration(args: GetDeviceRegistrationCommandInput, options?: __HttpHandlerOptions): Promise<GetDeviceRegistrationCommandOutput>;
23
17
  getDeviceRegistration(args: GetDeviceRegistrationCommandInput, cb: (err: any, data?: GetDeviceRegistrationCommandOutput) => void): void;
24
18
  getDeviceRegistration(args: GetDeviceRegistrationCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: GetDeviceRegistrationCommandOutput) => void): void;
25
19
  /**
26
- * @public
27
- * <p>Use to get the current status of devices registered on SageMaker Edge Manager.</p>
20
+ * @see {@link SendHeartbeatCommand}
28
21
  */
29
22
  sendHeartbeat(args: SendHeartbeatCommandInput, options?: __HttpHandlerOptions): Promise<SendHeartbeatCommandOutput>;
30
23
  sendHeartbeat(args: SendHeartbeatCommandInput, cb: (err: any, data?: SendHeartbeatCommandOutput) => void): void;
31
24
  sendHeartbeat(args: SendHeartbeatCommandInput, options: __HttpHandlerOptions, cb: (err: any, data?: SendHeartbeatCommandOutput) => void): void;
32
25
  }
26
+ /**
27
+ * @public
28
+ * <p>SageMaker Edge Manager dataplane service for communicating with active agents.</p>
29
+ */
30
+ export declare class SagemakerEdge extends SagemakerEdgeClient implements SagemakerEdge {
31
+ }
@@ -12,7 +12,7 @@ import {
12
12
  SendHeartbeatCommandOutput,
13
13
  } from "./commands/SendHeartbeatCommand";
14
14
  import { SagemakerEdgeClient } from "./SagemakerEdgeClient";
15
- export declare class SagemakerEdge extends SagemakerEdgeClient {
15
+ export interface SagemakerEdge {
16
16
  getDeployments(
17
17
  args: GetDeploymentsCommandInput,
18
18
  options?: __HttpHandlerOptions
@@ -53,3 +53,6 @@ export declare class SagemakerEdge extends SagemakerEdgeClient {
53
53
  cb: (err: any, data?: SendHeartbeatCommandOutput) => void
54
54
  ): void;
55
55
  }
56
+ export declare class SagemakerEdge
57
+ extends SagemakerEdgeClient
58
+ implements SagemakerEdge {}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@aws-sdk/client-sagemaker-edge",
3
3
  "description": "AWS SDK for JavaScript Sagemaker Edge Client for Node.js, Browser and React Native",
4
- "version": "3.312.0",
4
+ "version": "3.316.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",
@@ -21,9 +21,9 @@
21
21
  "dependencies": {
22
22
  "@aws-crypto/sha256-browser": "3.0.0",
23
23
  "@aws-crypto/sha256-js": "3.0.0",
24
- "@aws-sdk/client-sts": "3.312.0",
24
+ "@aws-sdk/client-sts": "3.316.0",
25
25
  "@aws-sdk/config-resolver": "3.310.0",
26
- "@aws-sdk/credential-provider-node": "3.310.0",
26
+ "@aws-sdk/credential-provider-node": "3.316.0",
27
27
  "@aws-sdk/fetch-http-handler": "3.310.0",
28
28
  "@aws-sdk/hash-node": "3.310.0",
29
29
  "@aws-sdk/invalid-dependency": "3.310.0",
@@ -40,14 +40,14 @@
40
40
  "@aws-sdk/node-config-provider": "3.310.0",
41
41
  "@aws-sdk/node-http-handler": "3.310.0",
42
42
  "@aws-sdk/protocol-http": "3.310.0",
43
- "@aws-sdk/smithy-client": "3.310.0",
43
+ "@aws-sdk/smithy-client": "3.316.0",
44
44
  "@aws-sdk/types": "3.310.0",
45
45
  "@aws-sdk/url-parser": "3.310.0",
46
46
  "@aws-sdk/util-base64": "3.310.0",
47
47
  "@aws-sdk/util-body-length-browser": "3.310.0",
48
48
  "@aws-sdk/util-body-length-node": "3.310.0",
49
- "@aws-sdk/util-defaults-mode-browser": "3.310.0",
50
- "@aws-sdk/util-defaults-mode-node": "3.310.0",
49
+ "@aws-sdk/util-defaults-mode-browser": "3.316.0",
50
+ "@aws-sdk/util-defaults-mode-node": "3.316.0",
51
51
  "@aws-sdk/util-endpoints": "3.310.0",
52
52
  "@aws-sdk/util-retry": "3.310.0",
53
53
  "@aws-sdk/util-user-agent-browser": "3.310.0",