createBudgetAction method

Future<CreateBudgetActionResponse> createBudgetAction({
  1. required String accountId,
  2. required ActionThreshold actionThreshold,
  3. required ActionType actionType,
  4. required ApprovalModel approvalModel,
  5. required String budgetName,
  6. required Definition definition,
  7. required String executionRoleArn,
  8. required NotificationType notificationType,
  9. required List<Subscriber> subscribers,
})

Creates a budget action.

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

Parameter actionType : The type of action. This defines the type of tasks that can be carried out by this action. This field also determines the format for definition.

Parameter approvalModel : This specifies if the action needs manual or automatic approval.

Parameter executionRoleArn : The role passed for action execution and reversion. Roles and actions must be in the same account.

Implementation

Future<CreateBudgetActionResponse> createBudgetAction({
  required String accountId,
  required ActionThreshold actionThreshold,
  required ActionType actionType,
  required ApprovalModel approvalModel,
  required String budgetName,
  required Definition definition,
  required String executionRoleArn,
  required NotificationType notificationType,
  required List<Subscriber> subscribers,
}) async {
  ArgumentError.checkNotNull(accountId, 'accountId');
  _s.validateStringLength(
    'accountId',
    accountId,
    12,
    12,
    isRequired: true,
  );
  ArgumentError.checkNotNull(actionThreshold, 'actionThreshold');
  ArgumentError.checkNotNull(actionType, 'actionType');
  ArgumentError.checkNotNull(approvalModel, 'approvalModel');
  ArgumentError.checkNotNull(budgetName, 'budgetName');
  _s.validateStringLength(
    'budgetName',
    budgetName,
    1,
    100,
    isRequired: true,
  );
  ArgumentError.checkNotNull(definition, 'definition');
  ArgumentError.checkNotNull(executionRoleArn, 'executionRoleArn');
  _s.validateStringLength(
    'executionRoleArn',
    executionRoleArn,
    32,
    618,
    isRequired: true,
  );
  ArgumentError.checkNotNull(notificationType, 'notificationType');
  ArgumentError.checkNotNull(subscribers, 'subscribers');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'AWSBudgetServiceGateway.CreateBudgetAction'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AccountId': accountId,
      'ActionThreshold': actionThreshold,
      'ActionType': actionType.toValue(),
      'ApprovalModel': approvalModel.toValue(),
      'BudgetName': budgetName,
      'Definition': definition,
      'ExecutionRoleArn': executionRoleArn,
      'NotificationType': notificationType.toValue(),
      'Subscribers': subscribers,
    },
  );

  return CreateBudgetActionResponse.fromJson(jsonResponse.body);
}