deletePolicy method
Deletes the specified scaling policy.
Deleting either a step scaling policy or a simple scaling policy deletes the underlying alarm action, but does not delete the alarm, even if it no longer has an associated action.
For more information, see Deleting a scaling policy in the Amazon EC2 Auto Scaling User Guide.
May throw ResourceContentionFault. May throw ServiceLinkedRoleFailure.
Parameter policyName
:
The name or Amazon Resource Name (ARN) of the policy.
Parameter autoScalingGroupName
:
The name of the Auto Scaling group.
Implementation
Future<void> deletePolicy({
required String policyName,
String? autoScalingGroupName,
}) async {
ArgumentError.checkNotNull(policyName, 'policyName');
_s.validateStringLength(
'policyName',
policyName,
1,
1600,
isRequired: true,
);
_s.validateStringLength(
'autoScalingGroupName',
autoScalingGroupName,
1,
255,
);
final $request = <String, dynamic>{};
$request['PolicyName'] = policyName;
autoScalingGroupName?.also((arg) => $request['AutoScalingGroupName'] = arg);
await _protocol.send(
$request,
action: 'DeletePolicy',
version: '2011-01-01',
method: 'POST',
requestUri: '/',
exceptionFnMap: _exceptionFns,
shape: shapes['DeletePolicyType'],
shapes: shapes,
);
}