Skip to content

Commit

Permalink
feat(client-lookoutmetrics): This release is to make GetDataQualityMe…
Browse files Browse the repository at this point in the history
…trics API publicly available.
  • Loading branch information
awstools committed Aug 19, 2022
1 parent 66a1950 commit d8ee980
Show file tree
Hide file tree
Showing 7 changed files with 670 additions and 6 deletions.
37 changes: 37 additions & 0 deletions clients/client-lookoutmetrics/src/LookoutMetrics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,11 @@ import {
GetAnomalyGroupCommandInput,
GetAnomalyGroupCommandOutput,
} from "./commands/GetAnomalyGroupCommand";
import {
GetDataQualityMetricsCommand,
GetDataQualityMetricsCommandInput,
GetDataQualityMetricsCommandOutput,
} from "./commands/GetDataQualityMetricsCommand";
import { GetFeedbackCommand, GetFeedbackCommandInput, GetFeedbackCommandOutput } from "./commands/GetFeedbackCommand";
import {
GetSampleDataCommand,
Expand Down Expand Up @@ -569,6 +574,38 @@ export class LookoutMetrics extends LookoutMetricsClient {
}
}

/**
* <p>Returns details about the requested data quality metrics.</p>
*/
public getDataQualityMetrics(
args: GetDataQualityMetricsCommandInput,
options?: __HttpHandlerOptions
): Promise<GetDataQualityMetricsCommandOutput>;
public getDataQualityMetrics(
args: GetDataQualityMetricsCommandInput,
cb: (err: any, data?: GetDataQualityMetricsCommandOutput) => void
): void;
public getDataQualityMetrics(
args: GetDataQualityMetricsCommandInput,
options: __HttpHandlerOptions,
cb: (err: any, data?: GetDataQualityMetricsCommandOutput) => void
): void;
public getDataQualityMetrics(
args: GetDataQualityMetricsCommandInput,
optionsOrCb?: __HttpHandlerOptions | ((err: any, data?: GetDataQualityMetricsCommandOutput) => void),
cb?: (err: any, data?: GetDataQualityMetricsCommandOutput) => void
): Promise<GetDataQualityMetricsCommandOutput> | void {
const command = new GetDataQualityMetricsCommand(args);
if (typeof optionsOrCb === "function") {
this.send(command, optionsOrCb);
} else if (typeof cb === "function") {
if (typeof optionsOrCb !== "object") throw new Error(`Expect http options but get ${typeof optionsOrCb}`);
this.send(command, optionsOrCb || {}, cb);
} else {
return this.send(command, optionsOrCb);
}
}

/**
* <p>Get feedback for an anomaly group.</p>
*/
Expand Down
6 changes: 6 additions & 0 deletions clients/client-lookoutmetrics/src/LookoutMetricsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ import {
DetectMetricSetConfigCommandOutput,
} from "./commands/DetectMetricSetConfigCommand";
import { GetAnomalyGroupCommandInput, GetAnomalyGroupCommandOutput } from "./commands/GetAnomalyGroupCommand";
import {
GetDataQualityMetricsCommandInput,
GetDataQualityMetricsCommandOutput,
} from "./commands/GetDataQualityMetricsCommand";
import { GetFeedbackCommandInput, GetFeedbackCommandOutput } from "./commands/GetFeedbackCommand";
import { GetSampleDataCommandInput, GetSampleDataCommandOutput } from "./commands/GetSampleDataCommand";
import { ListAlertsCommandInput, ListAlertsCommandOutput } from "./commands/ListAlertsCommand";
Expand Down Expand Up @@ -141,6 +145,7 @@ export type ServiceInputTypes =
| DescribeMetricSetCommandInput
| DetectMetricSetConfigCommandInput
| GetAnomalyGroupCommandInput
| GetDataQualityMetricsCommandInput
| GetFeedbackCommandInput
| GetSampleDataCommandInput
| ListAlertsCommandInput
Expand Down Expand Up @@ -172,6 +177,7 @@ export type ServiceOutputTypes =
| DescribeMetricSetCommandOutput
| DetectMetricSetConfigCommandOutput
| GetAnomalyGroupCommandOutput
| GetDataQualityMetricsCommandOutput
| GetFeedbackCommandOutput
| GetSampleDataCommandOutput
| ListAlertsCommandOutput
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
// smithy-typescript generated code
import { getSerdePlugin } from "@aws-sdk/middleware-serde";
import { HttpRequest as __HttpRequest, HttpResponse as __HttpResponse } from "@aws-sdk/protocol-http";
import { Command as $Command } from "@aws-sdk/smithy-client";
import {
FinalizeHandlerArguments,
Handler,
HandlerExecutionContext,
HttpHandlerOptions as __HttpHandlerOptions,
MetadataBearer as __MetadataBearer,
MiddlewareStack,
SerdeContext as __SerdeContext,
} from "@aws-sdk/types";

