sites
Creates, updates, deletes, gets or lists a sites resource.
Overview
| Name | sites |
| Type | Resource |
| Id | cloudflare.magic_transit.sites |
Fields
The following fields are returned by SELECT queries:
- get
- list
Site Details response
| Name | Datatype | Description |
|---|---|---|
id | string | Identifier (example: 023e105f4ecef8ad9ca31a8372d0c353) |
name | string | The name of the site. (example: site_1) |
connector_id | string | Magic Connector identifier tag. (example: ac60d3d0435248289d446cedd870bcf4) |
secondary_connector_id | string | Magic Connector identifier tag. Used when high availability mode is on. (example: 8d67040d3835dbcf46ce29da440dc482) |
description | string | |
ha_mode | boolean | Site high availability mode. If set to true, the site can have two connectors and runs in high availability mode. |
location | object | Location of site in latitude and longitude. |
List Sites response
| Name | Datatype | Description |
|---|---|---|
id | string | Identifier (example: 023e105f4ecef8ad9ca31a8372d0c353) |
name | string | The name of the site. (example: site_1) |
connector_id | string | Magic Connector identifier tag. (example: ac60d3d0435248289d446cedd870bcf4) |
secondary_connector_id | string | Magic Connector identifier tag. Used when high availability mode is on. (example: 8d67040d3835dbcf46ce29da440dc482) |
description | string | |
ha_mode | boolean | Site high availability mode. If set to true, the site can have two connectors and runs in high availability mode. |
location | object | Location of site in latitude and longitude. |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | site_id, account_id | x-magic-new-hc-target | Get a specific Site. |
list | select | account_id | connectorid | Lists Sites associated with an account. Use connectorid query param to return sites where connectorid matches either site.ConnectorID or site.SecondaryConnectorID. |
create | insert | account_id, name | Creates a new Site | |
edit | update | site_id, account_id | Patch a specific Site. | |
update | replace | site_id, account_id | Update a specific Site. | |
delete | delete | site_id, account_id | Remove a specific Site. |
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. |
site_id | string | The site ID. |
connectorid | string | |
x-magic-new-hc-target | boolean | If true, the health check target in the response body will be presented using the new object format. Defaults to false. |
SELECT examples
- get
- list
Get a specific Site.
SELECT
id,
name,
connector_id,
secondary_connector_id,
description,
ha_mode,
location
FROM cloudflare.magic_transit.sites
WHERE site_id = '{{ site_id }}' -- required
AND account_id = '{{ account_id }}' -- required
AND x-magic-new-hc-target = '{{ x-magic-new-hc-target }}'
;
Lists Sites associated with an account. Use connectorid query param to return sites where connectorid matches either site.ConnectorID or site.SecondaryConnectorID.
SELECT
id,
name,
connector_id,
secondary_connector_id,
description,
ha_mode,
location
FROM cloudflare.magic_transit.sites
WHERE account_id = '{{ account_id }}' -- required
AND connectorid = '{{ connectorid }}'
;
INSERT examples
- create
- Manifest
Creates a new Site
INSERT INTO cloudflare.magic_transit.sites (
connector_id,
description,
ha_mode,
location,
name,
secondary_connector_id,
account_id
)
SELECT
'{{ connector_id }}',
'{{ description }}',
{{ ha_mode }},
'{{ location }}',
'{{ name }}' /* required */,
'{{ secondary_connector_id }}',
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;
# Description fields are for documentation purposes
- name: sites
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the sites resource.
- name: connector_id
value: "{{ connector_id }}"
description: |
Magic Connector identifier tag.
- name: description
value: "{{ description }}"
- name: ha_mode
value: {{ ha_mode }}
description: |
Site high availability mode. If set to true, the site can have two connectors and runs in high availability mode.
- name: location
description: |
Location of site in latitude and longitude.
value:
lat: "{{ lat }}"
lon: "{{ lon }}"
- name: name
value: "{{ name }}"
description: |
The name of the site.
- name: secondary_connector_id
value: "{{ secondary_connector_id }}"
description: |
Magic Connector identifier tag. Used when high availability mode is on.
UPDATE examples
- edit
Patch a specific Site.
UPDATE cloudflare.magic_transit.sites
SET
connector_id = '{{ connector_id }}',
description = '{{ description }}',
location = '{{ location }}',
name = '{{ name }}',
secondary_connector_id = '{{ secondary_connector_id }}'
WHERE
site_id = '{{ site_id }}' --required
AND account_id = '{{ account_id }}' --required
RETURNING
errors,
messages,
result,
success;
REPLACE examples
- update
Update a specific Site.
REPLACE cloudflare.magic_transit.sites
SET
connector_id = '{{ connector_id }}',
description = '{{ description }}',
location = '{{ location }}',
name = '{{ name }}',
secondary_connector_id = '{{ secondary_connector_id }}'
WHERE
site_id = '{{ site_id }}' --required
AND account_id = '{{ account_id }}' --required
RETURNING
errors,
messages,
result,
success;
DELETE examples
- delete
Remove a specific Site.
DELETE FROM cloudflare.magic_transit.sites
WHERE site_id = '{{ site_id }}' --required
AND account_id = '{{ account_id }}' --required
;