shares
Creates, updates, deletes, gets or lists a shares resource.
Overview
| Name | shares |
| Type | Resource |
| Id | cloudflare.resource_sharing.shares |
Fields
The following fields are returned by SELECT queries:
- get
- list
Get account share response.
| Name | Datatype | Description |
|---|---|---|
id | string | Share identifier tag. (example: 3fd85f74b32742f1bff64a85009dda07) |
name | string | The name of the share. (example: My Shared WAF Managed Rule) |
account_id | string | Account identifier. (example: 023e105f4ecef8ad9ca31a8372d0c353) |
organization_id | string | Organization identifier. (example: 023e105f4ecef8ad9ca31a8372d0c353) |
account_name | string | The display name of an account. (example: Account A) |
associated_recipient_count | integer | The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. |
associating_recipient_count | integer | The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. |
created | string (date-time) | When the share was created. (example: 2023-09-21T18:56:32.624632Z) |
disassociated_recipient_count | integer | The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. |
disassociating_recipient_count | integer | The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. |
kind | string | (sent, received) |
modified | string (date-time) | When the share was modified. (example: 2023-09-21T18:56:32.624632Z) |
resources | array | A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. |
status | string | (active, deleting, deleted) |
target_type | string | (account, organization) |
List account shares response.
| Name | Datatype | Description |
|---|---|---|
id | string | Share identifier tag. (example: 3fd85f74b32742f1bff64a85009dda07) |
name | string | The name of the share. (example: My Shared WAF Managed Rule) |
account_id | string | Account identifier. (example: 023e105f4ecef8ad9ca31a8372d0c353) |
organization_id | string | Organization identifier. (example: 023e105f4ecef8ad9ca31a8372d0c353) |
account_name | string | The display name of an account. (example: Account A) |
associated_recipient_count | integer | The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. |
associating_recipient_count | integer | The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. |
created | string (date-time) | When the share was created. (example: 2023-09-21T18:56:32.624632Z) |
disassociated_recipient_count | integer | The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. |
disassociating_recipient_count | integer | The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. |
kind | string | (sent, received) |
modified | string (date-time) | When the share was modified. (example: 2023-09-21T18:56:32.624632Z) |
resources | array | A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. |
status | string | (active, deleting, deleted) |
target_type | string | (account, organization) |
Methods
The following methods are available for this resource:
| Name | Accessible by | Required Params | Optional Params | Description |
|---|---|---|---|---|
get | select | account_id, share_id | include_resources, include_recipient_counts | Fetches share by ID. |
list | select | account_id | status, kind, target_type, resource_types, order, direction, page, per_page, include_resources, include_recipient_counts | Lists all account shares. |
create | insert | account_id, name, resources, recipients | Creates a new resource share for sharing Cloudflare resources with other accounts or organizations. | |
update | replace | account_id, share_id, name | Updating is not immediate, an updated share object with a new status will be returned. | |
delete | delete | account_id, share_id | Deletion is not immediate, an updated share object with a new status will be returned. |
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. |
share_id | string | |
direction | string | Direction to sort objects. |
include_recipient_counts | boolean | Include recipient counts in the response. |
include_resources | boolean | Include resources in the response. |
kind | string | Filter shares by kind. |
order | string | Order shares by values in the given field. |
page | integer | Page number. |
per_page | integer | Number of objects to return per page. |
resource_types | array | Filter share resources by resource_types. |
status | string | Filter shares by status. |
target_type | string | Filter shares by target_type. |
SELECT examples
- get
- list
Fetches share by ID.
SELECT
id,
name,
account_id,
organization_id,
account_name,
associated_recipient_count,
associating_recipient_count,
created,
disassociated_recipient_count,
disassociating_recipient_count,
kind,
modified,
resources,
status,
target_type
FROM cloudflare.resource_sharing.shares
WHERE account_id = '{{ account_id }}' -- required
AND share_id = '{{ share_id }}' -- required
AND include_resources = '{{ include_resources }}'
AND include_recipient_counts = '{{ include_recipient_counts }}'
;
Lists all account shares.
SELECT
id,
name,
account_id,
organization_id,
account_name,
associated_recipient_count,
associating_recipient_count,
created,
disassociated_recipient_count,
disassociating_recipient_count,
kind,
modified,
resources,
status,
target_type
FROM cloudflare.resource_sharing.shares
WHERE account_id = '{{ account_id }}' -- required
AND status = '{{ status }}'
AND kind = '{{ kind }}'
AND target_type = '{{ target_type }}'
AND resource_types = '{{ resource_types }}'
AND order = '{{ order }}'
AND direction = '{{ direction }}'
AND page = '{{ page }}'
AND per_page = '{{ per_page }}'
AND include_resources = '{{ include_resources }}'
AND include_recipient_counts = '{{ include_recipient_counts }}'
;
INSERT examples
- create
- Manifest
Creates a new resource share for sharing Cloudflare resources with other accounts or organizations.
INSERT INTO cloudflare.resource_sharing.shares (
name,
recipients,
resources,
account_id
)
SELECT
'{{ name }}' /* required */,
'{{ recipients }}' /* required */,
'{{ resources }}' /* required */,
'{{ account_id }}'
RETURNING
errors,
result,
success
;
# Description fields are for documentation purposes
- name: shares
props:
- name: account_id
value: "{{ account_id }}"
description: Required parameter for the shares resource.
- name: name
value: "{{ name }}"
description: |
The name of the share.
- name: recipients
value:
- account_id: "{{ account_id }}"
organization_id: "{{ organization_id }}"
- name: resources
value:
- meta: "{{ meta }}"
resource_account_id: "{{ resource_account_id }}"
resource_id: "{{ resource_id }}"
resource_type: "{{ resource_type }}"
REPLACE examples
- update
Updating is not immediate, an updated share object with a new status will be returned.
REPLACE cloudflare.resource_sharing.shares
SET
name = '{{ name }}'
WHERE
account_id = '{{ account_id }}' --required
AND share_id = '{{ share_id }}' --required
AND name = '{{ name }}' --required
RETURNING
errors,
result,
success;
DELETE examples
- delete
Deletion is not immediate, an updated share object with a new status will be returned.
DELETE FROM cloudflare.resource_sharing.shares
WHERE account_id = '{{ account_id }}' --required
AND share_id = '{{ share_id }}' --required
;