Skip to content

Commit 316a691

Browse files
author
awstools
committed
feat(client-sagemaker-edge): Amazon SageMaker Edge Manager provides lightweight model deployment feature to deploy machine learning models on requested devices.
1 parent 6481e59 commit 316a691

File tree

8 files changed

+968
-34
lines changed

8 files changed

+968
-34
lines changed

clients/client-sagemaker-edge/README.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,16 @@ using your favorite package manager:
2626

2727
The AWS SDK is modulized by clients and commands.
2828
To send a request, you only need to import the `SagemakerEdgeClient` and
29-
the commands you need, for example `GetDeviceRegistrationCommand`:
29+
the commands you need, for example `GetDeploymentsCommand`:
3030

3131
```js
3232
// ES5 example
33-
const { SagemakerEdgeClient, GetDeviceRegistrationCommand } = require("@aws-sdk/client-sagemaker-edge");
33+
const { SagemakerEdgeClient, GetDeploymentsCommand } = require("@aws-sdk/client-sagemaker-edge");
3434
```
3535

3636
```ts
3737
// ES6+ example
38-
import { SagemakerEdgeClient, GetDeviceRegistrationCommand } from "@aws-sdk/client-sagemaker-edge";
38+
import { SagemakerEdgeClient, GetDeploymentsCommand } from "@aws-sdk/client-sagemaker-edge";
3939
```
4040

4141
### Usage
@@ -54,7 +54,7 @@ const client = new SagemakerEdgeClient({ region: "REGION" });
5454
const params = {
5555
/** input parameters */
5656
};
57-
const command = new GetDeviceRegistrationCommand(params);
57+
const command = new GetDeploymentsCommand(params);
5858
```
5959

6060
#### Async/await
@@ -133,15 +133,15 @@ const client = new AWS.SagemakerEdge({ region: "REGION" });
133133

134134
// async/await.
135135
try {
136-
const data = await client.getDeviceRegistration(params);
136+
const data = await client.getDeployments(params);
137137
// process data.
138138
} catch (error) {
139139
// error handling.
140140
}
141141

142142
// Promises.
143143
client
144-
.getDeviceRegistration(params)
144+
.getDeployments(params)
145145
.then((data) => {
146146
// process data.
147147
})
@@ -150,7 +150,7 @@ client
150150
});
151151

152152
// callbacks.
153-
client.getDeviceRegistration(params, (err, data) => {
153+
client.getDeployments(params, (err, data) => {
154154
// process err and data.
155155
});
156156
```

clients/client-sagemaker-edge/src/SagemakerEdge.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
// smithy-typescript generated code
22
import { HttpHandlerOptions as __HttpHandlerOptions } from "@aws-sdk/types";
33

4+
import {
5+
GetDeploymentsCommand,
6+
GetDeploymentsCommandInput,
7+
GetDeploymentsCommandOutput,
8+
} from "./commands/GetDeploymentsCommand";
49
import {
510
GetDeviceRegistrationCommand,
611
GetDeviceRegistrationCommandInput,
@@ -17,6 +22,38 @@ import { SagemakerEdgeClient } from "./SagemakerEdgeClient";
1722
* <p>SageMaker Edge Manager dataplane service for communicating with active agents.</p>
1823
*/
1924
export class SagemakerEdge extends SagemakerEdgeClient {
25+
/**
26+
* <p>Use to get the active deployments from a device.</p>
27+
*/
28+
public getDeployments(
29+
args: GetDeploymentsCommandInput,
30+
options?: __HttpHandlerOptions
31+
): Promise<GetDeploymentsCommandOutput>;
32+
public getDeployments(
33+
args: GetDeploymentsCommandInput,
34+
cb: (err: any, data?: GetDeploymentsCommandOutput) => void
35+
): void;
36+
public getDeployments(
37+
args: GetDeploymentsCommandInput,
38+
options: __HttpHandlerOptions,
39+
cb: (err: any, data?: GetDeploymentsCommandOutput) => void
40+
): void;
41+
public getDeployments(
42+
args: GetDeploymentsCommandInput,
43+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GetDeploymentsCommandOutput) => void),
44+
cb?: (err: any, data?: GetDeploymentsCommandOutput) => void
45+
): Promise<GetDeploymentsCommandOutput> | void {
46+
const command = new GetDeploymentsCommand(args);
47+
if (typeof optionsOrCb === "function") {
48+
this.send(command, optionsOrCb);
49+
} else if (typeof cb === "function") {
50+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
51+
this.send(command, optionsOrCb || {}, cb);
52+
} else {
53+
return this.send(command, optionsOrCb);
54+
}
55+
}
56+
2057
/**
2158
* <p>Use to check if a device is registered with SageMaker Edge Manager.</p>
2259
*/

clients/client-sagemaker-edge/src/SagemakerEdgeClient.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,23 @@ import {
5353
UserAgent as __UserAgent,
5454
} from "@aws-sdk/types";
5555

56+
import { GetDeploymentsCommandInput, GetDeploymentsCommandOutput } from "./commands/GetDeploymentsCommand";
5657
import {
5758
GetDeviceRegistrationCommandInput,
5859
GetDeviceRegistrationCommandOutput,
5960
} from "./commands/GetDeviceRegistrationCommand";
6061
import { SendHeartbeatCommandInput, SendHeartbeatCommandOutput } from "./commands/SendHeartbeatCommand";
6162
import { getRuntimeConfig as __getRuntimeConfig } from "./runtimeConfig";
6263

