createCostCategoryDefinition method
Creates a new cost category with the requested name and rules.
May throw LimitExceededException.
May throw ServiceQuotaExceededException.
Parameter rules :
The cost category rules 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 resourceTags :
An optional list of tags to associate with the specified
CostCategory . You can use resource tags to control
access to your cost category using IAM policies.
Each tag consists of a key and a value, and each key must be unique for the resource. The following restrictions apply to resource tags:
- Although the maximum number of array members is 200, you can assign a maximum of 50 user-tags to one resource. The remaining are reserved for Amazon Web Services use
- The maximum length of a key is 128 characters
- The maximum length of a value is 256 characters
-
Keys and values can only contain alphanumeric characters, spaces, and any
of the following:
_.:/=+@- - Keys and values are case sensitive
- Keys and values are trimmed for any leading or trailing whitespaces
-
Don’t use
aws:as a prefix for your keys. This prefix is reserved for Amazon Web Services use
Parameter splitChargeRules :
The split charge rules used to allocate your charges between your cost
category values.
Implementation
Future<CreateCostCategoryDefinitionResponse> createCostCategoryDefinition({
required String name,
required CostCategoryRuleVersion ruleVersion,
required List<CostCategoryRule> rules,
String? defaultValue,
String? effectiveStart,
List<ResourceTag>? resourceTags,
List<CostCategorySplitChargeRule>? splitChargeRules,
}) async {
final headers = <String, String>{
'Content-Type': 'application/x-amz-json-1.1',
'X-Amz-Target': 'AWSInsightsIndexService.CreateCostCategoryDefinition'
};
final jsonResponse = await _protocol.send(
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
// TODO queryParams
headers: headers,
payload: {
'Name': name,
'RuleVersion': ruleVersion.value,
'Rules': rules,
if (defaultValue != null) 'DefaultValue': defaultValue,
if (effectiveStart != null) 'EffectiveStart': effectiveStart,
if (resourceTags != null) 'ResourceTags': resourceTags,
if (splitChargeRules != null) 'SplitChargeRules': splitChargeRules,
},
);
return CreateCostCategoryDefinitionResponse.fromJson(jsonResponse.body);
}