setDesiredCapacity method
Sets the size of the specified Auto Scaling group.
If a scale-in activity occurs as a result of a new
DesiredCapacity
value that is lower than the current size of
the group, the Auto Scaling group uses its termination policy to determine
which instances to terminate.
For more information, see Manual scaling in the Amazon EC2 Auto Scaling User Guide.
May throw ScalingActivityInProgressFault. May throw ResourceContentionFault.
Parameter autoScalingGroupName
:
The name of the Auto Scaling group.
Parameter desiredCapacity
:
The desired capacity is the initial capacity of the Auto Scaling group
after this operation completes and the capacity it attempts to maintain.
Parameter honorCooldown
:
Indicates whether Amazon EC2 Auto Scaling waits for the cooldown period to
complete before initiating a scaling activity to set your Auto Scaling
group to its new capacity. By default, Amazon EC2 Auto Scaling does not
honor the cooldown period during manual scaling activities.
Implementation
Future<void> setDesiredCapacity({
required String autoScalingGroupName,
required int desiredCapacity,
bool? honorCooldown,
}) async {
ArgumentError.checkNotNull(autoScalingGroupName, 'autoScalingGroupName');
_s.validateStringLength(
'autoScalingGroupName',
autoScalingGroupName,
1,
255,
isRequired: true,
);
ArgumentError.checkNotNull(desiredCapacity, 'desiredCapacity');
final $request = <String, dynamic>{};
$request['AutoScalingGroupName'] = autoScalingGroupName;
$request['DesiredCapacity'] = desiredCapacity;
honorCooldown?.also((arg) => $request['HonorCooldown'] = arg);
await _protocol.send(
$request,
action: 'SetDesiredCapacity',
version: '2011-01-01',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
shape: shapes['SetDesiredCapacityType'],
shapes: shapes,
);
}