createNotification method

Future<void> createNotification({
  1. required String accountId,
  2. required String budgetName,
  3. required Notification notification,
  4. required List<Subscriber> subscribers,
})

Creates a notification. You must create the budget before you create the associated notification.

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

Parameter accountId : The accountId that is associated with the budget that you want to create a notification for.

Parameter budgetName : The name of the budget that you want AWS to notify you about. Budget names must be unique within an account.

Parameter notification : The notification that you want to create.

Parameter subscribers : A list of subscribers that you want to associate with the notification. Each notification can have one SNS subscriber and up to 10 email subscribers.

Implementation

Future<void> createNotification({
  required String accountId,
  required String budgetName,
  required Notification notification,
  required List<Subscriber> subscribers,
}) async {
  ArgumentError.checkNotNull(accountId, 'accountId');
  _s.validateStringLength(
    'accountId',
    accountId,
    12,
    12,
    isRequired: true,
  );
  ArgumentError.checkNotNull(budgetName, 'budgetName');
  _s.validateStringLength(
    'budgetName',
    budgetName,
    1,
    100,
    isRequired: true,
  );
  ArgumentError.checkNotNull(notification, 'notification');
  ArgumentError.checkNotNull(subscribers, 'subscribers');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSBudgetServiceGateway.CreateNotification'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AccountId': accountId,
      'BudgetName': budgetName,
      'Notification': notification,
      'Subscribers': subscribers,
    },
  );
}