Skip to content

delete_lifecycle_hook

delete_lifecycle_hook(
    *,
    config_overrides: Optional[AutoScalingClientConfig] = None,
    lifecycle_hook_name: Optional[AsciiStringMaxLen255] = None,
    auto_scaling_group_name: Optional[XmlStringMaxLen255] = None,
) -> DeleteLifecycleHookAnswer

Deletes the specified lifecycle hook.

If there are any outstanding lifecycle actions, they are completed first (ABANDON for launching instances, CONTINUE for terminating instances).

Parameters:

Raises:

  • ResourceContentionFault –

    You already have a pending update to an Amazon EC2 Auto Scaling resource (for example, an Auto Scaling group, instance, or load balancer).

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

To delete a lifecycle hook This example deletes the specified lifecycle hook.

>>> client.delete_lifecycle_hook(lifecycle_hook_name='my-lifecycle-hook', auto_scaling_group_name='my-auto-scaling-group')
Source code in docs_src/capo_auto_scaling/_services/auto_scaling.py
def delete_lifecycle_hook(
    self,
    *,
    config_overrides: Optional[AutoScalingClientConfig] = None,
    lifecycle_hook_name: Optional[
        "capo_auto_scaling.types.ascii_string_max_len255.AsciiStringMaxLen255"
    ] = None,
    auto_scaling_group_name: Optional[
        "capo_auto_scaling.types.xml_string_max_len255.XmlStringMaxLen255"
    ] = None,
) -> (
    "capo_auto_scaling.types.delete_lifecycle_hook_answer.DeleteLifecycleHookAnswer"
):
    """<p>Deletes the specified lifecycle hook.</p> <p>If there are any outstanding lifecycle actions, they are completed first (<code>ABANDON</code> for launching instances, <code>CONTINUE</code> for terminating instances).</p>

    Args:
        lifecycle_hook_name: <p>The name of the lifecycle hook.</p>
        auto_scaling_group_name: <p>The name of the Auto Scaling group.</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.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To delete a lifecycle hook
        This example deletes the specified lifecycle hook.

        >>> client.delete_lifecycle_hook(lifecycle_hook_name='my-lifecycle-hook', auto_scaling_group_name='my-auto-scaling-group')
    """

    def _handler(
        req: "OperationRequest[capo_auto_scaling.types.delete_lifecycle_hook_type.DeleteLifecycleHookType]",
    ) -> OperationResponse[
        "capo_auto_scaling.types.delete_lifecycle_hook_answer.DeleteLifecycleHookAnswer"
    ]:
        import capo_auto_scaling._operations.auto_scaling_2011_01_01.delete_lifecycle_hook

        output, http_response = (
            capo_auto_scaling._operations.auto_scaling_2011_01_01.delete_lifecycle_hook.delete_lifecycle_hook(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteLifecycleHook")
    )
    input_: capo_auto_scaling.types.delete_lifecycle_hook_type.DeleteLifecycleHookType = {}
    if lifecycle_hook_name is not None:
        input_["lifecycle_hook_name"] = lifecycle_hook_name
    if auto_scaling_group_name is not None:
        input_["auto_scaling_group_name"] = auto_scaling_group_name

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output