import { LookoutMetricsClientResolvedConfig, ServiceInputTypes, ServiceOutputTypes } from "../LookoutMetricsClient";
import {
GetDataQualityMetricsRequest,
GetDataQualityMetricsRequestFilterSensitiveLog,
GetDataQualityMetricsResponse,
GetDataQualityMetricsResponseFilterSensitiveLog,
} from "../models/models_0";
import {
deserializeAws_restJson1GetDataQualityMetricsCommand,
serializeAws_restJson1GetDataQualityMetricsCommand,
} from "../protocols/Aws_restJson1";

export interface GetDataQualityMetricsCommandInput extends GetDataQualityMetricsRequest {}
export interface GetDataQualityMetricsCommandOutput extends GetDataQualityMetricsResponse, __MetadataBearer {}

/**
* <p>Returns details about the requested data quality metrics.</p>
* @example
* Use a bare-bones client and the command you need to make an API call.
* ```javascript
* import { LookoutMetricsClient, GetDataQualityMetricsCommand } from "@aws-sdk/client-lookoutmetrics"; // ES Modules import
* // const { LookoutMetricsClient, GetDataQualityMetricsCommand } = require("@aws-sdk/client-lookoutmetrics"); // CommonJS import
* const client = new LookoutMetricsClient(config);
* const command = new GetDataQualityMetricsCommand(input);
* const response = await client.send(command);
* ```
*
* @see {@link GetDataQualityMetricsCommandInput} for command's `input` shape.
* @see {@link GetDataQualityMetricsCommandOutput} for command's `response` shape.
* @see {@link LookoutMetricsClientResolvedConfig | config} for LookoutMetricsClient's `config` shape.
*
*/
export class GetDataQualityMetricsCommand extends $Command<
GetDataQualityMetricsCommandInput,
GetDataQualityMetricsCommandOutput,
LookoutMetricsClientResolvedConfig
> {
// Start section: command_properties
// End section: command_properties

constructor(readonly input: GetDataQualityMetricsCommandInput) {
// Start section: command_constructor
super();
// End section: command_constructor
}

/**
* @internal
*/
resolveMiddleware(
clientStack: MiddlewareStack<ServiceInputTypes, ServiceOutputTypes>,
configuration: LookoutMetricsClientResolvedConfig,
options?: __HttpHandlerOptions
): Handler<GetDataQualityMetricsCommandInput, GetDataQualityMetricsCommandOutput> {
this.middlewareStack.use(getSerdePlugin(configuration, this.serialize, this.deserialize));

const stack = clientStack.concat(this.middlewareStack);

const { logger } = configuration;
const clientName = "LookoutMetricsClient";
const commandName = "GetDataQualityMetricsCommand";
const handlerExecutionContext: HandlerExecutionContext = {
logger,
clientName,
commandName,
inputFilterSensitiveLog: GetDataQualityMetricsRequestFilterSensitiveLog,
outputFilterSensitiveLog: GetDataQualityMetricsResponseFilterSensitiveLog,
};
const { requestHandler } = configuration;
return stack.resolve(
(request: FinalizeHandlerArguments<any>) =>
requestHandler.handle(request.request as __HttpRequest, options || {}),
handlerExecutionContext
);
}

private serialize(input: GetDataQualityMetricsCommandInput, context: __SerdeContext): Promise<__HttpRequest> {
return serializeAws_restJson1GetDataQualityMetricsCommand(input, context);
}

private deserialize(output: __HttpResponse, context: __SerdeContext): Promise<GetDataQualityMetricsCommandOutput> {
return deserializeAws_restJson1GetDataQualityMetricsCommand(output, context);
}

// Start section: command_body_extra
// End section: command_body_extra
}
1 change: 1 addition & 0 deletions clients/client-lookoutmetrics/src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export * from "./DescribeAnomalyDetectorCommand";
export * from "./DescribeMetricSetCommand";
export * from "./DetectMetricSetConfigCommand";
export * from "./GetAnomalyGroupCommand";
export * from "./GetDataQualityMetricsCommand";
export * from "./GetFeedbackCommand";
export * from "./GetSampleDataCommand";
export * from "./ListAlertsCommand";
Expand Down
128 changes: 125 additions & 3 deletions clients/client-lookoutmetrics/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,74 @@ export interface AnomalyDetectorConfigSummary {
AnomalyDetectorFrequency?: Frequency | string;
}

