# Resource Sharing ## List account shares `client.resourceSharing.list(ResourceSharingListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/shares` Lists all account shares. ### Parameters - `params: ResourceSharingListParams` - `account_id: string` Path param: Account identifier. - `direction?: "asc" | "desc"` Query param: Direction to sort objects. - `"asc"` - `"desc"` - `include_recipient_counts?: boolean` Query param: Include recipient counts in the response. - `include_resources?: boolean` Query param: Include resources in the response. - `kind?: "sent" | "received"` Query param: Filter shares by kind. - `"sent"` - `"received"` - `order?: "name" | "created"` Query param: Order shares by values in the given field. - `"name"` - `"created"` - `page?: number` Query param: Page number. - `per_page?: number` Query param: Number of objects to return per page. - `resource_types?: Array<"custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more>` Query param: Filter share resources by resource_types. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `status?: "active" | "deleting" | "deleted"` Query param: Filter shares by status. - `"active"` - `"deleting"` - `"deleted"` - `target_type?: "account" | "organization"` Query param: Filter shares by target_type. - `"account"` - `"organization"` ### Returns - `ResourceSharingListResponse` - `id: string` Share identifier tag. - `account_id: string` Account identifier. - `account_name: string` The display name of an account. - `created: string` When the share was created. - `modified: string` When the share was modified. - `name: string` The name of the share. - `organization_id: string` Organization identifier. - `status: "active" | "deleting" | "deleted"` - `"active"` - `"deleting"` - `"deleted"` - `target_type: "account" | "organization"` - `"account"` - `"organization"` - `associated_recipient_count?: number` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count?: number` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count?: number` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count?: number` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind?: "sent" | "received"` - `"sent"` - `"received"` - `resources?: Array` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const resourceSharingListResponse of client.resourceSharing.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(resourceSharingListResponse.id); } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "3fd85f74b32742f1bff64a85009dda07", "account_id": "023e105f4ecef8ad9ca31a8372d0c353", "account_name": "Account A", "created": "2023-09-21T18:56:32.624632Z", "modified": "2023-09-21T18:56:32.624632Z", "name": "My Shared WAF Managed Rule", "organization_id": "023e105f4ecef8ad9ca31a8372d0c353", "status": "active", "target_type": "account", "associated_recipient_count": 10, "associating_recipient_count": 1, "disassociated_recipient_count": 0, "disassociating_recipient_count": 0, "kind": "sent", "resources": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "meta": {}, "modified": "2023-09-21T18:56:32.624632Z", "resource_account_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_type": "custom-ruleset", "resource_version": 0, "status": "active" } ] } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 50 } } ``` ## Get account share by ID `client.resourceSharing.get(stringshareId, ResourceSharingGetParamsparams, RequestOptionsoptions?): ResourceSharingGetResponse` **get** `/accounts/{account_id}/shares/{share_id}` Fetches share by ID. ### Parameters - `shareId: string` Share identifier tag. - `params: ResourceSharingGetParams` - `account_id: string` Path param: Account identifier. - `include_recipient_counts?: boolean` Query param: Include recipient counts in the response. - `include_resources?: boolean` Query param: Include resources in the response. ### Returns - `ResourceSharingGetResponse` - `id: string` Share identifier tag. - `account_id: string` Account identifier. - `account_name: string` The display name of an account. - `created: string` When the share was created. - `modified: string` When the share was modified. - `name: string` The name of the share. - `organization_id: string` Organization identifier. - `status: "active" | "deleting" | "deleted"` - `"active"` - `"deleting"` - `"deleted"` - `target_type: "account" | "organization"` - `"account"` - `"organization"` - `associated_recipient_count?: number` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count?: number` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count?: number` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count?: number` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind?: "sent" | "received"` - `"sent"` - `"received"` - `resources?: Array` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const resourceSharing = await client.resourceSharing.get('3fd85f74b32742f1bff64a85009dda07', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(resourceSharing.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "3fd85f74b32742f1bff64a85009dda07", "account_id": "023e105f4ecef8ad9ca31a8372d0c353", "account_name": "Account A", "created": "2023-09-21T18:56:32.624632Z", "modified": "2023-09-21T18:56:32.624632Z", "name": "My Shared WAF Managed Rule", "organization_id": "023e105f4ecef8ad9ca31a8372d0c353", "status": "active", "target_type": "account", "associated_recipient_count": 10, "associating_recipient_count": 1, "disassociated_recipient_count": 0, "disassociating_recipient_count": 0, "kind": "sent", "resources": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "meta": {}, "modified": "2023-09-21T18:56:32.624632Z", "resource_account_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_type": "custom-ruleset", "resource_version": 0, "status": "active" } ] } } ``` ## Create a new share `client.resourceSharing.create(ResourceSharingCreateParamsparams, RequestOptionsoptions?): ResourceSharingCreateResponse` **post** `/accounts/{account_id}/shares` Creates a new resource share for sharing Cloudflare resources with other accounts or organizations. ### Parameters - `params: ResourceSharingCreateParams` - `account_id: string` Path param: Account identifier. - `name: string` Body param: The name of the share. - `recipients: Array` Body param - `account_id?: string` Account identifier. - `organization_id?: string` Organization identifier. - `resources: Array` Body param - `meta: unknown` Resource Metadata. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` ### Returns - `ResourceSharingCreateResponse` - `id: string` Share identifier tag. - `account_id: string` Account identifier. - `account_name: string` The display name of an account. - `created: string` When the share was created. - `modified: string` When the share was modified. - `name: string` The name of the share. - `organization_id: string` Organization identifier. - `status: "active" | "deleting" | "deleted"` - `"active"` - `"deleting"` - `"deleted"` - `target_type: "account" | "organization"` - `"account"` - `"organization"` - `associated_recipient_count?: number` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count?: number` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count?: number` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count?: number` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind?: "sent" | "received"` - `"sent"` - `"received"` - `resources?: Array` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const resourceSharing = await client.resourceSharing.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', name: 'My Shared WAF Managed Rule', recipients: [{}], resources: [ { meta: {}, resource_account_id: '023e105f4ecef8ad9ca31a8372d0c353', resource_id: '023e105f4ecef8ad9ca31a8372d0c353', resource_type: 'custom-ruleset', }, ], }); console.log(resourceSharing.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "3fd85f74b32742f1bff64a85009dda07", "account_id": "023e105f4ecef8ad9ca31a8372d0c353", "account_name": "Account A", "created": "2023-09-21T18:56:32.624632Z", "modified": "2023-09-21T18:56:32.624632Z", "name": "My Shared WAF Managed Rule", "organization_id": "023e105f4ecef8ad9ca31a8372d0c353", "status": "active", "target_type": "account", "associated_recipient_count": 10, "associating_recipient_count": 1, "disassociated_recipient_count": 0, "disassociating_recipient_count": 0, "kind": "sent", "resources": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "meta": {}, "modified": "2023-09-21T18:56:32.624632Z", "resource_account_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_type": "custom-ruleset", "resource_version": 0, "status": "active" } ] } } ``` ## Update a share `client.resourceSharing.update(stringshareId, ResourceSharingUpdateParamsparams, RequestOptionsoptions?): ResourceSharingUpdateResponse` **put** `/accounts/{account_id}/shares/{share_id}` Updating is not immediate, an updated share object with a new status will be returned. ### Parameters - `shareId: string` Share identifier tag. - `params: ResourceSharingUpdateParams` - `account_id: string` Path param: Account identifier. - `name: string` Body param: The name of the share. ### Returns - `ResourceSharingUpdateResponse` - `id: string` Share identifier tag. - `account_id: string` Account identifier. - `account_name: string` The display name of an account. - `created: string` When the share was created. - `modified: string` When the share was modified. - `name: string` The name of the share. - `organization_id: string` Organization identifier. - `status: "active" | "deleting" | "deleted"` - `"active"` - `"deleting"` - `"deleted"` - `target_type: "account" | "organization"` - `"account"` - `"organization"` - `associated_recipient_count?: number` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count?: number` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count?: number` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count?: number` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind?: "sent" | "received"` - `"sent"` - `"received"` - `resources?: Array` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const resourceSharing = await client.resourceSharing.update('3fd85f74b32742f1bff64a85009dda07', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', name: 'My Shared WAF Managed Rule', }); console.log(resourceSharing.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "3fd85f74b32742f1bff64a85009dda07", "account_id": "023e105f4ecef8ad9ca31a8372d0c353", "account_name": "Account A", "created": "2023-09-21T18:56:32.624632Z", "modified": "2023-09-21T18:56:32.624632Z", "name": "My Shared WAF Managed Rule", "organization_id": "023e105f4ecef8ad9ca31a8372d0c353", "status": "active", "target_type": "account", "associated_recipient_count": 10, "associating_recipient_count": 1, "disassociated_recipient_count": 0, "disassociating_recipient_count": 0, "kind": "sent", "resources": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "meta": {}, "modified": "2023-09-21T18:56:32.624632Z", "resource_account_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_type": "custom-ruleset", "resource_version": 0, "status": "active" } ] } } ``` ## Delete a share `client.resourceSharing.delete(stringshareId, ResourceSharingDeleteParamsparams, RequestOptionsoptions?): ResourceSharingDeleteResponse` **delete** `/accounts/{account_id}/shares/{share_id}` Deletion is not immediate, an updated share object with a new status will be returned. ### Parameters - `shareId: string` Share identifier tag. - `params: ResourceSharingDeleteParams` - `account_id: string` Account identifier. ### Returns - `ResourceSharingDeleteResponse` - `id: string` Share identifier tag. - `account_id: string` Account identifier. - `account_name: string` The display name of an account. - `created: string` When the share was created. - `modified: string` When the share was modified. - `name: string` The name of the share. - `organization_id: string` Organization identifier. - `status: "active" | "deleting" | "deleted"` - `"active"` - `"deleting"` - `"deleted"` - `target_type: "account" | "organization"` - `"account"` - `"organization"` - `associated_recipient_count?: number` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count?: number` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count?: number` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count?: number` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind?: "sent" | "received"` - `"sent"` - `"received"` - `resources?: Array` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const resourceSharing = await client.resourceSharing.delete('3fd85f74b32742f1bff64a85009dda07', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(resourceSharing.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "3fd85f74b32742f1bff64a85009dda07", "account_id": "023e105f4ecef8ad9ca31a8372d0c353", "account_name": "Account A", "created": "2023-09-21T18:56:32.624632Z", "modified": "2023-09-21T18:56:32.624632Z", "name": "My Shared WAF Managed Rule", "organization_id": "023e105f4ecef8ad9ca31a8372d0c353", "status": "active", "target_type": "account", "associated_recipient_count": 10, "associating_recipient_count": 1, "disassociated_recipient_count": 0, "disassociating_recipient_count": 0, "kind": "sent", "resources": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "meta": {}, "modified": "2023-09-21T18:56:32.624632Z", "resource_account_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_type": "custom-ruleset", "resource_version": 0, "status": "active" } ] } } ``` ## Domain Types ### Resource Sharing List Response - `ResourceSharingListResponse` - `id: string` Share identifier tag. - `account_id: string` Account identifier. - `account_name: string` The display name of an account. - `created: string` When the share was created. - `modified: string` When the share was modified. - `name: string` The name of the share. - `organization_id: string` Organization identifier. - `status: "active" | "deleting" | "deleted"` - `"active"` - `"deleting"` - `"deleted"` - `target_type: "account" | "organization"` - `"account"` - `"organization"` - `associated_recipient_count?: number` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count?: number` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count?: number` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count?: number` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind?: "sent" | "received"` - `"sent"` - `"received"` - `resources?: Array` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Sharing Get Response - `ResourceSharingGetResponse` - `id: string` Share identifier tag. - `account_id: string` Account identifier. - `account_name: string` The display name of an account. - `created: string` When the share was created. - `modified: string` When the share was modified. - `name: string` The name of the share. - `organization_id: string` Organization identifier. - `status: "active" | "deleting" | "deleted"` - `"active"` - `"deleting"` - `"deleted"` - `target_type: "account" | "organization"` - `"account"` - `"organization"` - `associated_recipient_count?: number` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count?: number` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count?: number` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count?: number` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind?: "sent" | "received"` - `"sent"` - `"received"` - `resources?: Array` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Sharing Create Response - `ResourceSharingCreateResponse` - `id: string` Share identifier tag. - `account_id: string` Account identifier. - `account_name: string` The display name of an account. - `created: string` When the share was created. - `modified: string` When the share was modified. - `name: string` The name of the share. - `organization_id: string` Organization identifier. - `status: "active" | "deleting" | "deleted"` - `"active"` - `"deleting"` - `"deleted"` - `target_type: "account" | "organization"` - `"account"` - `"organization"` - `associated_recipient_count?: number` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count?: number` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count?: number` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count?: number` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind?: "sent" | "received"` - `"sent"` - `"received"` - `resources?: Array` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Sharing Update Response - `ResourceSharingUpdateResponse` - `id: string` Share identifier tag. - `account_id: string` Account identifier. - `account_name: string` The display name of an account. - `created: string` When the share was created. - `modified: string` When the share was modified. - `name: string` The name of the share. - `organization_id: string` Organization identifier. - `status: "active" | "deleting" | "deleted"` - `"active"` - `"deleting"` - `"deleted"` - `target_type: "account" | "organization"` - `"account"` - `"organization"` - `associated_recipient_count?: number` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count?: number` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count?: number` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count?: number` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind?: "sent" | "received"` - `"sent"` - `"received"` - `resources?: Array` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Sharing Delete Response - `ResourceSharingDeleteResponse` - `id: string` Share identifier tag. - `account_id: string` Account identifier. - `account_name: string` The display name of an account. - `created: string` When the share was created. - `modified: string` When the share was modified. - `name: string` The name of the share. - `organization_id: string` Organization identifier. - `status: "active" | "deleting" | "deleted"` - `"active"` - `"deleting"` - `"deleted"` - `target_type: "account" | "organization"` - `"account"` - `"organization"` - `associated_recipient_count?: number` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count?: number` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count?: number` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count?: number` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind?: "sent" | "received"` - `"sent"` - `"received"` - `resources?: Array` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` # Recipients ## List share recipients by share ID `client.resourceSharing.recipients.list(stringshareId, RecipientListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/shares/{share_id}/recipients` List share recipients by share ID. ### Parameters - `shareId: string` Share identifier tag. - `params: RecipientListParams` - `account_id: string` Path param: Account identifier. - `include_resources?: boolean` Query param: Include resources in the response. - `page?: number` Query param: Page number. - `per_page?: number` Query param: Number of objects to return per page. ### Returns - `RecipientListResponse` - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` Share Recipient association status. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: string` When the share was created. - `modified: string` When the share was modified. - `resources?: Array` - `error: string` Share Recipient error message. - `resource_id: string` Share Resource identifier. - `resource_version: number` Resource Version. - `terminal: boolean` Whether the error is terminal or will be continually retried. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const recipientListResponse of client.resourceSharing.recipients.list( '3fd85f74b32742f1bff64a85009dda07', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, )) { console.log(recipientListResponse.id); } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "3fd85f74b32742f1bff64a85009dda07", "account_id": "023e105f4ecef8ad9ca31a8372d0c353", "association_status": "associating", "created": "2023-09-21T18:56:32.624632Z", "modified": "2023-09-21T18:56:32.624632Z", "resources": [ { "error": "Recipient is missing necessary entitlement", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_version": 0, "terminal": true } ] } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 50 } } ``` ## Get share recipient by ID `client.resourceSharing.recipients.get(stringshareId, stringrecipientId, RecipientGetParamsparams, RequestOptionsoptions?): RecipientGetResponse` **get** `/accounts/{account_id}/shares/{share_id}/recipients/{recipient_id}` Get share recipient by ID. ### Parameters - `shareId: string` Share identifier tag. - `recipientId: string` Share Recipient identifier tag. - `params: RecipientGetParams` - `account_id: string` Path param: Account identifier. - `include_resources?: boolean` Query param: Include resources in the response. ### Returns - `RecipientGetResponse` - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` Share Recipient association status. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: string` When the share was created. - `modified: string` When the share was modified. - `resources?: Array` - `error: string` Share Recipient error message. - `resource_id: string` Share Resource identifier. - `resource_version: number` Resource Version. - `terminal: boolean` Whether the error is terminal or will be continually retried. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const recipient = await client.resourceSharing.recipients.get( '3fd85f74b32742f1bff64a85009dda07', '3fd85f74b32742f1bff64a85009dda07', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(recipient.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "3fd85f74b32742f1bff64a85009dda07", "account_id": "023e105f4ecef8ad9ca31a8372d0c353", "association_status": "associating", "created": "2023-09-21T18:56:32.624632Z", "modified": "2023-09-21T18:56:32.624632Z", "resources": [ { "error": "Recipient is missing necessary entitlement", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_version": 0, "terminal": true } ] } } ``` ## Create a new share recipient `client.resourceSharing.recipients.create(stringshareId, RecipientCreateParamsparams, RequestOptionsoptions?): RecipientCreateResponse` **post** `/accounts/{account_id}/shares/{share_id}/recipients` Adds a recipient to a resource share, granting them access to the shared resources. ### Parameters - `shareId: string` Share identifier tag. - `params: RecipientCreateParams` - `body_account_id?: string` Body param: Account identifier. - `organization_id?: string` Body param: Organization identifier. ### Returns - `RecipientCreateResponse` - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` Share Recipient association status. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: string` When the share was created. - `modified: string` When the share was modified. - `resources?: Array` - `error: string` Share Recipient error message. - `resource_id: string` Share Resource identifier. - `resource_version: number` Resource Version. - `terminal: boolean` Whether the error is terminal or will be continually retried. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const recipient = await client.resourceSharing.recipients.create( '3fd85f74b32742f1bff64a85009dda07', { path_account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(recipient.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "3fd85f74b32742f1bff64a85009dda07", "account_id": "023e105f4ecef8ad9ca31a8372d0c353", "association_status": "associating", "created": "2023-09-21T18:56:32.624632Z", "modified": "2023-09-21T18:56:32.624632Z", "resources": [ { "error": "Recipient is missing necessary entitlement", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_version": 0, "terminal": true } ] } } ``` ## Delete a share recipient `client.resourceSharing.recipients.delete(stringshareId, stringrecipientId, RecipientDeleteParamsparams, RequestOptionsoptions?): RecipientDeleteResponse` **delete** `/accounts/{account_id}/shares/{share_id}/recipients/{recipient_id}` Deletion is not immediate, an updated share recipient object with a new status will be returned. ### Parameters - `shareId: string` Share identifier tag. - `recipientId: string` Share Recipient identifier tag. - `params: RecipientDeleteParams` - `account_id: string` Account identifier. ### Returns - `RecipientDeleteResponse` - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` Share Recipient association status. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: string` When the share was created. - `modified: string` When the share was modified. - `resources?: Array` - `error: string` Share Recipient error message. - `resource_id: string` Share Resource identifier. - `resource_version: number` Resource Version. - `terminal: boolean` Whether the error is terminal or will be continually retried. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const recipient = await client.resourceSharing.recipients.delete( '3fd85f74b32742f1bff64a85009dda07', '3fd85f74b32742f1bff64a85009dda07', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(recipient.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "3fd85f74b32742f1bff64a85009dda07", "account_id": "023e105f4ecef8ad9ca31a8372d0c353", "association_status": "associating", "created": "2023-09-21T18:56:32.624632Z", "modified": "2023-09-21T18:56:32.624632Z", "resources": [ { "error": "Recipient is missing necessary entitlement", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_version": 0, "terminal": true } ] } } ``` ## Domain Types ### Recipient List Response - `RecipientListResponse` - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` Share Recipient association status. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: string` When the share was created. - `modified: string` When the share was modified. - `resources?: Array` - `error: string` Share Recipient error message. - `resource_id: string` Share Resource identifier. - `resource_version: number` Resource Version. - `terminal: boolean` Whether the error is terminal or will be continually retried. ### Recipient Get Response - `RecipientGetResponse` - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` Share Recipient association status. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: string` When the share was created. - `modified: string` When the share was modified. - `resources?: Array` - `error: string` Share Recipient error message. - `resource_id: string` Share Resource identifier. - `resource_version: number` Resource Version. - `terminal: boolean` Whether the error is terminal or will be continually retried. ### Recipient Create Response - `RecipientCreateResponse` - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` Share Recipient association status. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: string` When the share was created. - `modified: string` When the share was modified. - `resources?: Array` - `error: string` Share Recipient error message. - `resource_id: string` Share Resource identifier. - `resource_version: number` Resource Version. - `terminal: boolean` Whether the error is terminal or will be continually retried. ### Recipient Delete Response - `RecipientDeleteResponse` - `id: string` Share Recipient identifier tag. - `account_id: string` Account identifier. - `association_status: "associating" | "associated" | "disassociating" | "disassociated"` Share Recipient association status. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: string` When the share was created. - `modified: string` When the share was modified. - `resources?: Array` - `error: string` Share Recipient error message. - `resource_id: string` Share Resource identifier. - `resource_version: number` Resource Version. - `terminal: boolean` Whether the error is terminal or will be continually retried. # Resources ## List share resources by share ID `client.resourceSharing.resources.list(stringshareId, ResourceListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/shares/{share_id}/resources` List share resources by share ID. ### Parameters - `shareId: string` Share identifier tag. - `params: ResourceListParams` - `account_id: string` Path param: Account identifier. - `page?: number` Query param: Page number. - `per_page?: number` Query param: Number of objects to return per page. - `resource_type?: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Query param: Filter share resources by resource_type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `status?: "active" | "deleting" | "deleted"` Query param: Filter share resources by status. - `"active"` - `"deleting"` - `"deleted"` ### Returns - `ResourceListResponse` - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const resourceListResponse of client.resourceSharing.resources.list( '3fd85f74b32742f1bff64a85009dda07', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, )) { console.log(resourceListResponse.id); } ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": [ { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "meta": {}, "modified": "2023-09-21T18:56:32.624632Z", "resource_account_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_type": "custom-ruleset", "resource_version": 0, "status": "active" } ], "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000, "total_pages": 50 } } ``` ## Get share resource by ID `client.resourceSharing.resources.get(stringshareId, stringresourceId, ResourceGetParamsparams, RequestOptionsoptions?): ResourceGetResponse` **get** `/accounts/{account_id}/shares/{share_id}/resources/{resource_id}` Get share resource by ID. ### Parameters - `shareId: string` Share identifier tag. - `resourceId: string` Share Resource identifier. - `params: ResourceGetParams` - `account_id: string` Account identifier. ### Returns - `ResourceGetResponse` - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const resource = await client.resourceSharing.resources.get( '3fd85f74b32742f1bff64a85009dda07', '023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(resource.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "meta": {}, "modified": "2023-09-21T18:56:32.624632Z", "resource_account_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_type": "custom-ruleset", "resource_version": 0, "status": "active" } } ``` ## Create a new share resource `client.resourceSharing.resources.create(stringshareId, ResourceCreateParamsparams, RequestOptionsoptions?): ResourceCreateResponse` **post** `/accounts/{account_id}/shares/{share_id}/resources` Adds a resource to an existing share, making it available to share recipients. ### Parameters - `shareId: string` Share identifier tag. - `params: ResourceCreateParams` - `account_id: string` Path param: Account identifier. - `meta: unknown` Body param: Resource Metadata. - `resource_account_id: string` Body param: Account identifier. - `resource_id: string` Body param: Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Body param: Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` ### Returns - `ResourceCreateResponse` - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const resource = await client.resourceSharing.resources.create('3fd85f74b32742f1bff64a85009dda07', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', meta: {}, resource_account_id: '023e105f4ecef8ad9ca31a8372d0c353', resource_id: '023e105f4ecef8ad9ca31a8372d0c353', resource_type: 'custom-ruleset', }); console.log(resource.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "meta": {}, "modified": "2023-09-21T18:56:32.624632Z", "resource_account_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_type": "custom-ruleset", "resource_version": 0, "status": "active" } } ``` ## Update a share resource `client.resourceSharing.resources.update(stringshareId, stringresourceId, ResourceUpdateParamsparams, RequestOptionsoptions?): ResourceUpdateResponse` **put** `/accounts/{account_id}/shares/{share_id}/resources/{resource_id}` Update is not immediate, an updated share resource object with a new status will be returned. ### Parameters - `shareId: string` Share identifier tag. - `resourceId: string` Share Resource identifier. - `params: ResourceUpdateParams` - `account_id: string` Path param: Account identifier. - `meta: unknown` Body param: Resource Metadata. ### Returns - `ResourceUpdateResponse` - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const resource = await client.resourceSharing.resources.update( '3fd85f74b32742f1bff64a85009dda07', '023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', meta: {}, }, ); console.log(resource.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "meta": {}, "modified": "2023-09-21T18:56:32.624632Z", "resource_account_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_type": "custom-ruleset", "resource_version": 0, "status": "active" } } ``` ## Delete a share resource `client.resourceSharing.resources.delete(stringshareId, stringresourceId, ResourceDeleteParamsparams, RequestOptionsoptions?): ResourceDeleteResponse` **delete** `/accounts/{account_id}/shares/{share_id}/resources/{resource_id}` Deletion is not immediate, an updated share resource object with a new status will be returned. ### Parameters - `shareId: string` Share identifier tag. - `resourceId: string` Share Resource identifier. - `params: ResourceDeleteParams` - `account_id: string` Account identifier. ### Returns - `ResourceDeleteResponse` - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiEmail: process.env['CLOUDFLARE_EMAIL'], // This is the default and can be omitted apiKey: process.env['CLOUDFLARE_API_KEY'], // This is the default and can be omitted }); const resource = await client.resourceSharing.resources.delete( '3fd85f74b32742f1bff64a85009dda07', '023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353' }, ); console.log(resource.id); ``` #### Response ```json { "errors": [ { "code": 1000, "message": "message", "documentation_url": "documentation_url", "source": { "pointer": "pointer" } } ], "success": true, "result": { "id": "023e105f4ecef8ad9ca31a8372d0c353", "created": "2023-09-21T18:56:32.624632Z", "meta": {}, "modified": "2023-09-21T18:56:32.624632Z", "resource_account_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_type": "custom-ruleset", "resource_version": 0, "status": "active" } } ``` ## Domain Types ### Resource List Response - `ResourceListResponse` - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Get Response - `ResourceGetResponse` - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Create Response - `ResourceCreateResponse` - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Update Response - `ResourceUpdateResponse` - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Delete Response - `ResourceDeleteResponse` - `id: string` Share Resource identifier. - `created: string` When the share was created. - `meta: unknown` Resource Metadata. - `modified: string` When the share was modified. - `resource_account_id: string` Account identifier. - `resource_id: string` Share Resource identifier. - `resource_type: "custom-ruleset" | "gateway-policy" | "gateway-destination-ip" | 2 more` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `resource_version: number` Resource Version. - `status: "active" | "deleting" | "deleted"` Resource Status. - `"active"` - `"deleting"` - `"deleted"`