Skip to content

delete_traffic_policy

delete_traffic_policy(
    id: TrafficPolicyId,
    version: TrafficPolicyVersion,
    *,
    config_overrides: Optional[Route53ClientConfig] = None,
) -> DeleteTrafficPolicyResponse

Deletes a traffic policy.

When you delete a traffic policy, Route 53 sets a flag on the policy to indicate that it has been deleted. However, Route 53 never fully deletes the traffic policy. Note the following:

  • Deleted traffic policies aren't listed if you run ListTrafficPolicies.

  • There's no way to get a list of deleted policies.

  • If you retain the ID of the policy, you can get information about the policy, including the traffic policy document, by running GetTrafficPolicy.

Parameters:

  • id (TrafficPolicyId) –

    The ID of the traffic policy that you want to delete.

  • version (TrafficPolicyVersion) –

    The version number of the traffic policy that you want to delete.

Raises:

  • ConcurrentModification –

    Another user submitted a request to create, update, or delete the object at the same time that you did. Retry the request.

  • InvalidInput –

    The input is not valid.

  • NoSuchTrafficPolicy –

    No traffic policy exists with the specified ID.

  • TrafficPolicyInUse –

    One or more traffic policy instances were created by using the specified traffic policy.

  • UnknownServiceError –

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

Source code in docs_src/capo_route_53/_services/route53.py
def delete_traffic_policy(
    self,
    id: "capo_route_53.types.traffic_policy_id.TrafficPolicyId",
    version: "capo_route_53.types.traffic_policy_version.TrafficPolicyVersion",
    *,
    config_overrides: Optional[Route53ClientConfig] = None,
) -> (
    "capo_route_53.types.delete_traffic_policy_response.DeleteTrafficPolicyResponse"
):
    """<p>Deletes a traffic policy.</p> <p>When you delete a traffic policy, Route 53 sets a flag on the policy to indicate that it has been deleted. However, Route 53 never fully deletes the traffic policy. Note the following:</p> <ul> <li> <p>Deleted traffic policies aren't listed if you run <a href="https://docs.aws.amazon.com/Route53/latest/APIReference/API_ListTrafficPolicies.html">ListTrafficPolicies</a>.</p> </li> <li> <p> There's no way to get a list of deleted policies.</p> </li> <li> <p>If you retain the ID of the policy, you can get information about the policy, including the traffic policy document, by running <a href="https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetTrafficPolicy.html">GetTrafficPolicy</a>.</p> </li> </ul>

    Args:
        id: <p>The ID of the traffic policy that you want to delete.</p>
        version: <p>The version number of the traffic policy that you want to delete.</p>

    Raises:
        capo_route_53.errors.concurrent_modification.ConcurrentModification: <p>Another user submitted a request to create, update, or delete the object at the same time that you did. Retry the request. </p>
        capo_route_53.errors.invalid_input.InvalidInput: <p>The input is not valid.</p>
        capo_route_53.errors.no_such_traffic_policy.NoSuchTrafficPolicy: <p>No traffic policy exists with the specified ID.</p>
        capo_route_53.errors.traffic_policy_in_use.TrafficPolicyInUse: <p>One or more traffic policy instances were created by using the specified traffic policy.</p>
        capo_route_53.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_route_53.types.delete_traffic_policy_request.DeleteTrafficPolicyRequest]",
    ) -> OperationResponse[
        "capo_route_53.types.delete_traffic_policy_response.DeleteTrafficPolicyResponse"
    ]:
        import capo_route_53._operations.aws_dns_v20130401.delete_traffic_policy

        output, http_response = (
            capo_route_53._operations.aws_dns_v20130401.delete_traffic_policy.delete_traffic_policy(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteTrafficPolicy")
    )
    input_: capo_route_53.types.delete_traffic_policy_request.DeleteTrafficPolicyRequest = {
        "id": id,
        "version": version,
    }

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