setLoadBasedAutoScaling method

Future<void> setLoadBasedAutoScaling({
  1. required String layerId,
  2. AutoScalingThresholds? downScaling,
  3. bool? enable,
  4. AutoScalingThresholds? upScaling,
})

Specify the load-based auto scaling configuration for a specified layer. For more information, see Managing Load with Time-based and Load-based Instances. Required Permissions: To use this action, an IAM user must have a Manage permissions level for the stack, or an attached policy that explicitly grants permissions. For more information on user permissions, see Managing User Permissions.

May throw ValidationException. May throw ResourceNotFoundException.

Parameter layerId : The layer ID.

Parameter downScaling : An AutoScalingThresholds object with the downscaling threshold configuration. If the load falls below these thresholds for a specified amount of time, AWS OpsWorks Stacks stops a specified number of instances.

Parameter enable : Enables load-based auto scaling for the layer.

Parameter upScaling : An AutoScalingThresholds object with the upscaling threshold configuration. If the load exceeds these thresholds for a specified amount of time, AWS OpsWorks Stacks starts a specified number of instances.

Implementation

Future<void> setLoadBasedAutoScaling({
  required String layerId,
  AutoScalingThresholds? downScaling,
  bool? enable,
  AutoScalingThresholds? upScaling,
}) async {
  ArgumentError.checkNotNull(layerId, 'layerId');
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target': 'OpsWorks_20130218.SetLoadBasedAutoScaling'
  };
  await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'LayerId': layerId,
      if (downScaling != null) 'DownScaling': downScaling,
      if (enable != null) 'Enable': enable,
      if (upScaling != null) 'UpScaling': upScaling,
    },
  );
}