createPricingPlan method

Future<CreatePricingPlanOutput> createPricingPlan({
  1. required String name,
  2. String? clientToken,
  3. String? description,
  4. List<String>? pricingRuleArns,
  5. Map<String, String>? tags,
})

Creates a pricing plan that is used for computing Amazon Web Services charges for billing groups.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceLimitExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter name : The name of the pricing plan. The names must be unique to each pricing plan.

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 pricing plan.

Parameter pricingRuleArns : A list of Amazon Resource Names (ARNs) that define the pricing plan parameters.

Parameter tags : A map that contains tag keys and tag values that are attached to a pricing plan.

Implementation

Future<CreatePricingPlanOutput> createPricingPlan({
  required String name,
  String? clientToken,
  String? description,
  List<String>? pricingRuleArns,
  Map<String, String>? tags,
}) async {
  final headers = <String, String>{
    if (clientToken != null) 'X-Amzn-Client-Token': clientToken.toString(),
  };
  final $payload = <String, dynamic>{
    'Name': name,
    if (description != null) 'Description': description,
    if (pricingRuleArns != null) 'PricingRuleArns': pricingRuleArns,
    if (tags != null) 'Tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/create-pricing-plan',
    headers: headers,
    exceptionFnMap: _exceptionFns,
  );
  return CreatePricingPlanOutput.fromJson(response);
}