# Resource Sharing ## List account shares `resource_sharing.list(ResourceSharingListParams**kwargs) -> SyncV4PagePaginationArray[ResourceSharingListResponse]` **get** `/accounts/{account_id}/shares` Lists all account shares. ### Parameters - `account_id: str` Account identifier. - `direction: Optional[Literal["asc", "desc"]]` Direction to sort objects. - `"asc"` - `"desc"` - `include_recipient_counts: Optional[bool]` Include recipient counts in the response. - `include_resources: Optional[bool]` Include resources in the response. - `kind: Optional[Literal["sent", "received"]]` Filter shares by kind. - `"sent"` - `"received"` - `order: Optional[Literal["name", "created"]]` Order shares by values in the given field. - `"name"` - `"created"` - `page: Optional[int]` Page number. Defaults to `1` when `per_page` is supplied without `page`. May be omitted entirely along with `per_page` to receive a non-paginated response. - `per_page: Optional[int]` Number of objects to return per page. Defaults to `20` when `page` is supplied without `per_page`. May be omitted entirely along with `page` to receive a non-paginated response. - `resource_types: Optional[List[Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]]]` Filter share resources by resource_types. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `status: Optional[Literal["active", "deleting", "deleted"]]` Filter shares by status. - `"active"` - `"deleting"` - `"deleted"` - `tag: Optional[Sequence[str]]` Filter shares by tag. Each value is either `key=value` (matches shares whose tags contain that key/value pair) or `key` alone (matches shares that have any value for that key). May be repeated; multiple `tag` parameters are ANDed together. Maximum 20 `tag` parameters per request. - `target_type: Optional[Literal["account", "organization"]]` Filter shares by target_type. - `"account"` - `"organization"` ### Returns - `class ResourceSharingListResponse: …` - `id: str` Share identifier tag. - `account_id: str` Account identifier. - `account_name: str` The display name of an account. - `created: datetime` When the share was created. - `modified: datetime` When the share was modified. - `name: str` The name of the share. - `organization_id: str` Organization identifier. - `status: Literal["active", "deleting", "deleted"]` - `"active"` - `"deleting"` - `"deleted"` - `target_type: Literal["account", "organization"]` - `"account"` - `"organization"` - `associated_recipient_count: Optional[int]` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count: Optional[int]` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count: Optional[int]` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count: Optional[int]` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind: Optional[Literal["sent", "received"]]` - `"sent"` - `"received"` - `resources: Optional[List[Resource]]` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: str` Share Resource identifier. - `created: datetime` When the share was created. - `meta: object` Resource Metadata. - `modified: datetime` When the share was modified. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: int` Resource Version. - `status: Literal["active", "deleting", "deleted"]` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) page = client.resource_sharing.list( account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.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 `resource_sharing.get(strshare_id, ResourceSharingGetParams**kwargs) -> ResourceSharingGetResponse` **get** `/accounts/{account_id}/shares/{share_id}` Fetches share by ID. ### Parameters - `account_id: str` Account identifier. - `share_id: str` Share identifier tag. - `include_recipient_counts: Optional[bool]` Include recipient counts in the response. - `include_resources: Optional[bool]` Include resources in the response. ### Returns - `class ResourceSharingGetResponse: …` - `id: str` Share identifier tag. - `account_id: str` Account identifier. - `account_name: str` The display name of an account. - `created: datetime` When the share was created. - `modified: datetime` When the share was modified. - `name: str` The name of the share. - `organization_id: str` Organization identifier. - `status: Literal["active", "deleting", "deleted"]` - `"active"` - `"deleting"` - `"deleted"` - `target_type: Literal["account", "organization"]` - `"account"` - `"organization"` - `associated_recipient_count: Optional[int]` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count: Optional[int]` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count: Optional[int]` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count: Optional[int]` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind: Optional[Literal["sent", "received"]]` - `"sent"` - `"received"` - `resources: Optional[List[Resource]]` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: str` Share Resource identifier. - `created: datetime` When the share was created. - `meta: object` Resource Metadata. - `modified: datetime` When the share was modified. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: int` Resource Version. - `status: Literal["active", "deleting", "deleted"]` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) resource_sharing = client.resource_sharing.get( share_id="3fd85f74b32742f1bff64a85009dda07", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(resource_sharing.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 `resource_sharing.create(ResourceSharingCreateParams**kwargs) -> ResourceSharingCreateResponse` **post** `/accounts/{account_id}/shares` Creates a new resource share for sharing Cloudflare resources with other accounts or organizations. ### Parameters - `account_id: str` Account identifier. - `name: str` The name of the share. - `recipients: Iterable[Recipient]` - `account_id: Optional[str]` Deprecated alias for `recipient_account_id`. Use `recipient_account_id` instead. The body field collided with the URL path parameter of the same name, which prevented SDK generators from distinguishing the source account (in the URL) from the recipient account (in the body). Both names will continue to be accepted until 2027-05-26 (see `x-sunset`). - `organization_id: Optional[str]` Organization identifier. - `recipient_account_id: Optional[str]` The account that will receive the share. - `resources: Iterable[Resource]` - `meta: object` Resource Metadata. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` ### Returns - `class ResourceSharingCreateResponse: …` - `id: str` Share identifier tag. - `account_id: str` Account identifier. - `account_name: str` The display name of an account. - `created: datetime` When the share was created. - `modified: datetime` When the share was modified. - `name: str` The name of the share. - `organization_id: str` Organization identifier. - `status: Literal["active", "deleting", "deleted"]` - `"active"` - `"deleting"` - `"deleted"` - `target_type: Literal["account", "organization"]` - `"account"` - `"organization"` - `associated_recipient_count: Optional[int]` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count: Optional[int]` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count: Optional[int]` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count: Optional[int]` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind: Optional[Literal["sent", "received"]]` - `"sent"` - `"received"` - `resources: Optional[List[Resource]]` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: str` Share Resource identifier. - `created: datetime` When the share was created. - `meta: object` Resource Metadata. - `modified: datetime` When the share was modified. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: int` Resource Version. - `status: Literal["active", "deleting", "deleted"]` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) resource_sharing = client.resource_sharing.create( account_id="023e105f4ecef8ad9ca31a8372d0c353", name="My Shared WAF Managed Rule", recipients=[{}], resources=[{ "meta": {}, "resource_account_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_id": "023e105f4ecef8ad9ca31a8372d0c353", "resource_type": "custom-ruleset", }], ) print(resource_sharing.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 `resource_sharing.update(strshare_id, ResourceSharingUpdateParams**kwargs) -> ResourceSharingUpdateResponse` **put** `/accounts/{account_id}/shares/{share_id}` Updating is not immediate, an updated share object with a new status will be returned. ### Parameters - `account_id: str` Account identifier. - `share_id: str` Share identifier tag. - `name: str` The name of the share. ### Returns - `class ResourceSharingUpdateResponse: …` - `id: str` Share identifier tag. - `account_id: str` Account identifier. - `account_name: str` The display name of an account. - `created: datetime` When the share was created. - `modified: datetime` When the share was modified. - `name: str` The name of the share. - `organization_id: str` Organization identifier. - `status: Literal["active", "deleting", "deleted"]` - `"active"` - `"deleting"` - `"deleted"` - `target_type: Literal["account", "organization"]` - `"account"` - `"organization"` - `associated_recipient_count: Optional[int]` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count: Optional[int]` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count: Optional[int]` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count: Optional[int]` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind: Optional[Literal["sent", "received"]]` - `"sent"` - `"received"` - `resources: Optional[List[Resource]]` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: str` Share Resource identifier. - `created: datetime` When the share was created. - `meta: object` Resource Metadata. - `modified: datetime` When the share was modified. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: int` Resource Version. - `status: Literal["active", "deleting", "deleted"]` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) resource_sharing = client.resource_sharing.update( share_id="3fd85f74b32742f1bff64a85009dda07", account_id="023e105f4ecef8ad9ca31a8372d0c353", name="My Shared WAF Managed Rule", ) print(resource_sharing.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 `resource_sharing.delete(strshare_id, ResourceSharingDeleteParams**kwargs) -> ResourceSharingDeleteResponse` **delete** `/accounts/{account_id}/shares/{share_id}` Deletion is not immediate, an updated share object with a new status will be returned. ### Parameters - `account_id: str` Account identifier. - `share_id: str` Share identifier tag. ### Returns - `class ResourceSharingDeleteResponse: …` - `id: str` Share identifier tag. - `account_id: str` Account identifier. - `account_name: str` The display name of an account. - `created: datetime` When the share was created. - `modified: datetime` When the share was modified. - `name: str` The name of the share. - `organization_id: str` Organization identifier. - `status: Literal["active", "deleting", "deleted"]` - `"active"` - `"deleting"` - `"deleted"` - `target_type: Literal["account", "organization"]` - `"account"` - `"organization"` - `associated_recipient_count: Optional[int]` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count: Optional[int]` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count: Optional[int]` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count: Optional[int]` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind: Optional[Literal["sent", "received"]]` - `"sent"` - `"received"` - `resources: Optional[List[Resource]]` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: str` Share Resource identifier. - `created: datetime` When the share was created. - `meta: object` Resource Metadata. - `modified: datetime` When the share was modified. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: int` Resource Version. - `status: Literal["active", "deleting", "deleted"]` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) resource_sharing = client.resource_sharing.delete( share_id="3fd85f74b32742f1bff64a85009dda07", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(resource_sharing.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 - `class ResourceSharingListResponse: …` - `id: str` Share identifier tag. - `account_id: str` Account identifier. - `account_name: str` The display name of an account. - `created: datetime` When the share was created. - `modified: datetime` When the share was modified. - `name: str` The name of the share. - `organization_id: str` Organization identifier. - `status: Literal["active", "deleting", "deleted"]` - `"active"` - `"deleting"` - `"deleted"` - `target_type: Literal["account", "organization"]` - `"account"` - `"organization"` - `associated_recipient_count: Optional[int]` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count: Optional[int]` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count: Optional[int]` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count: Optional[int]` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind: Optional[Literal["sent", "received"]]` - `"sent"` - `"received"` - `resources: Optional[List[Resource]]` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: str` Share Resource identifier. - `created: datetime` When the share was created. - `meta: object` Resource Metadata. - `modified: datetime` When the share was modified. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: int` Resource Version. - `status: Literal["active", "deleting", "deleted"]` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Sharing Get Response - `class ResourceSharingGetResponse: …` - `id: str` Share identifier tag. - `account_id: str` Account identifier. - `account_name: str` The display name of an account. - `created: datetime` When the share was created. - `modified: datetime` When the share was modified. - `name: str` The name of the share. - `organization_id: str` Organization identifier. - `status: Literal["active", "deleting", "deleted"]` - `"active"` - `"deleting"` - `"deleted"` - `target_type: Literal["account", "organization"]` - `"account"` - `"organization"` - `associated_recipient_count: Optional[int]` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count: Optional[int]` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count: Optional[int]` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count: Optional[int]` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind: Optional[Literal["sent", "received"]]` - `"sent"` - `"received"` - `resources: Optional[List[Resource]]` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: str` Share Resource identifier. - `created: datetime` When the share was created. - `meta: object` Resource Metadata. - `modified: datetime` When the share was modified. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: int` Resource Version. - `status: Literal["active", "deleting", "deleted"]` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Sharing Create Response - `class ResourceSharingCreateResponse: …` - `id: str` Share identifier tag. - `account_id: str` Account identifier. - `account_name: str` The display name of an account. - `created: datetime` When the share was created. - `modified: datetime` When the share was modified. - `name: str` The name of the share. - `organization_id: str` Organization identifier. - `status: Literal["active", "deleting", "deleted"]` - `"active"` - `"deleting"` - `"deleted"` - `target_type: Literal["account", "organization"]` - `"account"` - `"organization"` - `associated_recipient_count: Optional[int]` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count: Optional[int]` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count: Optional[int]` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count: Optional[int]` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind: Optional[Literal["sent", "received"]]` - `"sent"` - `"received"` - `resources: Optional[List[Resource]]` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: str` Share Resource identifier. - `created: datetime` When the share was created. - `meta: object` Resource Metadata. - `modified: datetime` When the share was modified. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: int` Resource Version. - `status: Literal["active", "deleting", "deleted"]` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Sharing Update Response - `class ResourceSharingUpdateResponse: …` - `id: str` Share identifier tag. - `account_id: str` Account identifier. - `account_name: str` The display name of an account. - `created: datetime` When the share was created. - `modified: datetime` When the share was modified. - `name: str` The name of the share. - `organization_id: str` Organization identifier. - `status: Literal["active", "deleting", "deleted"]` - `"active"` - `"deleting"` - `"deleted"` - `target_type: Literal["account", "organization"]` - `"account"` - `"organization"` - `associated_recipient_count: Optional[int]` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count: Optional[int]` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count: Optional[int]` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count: Optional[int]` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind: Optional[Literal["sent", "received"]]` - `"sent"` - `"received"` - `resources: Optional[List[Resource]]` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: str` Share Resource identifier. - `created: datetime` When the share was created. - `meta: object` Resource Metadata. - `modified: datetime` When the share was modified. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: int` Resource Version. - `status: Literal["active", "deleting", "deleted"]` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Sharing Delete Response - `class ResourceSharingDeleteResponse: …` - `id: str` Share identifier tag. - `account_id: str` Account identifier. - `account_name: str` The display name of an account. - `created: datetime` When the share was created. - `modified: datetime` When the share was modified. - `name: str` The name of the share. - `organization_id: str` Organization identifier. - `status: Literal["active", "deleting", "deleted"]` - `"active"` - `"deleting"` - `"deleted"` - `target_type: Literal["account", "organization"]` - `"account"` - `"organization"` - `associated_recipient_count: Optional[int]` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `associating_recipient_count: Optional[int]` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociated_recipient_count: Optional[int]` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `disassociating_recipient_count: Optional[int]` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `kind: Optional[Literal["sent", "received"]]` - `"sent"` - `"received"` - `resources: Optional[List[Resource]]` A list of resources that are part of the share. This field is only included when requested via the 'include_resources' parameter. - `id: str` Share Resource identifier. - `created: datetime` When the share was created. - `meta: object` Resource Metadata. - `modified: datetime` When the share was modified. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: int` Resource Version. - `status: Literal["active", "deleting", "deleted"]` Resource Status. - `"active"` - `"deleting"` - `"deleted"` # Recipients ## List share recipients by share ID `resource_sharing.recipients.list(strshare_id, RecipientListParams**kwargs) -> SyncV4PagePaginationArray[RecipientListResponse]` **get** `/accounts/{account_id}/shares/{share_id}/recipients` List share recipients by share ID. ### Parameters - `account_id: str` Account identifier. - `share_id: str` Share identifier tag. - `include_resources: Optional[bool]` Include resources in the response. - `page: Optional[int]` Page number. Defaults to `1` when `per_page` is supplied without `page`. May be omitted entirely along with `per_page` to receive a non-paginated response. - `per_page: Optional[int]` Number of objects to return per page. Defaults to `20` when `page` is supplied without `per_page`. May be omitted entirely along with `page` to receive a non-paginated response. ### Returns - `class RecipientListResponse: …` - `id: str` Share Recipient identifier tag. - `account_id: str` Account identifier. - `association_status: Literal["associating", "associated", "disassociating", "disassociated"]` Share Recipient association status. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: datetime` When the share was created. - `modified: datetime` When the share was modified. - `resources: Optional[List[Resource]]` - `error: str` Share Recipient error message. - `resource_id: str` Share Resource identifier. - `resource_version: int` Resource Version. - `terminal: bool` Whether the error is terminal or will be continually retried. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) page = client.resource_sharing.recipients.list( share_id="3fd85f74b32742f1bff64a85009dda07", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.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 `resource_sharing.recipients.get(strrecipient_id, RecipientGetParams**kwargs) -> RecipientGetResponse` **get** `/accounts/{account_id}/shares/{share_id}/recipients/{recipient_id}` Get share recipient by ID. ### Parameters - `account_id: str` Account identifier. - `share_id: str` Share identifier tag. - `recipient_id: str` Share Recipient identifier tag. - `include_resources: Optional[bool]` Include resources in the response. ### Returns - `class RecipientGetResponse: …` - `id: str` Share Recipient identifier tag. - `account_id: str` Account identifier. - `association_status: Literal["associating", "associated", "disassociating", "disassociated"]` Share Recipient association status. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: datetime` When the share was created. - `modified: datetime` When the share was modified. - `resources: Optional[List[Resource]]` - `error: str` Share Recipient error message. - `resource_id: str` Share Resource identifier. - `resource_version: int` Resource Version. - `terminal: bool` Whether the error is terminal or will be continually retried. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) recipient = client.resource_sharing.recipients.get( recipient_id="3fd85f74b32742f1bff64a85009dda07", account_id="023e105f4ecef8ad9ca31a8372d0c353", share_id="3fd85f74b32742f1bff64a85009dda07", ) print(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 `resource_sharing.recipients.create(strshare_id, RecipientCreateParams**kwargs) -> RecipientCreateResponse` **post** `/accounts/{account_id}/shares/{share_id}/recipients` Adds a recipient to a resource share, granting them access to the shared resources. ### Parameters - `account_id: str` Account identifier. - `share_id: str` Share identifier tag. - `account_id: str` Account identifier. - `organization_id: Optional[str]` Organization identifier. - `recipient_account_id: Optional[str]` The account that will receive the share. ### Returns - `class RecipientCreateResponse: …` - `id: str` Share Recipient identifier tag. - `account_id: str` Account identifier. - `association_status: Literal["associating", "associated", "disassociating", "disassociated"]` Share Recipient association status. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: datetime` When the share was created. - `modified: datetime` When the share was modified. - `resources: Optional[List[Resource]]` - `error: str` Share Recipient error message. - `resource_id: str` Share Resource identifier. - `resource_version: int` Resource Version. - `terminal: bool` Whether the error is terminal or will be continually retried. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) recipient = client.resource_sharing.recipients.create( share_id="3fd85f74b32742f1bff64a85009dda07", path_account_id="023e105f4ecef8ad9ca31a8372d0c353", ) print(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 `resource_sharing.recipients.delete(strrecipient_id, RecipientDeleteParams**kwargs) -> 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 - `account_id: str` Account identifier. - `share_id: str` Share identifier tag. - `recipient_id: str` Share Recipient identifier tag. ### Returns - `class RecipientDeleteResponse: …` - `id: str` Share Recipient identifier tag. - `account_id: str` Account identifier. - `association_status: Literal["associating", "associated", "disassociating", "disassociated"]` Share Recipient association status. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: datetime` When the share was created. - `modified: datetime` When the share was modified. - `resources: Optional[List[Resource]]` - `error: str` Share Recipient error message. - `resource_id: str` Share Resource identifier. - `resource_version: int` Resource Version. - `terminal: bool` Whether the error is terminal or will be continually retried. ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) recipient = client.resource_sharing.recipients.delete( recipient_id="3fd85f74b32742f1bff64a85009dda07", account_id="023e105f4ecef8ad9ca31a8372d0c353", share_id="3fd85f74b32742f1bff64a85009dda07", ) print(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 - `class RecipientListResponse: …` - `id: str` Share Recipient identifier tag. - `account_id: str` Account identifier. - `association_status: Literal["associating", "associated", "disassociating", "disassociated"]` Share Recipient association status. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: datetime` When the share was created. - `modified: datetime` When the share was modified. - `resources: Optional[List[Resource]]` - `error: str` Share Recipient error message. - `resource_id: str` Share Resource identifier. - `resource_version: int` Resource Version. - `terminal: bool` Whether the error is terminal or will be continually retried. ### Recipient Get Response - `class RecipientGetResponse: …` - `id: str` Share Recipient identifier tag. - `account_id: str` Account identifier. - `association_status: Literal["associating", "associated", "disassociating", "disassociated"]` Share Recipient association status. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: datetime` When the share was created. - `modified: datetime` When the share was modified. - `resources: Optional[List[Resource]]` - `error: str` Share Recipient error message. - `resource_id: str` Share Resource identifier. - `resource_version: int` Resource Version. - `terminal: bool` Whether the error is terminal or will be continually retried. ### Recipient Create Response - `class RecipientCreateResponse: …` - `id: str` Share Recipient identifier tag. - `account_id: str` Account identifier. - `association_status: Literal["associating", "associated", "disassociating", "disassociated"]` Share Recipient association status. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: datetime` When the share was created. - `modified: datetime` When the share was modified. - `resources: Optional[List[Resource]]` - `error: str` Share Recipient error message. - `resource_id: str` Share Resource identifier. - `resource_version: int` Resource Version. - `terminal: bool` Whether the error is terminal or will be continually retried. ### Recipient Delete Response - `class RecipientDeleteResponse: …` - `id: str` Share Recipient identifier tag. - `account_id: str` Account identifier. - `association_status: Literal["associating", "associated", "disassociating", "disassociated"]` Share Recipient association status. - `"associating"` - `"associated"` - `"disassociating"` - `"disassociated"` - `created: datetime` When the share was created. - `modified: datetime` When the share was modified. - `resources: Optional[List[Resource]]` - `error: str` Share Recipient error message. - `resource_id: str` Share Resource identifier. - `resource_version: int` Resource Version. - `terminal: bool` Whether the error is terminal or will be continually retried. # Resources ## List share resources by share ID `resource_sharing.resources.list(strshare_id, ResourceListParams**kwargs) -> SyncV4PagePaginationArray[ResourceListResponse]` **get** `/accounts/{account_id}/shares/{share_id}/resources` List share resources by share ID. ### Parameters - `account_id: str` Account identifier. - `share_id: str` Share identifier tag. - `page: Optional[int]` Page number. Defaults to `1` when `per_page` is supplied without `page`. May be omitted entirely along with `per_page` to receive a non-paginated response. - `per_page: Optional[int]` Number of objects to return per page. Defaults to `20` when `page` is supplied without `per_page`. May be omitted entirely along with `page` to receive a non-paginated response. - `resource_type: Optional[Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]]` Filter share resources by resource_type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `status: Optional[Literal["active", "deleting", "deleted"]]` Filter share resources by status. - `"active"` - `"deleting"` - `"deleted"` ### Returns - `class ResourceListResponse: …` - `id: str` Share Resource identifier. - `created: datetime` When the share was created. - `meta: object` Resource Metadata. - `modified: datetime` When the share was modified. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: int` Resource Version. - `status: Literal["active", "deleting", "deleted"]` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) page = client.resource_sharing.resources.list( share_id="3fd85f74b32742f1bff64a85009dda07", account_id="023e105f4ecef8ad9ca31a8372d0c353", ) page = page.result[0] print(page.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 `resource_sharing.resources.get(strshare_resource_id, ResourceGetParams**kwargs) -> ResourceGetResponse` **get** `/accounts/{account_id}/shares/{share_id}/resources/{share_resource_id}` Get share resource by ID. ### Parameters - `account_id: str` Account identifier. - `share_id: str` Share identifier tag. - `share_resource_id: str` Share Resource identifier. ### Returns - `class ResourceGetResponse: …` - `id: str` Share Resource identifier. - `created: datetime` When the share was created. - `meta: object` Resource Metadata. - `modified: datetime` When the share was modified. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: int` Resource Version. - `status: Literal["active", "deleting", "deleted"]` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) resource = client.resource_sharing.resources.get( share_resource_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", share_id="3fd85f74b32742f1bff64a85009dda07", ) print(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 `resource_sharing.resources.create(strshare_id, ResourceCreateParams**kwargs) -> ResourceCreateResponse` **post** `/accounts/{account_id}/shares/{share_id}/resources` Adds a resource to an existing share, making it available to share recipients. ### Parameters - `account_id: str` Account identifier. - `share_id: str` Share identifier tag. - `meta: object` Resource Metadata. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` ### Returns - `class ResourceCreateResponse: …` - `id: str` Share Resource identifier. - `created: datetime` When the share was created. - `meta: object` Resource Metadata. - `modified: datetime` When the share was modified. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: int` Resource Version. - `status: Literal["active", "deleting", "deleted"]` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) resource = client.resource_sharing.resources.create( share_id="3fd85f74b32742f1bff64a85009dda07", account_id="023e105f4ecef8ad9ca31a8372d0c353", meta={}, resource_account_id="023e105f4ecef8ad9ca31a8372d0c353", resource_id="023e105f4ecef8ad9ca31a8372d0c353", resource_type="custom-ruleset", ) print(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 `resource_sharing.resources.update(strshare_resource_id, ResourceUpdateParams**kwargs) -> ResourceUpdateResponse` **put** `/accounts/{account_id}/shares/{share_id}/resources/{share_resource_id}` Update is not immediate, an updated share resource object with a new status will be returned. ### Parameters - `account_id: str` Account identifier. - `share_id: str` Share identifier tag. - `share_resource_id: str` Share Resource identifier. - `meta: object` Resource Metadata. ### Returns - `class ResourceUpdateResponse: …` - `id: str` Share Resource identifier. - `created: datetime` When the share was created. - `meta: object` Resource Metadata. - `modified: datetime` When the share was modified. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: int` Resource Version. - `status: Literal["active", "deleting", "deleted"]` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) resource = client.resource_sharing.resources.update( share_resource_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", share_id="3fd85f74b32742f1bff64a85009dda07", meta={}, ) print(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 `resource_sharing.resources.delete(strshare_resource_id, ResourceDeleteParams**kwargs) -> ResourceDeleteResponse` **delete** `/accounts/{account_id}/shares/{share_id}/resources/{share_resource_id}` Deletion is not immediate, an updated share resource object with a new status will be returned. ### Parameters - `account_id: str` Account identifier. - `share_id: str` Share identifier tag. - `share_resource_id: str` Share Resource identifier. ### Returns - `class ResourceDeleteResponse: …` - `id: str` Share Resource identifier. - `created: datetime` When the share was created. - `meta: object` Resource Metadata. - `modified: datetime` When the share was modified. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: int` Resource Version. - `status: Literal["active", "deleting", "deleted"]` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Example ```python import os from cloudflare import Cloudflare client = Cloudflare( api_email=os.environ.get("CLOUDFLARE_EMAIL"), # This is the default and can be omitted api_key=os.environ.get("CLOUDFLARE_API_KEY"), # This is the default and can be omitted ) resource = client.resource_sharing.resources.delete( share_resource_id="023e105f4ecef8ad9ca31a8372d0c353", account_id="023e105f4ecef8ad9ca31a8372d0c353", share_id="3fd85f74b32742f1bff64a85009dda07", ) print(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 - `class ResourceListResponse: …` - `id: str` Share Resource identifier. - `created: datetime` When the share was created. - `meta: object` Resource Metadata. - `modified: datetime` When the share was modified. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: int` Resource Version. - `status: Literal["active", "deleting", "deleted"]` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Get Response - `class ResourceGetResponse: …` - `id: str` Share Resource identifier. - `created: datetime` When the share was created. - `meta: object` Resource Metadata. - `modified: datetime` When the share was modified. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: int` Resource Version. - `status: Literal["active", "deleting", "deleted"]` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Create Response - `class ResourceCreateResponse: …` - `id: str` Share Resource identifier. - `created: datetime` When the share was created. - `meta: object` Resource Metadata. - `modified: datetime` When the share was modified. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: int` Resource Version. - `status: Literal["active", "deleting", "deleted"]` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Update Response - `class ResourceUpdateResponse: …` - `id: str` Share Resource identifier. - `created: datetime` When the share was created. - `meta: object` Resource Metadata. - `modified: datetime` When the share was modified. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: int` Resource Version. - `status: Literal["active", "deleting", "deleted"]` Resource Status. - `"active"` - `"deleting"` - `"deleted"` ### Resource Delete Response - `class ResourceDeleteResponse: …` - `id: str` Share Resource identifier. - `created: datetime` When the share was created. - `meta: object` Resource Metadata. - `modified: datetime` When the share was modified. - `resource_account_id: str` Account identifier. - `resource_id: str` Share Resource identifier. - `resource_type: Literal["custom-ruleset", "gateway-policy", "gateway-destination-ip", 3 more]` Resource Type. - `"custom-ruleset"` - `"gateway-policy"` - `"gateway-destination-ip"` - `"gateway-block-page-settings"` - `"gateway-extended-email-matching"` - `"idp-federation-grant"` - `resource_version: int` Resource Version. - `status: Literal["active", "deleting", "deleted"]` Resource Status. - `"active"` - `"deleting"` - `"deleted"`