Skip to main content

routes

Creates, updates, deletes, gets or lists a routes resource.

Overview

Nameroutes
TypeResource
Idcloudflare.magic_transit.routes

Fields

The following fields are returned by SELECT queries:

Route Details response

NameDatatypeDescription
routeobject

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectroute_id, account_idGet a specific Magic static route.
listselectaccount_idList all Magic static routes.
createinsertaccount_id, prefix, nexthop, priorityCreates a new Magic static route. Use ?validate_only=true as an optional query parameter to run validation only without persisting changes.
updatereplaceroute_id, account_id, prefix, nexthop, priorityUpdate a specific Magic static route. Use ?validate_only=true as an optional query parameter to run validation only without persisting changes.
bulk_updatereplaceaccount_id, routesUpdate multiple Magic static routes. Use ?validate_only=true as an optional query parameter to run validation only without persisting changes. Only fields for a route that need to be changed need be provided.
deletedeleteroute_id, account_idDisable and remove a specific Magic static route.
emptydeleteaccount_idDelete multiple Magic static routes.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
account_idstringThe Cloudflare account ID.
route_idstring

SELECT examples

Get a specific Magic static route.

SELECT
route
FROM cloudflare.magic_transit.routes
WHERE route_id = '{{ route_id }}' -- required
AND account_id = '{{ account_id }}' -- required
;

INSERT examples

Creates a new Magic static route. Use ?validate_only=true as an optional query parameter to run validation only without persisting changes.

INSERT INTO cloudflare.magic_transit.routes (
description,
nexthop,
prefix,
priority,
scope,
weight,
account_id
)
SELECT
'{{ description }}',
'{{ nexthop }}' /* required */,
'{{ prefix }}' /* required */,
{{ priority }} /* required */,
'{{ scope }}',
{{ weight }},
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;

REPLACE examples

Update a specific Magic static route. Use ?validate_only=true as an optional query parameter to run validation only without persisting changes.

REPLACE cloudflare.magic_transit.routes
SET
description = '{{ description }}',
nexthop = '{{ nexthop }}',
prefix = '{{ prefix }}',
priority = {{ priority }},
scope = '{{ scope }}',
weight = {{ weight }}
WHERE
route_id = '{{ route_id }}' --required
AND account_id = '{{ account_id }}' --required
AND prefix = '{{ prefix }}' --required
AND nexthop = '{{ nexthop }}' --required
AND priority = '{{ priority }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples

Disable and remove a specific Magic static route.

DELETE FROM cloudflare.magic_transit.routes
WHERE route_id = '{{ route_id }}' --required
AND account_id = '{{ account_id }}' --required
;