prefixes
Creates, updates, deletes, gets or lists a prefixes resource.
Overview
| Name | prefixes |
| Type | Resource |
| Id | cloudflare.addressing.prefixes |
Fields
The following fields are returned by SELECT queries:
- get
- list
Prefix Details response
| Name | Datatype | Description |
|---|---|---|
id | string | Identifier of an IP Prefix. (example: 2af39739cc4e3b5910c918468bb89828) |
account_id | string | Identifier of a Cloudflare account. (example: 258def64c72dae45f3e4c8516e2111f2) |
loa_document_id | string | Identifier for the uploaded LOA document. (example: d933b1530bc56c9953cf8ce166da8004) |
advertised | boolean | Prefix advertisement status to the Internet. This field is only not 'null' if on demand is enabled. (x-stainless-deprecation-message: Prefer the BGP Prefixes API instead, which allows for advertising multiple BGP routes within a single IP Prefix.) |
advertised_modified_at | string (date-time) | Last time the advertisement status was changed. This field is only not 'null' if on demand is enabled. (example: 2014-01-01T05:20:00.12345Z, x-stainless-deprecation-message: Prefer the BGP Prefixes API instead, which allows for advertising multiple BGP routes within a single IP Prefix.) |
approved | string | Approval state of the prefix (P = pending, V = active). (example: P) |
asn | integer | Autonomous System Number (ASN) the prefix will be advertised under. |
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) |
delegate_loa_creation | boolean | Whether Cloudflare is allowed to generate the LOA document on behalf of the prefix owner. |
description | string | Description of the prefix. (example: Internal test prefix) |
irr_validation_state | string | State of one kind of validation for an IP prefix. (example: pending) |
modified_at | string (date-time) | (example: 2014-01-01T05:20:00.12345Z) |
on_demand_enabled | boolean | Whether advertisement of the prefix to the Internet may be dynamically enabled or disabled. (x-stainless-deprecation-message: Prefer the BGP Prefixes API instead, which allows for advertising multiple BGP routes within a single IP Prefix.) |
on_demand_locked | boolean | Whether advertisement status of the prefix is locked, meaning it cannot be changed. (x-stainless-deprecation-message: Prefer the BGP Prefixes API instead, which allows for advertising multiple BGP routes within a single IP Prefix.) |
ownership_validation_state | string | State of one kind of validation for an IP prefix. (example: pending) |
ownership_validation_token | string | Token provided to demonstrate ownership of the prefix. (example: 1234a5b6-1234-1abc-12a3-1234a5b6789c) |
rpki_validation_state | string | State of one kind of validation for an IP prefix. (example: pending) |
List Prefixes response
| Name | Datatype | Description |
|---|---|---|
id | string | Identifier of an IP Prefix. (example: 2af39739cc4e3b5910c918468bb89828) |
account_id | string | Identifier of a Cloudflare account. (example: 258def64c72dae45f3e4c8516e2111f2) |
loa_document_id | string | Identifier for the uploaded LOA document. (example: d933b1530bc56c9953cf8ce166da8004) |
advertised | boolean | Prefix advertisement status to the Internet. This field is only not 'null' if on demand is enabled. (x-stainless-deprecation-message: Prefer the BGP Prefixes API instead, which allows for advertising multiple BGP routes within a single IP Prefix.) |
advertised_modified_at | string (date-time) | Last time the advertisement status was changed. This field is only not 'null' if on demand is enabled. (example: 2014-01-01T05:20:00.12345Z, x-stainless-deprecation-message: Prefer the BGP Prefixes API instead, which allows for advertising multiple BGP routes within a single IP Prefix.) |
approved | string | Approval state of the prefix (P = pending, V = active). (example: P) |
asn | integer | Autonomous System Number (ASN) the prefix will be advertised under. |
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) |
delegate_loa_creation | boolean | Whether Cloudflare is allowed to generate the LOA document on behalf of the prefix owner. |
description | string | Description of the prefix. (example: Internal test prefix) |
irr_validation_state | string | State of one kind of validation for an IP prefix. (example: pending) |
modified_at | string (date-time) | (example: 2014-01-01T05:20:00.12345Z) |
on_demand_enabled | boolean | Whether advertisement of the prefix to the Internet may be dynamically enabled or disabled. (x-stainless-deprecation-message: Prefer the BGP Prefixes API instead, which allows for advertising multiple BGP routes within a single IP Prefix.) |
on_demand_locked | boolean | Whether advertisement status of the prefix is locked, meaning it cannot be changed. (x-stainless-deprecation-message: Prefer the BGP Prefixes API instead, which allows for advertising multiple BGP routes within a single IP Prefix.) |
ownership_validation_state | string | State of one kind of validation for an IP prefix. (example: pending) |
ownership_validation_token | string | Token provided to demonstrate ownership of the prefix. (example: 1234a5b6-1234-1abc-12a3-1234a5b6789c) |
rpki_validation_state | string | State of one kind of validation for an IP prefix. (example: pending) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | prefix_id, account_id | List a particular prefix owned by the account. | |
list | select | account_id | List all prefixes owned by the account. | |
create | insert | account_id, cidr, asn | Add a new prefix under the account. | |
edit | update | prefix_id, account_id, description | Modify the description for a prefix owned by the account. | |
ip_address_management_prefixes_delete_bgp_prefix | delete | account_id, prefix_id, bgp_prefix_id | Delete a BGP Prefix associated with the specified IP Prefix. A BGP Prefix must be withdrawn before it can be deleted. | |
delete | delete | prefix_id, account_id | Delete an unapproved prefix owned by the account. |
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
List a particular prefix owned by the account.
SELECT
id,
account_id,
loa_document_id,
advertised,
advertised_modified_at,
approved,
asn,
cidr,
created_at,
delegate_loa_creation,
description,
irr_validation_state,
modified_at,
on_demand_enabled,
on_demand_locked,
ownership_validation_state,
ownership_validation_token,
rpki_validation_state
FROM cloudflare.addressing.prefixes
WHERE prefix_id = '{{ prefix_id }}' -- required
AND account_id = '{{ account_id }}' -- required
;
List all prefixes owned by the account.
SELECT
id,
account_id,
loa_document_id,
advertised,
advertised_modified_at,
approved,
asn,
cidr,
created_at,
delegate_loa_creation,
description,
irr_validation_state,
modified_at,
on_demand_enabled,
on_demand_locked,
ownership_validation_state,
ownership_validation_token,
rpki_validation_state
FROM cloudflare.addressing.prefixes
WHERE account_id = '{{ account_id }}' -- required
;
INSERT examples
- create
- Manifest
Add a new prefix under the account.
INSERT INTO cloudflare.addressing.prefixes (
asn,
cidr,
delegate_loa_creation,
description,
loa_document_id,
account_id
)
SELECT
{{ asn }} /* required */,
'{{ cidr }}' /* required */,
{{ delegate_loa_creation }},
'{{ description }}',
'{{ loa_document_id }}',
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;
# Description fields are for documentation purposes
- name: prefixes
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the prefixes resource.
- name: asn
value: {{ asn }}
description: |
Autonomous System Number (ASN) the prefix will be advertised under.
- name: cidr
value: "{{ cidr }}"
description: |
IP Prefix in Classless Inter-Domain Routing format.
- name: delegate_loa_creation
value: {{ delegate_loa_creation }}
description: |
Whether Cloudflare is allowed to generate the LOA document on behalf of the prefix owner.
default: false
- name: description
value: "{{ description }}"
description: |
Description of the prefix.
- name: loa_document_id
value: "{{ loa_document_id }}"
description: |
Identifier for the uploaded LOA document.
UPDATE examples
- edit
Modify the description for a prefix owned by the account.
UPDATE cloudflare.addressing.prefixes
SET
description = '{{ description }}'
WHERE
prefix_id = '{{ prefix_id }}' --required
AND account_id = '{{ account_id }}' --required
AND description = '{{ description }}' --required
RETURNING
errors,
messages,
result,
success;
DELETE examples
- ip_address_management_prefixes_delete_bgp_prefix
- delete
Delete a BGP Prefix associated with the specified IP Prefix. A BGP Prefix must be withdrawn before it can be deleted.
DELETE FROM cloudflare.addressing.prefixes
WHERE account_id = '{{ account_id }}' --required
AND prefix_id = '{{ prefix_id }}' --required
AND bgp_prefix_id = '{{ bgp_prefix_id }}' --required
;
Delete an unapproved prefix owned by the account.
DELETE FROM cloudflare.addressing.prefixes
WHERE prefix_id = '{{ prefix_id }}' --required
AND account_id = '{{ account_id }}' --required
;