Skip to content

delete_load_balancer_policy

delete_load_balancer_policy(
    load_balancer_name: AccessPointName,
    policy_name: PolicyName,
    *,
    config_overrides: Optional[ElasticLoadBalancingClientConfig] = None,
) -> DeleteLoadBalancerPolicyOutput

Deletes the specified policy from the specified load balancer. This policy must not be enabled for any listeners.

Parameters:

  • load_balancer_name (AccessPointName) –

    The name of the load balancer.

  • policy_name (PolicyName) –

    The name of the policy.

Raises:

Examples:

To delete a policy from your load balancer This example deletes the specified policy from the specified load balancer. The policy must not be enabled on any listener.

>>> client.delete_load_balancer_policy(load_balancer_name='my-load-balancer', policy_name='my-duration-cookie-policy')
Source code in docs_src/capo_elastic_load_balancing/_services/elastic_load_balancing.py
def delete_load_balancer_policy(
    self,
    load_balancer_name: "capo_elastic_load_balancing.types.access_point_name.AccessPointName",
    policy_name: "capo_elastic_load_balancing.types.policy_name.PolicyName",
    *,
    config_overrides: Optional[ElasticLoadBalancingClientConfig] = None,
) -> "capo_elastic_load_balancing.types.delete_load_balancer_policy_output.DeleteLoadBalancerPolicyOutput":
    """<p>Deletes the specified policy from the specified load balancer. This policy must not be enabled for any listeners.</p>

    Args:
        load_balancer_name: <p>The name of the load balancer.</p>
        policy_name: <p>The name of the policy.</p>

    Raises:
        capo_elastic_load_balancing.errors.access_point_not_found_exception.AccessPointNotFoundException: <p>The specified load balancer does not exist.</p>
        capo_elastic_load_balancing.errors.invalid_configuration_request_exception.InvalidConfigurationRequestException: <p>The requested configuration change is not valid.</p>
        capo_elastic_load_balancing.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To delete a policy from your load balancer
        This example deletes the specified policy from the specified load balancer. The policy must not be enabled on any listener.

        >>> client.delete_load_balancer_policy(load_balancer_name='my-load-balancer', policy_name='my-duration-cookie-policy')
    """

    def _handler(
        req: "OperationRequest[capo_elastic_load_balancing.types.delete_load_balancer_policy_input.DeleteLoadBalancerPolicyInput]",
    ) -> OperationResponse[
        "capo_elastic_load_balancing.types.delete_load_balancer_policy_output.DeleteLoadBalancerPolicyOutput"
    ]:
        import capo_elastic_load_balancing._operations.elastic_load_balancing_v7.delete_load_balancer_policy

        output, http_response = (
            capo_elastic_load_balancing._operations.elastic_load_balancing_v7.delete_load_balancer_policy.delete_load_balancer_policy(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteLoadBalancerPolicy")
    )
    input_: capo_elastic_load_balancing.types.delete_load_balancer_policy_input.DeleteLoadBalancerPolicyInput = {
        "load_balancer_name": load_balancer_name,
        "policy_name": policy_name,
    }

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