Skip to content

Commit 5b6c0db

Browse files
author
awstools
committed
feat(client-sagemaker-metrics): This release introduces support for the SageMaker Metrics BatchGetMetrics API.
1 parent a39132c commit 5b6c0db

File tree

9 files changed

+733
-16
lines changed

9 files changed

+733
-16
lines changed

clients/client-sagemaker-metrics/README.md

+15-7
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ using your favorite package manager:
3131

3232
The AWS SDK is modulized by clients and commands.
3333
To send a request, you only need to import the `SageMakerMetricsClient` and
34-
the commands you need, for example `BatchPutMetricsCommand`:
34+
the commands you need, for example `BatchGetMetricsCommand`:
3535

3636
```js
3737
// ES5 example
38-
const { SageMakerMetricsClient, BatchPutMetricsCommand } = require("@aws-sdk/client-sagemaker-metrics");
38+
const { SageMakerMetricsClient, BatchGetMetricsCommand } = require("@aws-sdk/client-sagemaker-metrics");
3939
```
4040

4141
```ts
4242
// ES6+ example
43-
import { SageMakerMetricsClient, BatchPutMetricsCommand } from "@aws-sdk/client-sagemaker-metrics";
43+
import { SageMakerMetricsClient, BatchGetMetricsCommand } from "@aws-sdk/client-sagemaker-metrics";
4444
```
4545

4646
### Usage
@@ -59,7 +59,7 @@ const client = new SageMakerMetricsClient({ region: "REGION" });
5959
const params = {
6060
/** input parameters */
6161
};
62-
const command = new BatchPutMetricsCommand(params);
62+
const command = new BatchGetMetricsCommand(params);
6363
```
6464

6565
#### Async/await
@@ -138,15 +138,15 @@ const client = new AWS.SageMakerMetrics({ region: "REGION" });
138138

139139
// async/await.
140140
try {
141-
const data = await client.batchPutMetrics(params);
141+
const data = await client.batchGetMetrics(params);
142142
// process data.
143143
} catch (error) {
144144
// error handling.
145145
}
146146

147147
// Promises.
148148
client
149-
.batchPutMetrics(params)
149+
.batchGetMetrics(params)
150150
.then((data) => {
151151
// process data.
152152
})
@@ -155,7 +155,7 @@ client
155155
});
156156

157157
// callbacks.
158-
client.batchPutMetrics(params, (err, data) => {
158+
client.batchGetMetrics(params, (err, data) => {
159159
// process err and data.
160160
});
161161
```
@@ -211,6 +211,14 @@ see LICENSE for more information.
211211

212212
## Client Commands (Operations List)
213213

214+
<details>
215+
<summary>
216+
BatchGetMetrics
217+
</summary>
218+
219+
[Command API Reference](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/client/sagemaker-metrics/command/BatchGetMetricsCommand/) / [Input](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-sagemaker-metrics/Interface/BatchGetMetricsCommandInput/) / [Output](https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/Package/-aws-sdk-client-sagemaker-metrics/Interface/BatchGetMetricsCommandOutput/)
220+
221+
</details>
214222
<details>
215223
<summary>
216224
BatchPutMetrics

clients/client-sagemaker-metrics/src/SageMakerMetrics.ts

+20
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
import { createAggregatedClient } from "@smithy/smithy-client";
33
import { HttpHandlerOptions as __HttpHandlerOptions } from "@smithy/types";
44