63-
export type ServiceInputTypes = GetDeviceRegistrationCommandInput | SendHeartbeatCommandInput;
64+
export type ServiceInputTypes =
65+
| GetDeploymentsCommandInput
66+
| GetDeviceRegistrationCommandInput
67+
| SendHeartbeatCommandInput;
6468

65-
export type ServiceOutputTypes = GetDeviceRegistrationCommandOutput | SendHeartbeatCommandOutput;
69+
export type ServiceOutputTypes =
70+
| GetDeploymentsCommandOutput
71+
| GetDeviceRegistrationCommandOutput
72+
| SendHeartbeatCommandOutput;
6673

6774
export interface ClientDefaults extends Partial<__SmithyResolvedConfiguration<__HttpHandlerOptions>> {
6875
/**
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// smithy-typescript generated code
2+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
3+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
4+
import { Command as $Command } from "@aws-sdk/smithy-client";
5+
import {
6+
FinalizeHandlerArguments,
7+
Handler,
8+
HandlerExecutionContext,
9+
HttpHandlerOptions as __HttpHandlerOptions,
10+
MetadataBearer as __MetadataBearer,
11+
MiddlewareStack,
12+
SerdeContext as __SerdeContext,
13+
} from "@aws-sdk/types";
14+
15+
import { GetDeploymentsRequest, GetDeploymentsResult } from "../models/models_0";
16+
import {
17+
deserializeAws_restJson1GetDeploymentsCommand,
18+
serializeAws_restJson1GetDeploymentsCommand,
19+
} from "../protocols/Aws_restJson1";
20+
import { SagemakerEdgeClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../SagemakerEdgeClient";
21+
22+
export interface GetDeploymentsCommandInput extends GetDeploymentsRequest {}
23+
export interface GetDeploymentsCommandOutput extends GetDeploymentsResult, __MetadataBearer {}
24+
25+
/**
26+
* <p>Use to get the active deployments from a device.</p>
27+
* @example
28+
* Use a bare-bones client and the command you need to make an API call.
29+
* ```javascript
30+
* import { SagemakerEdgeClient, GetDeploymentsCommand } from "@aws-sdk/client-sagemaker-edge"; // ES Modules import
31+
* // const { SagemakerEdgeClient, GetDeploymentsCommand } = require("@aws-sdk/client-sagemaker-edge"); // CommonJS import
32+
* const client = new SagemakerEdgeClient(config);
33+
* const command = new GetDeploymentsCommand(input);
34+
* const response = await client.send(command);
35+
* ```
36+
*
37+
* @see {@link GetDeploymentsCommandInput} for command's `input` shape.
38+
* @see {@link GetDeploymentsCommandOutput} for command's `response` shape.
39+
* @see {@link SagemakerEdgeClientResolvedConfig | config} for SagemakerEdgeClient's `config` shape.
40+
*
41+
*/
42+
export class GetDeploymentsCommand extends $Command<
43+
GetDeploymentsCommandInput,
44+
GetDeploymentsCommandOutput,
45+
SagemakerEdgeClientResolvedConfig
46+
> {
47+
// Start section: command_properties
48+
// End section: command_properties
49+
50+
constructor(readonly input: GetDeploymentsCommandInput) {
51+
// Start section: command_constructor
52+
super();
53+
// End section: command_constructor
54+
}
55+
56+
/**
57+
* @internal
58+
*/
59+
resolveMiddleware(
60+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
61+
configuration: SagemakerEdgeClientResolvedConfig,
62+
options?: __HttpHandlerOptions
63+
): Handler<GetDeploymentsCommandInput, GetDeploymentsCommandOutput> {
64+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
65+
66+
const stack = clientStack.concat(this.middlewareStack);
67+
68+
const { logger } = configuration;
69+
const clientName = "SagemakerEdgeClient";
70+
const commandName = "GetDeploymentsCommand";
71+
const handlerExecutionContext: HandlerExecutionContext = {
72+
logger,
73+
clientName,
74+
commandName,
75+
inputFilterSensitiveLog: GetDeploymentsRequest.filterSensitiveLog,
76+
outputFilterSensitiveLog: GetDeploymentsResult.filterSensitiveLog,
77+
};
78+
const { requestHandler } = configuration;
79+
return stack.resolve(
80+
(request: FinalizeHandlerArguments<any>) =>
81+
requestHandler.handle(request.request as __HttpRequest, options || {}),
82+
handlerExecutionContext
83+
);
84+
}
85+
86+
private serialize(input: GetDeploymentsCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
87+
return serializeAws_restJson1GetDeploymentsCommand(input, context);
88+
}
89+
90+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<GetDeploymentsCommandOutput> {
91+
return deserializeAws_restJson1GetDeploymentsCommand(output, context);
92+
}
93+
94+
// Start section: command_body_extra
95+
// End section: command_body_extra
96+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
// smithy-typescript generated code
2+
export * from "./GetDeploymentsCommand";
23
export * from "./GetDeviceRegistrationCommand";
34
export * from "./SendHeartbeatCommand";

0 commit comments

Comments
 (0)