routes
Creates, updates, deletes, gets or lists a routes resource.
Overview
| Name | routes |
| Type | Resource |
| Id | cloudflare.magic_transit.routes |
Fields
The following fields are returned by SELECT queries:
- get
- list
Route Details response
| Name | Datatype | Description |
|---|---|---|
route | object |
List Routes response
| Name | Datatype | Description |
|---|---|---|
id | string | Identifier (example: 023e105f4ecef8ad9ca31a8372d0c353) |
created_on | string (date-time) | When the route was created. (example: 2017-06-14T00:00:00Z) |
description | string | An optional human provided description of the static route. (example: New route for new prefix 203.0.113.1) |
modified_on | string (date-time) | When the route was last modified. (example: 2017-06-14T05:20:00Z) |
nexthop | string | The next-hop IP Address for the static route. (example: 203.0.113.1) |
prefix | string | IP Prefix in Classless Inter-Domain Routing format. (example: 192.0.2.0/24) |
priority | integer | Priority of the static route. |
scope | object | Used only for ECMP routes. |
weight | integer | Optional weight of the ECMP scope - if provided. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | route_id, account_id | Get a specific Magic static route. | |
list | select | account_id | List all Magic static routes. | |
create | insert | account_id, prefix, nexthop, priority | Creates a new Magic static route. Use ?validate_only=true as an optional query parameter to run validation only without persisting changes. | |
update | replace | route_id, account_id, prefix, nexthop, priority | Update a specific Magic static route. Use ?validate_only=true as an optional query parameter to run validation only without persisting changes. | |
bulk_update | replace | account_id, routes | Update 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. | |
delete | delete | route_id, account_id | Disable and remove a specific Magic static route. | |
empty | delete | account_id | Delete 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.
| Name | Datatype | Description |
|---|---|---|
account_id | string | The Cloudflare account ID. |
route_id | string |
SELECT examples
- get
- list
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
;
List all Magic static routes.
SELECT
id,
created_on,
description,
modified_on,
nexthop,
prefix,
priority,
scope,
weight
FROM cloudflare.magic_transit.routes
WHERE account_id = '{{ account_id }}' -- required
;
INSERT examples
- create
- Manifest
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
;
# Description fields are for documentation purposes
- name: routes
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the routes resource.
- name: description
value: "{{ description }}"
description: |
An optional human provided description of the static route.
- name: nexthop
value: "{{ nexthop }}"
description: |
The next-hop IP Address for the static route.
- name: prefix
value: "{{ prefix }}"
description: |
IP Prefix in Classless Inter-Domain Routing format.
- name: priority
value: {{ priority }}
description: |
Priority of the static route.
- name: scope
description: |
Used only for ECMP routes.
value:
colo_names:
- "{{ colo_names }}"
colo_regions:
- "{{ colo_regions }}"
- name: weight
value: {{ weight }}
description: |
Optional weight of the ECMP scope - if provided.
REPLACE examples
- update
- bulk_update
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;
Update 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.
REPLACE cloudflare.magic_transit.routes
SET
routes = '{{ routes }}'
WHERE
account_id = '{{ account_id }}' --required
AND routes = '{{ routes }}' --required
RETURNING
errors,
messages,
result,
success;
DELETE examples
- delete
- empty
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
;
Delete multiple Magic static routes.
DELETE FROM cloudflare.magic_transit.routes
WHERE account_id = '{{ account_id }}' --required
;