updateScheduledAction method

Future<UpdateScheduledActionResponse> updateScheduledAction({
  1. required String scheduledActionName,
  2. bool? enabled,
  3. DateTime? endTime,
  4. String? roleArn,
  5. Schedule? schedule,
  6. String? scheduledActionDescription,
  7. DateTime? startTime,
  8. TargetAction? targetAction,
})

Updates a scheduled action.

May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ValidationException.

Parameter scheduledActionName : The name of the scheduled action to update to.

Parameter enabled : Specifies whether to enable the scheduled action.

Parameter endTime : The end time in UTC of the scheduled action to update.

Parameter roleArn : The ARN of the IAM role to assume to run the scheduled action. This IAM role must have permission to run the Amazon Redshift Serverless API operation in the scheduled action. This IAM role must allow the Amazon Redshift scheduler to schedule creating snapshots (Principal scheduler.redshift.amazonaws.com) to assume permissions on your behalf. For more information about the IAM role to use with the Amazon Redshift scheduler, see Using Identity-Based Policies for Amazon Redshift in the Amazon Redshift Management Guide

Parameter schedule : The schedule for a one-time (at timestamp format) or recurring (cron format) scheduled action. Schedule invocations must be separated by at least one hour. Times are in UTC.

  • Format of at timestamp is yyyy-mm-ddThh:mm:ss. For example, 2016-03-04T17:27:00.
  • Format of cron expression is (Minutes Hours Day-of-month Month Day-of-week Year). For example, "(0 10 ? * MON *)". For more information, see Cron Expressions in the Amazon CloudWatch Events User Guide.

Parameter scheduledActionDescription : The descripion of the scheduled action to update to.

Parameter startTime : The start time in UTC of the scheduled action to update to.

Implementation

Future<UpdateScheduledActionResponse> updateScheduledAction({
  required String scheduledActionName,
  bool? enabled,
  DateTime? endTime,
  String? roleArn,
  Schedule? schedule,
  String? scheduledActionDescription,
  DateTime? startTime,
  TargetAction? targetAction,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'RedshiftServerless.UpdateScheduledAction'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'scheduledActionName': scheduledActionName,
      if (enabled != null) 'enabled': enabled,
      if (endTime != null) 'endTime': unixTimestampToJson(endTime),
      if (roleArn != null) 'roleArn': roleArn,
      if (schedule != null) 'schedule': schedule,
      if (scheduledActionDescription != null)
        'scheduledActionDescription': scheduledActionDescription,
      if (startTime != null) 'startTime': unixTimestampToJson(startTime),
      if (targetAction != null) 'targetAction': targetAction,
    },
  );

  return UpdateScheduledActionResponse.fromJson(jsonResponse.body);
}