anomaly_monitor#
State module for managing Amazon anomaly detection monitor.
- async idem_aws.states.aws.costexplorer.anomaly_monitor.present(hub, ctx, name: str, monitor_name: str, monitor_type: str, monitor_dimension: str = None, monitor_specification: Expression = None, resource_id: str = None) Dict[str, Any] [source]#
Creates a new cost anomaly detection monitor with the requested type and monitor specification.
- Parameters:
name (str) – An Idem name of the resource.
monitor_name (str) – Name of anomaly monitor.
monitor_type (str) – Possible type values. Valid Values: DIMENSIONAL | CUSTOM
monitor_dimension (str) – The dimensions to evaluate : SERVICE
resource_id (str, Optional) – Monitor ARN to identify the resource.
monitor_specification (dict[str, Any], Optional) –
- Use Expression to filter by cost or by usage. There are two patterns:
- Simple dimension values
You can set the dimension name and values for the filters that you plan to use. For example, you can filter for REGION==us-east-1 OR REGION==us-west-1. For GetRightsizingRecommendation, the Region is a full name (for example, REGION==US East (N. Virginia). The Expression example is as follows:
{ "Dimensions": { "Key": "REGION", "Values": [ "us-east-1", “us-west-1” ] } }
The list of dimension values are OR’d together to retrieve cost or usage data. You can create Expression and DimensionValues objects using either with* methods or set* methods in multiple lines.
- Compound dimension values with logical operations
You can use multiple Expression types and the logical operators AND/OR/NOT to create a list of one or more Expression objects. By doing this, you can filter on more advanced options. For example, you can filter on ((REGION == us-east-1 OR REGION == us-west-1) OR (TAG.Type == Type1)) AND (USAGE_TYPE != DataTransfer). The Expression for that is as follows:
{ "And": [ {"Or": [ {"Dimensions": { "Key": "REGION", "Values": [ "us-east-1", "us-west-1" ] }}, {"Tags": { "Key": "TagName", "Values": ["Value1"] } } ]}, {"Not": {"Dimensions": { "Key": "USAGE_TYPE", "Values": ["DataTransfer"] }}} ] }
Note
Because each Expression can have only one operator, the service returns an error if more than one is specified. The following example shows an Expression object that creates an error.
{ "And": [ ... ], "DimensionValues": { "Dimension": "USAGE_TYPE", "Values": [ "DataTransfer" ] } }
Note
For the GetRightsizingRecommendation action, a combination of OR and NOT isn’t supported. OR isn’t supported between different dimensions, or dimensions and tags. NOT operators aren’t supported. Dimensions are also limited to LINKED_ACCOUNT, REGION, or RIGHTSIZING_TYPE. For the GetReservationPurchaseRecommendation action, only NOT is supported. AND and OR aren’t supported. Dimensions are limited to LINKED_ACCOUNT.
- Or (list[Expression], Optional):
- Return results that match either Dimension object.
- Or (list[Expression], Optional):
Return results that match either Dimension object.
- And (list[Expression], Optional):
Return results that match both Dimension objects.
- Not (Expression, Optional):
Return results that don’t match a Dimension object.
- Dimensions (DimensionValues, Optional):
- The specific Dimension to use for Expression.
- Key (str, Optional):
The names of the metadata types that you can use to filter and group your results. For example, AZ returns a list of Availability Zones.
- Values (list[str], Optional):
The metadata values that you can use to filter and group your results. You can use GetDimensionValues to find specific values.
- MatchOptions (List[str], Optional):
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE.
- Tags (TagValues, Optional):
- The specific Tag to use for Expression.
- Key (str, Optional):
The key for the tag.
- Values (list[str], Optional):
The specific value of the tag.
- MatchOptions (list[str], Optional):
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to Cost Category. The default values for MatchOptions are EQUALS and CASE_SENSITIVE.
- CostCategories (CostCategoryValues, Optional):
- The filter that’s based on CostCategory values.
- Key (str, Optional):
The unique name of the Cost Category.
- Values (list[str], Optional):
The specific value of the Cost Category.
- MatchOptions (list[str], Optional):
The match options that you can use to filter your results. MatchOptions is only applicable for actions related to cost category. The default values for MatchOptions is EQUALS and CASE_SENSITIVE.
- And (list[Expression], Optional):
Return results that match both Dimension objects.
- Not (Expression, Optional):
Return results that don’t match a Dimension object.
- Dimensions (DimensionValues, Optional):
The specific Dimension to use for Expression.
- Tags (Any, Optional):
The specific Tag to use for Expression.
- CostCategories (Any, Optional):
The filter that’s based on CostCategory values.
- Request Syntax:
[monitor-resource-id]: aws.costexplorer.anomaly_monitor.present: - resource_id: "string" - monitor_name: "string" - monitor_type: "string" - monitor_specification: - Dimensions: "dict"
- Returns:
Dict[str, str]
Examples
cost_monitor1234: aws.costexplorer.anomaly_monitor.present: - name: cost_monitor1234 - resource_id: cost_monitor1234 - monitor_specification: Dimensions: Key: LINKED_ACCOUNT Values: - "820272282974" - monitor_type: CUSTOM
- async idem_aws.states.aws.costexplorer.anomaly_monitor.absent(hub, ctx, name: str, resource_id: str = None) Dict[str, Any] [source]#
Deletes a cost anomaly monitor by the specified monitor ARN as resource_id.
- Parameters:
- Returns:
Dict[str, Any]
Examples
cost_monitor1234: aws.costexplorer.anomaly_monitor.absent: - name: value - resource_id: cost_monitor1234
- async idem_aws.states.aws.costexplorer.anomaly_monitor.describe(hub, ctx) Dict[str, Dict[str, Any]] [source]#
Returns a list of aws cost anomaly monitors.
Describe the resource in a way that can be recreated/managed with the corresponding “present” function. If a monitor arn or name is specified, the list contains only the description of that monitor.
- Returns:
Dict[str, Any]
Examples
$ idem describe aws.costexplorer.anomaly_monitor