updateCostCategoryDefinition method

Future<UpdateCostCategoryDefinitionResponse> updateCostCategoryDefinition({
  1. required String costCategoryArn,
  2. required CostCategoryRuleVersion ruleVersion,
  3. required List<CostCategoryRule> rules,
})

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 ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw LimitExceededException.

Parameter costCategoryArn : The unique identifier for your Cost Category.

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

Implementation

Future<UpdateCostCategoryDefinitionResponse> updateCostCategoryDefinition({
  required String costCategoryArn,
  required CostCategoryRuleVersion ruleVersion,
  required List<CostCategoryRule> rules,
}) async {
  ArgumentError.checkNotNull(costCategoryArn, 'costCategoryArn');
  _s.validateStringLength(
    'costCategoryArn',
    costCategoryArn,
    20,
    2048,
    isRequired: true,
  );
  ArgumentError.checkNotNull(ruleVersion, 'ruleVersion');
  ArgumentError.checkNotNull(rules, 'rules');
  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.toValue(),
      'Rules': rules,
    },
  );

  return UpdateCostCategoryDefinitionResponse.fromJson(jsonResponse.body);
}