Skip to content

delete_listener

delete_listener(
    *,
    config_overrides: Optional[ElasticLoadBalancingv2ClientConfig] = None,
    listener_arn: Optional[ListenerArn] = None,
) -> DeleteListenerOutput

Deletes the specified listener.

Alternatively, your listener is deleted when you delete the load balancer to which it is attached.

Parameters:

  • listener_arn (Optional[ListenerArn], default: None ) –

    The Amazon Resource Name (ARN) of the listener.

Raises:

Examples:

To delete a listener This example deletes the specified listener.

>>> client.delete_listener(listener_arn='arn:aws:elasticloadbalancing:ua-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2')
Source code in docs_src/capo_elastic_load_balancing_v2/_services/elastic_load_balancingv2.py
def delete_listener(
    self,
    *,
    config_overrides: Optional[ElasticLoadBalancingv2ClientConfig] = None,
    listener_arn: Optional[
        "capo_elastic_load_balancing_v2.types.listener_arn.ListenerArn"
    ] = None,
) -> "capo_elastic_load_balancing_v2.types.delete_listener_output.DeleteListenerOutput":
    """<p>Deletes the specified listener.</p> <p>Alternatively, your listener is deleted when you delete the load balancer to which it is attached.</p>

    Args:
        listener_arn: <p>The Amazon Resource Name (ARN) of the listener.</p>

    Raises:
        capo_elastic_load_balancing_v2.errors.listener_not_found_exception.ListenerNotFoundException: <p>The specified listener does not exist.</p>
        capo_elastic_load_balancing_v2.errors.resource_in_use_exception.ResourceInUseException: <p>A specified resource is in use.</p>
        capo_elastic_load_balancing_v2.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To delete a listener
        This example deletes the specified listener.

        >>> client.delete_listener(listener_arn='arn:aws:elasticloadbalancing:ua-west-2:123456789012:listener/app/my-load-balancer/50dc6c495c0c9188/f2f7dc8efc522ab2')
    """

    def _handler(
        req: "OperationRequest[capo_elastic_load_balancing_v2.types.delete_listener_input.DeleteListenerInput]",
    ) -> OperationResponse[
        "capo_elastic_load_balancing_v2.types.delete_listener_output.DeleteListenerOutput"
    ]:
        import capo_elastic_load_balancing_v2._operations.elastic_load_balancing_v10.delete_listener

        output, http_response = (
            capo_elastic_load_balancing_v2._operations.elastic_load_balancing_v10.delete_listener.delete_listener(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteListener")
    )
    input_: capo_elastic_load_balancing_v2.types.delete_listener_input.DeleteListenerInput = {}
    if listener_arn is not None:
        input_["listener_arn"] = listener_arn

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