createBudget method

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

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

May throw InvalidParameterException. May throw InternalErrorException. May throw CreationLimitExceededException. May throw DuplicateRecordException. May throw AccessDeniedException.

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, AWS creates the notifications and subscribers for you.

Implementation

Future<void> createBudget({
  required String accountId,
  required Budget budget,
  List<NotificationWithSubscribers>? notificationsWithSubscribers,
}) async {
  ArgumentError.checkNotNull(accountId, 'accountId');
  _s.validateStringLength(
    'accountId',
    accountId,
    12,
    12,
    isRequired: true,
  );
  ArgumentError.checkNotNull(budget, 'budget');
  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,
    },
  );
}