createBudget method

Future<void> createBudget({
  1. required String accountId,
  2. required Budget budget,
  3. List<NotificationWithSubscribers>? notificationsWithSubscribers,
  4. List<ResourceTag>? resourceTags,
})

Creates a budget and, if included, notifications and subscribers.

Similarly, only one set of filter and metric selections can be present in the syntax at one time. Either FilterExpression and Metrics or CostFilters and CostTypes, not both or a different combination. We recommend using FilterExpression and Metrics as they provide more flexible and powerful filtering capabilities. The Request Syntax section shows the FilterExpression/Metrics syntax.

May throw AccessDeniedException. May throw BillingViewHealthStatusException. May throw CreationLimitExceededException. May throw DuplicateRecordException. May throw InternalErrorException. May throw InvalidParameterException. May throw NotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException.

Parameter accountId : The accountId that is associated with the budget.

Parameter budget : The budget object that you want to create.

Parameter notificationsWithSubscribers : A notification that you want to associate with a budget. A budget can have up to five notifications, and each notification can have one SNS subscriber and up to 10 email subscribers. If you include notifications and subscribers in your CreateBudget call, Amazon Web Services creates the notifications and subscribers for you.

Parameter resourceTags : An optional list of tags to associate with the specified budget. Each tag consists of a key and a value, and each key must be unique for the resource.

Implementation

Future<void> createBudget({
  required String accountId,
  required Budget budget,
  List<NotificationWithSubscribers>? notificationsWithSubscribers,
  List<ResourceTag>? resourceTags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSBudgetServiceGateway.CreateBudget'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AccountId': accountId,
      'Budget': budget,
      if (notificationsWithSubscribers != null)
        'NotificationsWithSubscribers': notificationsWithSubscribers,
      if (resourceTags != null) 'ResourceTags': resourceTags,
    },
  );
}