Skip to main content

shares

Creates, updates, deletes, gets or lists a shares resource.

Overview

Nameshares
TypeResource
Idcloudflare.resource_sharing.shares

Fields

The following fields are returned by SELECT queries:

Get account share response.

NameDatatypeDescription
idstringShare identifier tag. (example: 3fd85f74b32742f1bff64a85009dda07)
namestringThe name of the share. (example: My Shared WAF Managed Rule)
account_idstringAccount identifier. (example: 023e105f4ecef8ad9ca31a8372d0c353)
organization_idstringOrganization identifier. (example: 023e105f4ecef8ad9ca31a8372d0c353)
account_namestringThe display name of an account. (example: Account A)
associated_recipient_countintegerThe number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter.
associating_recipient_countintegerThe number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter.
createdstring (date-time)When the share was created. (example: 2023-09-21T18:56:32.624632Z)
disassociated_recipient_countintegerThe number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter.
disassociating_recipient_countintegerThe number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter.
kindstring (sent, received)
modifiedstring (date-time)When the share was modified. (example: 2023-09-21T18:56:32.624632Z)
resourcesarrayA list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter.
statusstring (active, deleting, deleted)
target_typestring (account, organization)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectaccount_id, share_idinclude_resources, include_recipient_countsFetches share by ID.
listselectaccount_idstatus, kind, target_type, resource_types, order, direction, page, per_page, include_resources, include_recipient_countsLists all account shares.
createinsertaccount_id, name, resources, recipientsCreates a new resource share for sharing Cloudflare resources with other accounts or organizations.
updatereplaceaccount_id, share_id, nameUpdating is not immediate, an updated share object with a new status will be returned.
deletedeleteaccount_id, share_idDeletion 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.

NameDatatypeDescription
account_idstringThe Cloudflare account ID.
share_idstring
directionstringDirection to sort objects.
include_recipient_countsbooleanInclude recipient counts in the response.
include_resourcesbooleanInclude resources in the response.
kindstringFilter shares by kind.
orderstringOrder shares by values in the given field.
pageintegerPage number.
per_pageintegerNumber of objects to return per page.
resource_typesarrayFilter share resources by resource_types.
statusstringFilter shares by status.
target_typestringFilter shares by target_type.

SELECT examples

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 }}'
;

INSERT examples

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
;

REPLACE examples

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

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
;