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 Delete a scaling policy in the Amazon EC2 Auto Scaling User Guide.
Parameters:
Raises:
Examples:
To delete an Auto Scaling policy
This example deletes the specified Auto Scaling policy.
>>> client.delete_policy(auto_scaling_group_name='my-auto-scaling-group', policy_name='my-step-scale-out-policy')
Source code in docs_src/capo_auto_scaling/_services/auto_scaling.py
| def delete_policy(
self,
*,
config_overrides: Optional[AutoScalingClientConfig] = None,
auto_scaling_group_name: Optional[
"capo_auto_scaling.types.xml_string_max_len255.XmlStringMaxLen255"
] = None,
policy_name: Optional[
"capo_auto_scaling.types.resource_name.ResourceName"
] = None,
) -> None:
"""<p>Deletes the specified scaling policy.</p> <p>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.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/deleting-scaling-policy.html">Delete a scaling policy</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p>
Args:
auto_scaling_group_name: <p>The name of the Auto Scaling group.</p>
policy_name: <p>The name or Amazon Resource Name (ARN) of the policy.</p>
Raises:
capo_auto_scaling.errors.resource_contention_fault.ResourceContentionFault: <p>You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).</p>
capo_auto_scaling.errors.service_linked_role_failure.ServiceLinkedRoleFailure: <p>The service-linked role is not yet ready for use.</p>
capo_auto_scaling.errors.UnknownServiceError: The service returned an error code this client does not model.
Examples:
To delete an Auto Scaling policy
This example deletes the specified Auto Scaling policy.
>>> client.delete_policy(auto_scaling_group_name='my-auto-scaling-group', policy_name='my-step-scale-out-policy')
"""
def _handler(
req: "OperationRequest[capo_auto_scaling.types.delete_policy_type.DeletePolicyType]",
) -> OperationResponse[None]:
import capo_auto_scaling._operations.auto_scaling_2011_01_01.delete_policy
output, http_response = (
capo_auto_scaling._operations.auto_scaling_2011_01_01.delete_policy.delete_policy(
req.options, req.input
)
)
return OperationResponse(output=output, response=http_response)
interceptors_, options_ = self.operation_options(
config_overrides, OperationLogging("DeletePolicy")
)
input_: capo_auto_scaling.types.delete_policy_type.DeletePolicyType = {}
if auto_scaling_group_name is not None:
input_["auto_scaling_group_name"] = auto_scaling_group_name
if policy_name is not None:
input_["policy_name"] = policy_name
response = execute_pipeline(
OperationRequest(input=input_, options=options_),
handler=_handler,
interceptors=list(interceptors_),
)
response.response.close()
return response.output
|