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,
  10. List<ResourceTag>? resourceTags,
})

Creates a budget action.

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

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.

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

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,
  List<ResourceTag>? resourceTags,
}) async {
  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.value,
      'ApprovalModel': approvalModel.value,
      'BudgetName': budgetName,
      'Definition': definition,
      'ExecutionRoleArn': executionRoleArn,
      'NotificationType': notificationType.value,
      'Subscribers': subscribers,
      if (resourceTags != null) 'ResourceTags': resourceTags,
    },
  );

  return CreateBudgetActionResponse.fromJson(jsonResponse.body);
}