5+
import {
6+
BatchGetMetricsCommand,
7+
BatchGetMetricsCommandInput,
8+
BatchGetMetricsCommandOutput,
9+
} from "./commands/BatchGetMetricsCommand";
510
import {
611
BatchPutMetricsCommand,
712
BatchPutMetricsCommandInput,
@@ -10,10 +15,25 @@ import {
1015
import { SageMakerMetricsClient, SageMakerMetricsClientConfig } from "./SageMakerMetricsClient";
1116

1217
const commands = {
18+
BatchGetMetricsCommand,
1319
BatchPutMetricsCommand,
1420
};
1521

1622
export interface SageMakerMetrics {
23+
/**
24+
* @see {@link BatchGetMetricsCommand}
25+
*/
26+
batchGetMetrics(
27+
args: BatchGetMetricsCommandInput,
28+
options?: __HttpHandlerOptions
29+
): Promise<BatchGetMetricsCommandOutput>;
30+
batchGetMetrics(args: BatchGetMetricsCommandInput, cb: (err: any, data?: BatchGetMetricsCommandOutput) => void): void;
31+
batchGetMetrics(
32+
args: BatchGetMetricsCommandInput,
33+
options: __HttpHandlerOptions,
34+
cb: (err: any, data?: BatchGetMetricsCommandOutput) => void
35+
): void;
36+
1737
/**
1838
* @see {@link BatchPutMetricsCommand}
1939
*/

clients/client-sagemaker-metrics/src/SageMakerMetricsClient.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import {
5353
HttpAuthSchemeResolvedConfig,
5454
resolveHttpAuthSchemeConfig,
5555
} from "./auth/httpAuthSchemeProvider";
56+
import { BatchGetMetricsCommandInput, BatchGetMetricsCommandOutput } from "./commands/BatchGetMetricsCommand";
5657
import { BatchPutMetricsCommandInput, BatchPutMetricsCommandOutput } from "./commands/BatchPutMetricsCommand";
5758
import {
5859
ClientInputEndpointParameters,
@@ -68,12 +69,12 @@ export { __Client };
6869
/**
6970
* @public
7071
*/
71-
export type ServiceInputTypes = BatchPutMetricsCommandInput;
72+
export type ServiceInputTypes = BatchGetMetricsCommandInput | BatchPutMetricsCommandInput;
7273

7374
/**
7475
* @public
7576
*/
76-
export type ServiceOutputTypes = BatchPutMetricsCommandOutput;
77+
export type ServiceOutputTypes = BatchGetMetricsCommandOutput | BatchPutMetricsCommandOutput;
7778

7879
/**
7980
* @public
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
// smithy-typescript generated code
2+
import { getEndpointPlugin } from "@smithy/middleware-endpoint";
3+
import { getSerdePlugin } from "@smithy/middleware-serde";
4+
import { Command as $Command } from "@smithy/smithy-client";
5+
import { MetadataBearer as __MetadataBearer } from "@smithy/types";
6+
7+
import { commonParams } from "../endpoint/EndpointParameters";
8+
import { BatchGetMetricsRequest, BatchGetMetricsResponse } from "../models/models_0";
9+
import { de_BatchGetMetricsCommand, se_BatchGetMetricsCommand } from "../protocols/Aws_restJson1";
10+
import { SageMakerMetricsClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../SageMakerMetricsClient";
11+
12+
/**
13+
* @public
14+
*/
15+
export type { __MetadataBearer };
16+
export { $Command };
17+
/**
18+
* @public
19+
*
20+
* The input for {@link BatchGetMetricsCommand}.
21+
*/
22+
export interface BatchGetMetricsCommandInput extends BatchGetMetricsRequest {}
23+
/**
24+
* @public
25+
*
26+
* The output of {@link BatchGetMetricsCommand}.
27+
*/
28+
export interface BatchGetMetricsCommandOutput extends BatchGetMetricsResponse, __MetadataBearer {}
29+
30+
/**
31+
* <p>Used to retrieve training metrics from SageMaker.</p>
32+
* @example
33+
* Use a bare-bones client and the command you need to make an API call.
34+
* ```javascript
35+
* import { SageMakerMetricsClient, BatchGetMetricsCommand } from "@aws-sdk/client-sagemaker-metrics"; // ES Modules import
36+
* // const { SageMakerMetricsClient, BatchGetMetricsCommand } = require("@aws-sdk/client-sagemaker-metrics"); // CommonJS import
37+
* const client = new SageMakerMetricsClient(config);
38+
* const input = { // BatchGetMetricsRequest
39+
* MetricQueries: [ // MetricQueryList // required
40+
* { // MetricQuery
41+
* MetricName: "STRING_VALUE", // required
42+
* ResourceArn: "STRING_VALUE", // required
43+
* MetricStat: "Min" || "Max" || "Avg" || "Count" || "StdDev" || "Last", // required
44+
* Period: "OneMinute" || "FiveMinute" || "OneHour" || "IterationNumber", // required
45+
* XAxisType: "IterationNumber" || "Timestamp", // required
46+
* Start: Number("long"),
47+
* End: Number("long"),
48+
* },
49+
* ],
50+
* };
51+
* const command = new BatchGetMetricsCommand(input);
52+
* const response = await client.send(command);
53+
* // { // BatchGetMetricsResponse
54+
* // MetricQueryResults: [ // MetricQueryResultList
55+
* // { // MetricQueryResult
56+
* // Status: "Complete" || "Truncated" || "InternalError" || "ValidationError", // required
57+
* // Message: "STRING_VALUE",
58+
* // XAxisValues: [ // XAxisValues // required
59+
* // Number("long"),
60+
* // ],
61+
* // MetricValues: [ // MetricValues // required
62+
* // Number("double"),
63+
* // ],
64+
* // },
65+
* // ],
66+
* // };
67+
*
68+
* ```
69+
*
70+
* @param BatchGetMetricsCommandInput - {@link BatchGetMetricsCommandInput}
71+
* @returns {@link BatchGetMetricsCommandOutput}
72+
* @see {@link BatchGetMetricsCommandInput} for command's `input` shape.
73+
* @see {@link BatchGetMetricsCommandOutput} for command's `response` shape.
74+
* @see {@link SageMakerMetricsClientResolvedConfig | config} for SageMakerMetricsClient's `config` shape.
75+
*
76+
* @throws {@link SageMakerMetricsServiceException}
77+
* <p>Base exception class for all service exceptions from SageMakerMetrics service.</p>
78+
*
79+
* @public
80+
*/
81+
export class BatchGetMetricsCommand extends $Command
82+
.classBuilder<
83+
BatchGetMetricsCommandInput,
84+
BatchGetMetricsCommandOutput,
85+
SageMakerMetricsClientResolvedConfig,
86+
ServiceInputTypes,
87+
ServiceOutputTypes
88+
>()
89+
.ep(commonParams)
90+
.m(function (this: any, Command: any, cs: any, config: SageMakerMetricsClientResolvedConfig, o: any) {
91+
return [
92+
getSerdePlugin(config, this.serialize, this.deserialize),
93+
getEndpointPlugin(config, Command.getEndpointParameterInstructions()),
94+
];
95+
})
96+
.s("SageMakerMetricsService", "BatchGetMetrics", {})
97+
.n("SageMakerMetricsClient", "BatchGetMetricsCommand")
98+
.f(void 0, void 0)
99+
.ser(se_BatchGetMetricsCommand)
100+
.de(de_BatchGetMetricsCommand)
101+
.build() {
102+
/** @internal type navigation helper, not in runtime. */
103+
protected declare static __types: {
104+
api: {
105+
input: BatchGetMetricsRequest;
106+
output: BatchGetMetricsResponse;
107+
};
108+
sdk: {
109+
input: BatchGetMetricsCommandInput;
110+
output: BatchGetMetricsCommandOutput;
111+
};
112+
};
113+
}

clients/client-sagemaker-metrics/src/commands/BatchPutMetricsCommand.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,7 @@ export interface BatchPutMetricsCommandInput extends BatchPutMetricsRequest {}
2828
export interface BatchPutMetricsCommandOutput extends BatchPutMetricsResponse, __MetadataBearer {}
2929

3030
/**
31-
* <p>Used to ingest training metrics into SageMaker. These metrics can be visualized in SageMaker Studio and
32-
* retrieved with the <code>GetMetrics</code> API.
31+
* <p>Used to ingest training metrics into SageMaker. These metrics can be visualized in SageMaker Studio.
3332
* </p>
3433
* @example
3534
* Use a bare-bones client and the command you need to make an API call.
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
// smithy-typescript generated code
2+
export * from "./BatchGetMetricsCommand";
23
export * from "./BatchPutMetricsCommand";

0 commit comments

Comments
 (0)