Skip to content

update_cost_category_definition

update_cost_category_definition(
    cost_category_arn: Arn,
    rule_version: CostCategoryRuleVersion,
    rules: CostCategoryRulesList,
    *,
    config_overrides: Optional[CostExplorerClientConfig] = None,
    effective_start: Optional[ZonedDateTime] = None,
    default_value: Optional[CostCategoryValue] = None,
    split_charge_rules: Optional[CostCategorySplitChargeRulesList] = None,
) -> UpdateCostCategoryDefinitionResponse

Updates an existing cost category. Changes made to the cost category rules will be used to categorize the current month’s expenses and future expenses. This won’t change categorization for the previous months.

Parameters:

  • cost_category_arn (Arn) –

    The unique identifier for your cost category.

  • effective_start (Optional[ZonedDateTime], default: None ) –

    The cost category's effective start date. It can only be a billing start date (first day of the month). If the date isn't provided, it's the first day of the current month. Dates can't be before the previous twelve months, or in the future.

  • rules (CostCategoryRulesList) –

    The Expression object used to categorize costs. For more information, see CostCategoryRule .

  • split_charge_rules (Optional[CostCategorySplitChargeRulesList], default: None ) –

    The split charge rules used to allocate your charges between your cost category values.

Raises:

Source code in docs_src/capo_cost_explorer/_services/cost_explorer.py
def update_cost_category_definition(
    self,
    cost_category_arn: "capo_cost_explorer.types.arn.Arn",
    rule_version: "capo_cost_explorer.types.cost_category_rule_version.CostCategoryRuleVersion",
    rules: "capo_cost_explorer.types.cost_category_rules_list.CostCategoryRulesList",
    *,
    config_overrides: Optional[CostExplorerClientConfig] = None,
    effective_start: Optional[
        "capo_cost_explorer.types.zoned_date_time.ZonedDateTime"
    ] = None,
    default_value: Optional[
        "capo_cost_explorer.types.cost_category_value.CostCategoryValue"
    ] = None,
    split_charge_rules: Optional[
        "capo_cost_explorer.types.cost_category_split_charge_rules_list.CostCategorySplitChargeRulesList"
    ] = None,
) -> "capo_cost_explorer.types.update_cost_category_definition_response.UpdateCostCategoryDefinitionResponse":
    """<p>Updates an existing cost category. Changes made to the cost category rules will be used to categorize the current month’s expenses and future expenses. This won’t change categorization for the previous months.</p>

    Args:
        cost_category_arn: <p>The unique identifier for your cost category.</p>
        effective_start: <p>The cost category's effective start date. It can only be a billing start date (first day of the month). If the date isn't provided, it's the first day of the current month. Dates can't be before the previous twelve months, or in the future.</p>
        rules: <p>The <code>Expression</code> object used to categorize costs. For more information, see <a href="https://docs.aws.amazon.com/aws-cost-management/latest/APIReference/API_CostCategoryRule.html">CostCategoryRule </a>. </p>
        split_charge_rules: <p> The split charge rules used to allocate your charges between your cost category values. </p>

    Raises:
        capo_cost_explorer.errors.limit_exceeded_exception.LimitExceededException: <p>You made too many calls in a short period of time. Try again later.</p>
        capo_cost_explorer.errors.resource_not_found_exception.ResourceNotFoundException: <p> The specified ARN in the request doesn't exist. </p>
        capo_cost_explorer.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p> You've reached the limit on the number of resources you can create, or exceeded the size of an individual resource. </p>
        capo_cost_explorer.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_cost_explorer.types.update_cost_category_definition_request.UpdateCostCategoryDefinitionRequest]",
    ) -> OperationResponse[
        "capo_cost_explorer.types.update_cost_category_definition_response.UpdateCostCategoryDefinitionResponse"
    ]:
        import capo_cost_explorer._operations.aws_insights_index_service.update_cost_category_definition

        output, http_response = (
            capo_cost_explorer._operations.aws_insights_index_service.update_cost_category_definition.update_cost_category_definition(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("UpdateCostCategoryDefinition")
    )
    input_: capo_cost_explorer.types.update_cost_category_definition_request.UpdateCostCategoryDefinitionRequest = {
        "cost_category_arn": cost_category_arn,
        "rule_version": rule_version,
        "rules": rules,
    }
    if effective_start is not None:
        input_["effective_start"] = effective_start
    if default_value is not None:
        input_["default_value"] = default_value
    if split_charge_rules is not None:
        input_["split_charge_rules"] = split_charge_rules

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output