Skip to content

Commit

Permalink
feat(client-lookoutmetrics): Release dimension value filtering featur…
Browse files Browse the repository at this point in the history
…e to allow customers to define dimension filters for including only a subset of their dataset to be used by LookoutMetrics.
  • Loading branch information
awstools committed Sep 8, 2022
1 parent 3d46a39 commit 495f023
Show file tree
Hide file tree
Showing 3 changed files with 246 additions and 0 deletions.
66 changes: 66 additions & 0 deletions clients/client-lookoutmetrics/src/models/models_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1056,6 +1056,40 @@ export interface CreateAnomalyDetectorResponse {
AnomalyDetectorArn?: string;
}

export enum FilterOperation {
EQUALS = "EQUALS",
}

/**
* <p>Describes a filter for choosing a subset of dimension values. Each filter consists of the dimension that you want to include and the condition statement. The condition statement is specified in the <code>FilterOperation</code> object.</p>
*/
export interface Filter {
/**
* <p>The value that you want to include in the filter.</p>
*/
DimensionValue?: string;

/**
* <p>The condition to apply.</p>
*/
FilterOperation?: FilterOperation | string;
}

/**
* <p>Describes a list of filters for choosing a subset of dimension values. Each filter consists of the dimension and one of its values that you want to include. When multiple dimensions or values are specified, the dimensions are joined with an AND operation and the values are joined with an OR operation. </p>
*/
export interface MetricSetDimensionFilter {
/**
* <p>The dimension that you want to filter on.</p>
*/
Name?: string;

/**
* <p>The list of filters that you are applying.</p>
*/
FilterList?: Filter[];
}

/**
* <p>A calculation made by contrasting a measure and a dimension from your source data.</p>
*/
Expand Down Expand Up @@ -1386,6 +1420,11 @@ export interface CreateMetricSetRequest {
* <p>A list of <a href="https://docs.aws.amazon.com/lookoutmetrics/latest/dev/detectors-tags.html">tags</a> to apply to the dataset.</p>
*/
Tags?: Record<string, string>;

/**
* <p>A list of filters that specify which data is kept for anomaly detection.</p>
*/
DimensionFilterList?: MetricSetDimensionFilter[];
}

export interface CreateMetricSetResponse {
Expand Down Expand Up @@ -1621,6 +1660,11 @@ export interface DescribeMetricSetResponse {
* <p>Contains information about the dataset's source data.</p>
*/
MetricSource?: MetricSource;

/**
* <p>The dimensions and their values that were used to filter the dataset.</p>
*/
DimensionFilterList?: MetricSetDimensionFilter[];
}

/**
Expand Down Expand Up @@ -2394,6 +2438,14 @@ export interface UpdateMetricSetRequest {
* <p>Contains information about source data used to generate metrics.</p>
*/
MetricSource?: MetricSource;

/**
* <p>Describes a list of filters for choosing specific dimensions and specific values. Each
* filter consists of the dimension and one of its values that you want to include. When
* multiple dimensions or values are specified, the dimensions are joined with an AND operation
* and the values are joined with an OR operation.</p>
*/
DimensionFilterList?: MetricSetDimensionFilter[];
}

export interface UpdateMetricSetResponse {
Expand Down Expand Up @@ -2676,6 +2728,20 @@ export const CreateAnomalyDetectorResponseFilterSensitiveLog = (obj: CreateAnoma
...obj,
});

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

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

