labels
Creates, updates, deletes, gets or lists a labels resource.
Overview
| Name | labels |
| Type | Resource |
| Id | cloudflare.api_gateway.labels |
Fields
The following fields are returned by SELECT queries:
- list
Retrieve all labels response
| Name | Datatype | Description |
|---|---|---|
name | string | The name of the label (example: login) |
created_at | string (date-time) | (example: 2014-01-01T05:20:00.12345Z) |
description | string | The description of the label (example: All endpoints that deal with logins) |
last_updated | string (date-time) | (example: 2014-01-01T05:20:00.12345Z) |
mapped_resources | object | Provides counts of what resources are linked to this label |
metadata | object | Metadata for the label |
source | string | * user - label is owned by the user * managed - label is owned by cloudflare (user, managed) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
list | select | zone_id | page, per_page, order, direction, source, filter, with_mapped_resource_counts | Retrieve all labels |
create | insert | zone_id, operation_id | Attach label(s) on an operation in endpoint management | |
api_shield_operations_bulk_post_labels_to_operations | insert | zone_id, selector | Bulk attach label(s) on operation(s) in endpoint management | |
update | replace | zone_id, operation_id | Replace label(s) on an operation in endpoint management | |
api_shield_operations_bulk_put_labels_to_operations | replace | zone_id, selector, user, managed | Bulk replace label(s) on operation(s) in endpoint management | |
delete | delete | zone_id, operation_id | Remove label(s) on an operation in endpoint management | |
api_shield_operations_bulk_delete_labels_to_operations | delete | zone_id | Bulk remove label(s) on operation(s) in endpoint management |
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 |
|---|---|---|
operation_id | string | Identifier for the operation |
zone_id | string | The Cloudflare zone ID. |
direction | string | |
filter | string | Filter for labels where the name or description matches using substring match |
order | string | |
page | integer | Page number of paginated results. |
per_page | integer | Maximum number of results per page. |
source | string | Filter for labels with source |
with_mapped_resource_counts | boolean | Include mapped_resources for each label |
SELECT examples
- list
Retrieve all labels
SELECT
name,
created_at,
description,
last_updated,
mapped_resources,
metadata,
source
FROM cloudflare.api_gateway.labels
WHERE zone_id = '{{ zone_id }}' -- required
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
AND order = '{{ order }}'
AND direction = '{{ direction }}'
AND source = '{{ source }}'
AND filter = '{{ filter }}'
AND with_mapped_resource_counts = '{{ with_mapped_resource_counts }}'
;
INSERT examples
- create
- api_shield_operations_bulk_post_labels_to_operations
- Manifest
Attach label(s) on an operation in endpoint management
INSERT INTO cloudflare.api_gateway.labels (
managed,
user,
zone_id,
operation_id
)
SELECT
'{{ managed }}',
'{{ user }}',
'{{ zone_id }}',
'{{ operation_id }}'
RETURNING
errors,
messages,
result,
success
;
Bulk attach label(s) on operation(s) in endpoint management
INSERT INTO cloudflare.api_gateway.labels (
managed,
selector,
user,
zone_id
)
SELECT
'{{ managed }}',
'{{ selector }}' /* required */,
'{{ user }}',
'{{ zone_id }}'
RETURNING
errors,
messages,
result,
success
;
# Description fields are for documentation purposes
- name: labels
props:
- name: zone_id
value: "{{ zone_id }}"
description: Required parameter for the labels resource.
- name: operation_id
value: "{{ operation_id }}"
description: Required parameter for the labels resource.
- name: managed
value:
labels:
- "{{ labels }}"
- name: user
value:
labels:
- "{{ labels }}"
- name: selector
description: |
Operation IDs selector
value:
include:
operation_ids:
- "{{ operation_ids }}"
REPLACE examples
- update
- api_shield_operations_bulk_put_labels_to_operations
Replace label(s) on an operation in endpoint management
REPLACE cloudflare.api_gateway.labels
SET
managed = '{{ managed }}',
user = '{{ user }}'
WHERE
zone_id = '{{ zone_id }}' --required
AND operation_id = '{{ operation_id }}' --required
RETURNING
errors,
messages,
result,
success;
Bulk replace label(s) on operation(s) in endpoint management
REPLACE cloudflare.api_gateway.labels
SET
managed = '{{ managed }}',
selector = '{{ selector }}',
user = '{{ user }}'
WHERE
zone_id = '{{ zone_id }}' --required
AND selector = '{{ selector }}' --required
AND user = '{{ user }}' --required
AND managed = '{{ managed }}' --required
RETURNING
errors,
messages,
result,
success;
DELETE examples
- delete
- api_shield_operations_bulk_delete_labels_to_operations
Remove label(s) on an operation in endpoint management
DELETE FROM cloudflare.api_gateway.labels
WHERE zone_id = '{{ zone_id }}' --required
AND operation_id = '{{ operation_id }}' --required
;
Bulk remove label(s) on operation(s) in endpoint management
DELETE FROM cloudflare.api_gateway.labels
WHERE zone_id = '{{ zone_id }}' --required
;