Skip to content

Commit 902a074

Browse files
author
awstools
committed
feat(client-lookoutmetrics): Added DetectMetricSetConfig API for detecting configuration required for creating metric set from provided S3 data source.
1 parent 808b04f commit 902a074

File tree

7 files changed

+1117
-0
lines changed

7 files changed

+1117
-0
lines changed

clients/client-lookoutmetrics/src/LookoutMetrics.ts

+37
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ import {
5252
DescribeMetricSetCommandInput,
5353
DescribeMetricSetCommandOutput,
5454
} from "./commands/DescribeMetricSetCommand";
55+
import {
56+
DetectMetricSetConfigCommand,
57+
DetectMetricSetConfigCommandInput,
58+
DetectMetricSetConfigCommandOutput,
59+
} from "./commands/DetectMetricSetConfigCommand";
5560
import {
5661
GetAnomalyGroupCommand,
5762
GetAnomalyGroupCommandInput,
@@ -498,6 +503,38 @@ export class LookoutMetrics extends LookoutMetricsClient {
498503
}
499504
}
500505

506+
/**
507+
* <p>Detects an Amazon S3 dataset's file format, interval, and offset.</p>
508+
*/
509+
public detectMetricSetConfig(
510+
args: DetectMetricSetConfigCommandInput,
511+
options?: __HttpHandlerOptions
512+
): Promise<DetectMetricSetConfigCommandOutput>;
513+
public detectMetricSetConfig(
514+
args: DetectMetricSetConfigCommandInput,
515+
cb: (err: any, data?: DetectMetricSetConfigCommandOutput) => void
516+
): void;
517+
public detectMetricSetConfig(
518+
args: DetectMetricSetConfigCommandInput,
519+
options: __HttpHandlerOptions,
520+
cb: (err: any, data?: DetectMetricSetConfigCommandOutput) => void
521+
): void;
522+
public detectMetricSetConfig(
523+
args: DetectMetricSetConfigCommandInput,
524+
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: DetectMetricSetConfigCommandOutput) => void),
525+
cb?: (err: any, data?: DetectMetricSetConfigCommandOutput) => void
526+
): Promise<DetectMetricSetConfigCommandOutput> | void {
527+
const command = new DetectMetricSetConfigCommand(args);
528+
if (typeof optionsOrCb === "function") {
529+
this.send(command, optionsOrCb);
530+
} else if (typeof cb === "function") {
531+
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
532+
this.send(command, optionsOrCb || {}, cb);
533+
} else {
534+
return this.send(command, optionsOrCb);
535+
}
536+
}
537+
501538
/**
502539
* <p>Returns details about a group of anomalous metrics.</p>
503540
*/

clients/client-lookoutmetrics/src/LookoutMetricsClient.ts

