service_bindings
Creates, updates, deletes, gets or lists a service_bindings resource.
Overview
| Name | service_bindings |
| Type | Resource |
| Id | cloudflare.addressing.service_bindings |
Fields
The following fields are returned by SELECT queries:
- get
- list
The Service Binding with the requested ID
| Name | Datatype | Description |
|---|---|---|
id | string | Identifier of a Service Binding. (example: 0429b49b6a5155297b78e75a44b09e14) |
service_id | string | Identifier of a Service on the Cloudflare network. Available services and their IDs may be found in the List Services endpoint. (example: 2db684ee7ca04e159946fd05b99e1bcd) |
service_name | string | Name of a service running on the Cloudflare network (example: Magic Transit) |
cidr | string | IP Prefix in Classless Inter-Domain Routing format. (example: 192.0.2.0/24) |
provisioning | object | Status of a Service Binding's deployment to the Cloudflare network |
Service Bindings attached to the Prefix
| Name | Datatype | Description |
|---|---|---|
id | string | Identifier of a Service Binding. (example: 0429b49b6a5155297b78e75a44b09e14) |
service_id | string | Identifier of a Service on the Cloudflare network. Available services and their IDs may be found in the List Services endpoint. (example: 2db684ee7ca04e159946fd05b99e1bcd) |
service_name | string | Name of a service running on the Cloudflare network (example: Magic Transit) |
cidr | string | IP Prefix in Classless Inter-Domain Routing format. (example: 192.0.2.0/24) |
provisioning | object | Status of a Service Binding's deployment to the Cloudflare network |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | account_id, prefix_id, binding_id | Fetch a single Service Binding | |
list | select | account_id, prefix_id | List the Cloudflare services this prefix is currently bound to. Traffic sent to an address within an IP prefix will be routed to the Cloudflare service of the most-specific Service Binding matching the address. Example: binding 192.0.2.0/24 to Cloudflare Magic Transit and 192.0.2.1/32 to the Cloudflare CDN would route traffic for 192.0.2.1 to the CDN, and traffic for all other IPs in the prefix to Cloudflare Magic Transit. | |
create | insert | account_id, prefix_id, cidr, service_id | Creates a new Service Binding, routing traffic to IPs within the given CIDR to a service running on Cloudflare's network. NOTE: The first Service Binding created for an IP Prefix must exactly match the IP Prefix's CIDR. Subsequent Service Bindings may be created with a more-specific CIDR. Refer to the Service Bindings Documentation for compatibility details. | |
delete | delete | account_id, prefix_id, binding_id | Delete a Service Binding |
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. |
binding_id | string | |
prefix_id | string | The IP prefix ID. |
SELECT examples
- get
- list
Fetch a single Service Binding
SELECT
id,
service_id,
service_name,
cidr,
provisioning
FROM cloudflare.addressing.service_bindings
WHERE account_id = '{{ account_id }}' -- required
AND prefix_id = '{{ prefix_id }}' -- required
AND binding_id = '{{ binding_id }}' -- required
;
List the Cloudflare services this prefix is currently bound to. Traffic sent to an address within an IP prefix will be routed to the Cloudflare service of the most-specific Service Binding matching the address. Example: binding 192.0.2.0/24 to Cloudflare Magic Transit and 192.0.2.1/32 to the Cloudflare CDN would route traffic for 192.0.2.1 to the CDN, and traffic for all other IPs in the prefix to Cloudflare Magic Transit.
SELECT
id,
service_id,
service_name,
cidr,
provisioning
FROM cloudflare.addressing.service_bindings
WHERE account_id = '{{ account_id }}' -- required
AND prefix_id = '{{ prefix_id }}' -- required
;
INSERT examples
- create
- Manifest
Creates a new Service Binding, routing traffic to IPs within the given CIDR to a service running on Cloudflare's network. NOTE: The first Service Binding created for an IP Prefix must exactly match the IP Prefix's CIDR. Subsequent Service Bindings may be created with a more-specific CIDR. Refer to the Service Bindings Documentation for compatibility details.
INSERT INTO cloudflare.addressing.service_bindings (
cidr,
service_id,
account_id,
prefix_id
)
SELECT
'{{ cidr }}' /* required */,
'{{ service_id }}' /* required */,
'{{ account_id }}',
'{{ prefix_id }}'
RETURNING
errors,
messages,
result,
success
;
# Description fields are for documentation purposes
- name: service_bindings
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the service_bindings resource.
- name: prefix_id
value: "{{ prefix_id }}"
description: Required parameter for the service_bindings resource.
- name: cidr
value: "{{ cidr }}"
description: |
IP Prefix in Classless Inter-Domain Routing format.
- name: service_id
value: "{{ service_id }}"
description: |
Identifier of a Service on the Cloudflare network. Available services and their IDs may be found in the **List Services** endpoint.
DELETE examples
- delete
Delete a Service Binding
DELETE FROM cloudflare.addressing.service_bindings
WHERE account_id = '{{ account_id }}' --required
AND prefix_id = '{{ prefix_id }}' --required
AND binding_id = '{{ binding_id }}' --required
;