export enum DataQualityMetricType {
BACKTEST_INFERENCE_DATA_END_TIME_STAMP = "BACKTEST_INFERENCE_DATA_END_TIME_STAMP",
BACKTEST_INFERENCE_DATA_START_TIME_STAMP = "BACKTEST_INFERENCE_DATA_START_TIME_STAMP",
BACKTEST_TRAINING_DATA_END_TIME_STAMP = "BACKTEST_TRAINING_DATA_END_TIME_STAMP",
BACKTEST_TRAINING_DATA_START_TIME_STAMP = "BACKTEST_TRAINING_DATA_START_TIME_STAMP",
COLUMN_COMPLETENESS = "COLUMN_COMPLETENESS",
DIMENSION_UNIQUENESS = "DIMENSION_UNIQUENESS",
INVALID_ROWS_COMPLIANCE = "INVALID_ROWS_COMPLIANCE",
ROWS_PARTIAL_COMPLIANCE = "ROWS_PARTIAL_COMPLIANCE",
ROWS_PROCESSED = "ROWS_PROCESSED",
TIME_SERIES_COUNT = "TIME_SERIES_COUNT",
}

/**
* <p>An array that describes a data quality metric. Each <code>DataQualityMetric</code> object contains the data quality metric name, its value, a description of the metric, and the affected column.</p>
*/
export interface DataQualityMetric {
/**
* <p>The name of the data quality metric.</p>
*/
MetricType?: DataQualityMetricType | string;

/**
* <p>A description of the data quality metric.</p>
*/
MetricDescription?: string;

/**
* <p>The column that is being monitored.</p>
*/
RelatedColumnName?: string;

/**
* <p>The value of the data quality metric.</p>
*/
MetricValue?: number;
}

/**
* <p>An array of <code>DataQualityMetric</code> objects that describes one or more data quality metrics.</p>
*/
export interface MetricSetDataQualityMetric {
/**
* <p>The Amazon Resource Name (ARN) of the data quality metric array.</p>
*/
MetricSetArn?: string;

/**
* <p>The array of data quality metrics contained in the data quality metric set.</p>
*/
DataQualityMetricList?: DataQualityMetric[];
}

/**
* <p>Aggregated details about the data quality metrics collected for the <code>AnomalyDetectorArn</code> provided in the <a>GetDataQualityMetrics</a> object.</p>
*/
export interface AnomalyDetectorDataQualityMetric {
/**
* <p>The start time for the data quality metrics collection.</p>
*/
StartTimestamp?: Date;

/**
* <p>An array of <code>DataQualityMetricList</code> objects. Each object in the array contains information about a data quality metric.</p>
*/
MetricSetDataQualityMetricList?: MetricSetDataQualityMetric[];
}

