createBillingGroup method
Creates a billing group that resembles a consolidated billing family that Amazon Web Services charges, based off of the predefined pricing plan computation.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ServiceLimitExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter accountGrouping :
The set of accounts that will be under the billing group. The set of
accounts resemble the linked accounts in a consolidated billing family.
Parameter computationPreference :
The preferences and settings that will be used to compute the Amazon Web
Services charges for a billing group.
Parameter name :
The billing group name. The names must be unique.
Parameter clientToken :
A unique, case-sensitive identifier that you specify to ensure idempotency
of the request. Idempotency ensures that an API request completes no more
than one time. With an idempotent request, if the original request
completes successfully, any subsequent retries complete successfully
without performing any further actions.
Parameter description :
The description of the billing group.
Parameter primaryAccountId :
The account ID that serves as the main account in a billing group.
Parameter tags :
A map that contains tag keys and tag values that are attached to a billing
group. This feature isn't available during the beta.
Implementation
Future<CreateBillingGroupOutput> createBillingGroup({
required AccountGrouping accountGrouping,
required ComputationPreference computationPreference,
required String name,
String? clientToken,
String? description,
String? primaryAccountId,
Map<String, String>? tags,
}) async {
final headers = <String, String>{
if (clientToken != null) 'X-Amzn-Client-Token': clientToken.toString(),
};
final $payload = <String, dynamic>{
'AccountGrouping': accountGrouping,
'ComputationPreference': computationPreference,
'Name': name,
if (description != null) 'Description': description,
if (primaryAccountId != null) 'PrimaryAccountId': primaryAccountId,
if (tags != null) 'Tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/create-billing-group',
headers: headers,
exceptionFnMap: _exceptionFns,
);
return CreateBillingGroupOutput.fromJson(response);
}