+6
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ import {
8484
DescribeAnomalyDetectorCommandOutput,
8585
} from "./commands/DescribeAnomalyDetectorCommand";
8686
import { DescribeMetricSetCommandInput, DescribeMetricSetCommandOutput } from "./commands/DescribeMetricSetCommand";
87+
import {
88+
DetectMetricSetConfigCommandInput,
89+
DetectMetricSetConfigCommandOutput,
90+
} from "./commands/DetectMetricSetConfigCommand";
8791
import { GetAnomalyGroupCommandInput, GetAnomalyGroupCommandOutput } from "./commands/GetAnomalyGroupCommand";
8892
import { GetFeedbackCommandInput, GetFeedbackCommandOutput } from "./commands/GetFeedbackCommand";
8993
import { GetSampleDataCommandInput, GetSampleDataCommandOutput } from "./commands/GetSampleDataCommand";
@@ -132,6 +136,7 @@ export type ServiceInputTypes =
132136
| DescribeAnomalyDetectionExecutionsCommandInput
133137
| DescribeAnomalyDetectorCommandInput
134138
| DescribeMetricSetCommandInput
139+
| DetectMetricSetConfigCommandInput
135140
| GetAnomalyGroupCommandInput
136141
| GetFeedbackCommandInput
137142
| GetSampleDataCommandInput
@@ -161,6 +166,7 @@ export type ServiceOutputTypes =
161166
| DescribeAnomalyDetectionExecutionsCommandOutput
162167
| DescribeAnomalyDetectorCommandOutput
163168
| DescribeMetricSetCommandOutput
169+
| DetectMetricSetConfigCommandOutput
164170
| GetAnomalyGroupCommandOutput
165171
| GetFeedbackCommandOutput
166172
| GetSampleDataCommandOutput
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
2+
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
3+
import { Command as $Command } from "@aws-sdk/smithy-client";
4+
import {
5+
FinalizeHandlerArguments,
6+
Handler,
7+
HandlerExecutionContext,
8+
HttpHandlerOptions as __HttpHandlerOptions,
9+
MetadataBearer as __MetadataBearer,
10+
MiddlewareStack,
11+
SerdeContext as __SerdeContext,
12+
} from "@aws-sdk/types";
13+
14+
import { LookoutMetricsClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../LookoutMetricsClient";
15+
import { DetectMetricSetConfigRequest, DetectMetricSetConfigResponse } from "../models/models_0";
16+
import {
17+
deserializeAws_restJson1DetectMetricSetConfigCommand,
18+
serializeAws_restJson1DetectMetricSetConfigCommand,
19+
} from "../protocols/Aws_restJson1";
20+
21+
export interface DetectMetricSetConfigCommandInput extends DetectMetricSetConfigRequest {}
22+
export interface DetectMetricSetConfigCommandOutput extends DetectMetricSetConfigResponse, __MetadataBearer {}
23+
24+
/**
25+
* <p>Detects an Amazon S3 dataset's file format, interval, and offset.</p>
26+
* @example
27+
* Use a bare-bones client and the command you need to make an API call.
28+
* ```javascript
29+
* import { LookoutMetricsClient, DetectMetricSetConfigCommand } from "@aws-sdk/client-lookoutmetrics"; // ES Modules import
30+
* // const { LookoutMetricsClient, DetectMetricSetConfigCommand } = require("@aws-sdk/client-lookoutmetrics"); // CommonJS import
31+
* const client = new LookoutMetricsClient(config);
32+
* const command = new DetectMetricSetConfigCommand(input);
33+
* const response = await client.send(command);
34+
* ```
35+
*
36+
* @see {@link DetectMetricSetConfigCommandInput} for command's `input` shape.
37+
* @see {@link DetectMetricSetConfigCommandOutput} for command's `response` shape.
38+
* @see {@link LookoutMetricsClientResolvedConfig | config} for LookoutMetricsClient's `config` shape.
39+
*
40+
*/
41+
export class DetectMetricSetConfigCommand extends $Command<
42+
DetectMetricSetConfigCommandInput,
43+
DetectMetricSetConfigCommandOutput,
44+
LookoutMetricsClientResolvedConfig
45+
> {
46+
// Start section: command_properties
47+
// End section: command_properties
48+
49+
constructor(readonly input: DetectMetricSetConfigCommandInput) {
50+
// Start section: command_constructor
51+
super();
52+
// End section: command_constructor
53+
}
54+
55+
/**
56+
* @internal
57+
*/
58+
resolveMiddleware(
59+
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
60+
configuration: LookoutMetricsClientResolvedConfig,
61+
options?: __HttpHandlerOptions
62+
): Handler<DetectMetricSetConfigCommandInput, DetectMetricSetConfigCommandOutput> {
63+
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));
64+
65+
const stack = clientStack.concat(this.middlewareStack);
66+
67+
const { logger } = configuration;
68+
const clientName = "LookoutMetricsClient";
69+
const commandName = "DetectMetricSetConfigCommand";
70+
const handlerExecutionContext: HandlerExecutionContext = {
71+
logger,
72+
clientName,
73+
commandName,
74+
inputFilterSensitiveLog: DetectMetricSetConfigRequest.filterSensitiveLog,
75+
outputFilterSensitiveLog: DetectMetricSetConfigResponse.filterSensitiveLog,
76+
};
77+
const { requestHandler } = configuration;
78+
return stack.resolve(
79+
(request: FinalizeHandlerArguments<any>) =>
80+
requestHandler.handle(request.request as __HttpRequest, options || {}),
81+
handlerExecutionContext
82+
);
83+
}
84+
85+
private serialize(input: DetectMetricSetConfigCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
86+
return serializeAws_restJson1DetectMetricSetConfigCommand(input, context);
87+
}
88+
89+
private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<DetectMetricSetConfigCommandOutput> {
90+
return deserializeAws_restJson1DetectMetricSetConfigCommand(output, context);
91+
}
92+
93+
// Start section: command_body_extra
94+
// End section: command_body_extra
95+
}

clients/client-lookoutmetrics/src/commands/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export * from "./DescribeAlertCommand";
1010
export * from "./DescribeAnomalyDetectionExecutionsCommand";
1111
export * from "./DescribeAnomalyDetectorCommand";
1212
export * from "./DescribeMetricSetCommand";
13+
export * from "./DetectMetricSetConfigCommand";
1314
export * from "./GetAnomalyGroupCommand";
1415
export * from "./GetFeedbackCommand";
1516
export * from "./GetSampleDataCommand";

0 commit comments

Comments
 (0)