export enum AnomalyDetectorFailureType {
ACTIVATION_FAILURE = "ACTIVATION_FAILURE",
BACK_TEST_ACTIVATION_FAILURE = "BACK_TEST_ACTIVATION_FAILURE",
Expand Down Expand Up @@ -1285,7 +1353,7 @@ export interface CreateMetricSetRequest {
MetricList: Metric[] | undefined;

/**
* <p>After an interval ends, the amount of seconds that the detector waits before importing data. Offset is only supported for S3 and Redshift datasources.</p>
* <p>After an interval ends, the amount of seconds that the detector waits before importing data. Offset is only supported for S3, Redshift, Athena and datasources.</p>
*/
Offset?: number;

Expand Down Expand Up @@ -1520,7 +1588,7 @@ export interface DescribeMetricSetResponse {
LastModificationTime?: Date;

/**
* <p>The offset in seconds. Only supported for S3 and Redshift datasources.</p>
* <p>After an interval ends, the amount of seconds that the detector waits before importing data. Offset is only supported for S3, Redshift, Athena and datasources.</p>
*/
Offset?: number;

Expand Down Expand Up @@ -1733,6 +1801,25 @@ export interface GetAnomalyGroupResponse {
AnomalyGroup?: AnomalyGroup;
}

export interface GetDataQualityMetricsRequest {
/**
* <p>The Amazon Resource Name (ARN) of the anomaly detector that you want to investigate.</p>
*/
AnomalyDetectorArn: string | undefined;

/**
* <p>The Amazon Resource Name (ARN) of a specific data quality metric set.</p>
*/
MetricSetArn?: string;
}

export interface GetDataQualityMetricsResponse {
/**
* <p>A list of the data quality metrics for the <code>AnomalyDetectorArn</code> that you requested.</p>
*/
AnomalyDetectorDataQualityMetricList?: AnomalyDetectorDataQualityMetric[];
}

export interface GetFeedbackRequest {
/**
* <p>The Amazon Resource Name (ARN) of the anomaly detector.</p>
Expand Down Expand Up @@ -2284,7 +2371,7 @@ export interface UpdateMetricSetRequest {
MetricList?: Metric[];

/**
* <p>After an interval ends, the amount of seconds that the detector waits before importing data. Offset is only supported for S3 and Redshift datasources.</p>
* <p>After an interval ends, the amount of seconds that the detector waits before importing data. Offset is only supported for S3, Redshift, Athena and datasources.</p>
*/
Offset?: number;

Expand Down Expand Up @@ -2400,6 +2487,27 @@ export const AnomalyDetectorConfigSummaryFilterSensitiveLog = (obj: AnomalyDetec
...obj,
});

/**
* @internal
*/
export const DataQualityMetricFilterSensitiveLog = (obj: DataQualityMetric): any => ({
...obj,
});

/**
* @internal
*/
export const MetricSetDataQualityMetricFilterSensitiveLog = (obj: MetricSetDataQualityMetric): any => ({
...obj,
});

/**
* @internal
*/
export const AnomalyDetectorDataQualityMetricFilterSensitiveLog = (obj: AnomalyDetectorDataQualityMetric): any => ({
...obj,
});

/**
* @internal
*/
Expand Down Expand Up @@ -2845,6 +2953,20 @@ export const GetAnomalyGroupResponseFilterSensitiveLog = (obj: GetAnomalyGroupRe
...obj,
});

/**
* @internal
*/
export const GetDataQualityMetricsRequestFilterSensitiveLog = (obj: GetDataQualityMetricsRequest): any => ({
...obj,
});

/**
* @internal
*/
export const GetDataQualityMetricsResponseFilterSensitiveLog = (obj: GetDataQualityMetricsResponse): any => ({
...obj,
});

/**
* @internal
*/
Expand Down
Loading

0 comments on commit d8ee980

Please sign in to comment.