Skip to content

delete_route_table

delete_route_table(
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    dry_run: Optional[Boolean] = None,
    route_table_id: Optional[RouteTableId] = None,
) -> None

Deletes the specified route table. You must disassociate the route table from any subnets before you can delete it. You can't delete the main route table.

Parameters:

  • 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.

Raises:

Examples:

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

>>> client.delete_route_table(route_table_id='rtb-22574640')
Source code in docs_src/capo_ec2/_services/ec2.py
def delete_route_table(
    self,
    *,
    config_overrides: Optional[EC2ClientConfig] = None,
    dry_run: Optional["capo_ec2.types.boolean.Boolean"] = None,
    route_table_id: Optional["capo_ec2.types.route_table_id.RouteTableId"] = None,
) -> None:
    """<p>Deletes the specified route table. You must disassociate the route table from any subnets before you can delete it. You can't delete the main route table.</p>

    Args:
        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>

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

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

        >>> client.delete_route_table(route_table_id='rtb-22574640')
    """

    def _handler(
        req: "OperationRequest[capo_ec2.types.delete_route_table_request.DeleteRouteTableRequest]",
    ) -> OperationResponse[None]:
        import capo_ec2._operations.amazon_ec2.delete_route_table

        output, http_response = (
            capo_ec2._operations.amazon_ec2.delete_route_table.delete_route_table(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("DeleteRouteTable")
    )
    input_: capo_ec2.types.delete_route_table_request.DeleteRouteTableRequest = {}
    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

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