updateCostCategoryDefinition method

Future<UpdateCostCategoryDefinitionResponse> updateCostCategoryDefinition({
  1. required String costCategoryArn,
  2. required CostCategoryRuleVersion ruleVersion,
  3. required List<CostCategoryRule> rules,
  4. String? defaultValue,
  5. String? effectiveStart,
  6. List<CostCategorySplitChargeRule>? splitChargeRules,
})

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.

May throw LimitExceededException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException.

Parameter costCategoryArn : The unique identifier for your cost category.

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

Parameter effectiveStart : 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.

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

Implementation

Future<UpdateCostCategoryDefinitionResponse> updateCostCategoryDefinition({
  required String costCategoryArn,
  required CostCategoryRuleVersion ruleVersion,
  required List<CostCategoryRule> rules,
  String? defaultValue,
  String? effectiveStart,
  List<CostCategorySplitChargeRule>? splitChargeRules,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSInsightsIndexService.UpdateCostCategoryDefinition'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'CostCategoryArn': costCategoryArn,
      'RuleVersion': ruleVersion.value,
      'Rules': rules,
      if (defaultValue != null) 'DefaultValue': defaultValue,
      if (effectiveStart != null) 'EffectiveStart': effectiveStart,
      if (splitChargeRules != null) 'SplitChargeRules': splitChargeRules,
    },
  );

  return UpdateCostCategoryDefinitionResponse.fromJson(jsonResponse.body);
}