bgp_prefixes
Creates, updates, deletes, gets or lists a bgp_prefixes resource.
Overview
| Name | bgp_prefixes |
| Type | Resource |
| Id | cloudflare.addressing.bgp_prefixes |
Fields
The following fields are returned by SELECT queries:
- get
- list
Fetch BGP Prefix response
| Name | Datatype | Description |
|---|---|---|
id | string | Identifier of BGP Prefix. (example: 7009ba364c7a5760798ceb430e603b74) |
asn | integer | Autonomous System Number (ASN) the prefix will be advertised under. |
asn_prepend_count | integer | Number of times to prepend the Cloudflare ASN to the BGP AS-Path attribute |
auto_advertise_withdraw | boolean | Determines if Cloudflare advertises a BYOIP BGP prefix even when there is no matching BGP prefix in the Magic routing table. When true, Cloudflare will automatically withdraw the BGP prefix when there are no matching BGP routes, and will resume advertising when there is at least one matching BGP route. |
bgp_signal_opts | object | |
cidr | string | IP Prefix in Classless Inter-Domain Routing format. (example: 192.0.2.0/24) |
created_at | string (date-time) | (example: 2014-01-01T05:20:00.12345Z) |
modified_at | string (date-time) | (example: 2014-01-01T05:20:00.12345Z) |
on_demand | object |
List BGP Prefixes response
| Name | Datatype | Description |
|---|---|---|
id | string | Identifier of BGP Prefix. (example: 7009ba364c7a5760798ceb430e603b74) |
asn | integer | Autonomous System Number (ASN) the prefix will be advertised under. |
asn_prepend_count | integer | Number of times to prepend the Cloudflare ASN to the BGP AS-Path attribute |
auto_advertise_withdraw | boolean | Determines if Cloudflare advertises a BYOIP BGP prefix even when there is no matching BGP prefix in the Magic routing table. When true, Cloudflare will automatically withdraw the BGP prefix when there are no matching BGP routes, and will resume advertising when there is at least one matching BGP route. |
bgp_signal_opts | object | |
cidr | string | IP Prefix in Classless Inter-Domain Routing format. (example: 192.0.2.0/24) |
created_at | string (date-time) | (example: 2014-01-01T05:20:00.12345Z) |
modified_at | string (date-time) | (example: 2014-01-01T05:20:00.12345Z) |
on_demand | object |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | account_id, prefix_id, bgp_prefix_id | Retrieve a single BGP Prefix according to its identifier | |
list | select | account_id, prefix_id | List all BGP Prefixes within the specified IP Prefix. BGP Prefixes are used to control which specific subnets are advertised to the Internet. It is possible to advertise subnets more specific than an IP Prefix by creating more specific BGP Prefixes. | |
create | insert | account_id, prefix_id, cidr | Create a BGP prefix, controlling the BGP advertisement status of a specific subnet. When created, BGP prefixes are initially withdrawn, and can be advertised with the Update BGP Prefix API. | |
edit | update | account_id, prefix_id, bgp_prefix_id | Update the properties of a BGP Prefix, such as the on demand advertisement status (advertised or withdrawn). |
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. |
bgp_prefix_id | string | |
prefix_id | string | The IP prefix ID. |
SELECT examples
- get
- list
Retrieve a single BGP Prefix according to its identifier
SELECT
id,
asn,
asn_prepend_count,
auto_advertise_withdraw,
bgp_signal_opts,
cidr,
created_at,
modified_at,
on_demand
FROM cloudflare.addressing.bgp_prefixes
WHERE account_id = '{{ account_id }}' -- required
AND prefix_id = '{{ prefix_id }}' -- required
AND bgp_prefix_id = '{{ bgp_prefix_id }}' -- required
;
List all BGP Prefixes within the specified IP Prefix. BGP Prefixes are used to control which specific subnets are advertised to the Internet. It is possible to advertise subnets more specific than an IP Prefix by creating more specific BGP Prefixes.
SELECT
id,
asn,
asn_prepend_count,
auto_advertise_withdraw,
bgp_signal_opts,
cidr,
created_at,
modified_at,
on_demand
FROM cloudflare.addressing.bgp_prefixes
WHERE account_id = '{{ account_id }}' -- required
AND prefix_id = '{{ prefix_id }}' -- required
;
INSERT examples
- create
- Manifest
Create a BGP prefix, controlling the BGP advertisement status of a specific subnet. When created, BGP prefixes are initially withdrawn, and can be advertised with the Update BGP Prefix API.
INSERT INTO cloudflare.addressing.bgp_prefixes (
cidr,
account_id,
prefix_id
)
SELECT
'{{ cidr }}' /* required */,
'{{ account_id }}',
'{{ prefix_id }}'
RETURNING
errors,
messages,
result,
success
;
# Description fields are for documentation purposes
- name: bgp_prefixes
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the bgp_prefixes resource.
- name: prefix_id
value: "{{ prefix_id }}"
description: Required parameter for the bgp_prefixes resource.
- name: cidr
value: "{{ cidr }}"
description: |
IP Prefix in Classless Inter-Domain Routing format.
UPDATE examples
- edit
Update the properties of a BGP Prefix, such as the on demand advertisement status (advertised or withdrawn).
UPDATE cloudflare.addressing.bgp_prefixes
SET
asn_prepend_count = {{ asn_prepend_count }},
auto_advertise_withdraw = {{ auto_advertise_withdraw }},
on_demand = '{{ on_demand }}'
WHERE
account_id = '{{ account_id }}' --required
AND prefix_id = '{{ prefix_id }}' --required
AND bgp_prefix_id = '{{ bgp_prefix_id }}' --required
RETURNING
errors,
messages,
result,
success;