/**
* @internal
*/
Expand Down
94 changes: 94 additions & 0 deletions clients/client-lookoutmetrics/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ import {
DimensionValueContribution,
ExecutionStatus,
FileFormatDescriptor,
Filter,
InterMetricImpactDetails,
InternalServerException,
ItemizedMetricStats,
Expand All @@ -144,6 +145,7 @@ import {
Metric,
MetricLevelImpact,
MetricSetDataQualityMetric,
MetricSetDimensionFilter,
MetricSetSummary,
MetricSource,
RDSSourceConfig,
Expand Down Expand Up @@ -286,6 +288,9 @@ export const serializeAws_restJson1CreateMetricSetCommand = async (
let body: any;
body = JSON.stringify({
...(input.AnomalyDetectorArn != null && { AnomalyDetectorArn: input.AnomalyDetectorArn }),
...(input.DimensionFilterList != null && {
DimensionFilterList: serializeAws_restJson1MetricSetDimensionFilterList(input.DimensionFilterList, context),
}),
...(input.DimensionList != null && {
DimensionList: serializeAws_restJson1DimensionList(input.DimensionList, context),
}),
Expand Down Expand Up @@ -958,6 +963,9 @@ export const serializeAws_restJson1UpdateMetricSetCommand = async (
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/UpdateMetricSet";
let body: any;
body = JSON.stringify({
...(input.DimensionFilterList != null && {
DimensionFilterList: serializeAws_restJson1MetricSetDimensionFilterList(input.DimensionFilterList, context),
}),
...(input.DimensionList != null && {
DimensionList: serializeAws_restJson1DimensionList(input.DimensionList, context),
}),
Expand Down Expand Up @@ -1626,6 +1634,12 @@ export const deserializeAws_restJson1DescribeMetricSetCommand = async (
if (data.CreationTime != null) {
contents.CreationTime = __expectNonNull(__parseEpochTimestamp(__expectNumber(data.CreationTime)));
}
if (data.DimensionFilterList != null) {
contents.DimensionFilterList = deserializeAws_restJson1MetricSetDimensionFilterList(
data.DimensionFilterList,
context
);
}
if (data.DimensionList != null) {
contents.DimensionList = deserializeAws_restJson1DimensionList(data.DimensionList, context);
}
Expand Down Expand Up @@ -2985,6 +2999,21 @@ const serializeAws_restJson1FileFormatDescriptor = (input: FileFormatDescriptor,
};
};

const serializeAws_restJson1Filter = (input: Filter, context: __SerdeContext): any => {
return {
...(input.DimensionValue != null && { DimensionValue: input.DimensionValue }),
...(input.FilterOperation != null && { FilterOperation: input.FilterOperation }),
};
};

const serializeAws_restJson1FilterList = (input: Filter[], context: __SerdeContext): any => {
return input
.filter((e: any) => e != null)
.map((entry) => {
return serializeAws_restJson1Filter(entry, context);
});
};

const serializeAws_restJson1HeaderList = (input: string[], context: __SerdeContext): any => {
return input
.filter((e: any) => e != null)
Expand Down Expand Up @@ -3039,6 +3068,27 @@ const serializeAws_restJson1MetricNameList = (input: string[], context: __SerdeC
});
};

const serializeAws_restJson1MetricSetDimensionFilter = (
input: MetricSetDimensionFilter,
context: __SerdeContext
): any => {
return {
...(input.FilterList != null && { FilterList: serializeAws_restJson1FilterList(input.FilterList, context) }),
...(input.Name != null && { Name: input.Name }),
};
};

const serializeAws_restJson1MetricSetDimensionFilterList = (
input: MetricSetDimensionFilter[],
context: __SerdeContext
): any => {
return input
.filter((e: any) => e != null)
.map((entry) => {
return serializeAws_restJson1MetricSetDimensionFilter(entry, context);
});
};

const serializeAws_restJson1MetricSource = (input: MetricSource, context: __SerdeContext): any => {
return {
...(input.AppFlowConfig != null && {
Expand Down Expand Up @@ -3740,6 +3790,25 @@ const deserializeAws_restJson1FileFormatDescriptor = (output: any, context: __Se
} as any;
};

const deserializeAws_restJson1Filter = (output: any, context: __SerdeContext): Filter => {
return {
DimensionValue: __expectString(output.DimensionValue),
FilterOperation: __expectString(output.FilterOperation),
} as any;
};

const deserializeAws_restJson1FilterList = (output: any, context: __SerdeContext): Filter[] => {
const retVal = (output || [])
.filter((e: any) => e != null)
.map((entry: any) => {
if (entry === null) {
return null as any;
}
return deserializeAws_restJson1Filter(entry, context);
});
return retVal;
};

const deserializeAws_restJson1HeaderList = (output: any, context: __SerdeContext): string[] => {
const retVal = (output || [])
.filter((e: any) => e != null)
Expand Down Expand Up @@ -3922,6 +3991,31 @@ const deserializeAws_restJson1MetricSetDataQualityMetricList = (
return retVal;
};

const deserializeAws_restJson1MetricSetDimensionFilter = (
output: any,
context: __SerdeContext
): MetricSetDimensionFilter => {
return {
FilterList: output.FilterList != null ? deserializeAws_restJson1FilterList(output.FilterList, context) : undefined,
Name: __expectString(output.Name),
} as any;
};

const deserializeAws_restJson1MetricSetDimensionFilterList = (
output: any,
context: __SerdeContext
): MetricSetDimensionFilter[] => {
const retVal = (output || [])
.filter((e: any) => e != null)
.map((entry: any) => {
if (entry === null) {
return null as any;
}
return deserializeAws_restJson1MetricSetDimensionFilter(entry, context);
});
return retVal;
};

const deserializeAws_restJson1MetricSetSummary = (output: any, context: __SerdeContext): MetricSetSummary => {
return {
AnomalyDetectorArn: __expectString(output.AnomalyDetectorArn),
Expand Down
86 changes: 86 additions & 0 deletions codegen/sdk-codegen/aws-models/lookoutmetrics.json
Original file line number Diff line number Diff line change
Expand Up @@ -1453,6 +1453,12 @@
"traits": {
"smithy.api#documentation": "<p>A list of <a href=\"https://docs.aws.amazon.com/lookoutmetrics/latest/dev/detectors-tags.html\">tags</a> to apply to the dataset.</p>"
}
},
"DimensionFilterList": {
"target": "com.amazonaws.lookoutmetrics#MetricSetDimensionFilterList",
"traits": {
"smithy.api#documentation": "<p>A list of filters that specify which data is kept for anomaly detection.</p>"
}
}
}
},
Expand Down Expand Up @@ -2186,6 +2192,12 @@
"traits": {
"smithy.api#documentation": "<p>Contains information about the dataset's source data.</p>"
}
},
"DimensionFilterList": {
"target": "com.amazonaws.lookoutmetrics#MetricSetDimensionFilterList",
"traits": {
"smithy.api#documentation": "<p>The dimensions and their values that were used to filter the dataset.</p>"
}
}
}
},
Expand Down Expand Up @@ -2625,6 +2637,48 @@
"smithy.api#documentation": "<p>Contains information about a source file's formatting.</p>"
}
},
"com.amazonaws.lookoutmetrics#Filter": {
"type": "structure",
"members": {
"DimensionValue": {
"target": "com.amazonaws.lookoutmetrics#DimensionValue",
"traits": {
"smithy.api#documentation": "<p>The value that you want to include in the filter.</p>"
}
},
"FilterOperation": {
"target": "com.amazonaws.lookoutmetrics#FilterOperation",
"traits": {
"smithy.api#documentation": "<p>The condition to apply.</p>"
}
}
},
"traits": {
"smithy.api#documentation": "<p>Describes a filter for choosing a subset of dimension values. Each filter consists of the dimension that you want to include and the condition statement. The condition statement is specified in the <code>FilterOperation</code> object.</p>"
}
},
"com.amazonaws.lookoutmetrics#FilterList": {
"type": "list",
"member": {
"target": "com.amazonaws.lookoutmetrics#Filter"
},
"traits": {
"smithy.api#length": {
"min": 1
}
}
},
"com.amazonaws.lookoutmetrics#FilterOperation": {
"type": "string",
"traits": {
"smithy.api#enum": [
{
"value": "EQUALS",
"name": "EQUALS"
}
]
}
},
"com.amazonaws.lookoutmetrics#FlowName": {
"type": "string",
"traits": {
Expand Down Expand Up @@ -3973,6 +4027,32 @@
"smithy.api#pattern": "\\S"
}
},
"com.amazonaws.lookoutmetrics#MetricSetDimensionFilter": {
"type": "structure",
"members": {
"Name": {
"target": "com.amazonaws.lookoutmetrics#ColumnName",
"traits": {
"smithy.api#documentation": "<p>The dimension that you want to filter on.</p>"
}
},
"FilterList": {
"target": "com.amazonaws.lookoutmetrics#FilterList",
"traits": {
"smithy.api#documentation": "<p>The list of filters that you are applying.</p>"
}
}
},
"traits": {
"smithy.api#documentation": "<p>Describes a list of filters for choosing a subset of dimension values. Each filter consists of the dimension and one of its values that you want to include. When multiple dimensions or values are specified, the dimensions are joined with an AND operation and the values are joined with an OR operation. </p>"
}
},
"com.amazonaws.lookoutmetrics#MetricSetDimensionFilterList": {
"type": "list",
"member": {
"target": "com.amazonaws.lookoutmetrics#MetricSetDimensionFilter"
}
},
"com.amazonaws.lookoutmetrics#MetricSetName": {
"type": "string",
"traits": {
Expand Down Expand Up @@ -5224,6 +5304,12 @@
},
"MetricSource": {
"target": "com.amazonaws.lookoutmetrics#MetricSource"
},
"DimensionFilterList": {
"target": "com.amazonaws.lookoutmetrics#MetricSetDimensionFilterList",
"traits": {
"smithy.api#documentation": "<p>Describes a list of filters for choosing specific dimensions and specific values. Each\n filter consists of the dimension and one of its values that you want to include. When\n multiple dimensions or values are specified, the dimensions are joined with an AND operation\n and the values are joined with an OR operation.</p>"
}
}
}
},
Expand Down

0 comments on commit 495f023

Please sign in to comment.