Skip to content

delete_route async

delete_route(
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    destination_prefix_list_id: Optional[PrefixListResourceId] = None,
    dry_run: Optional[Boolean] = None,
    route_table_id: Optional[RouteTableId] = None,
    destination_cidr_block: Optional[String] = None,
    destination_ipv6_cidr_block: Optional[String] = None,
) -> None

Deletes the specified route from the specified route table.

Parameters:

  • destination_prefix_list_id (Optional[PrefixListResourceId], default: None ) –

    The ID of the prefix list for the route.

  • dry_run (Optional[Boolean], default: None ) –

    Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is DryRunOperation. Otherwise, it is UnauthorizedOperation.

  • route_table_id (Optional[RouteTableId], default: None ) –

    The ID of the route table.

  • destination_cidr_block (Optional[String], default: None ) –

    The IPv4 CIDR range for the route. The value you specify must match the CIDR for the route exactly.

  • destination_ipv6_cidr_block (Optional[String], default: None ) –

    The IPv6 CIDR range for the route. The value you specify must match the CIDR for the route exactly.

Raises:

Examples:

To delete a route This example deletes the specified route from the specified route table.

>>> await client.delete_route(route_table_id='rtb-22574640', destination_cidr_block='0.0.0.0/0')
Source code in docs_src/capo_ec2/_services/async_ec2.py
async def delete_route(
    self,
    *,
    config_overrides: Optional[AsyncEC2ClientConfig] = None,
    destination_prefix_list_id: Optional[
        "capo_ec2.types.prefix_list_resource_id.PrefixListResourceId"
    ] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    route_table_id: Optional["capo_ec2.types.route_table_id.RouteTableId"] = None,
    destination_cidr_block: Optional["capo_ec2.types.string.String"] = None,
    destination_ipv6_cidr_block: Optional["capo_ec2.types.string.String"] = None,
) -> None:
    """<p>Deletes the specified route from the specified route table.</p>

    Args:
        destination_prefix_list_id: <p>The ID of the prefix list for the route.</p>
        dry_run: <p>Checks whether you have the required permissions for the action, without actually making the request, and provides an error response. If you have the required permissions, the error response is <code>DryRunOperation</code>. Otherwise, it is <code>UnauthorizedOperation</code>.</p>
        route_table_id: <p>The ID of the route table.</p>
        destination_cidr_block: <p>The IPv4 CIDR range for the route. The value you specify must match the CIDR for the route exactly.</p>
        destination_ipv6_cidr_block: <p>The IPv6 CIDR range for the route. The value you specify must match the CIDR for the route exactly.</p>

    Raises:
        capo_ec2.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To delete a route
        This example deletes the specified route from the specified route table.

        >>> await client.delete_route(route_table_id='rtb-22574640', destination_cidr_block='0.0.0.0/0')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_ec2.types.delete_route_request.DeleteRouteRequest]",
    ) -> AsyncOperationResponse[None]:
        import capo_ec2._operations.amazon_ec2.delete_route

        (
            output,
            http_response,
        ) = await capo_ec2._operations.amazon_ec2.delete_route.async_delete_route(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteRoute")
    )
    input_: capo_ec2.types.delete_route_request.DeleteRouteRequest = {}
    if destination_prefix_list_id is not None:
        input_["destination_prefix_list_id"] = destination_prefix_list_id
    if dry_run is not None:
        input_["dry_run"] = dry_run
    if route_table_id is not None:
        input_["route_table_id"] = route_table_id
    if destination_cidr_block is not None:
        input_["destination_cidr_block"] = destination_cidr_block
    if destination_ipv6_cidr_block is not None:
        input_["destination_ipv6_cidr_block"] = destination_ipv6_cidr_block

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output