putScheduledUpdateGroupAction method

Future<void> putScheduledUpdateGroupAction({
  1. required String autoScalingGroupName,
  2. required String scheduledActionName,
  3. int? desiredCapacity,
  4. DateTime? endTime,
  5. int? maxSize,
  6. int? minSize,
  7. String? recurrence,
  8. DateTime? startTime,
  9. DateTime? time,
})

Creates or updates a scheduled scaling action for an Auto Scaling group. If you leave a parameter unspecified when updating a scheduled scaling action, the corresponding value remains unchanged.

For more information, see Scheduled scaling in the Amazon EC2 Auto Scaling User Guide.

May throw AlreadyExistsFault. May throw LimitExceededFault. May throw ResourceContentionFault.

Parameter autoScalingGroupName : The name of the Auto Scaling group.

Parameter scheduledActionName : The name of this scaling action.

Parameter desiredCapacity : The desired capacity is the initial capacity of the Auto Scaling group after the scheduled action runs and the capacity it attempts to maintain. It can scale beyond this capacity if you add more scaling conditions.

Parameter endTime : The date and time for the recurring schedule to end. Amazon EC2 Auto Scaling does not perform the action after this time.

Parameter maxSize : The maximum size of the Auto Scaling group.

Parameter minSize : The minimum size of the Auto Scaling group.

Parameter recurrence : The recurring schedule for this action, in Unix cron syntax format. This format consists of five fields separated by white spaces: Minute Hour Day_of_Month Month_of_Year Day_of_Week. The value must be in quotes (for example, "30 0 1 1,6,12 *"). For more information about this format, see Crontab.

When StartTime and EndTime are specified with Recurrence, they form the boundaries of when the recurring action starts and stops.

Parameter startTime : The date and time for this action to start, in YYYY-MM-DDThh:mm:ssZ format in UTC/GMT only and in quotes (for example, "2019-06-01T00:00:00Z").

If you specify Recurrence and StartTime, Amazon EC2 Auto Scaling performs the action at this time, and then performs the action based on the specified recurrence.

If you try to schedule your action in the past, Amazon EC2 Auto Scaling returns an error message.

Parameter time : This parameter is no longer used.

Implementation

Future<void> putScheduledUpdateGroupAction({
  required String autoScalingGroupName,
  required String scheduledActionName,
  int? desiredCapacity,
  DateTime? endTime,
  int? maxSize,
  int? minSize,
  String? recurrence,
  DateTime? startTime,
  DateTime? time,
}) async {
  ArgumentError.checkNotNull(autoScalingGroupName, 'autoScalingGroupName');
  _s.validateStringLength(
    'autoScalingGroupName',
    autoScalingGroupName,
    1,
    255,
    isRequired: true,
  );
  ArgumentError.checkNotNull(scheduledActionName, 'scheduledActionName');
  _s.validateStringLength(
    'scheduledActionName',
    scheduledActionName,
    1,
    255,
    isRequired: true,
  );
  _s.validateStringLength(
    'recurrence',
    recurrence,
    1,
    255,
  );
  final $request = <String, dynamic>{};
  $request['AutoScalingGroupName'] = autoScalingGroupName;
  $request['ScheduledActionName'] = scheduledActionName;
  desiredCapacity?.also((arg) => $request['DesiredCapacity'] = arg);
  endTime?.also((arg) => $request['EndTime'] = _s.iso8601ToJson(arg));
  maxSize?.also((arg) => $request['MaxSize'] = arg);
  minSize?.also((arg) => $request['MinSize'] = arg);
  recurrence?.also((arg) => $request['Recurrence'] = arg);
  startTime?.also((arg) => $request['StartTime'] = _s.iso8601ToJson(arg));
  time?.also((arg) => $request['Time'] = _s.iso8601ToJson(arg));
  await _protocol.send(
    $request,
    action: 'PutScheduledUpdateGroupAction',
    version: '2011-01-01',
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    shape: shapes['PutScheduledUpdateGroupActionType'],
    shapes: shapes,
  );
}