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 ClusterNotFoundFault. May throw InvalidScheduledActionFault. May throw InvalidScheduleFault. May throw ScheduledActionAlreadyExistsFault. May throw ScheduledActionQuotaExceededFault. May throw ScheduledActionTypeUnsupportedFault. May throw UnauthorizedOperation. May throw UnsupportedOperationFault.

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 {
  final $request = <String, String>{
    'IamRole': iamRole,
    'Schedule': schedule,
    'ScheduledActionName': scheduledActionName,
    for (var e1 in targetAction.toQueryMap().entries)
      'TargetAction.${e1.key}': e1.value,
    if (enable != null) 'Enable': enable.toString(),
    if (endTime != null) 'EndTime': _s.iso8601ToJson(endTime),
    if (scheduledActionDescription != null)
      'ScheduledActionDescription': scheduledActionDescription,
    if (startTime != null) 'StartTime': _s.iso8601ToJson(startTime),
  };
  final $result = await _protocol.send(
    $request,
    action: 'CreateScheduledAction',
    version: '2012-12-01',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    resultWrapper: 'CreateScheduledActionResult',
  );
  return ScheduledAction.fromXml($result);
}