createScheduledAction method

Future<ScheduledAction> createScheduledAction({
  1. required String iamRole,
  2. required String schedule,
  3. required String scheduledActionName,
  4. required ScheduledActionType targetAction,
  5. bool? enable,
  6. DateTime? endTime,
  7. String? scheduledActionDescription,
  8. DateTime? startTime,
})

Creates a scheduled action. A scheduled action contains a schedule and an Amazon Redshift API action. For example, you can create a schedule of when to run the ResizeCluster API operation.

May throw ScheduledActionAlreadyExistsFault. May throw ScheduledActionQuotaExceededFault. May throw ScheduledActionTypeUnsupportedFault. May throw InvalidScheduleFault. May throw InvalidScheduledActionFault. May throw UnauthorizedOperation.

Parameter iamRole : The IAM role to assume to run the target action. For more information about this parameter, see ScheduledAction.

Parameter schedule : The schedule in at( ) or cron( ) format. For more information about this parameter, see ScheduledAction.

Parameter scheduledActionName : The name of the scheduled action. The name must be unique within an account. For more information about this parameter, see ScheduledAction.

Parameter targetAction : A JSON format string of the Amazon Redshift API operation with input parameters. For more information about this parameter, see ScheduledAction.

Parameter enable : If true, the schedule is enabled. If false, the scheduled action does not trigger. For more information about state of the scheduled action, see ScheduledAction.

Parameter endTime : The end time in UTC of the scheduled action. After this time, the scheduled action does not trigger. For more information about this parameter, see ScheduledAction.

Parameter scheduledActionDescription : The description of the scheduled action.

Parameter startTime : The start time in UTC of the scheduled action. Before this time, the scheduled action does not trigger. For more information about this parameter, see ScheduledAction.

Implementation

Future<ScheduledAction> createScheduledAction({
  required String iamRole,
  required String schedule,
  required String scheduledActionName,
  required ScheduledActionType targetAction,
  bool? enable,
  DateTime? endTime,
  String? scheduledActionDescription,
  DateTime? startTime,
}) async {
  ArgumentError.checkNotNull(iamRole, 'iamRole');
  _s.validateStringLength(
    'iamRole',
    iamRole,
    0,
    2147483647,
    isRequired: true,
  );
  ArgumentError.checkNotNull(schedule, 'schedule');
  _s.validateStringLength(
    'schedule',
    schedule,
    0,
    2147483647,
    isRequired: true,
  );
  ArgumentError.checkNotNull(scheduledActionName, 'scheduledActionName');
  _s.validateStringLength(
    'scheduledActionName',
    scheduledActionName,
    0,
    2147483647,
    isRequired: true,
  );
  ArgumentError.checkNotNull(targetAction, 'targetAction');
  _s.validateStringLength(
    'scheduledActionDescription',
    scheduledActionDescription,
    0,
    2147483647,
  );
  final $request = <String, dynamic>{};
  $request['IamRole'] = iamRole;
  $request['Schedule'] = schedule;
  $request['ScheduledActionName'] = scheduledActionName;
  $request['TargetAction'] = targetAction;
  enable?.also((arg) => $request['Enable'] = arg);
  endTime?.also((arg) => $request['EndTime'] = _s.iso8601ToJson(arg));
  scheduledActionDescription
      ?.also((arg) => $request['ScheduledActionDescription'] = arg);
  startTime?.also((arg) => $request['StartTime'] = _s.iso8601ToJson(arg));
  final $result = await _protocol.send(
    $request,
    action: 'CreateScheduledAction',
    version: '2012-12-01',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['CreateScheduledActionMessage'],
    shapes: shapes,
    resultWrapper: 'CreateScheduledActionResult',
  );
  return ScheduledAction.fromXml($result);
}