createBillingView method

Future<CreateBillingViewResponse> createBillingView({
  1. required String name,
  2. required List<String> sourceViews,
  3. String? clientToken,
  4. Expression? dataFilterExpression,
  5. String? description,
  6. List<ResourceTag>? resourceTags,
})

Creates a billing view with the specified billing view attributes.

May throw AccessDeniedException. May throw BillingViewHealthStatusException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter name : The name of the billing view.

Parameter sourceViews : A list of billing views used as the data source for the custom billing view.

Parameter clientToken : A unique, case-sensitive identifier you specify to ensure idempotency of the request. Idempotency ensures that an API request completes no more than one time. If the original request completes successfully, any subsequent retries complete successfully without performing any further actions with an idempotent request.

Parameter dataFilterExpression : See Expression. Billing view only supports LINKED_ACCOUNT, Tags, and CostCategories.

Parameter description : The description of the billing view.

Parameter resourceTags : A list of key value map specifying tags associated to the billing view being created.

Implementation

Future<CreateBillingViewResponse> createBillingView({
  required String name,
  required List<String> sourceViews,
  String? clientToken,
  Expression? dataFilterExpression,
  String? description,
  List<ResourceTag>? resourceTags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AWSBilling.CreateBillingView'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'name': name,
      'sourceViews': sourceViews,
      'clientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (dataFilterExpression != null)
        'dataFilterExpression': dataFilterExpression,
      if (description != null) 'description': description,
      if (resourceTags != null) 'resourceTags': resourceTags,
    },
  );

  return CreateBillingViewResponse.fromJson(jsonResponse.body);
}