createCustomLineItem method
- required String billingGroupArn,
- required CustomLineItemChargeDetails chargeDetails,
- required String description,
- required String name,
- String? accountId,
- CustomLineItemBillingPeriodRange? billingPeriodRange,
- String? clientToken,
- ComputationRuleEnum? computationRule,
- PresentationObject? presentationDetails,
- Map<
String, String> ? tags,
Creates a custom line item that can be used to create a one-time fixed charge that can be applied to a single billing group for the current or previous billing period. The one-time fixed charge is either a fee or discount.
May throw AccessDeniedException.
May throw ConflictException.
May throw InternalServerException.
May throw ServiceLimitExceededException.
May throw ThrottlingException.
May throw ValidationException.
Parameter billingGroupArn :
The Amazon Resource Name (ARN) that references the billing group where the
custom line item applies to.
Parameter chargeDetails :
A CustomLineItemChargeDetails that describes the charge
details for a custom line item.
Parameter description :
The description of the custom line item. This is shown on the Bills page
in association with the charge value.
Parameter name :
The name of the custom line item.
Parameter accountId :
The Amazon Web Services account in which this custom line item will be
applied to.
Parameter billingPeriodRange :
A time range for which the custom line item is effective.
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 computationRule :
Specifies how the custom line item charges are computed.
Parameter presentationDetails :
Details controlling how the custom line item charges are presented in the
bill. Contains specifications for which service the charges will be shown
under.
Parameter tags :
A map that contains tag keys and tag values that are attached to a custom
line item.
Implementation
Future<CreateCustomLineItemOutput> createCustomLineItem({
required String billingGroupArn,
required CustomLineItemChargeDetails chargeDetails,
required String description,
required String name,
String? accountId,
CustomLineItemBillingPeriodRange? billingPeriodRange,
String? clientToken,
ComputationRuleEnum? computationRule,
PresentationObject? presentationDetails,
Map<String, String>? tags,
}) async {
final headers = <String, String>{
if (clientToken != null) 'X-Amzn-Client-Token': clientToken.toString(),
};
final $payload = <String, dynamic>{
'BillingGroupArn': billingGroupArn,
'ChargeDetails': chargeDetails,
'Description': description,
'Name': name,
if (accountId != null) 'AccountId': accountId,
if (billingPeriodRange != null) 'BillingPeriodRange': billingPeriodRange,
if (computationRule != null) 'ComputationRule': computationRule.value,
if (presentationDetails != null)
'PresentationDetails': presentationDetails,
if (tags != null) 'Tags': tags,
};
final response = await _protocol.send(
payload: $payload,
method: 'POST',
requestUri: '/create-custom-line-item',
headers: headers,
exceptionFnMap: _exceptionFns,
);
return CreateCustomLineItemOutput.fromJson(response);
}