cost_category#
State module for managing Amazon Cost Category.
- async idem_aws.states.aws.costexplorer.cost_category.present(hub, ctx, name: str, rules: List[CostCategoryRule], cost_category_name: str, rule_version: str, resource_id: str = None, split_charge_rules: List[CostCategorySplitChargeRule] = None, default_value: str = None, tags: Dict[str, Any] = None) Dict[str, Any] [source]#
Creates a new Cost Category with the requested name and rules.
- Parameters:
name (str) – The unique name of the Cost Category.
rules (list[dict[str, Any]]) –
- The Cost Category rules used to categorize costs.
- Value (str, Optional):
The default value for the cost category.
- Rule (dict[str, Any], Optional):
An Expression object used to categorize costs. This supports dimensions, tags, and nested expressions. Currently the only dimensions supported are LINKED_ACCOUNT, SERVICE_CODE, RECORD_TYPE, and LINKED_ACCOUNT_NAME. Root level OR isn’t supported. We recommend that you create a separate rule instead. RECORD_TYPE is a dimension used for Cost Explorer APIs, and is also supported for Cost Category expressions. This dimension uses different terms, depending on whether you’re using the console or API/JSON editor. For a detailed comparison, see Term Comparisons in the Billing and Cost Management User Guide.
- Or (list[dict[str, Any]], Optional):
- Return results that match either Dimension object.
- Or (list[Any], Optional):
Return results that match either Dimension object.
- And (list[Any], Optional):
Return results that match both Dimension objects.
- Not (Any, Optional):
Return results that don’t match a Dimension object.
- Dimensions (dict[str, Any], 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 (dict[str, Any], 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 (dict[str, Any], 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[Any], Optional):
Return results that match both Dimension objects.
- Not (Any, Optional):
Return results that don’t match a Dimension object.
- Dimensions (Any, 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.
- InheritedValue (dict[str, Any], Optional):
- The value the line item is categorized as if the line item contains the matched dimension.
- DimensionName (str, Optional):
The name of the dimension that’s used to group costs. If you specify LINKED_ACCOUNT_NAME, the cost category value is based on account name. If you specify TAG, the cost category value is based on the value of the specified tag key.
- DimensionKey (str, Optional):
The key to extract cost category values.
- Type (str, Optional):
You can define the CostCategoryRule rule type as either REGULAR or INHERITED_VALUE. The INHERITED_VALUE rule type adds the flexibility to define a rule that dynamically inherits the cost category value. This value is from the dimension value that’s defined by CostCategoryInheritedValueDimension. For example, suppose that you want to costs to be dynamically grouped based on the value of a specific tag key. First, choose an inherited value rule type, and then choose the tag dimension and specify the tag key to use.
cost_category_name (str) – Name of Cost Category.
rule_version (str) – The rule schema version in this particular Cost Category.
tags (dict[str, Any]]) – Each tag consists of a key and a value, and each key must be unique for the resource.
resource_id (str, Optional) – Cost Category ARN to identify the resource.
split_charge_rules (list[dict[str, Any]], Optional) –
- The split charge rules used to allocate your charges between your Cost Category values. Defaults to None.
- Source (str):
The Cost Category value that you want to split. That value can’t be used as a source or a target in other split charge rules. To indicate uncategorized costs, you can use an empty string as the source.
- Targets (list[str]):
The Cost Category values that you want to split costs across. These values can’t be used as a source in other split charge rules.
- Method (str):
The method that’s used to define how to split your source costs across your targets. Proportional - Allocates charges across your targets based on the proportional weighted cost of each target. Fixed - Allocates charges across your targets based on your defined allocation percentage. >Even - Allocates costs evenly across all targets.
- Parameters (list[dict[str, Any]], Optional):
The parameters for a split charge method. This is only required for the FIXED method.
- Type (str):
The parameter type.
- Values (list[str]):
The parameter values.
default_value (str, Optional) – The default value for the cost category.
- Request Syntax:
[monitor-resource-id]: aws.costexplorer.cost_category.present: - resource_id: "string" - tags: "dict" - cost_category_name: "string" - effective_start: "string" - rules: - Rule: Dimensions: Key: "string" MatchOptions: - EQUALS Values: - "string" Type: "string" Value: "string" - split_charge_rules: - Method: "string" Parameters: - Type: "string" Values: - "string" - "string" Source: "string" Targets: - "string" - processing_status: - Component: "string" Status: "string" - default_value: "string"
- Returns:
Dict[str, str]
Examples
arn:aws:ce::1234567891012:costcategory/4e9662f0-5533-4fdf-8224-9bb9f82d0a39: aws.costexplorer.cost_category.present: - resource_id: arn:aws:ce::1234567891012:costcategory/4e9662f0-5533-4fdf-8224-9bb9f82d0a39 - tags: name: test_category - cost_category_name: test_category - effective_start: "2022-06-01T00:00:00Z" - rule_version: CostCategoryExpression.v1 - rules: - Rule: Dimensions: Key: LINKED_ACCOUNT MatchOptions: - EQUALS Values: - "107488843946" Type: REGULAR Value: Alpha - Rule: Dimensions: Key: LINKED_ACCOUNT MatchOptions: - EQUALS Values: - 011922870716 Type: REGULAR Value: Beta - Rule: Dimensions: Key: LINKED_ACCOUNT MatchOptions: - EQUALS Values: - "332986752459" Type: REGULAR Value: Gamma - split_charge_rules: - Method: FIXED Parameters: - Type: ALLOCATION_PERCENTAGES Values: - "40" - "60" Source: Alpha Targets: - Beta - Gamma - processing_status: - Component: COST_EXPLORER Status: PROCESSING - default_value: Other
- async idem_aws.states.aws.costexplorer.cost_category.absent(hub, ctx, name: str, resource_id: str = None) Dict[str, Any] [source]#
Deletes a cost category.
- Parameters:
- Returns:
Dict[str, Any]
Examples
resource_is_absent: aws.costexplorer.cost_category.absent: - name: value - resource_id: value
- async idem_aws.states.aws.costexplorer.cost_category.describe(hub, ctx) Dict[str, Dict[str, Any]] [source]#
Returns a list of aws cost categories.
Describe the resource in a way that can be recreated/managed with the corresponding “present” function.
- Returns:
dict[str, Any]
Examples
$ idem describe aws.costexplorer.cost_category