# Resource Sharing ## List account shares `client.ResourceSharing.List(ctx, params) (*V4PagePaginationArray[ResourceSharingListResponse], error)` **get** `/accounts/{account_id}/shares` Lists all account shares. ### Parameters - `params ResourceSharingListParams` - `AccountID param.Field[string]` Path param: Account identifier. - `Direction param.Field[ResourceSharingListParamsDirection]` Query param: Direction to sort objects. - `const ResourceSharingListParamsDirectionAsc ResourceSharingListParamsDirection = "asc"` - `const ResourceSharingListParamsDirectionDesc ResourceSharingListParamsDirection = "desc"` - `IncludeRecipientCounts param.Field[bool]` Query param: Include recipient counts in the response. - `IncludeResources param.Field[bool]` Query param: Include resources in the response. - `Kind param.Field[ResourceSharingListParamsKind]` Query param: Filter shares by kind. - `const ResourceSharingListParamsKindSent ResourceSharingListParamsKind = "sent"` - `const ResourceSharingListParamsKindReceived ResourceSharingListParamsKind = "received"` - `Order param.Field[ResourceSharingListParamsOrder]` Query param: Order shares by values in the given field. - `const ResourceSharingListParamsOrderName ResourceSharingListParamsOrder = "name"` - `const ResourceSharingListParamsOrderCreated ResourceSharingListParamsOrder = "created"` - `Page param.Field[int64]` Query param: 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. - `PerPage param.Field[int64]` Query param: 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. - `ResourceTypes param.Field[[]ResourceSharingListParamsResourceType]` Query param: Filter share resources by resource_types. - `const ResourceSharingListParamsResourceTypeCustomRuleset ResourceSharingListParamsResourceType = "custom-ruleset"` - `const ResourceSharingListParamsResourceTypeGatewayPolicy ResourceSharingListParamsResourceType = "gateway-policy"` - `const ResourceSharingListParamsResourceTypeGatewayDestinationIP ResourceSharingListParamsResourceType = "gateway-destination-ip"` - `const ResourceSharingListParamsResourceTypeGatewayBlockPageSettings ResourceSharingListParamsResourceType = "gateway-block-page-settings"` - `const ResourceSharingListParamsResourceTypeGatewayExtendedEmailMatching ResourceSharingListParamsResourceType = "gateway-extended-email-matching"` - `const ResourceSharingListParamsResourceTypeIdPFederationGrant ResourceSharingListParamsResourceType = "idp-federation-grant"` - `Status param.Field[ResourceSharingListParamsStatus]` Query param: Filter shares by status. - `const ResourceSharingListParamsStatusActive ResourceSharingListParamsStatus = "active"` - `const ResourceSharingListParamsStatusDeleting ResourceSharingListParamsStatus = "deleting"` - `const ResourceSharingListParamsStatusDeleted ResourceSharingListParamsStatus = "deleted"` - `Tag param.Field[[]string]` Query param: 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. - `TargetType param.Field[ResourceSharingListParamsTargetType]` Query param: Filter shares by target_type. - `const ResourceSharingListParamsTargetTypeAccount ResourceSharingListParamsTargetType = "account"` - `const ResourceSharingListParamsTargetTypeOrganization ResourceSharingListParamsTargetType = "organization"` ### Returns - `type ResourceSharingListResponse struct{…}` - `ID string` Share identifier tag. - `AccountID string` Account identifier. - `AccountName string` The display name of an account. - `Created Time` When the share was created. - `Modified Time` When the share was modified. - `Name string` The name of the share. - `OrganizationID string` Organization identifier. - `Status ResourceSharingListResponseStatus` - `const ResourceSharingListResponseStatusActive ResourceSharingListResponseStatus = "active"` - `const ResourceSharingListResponseStatusDeleting ResourceSharingListResponseStatus = "deleting"` - `const ResourceSharingListResponseStatusDeleted ResourceSharingListResponseStatus = "deleted"` - `TargetType ResourceSharingListResponseTargetType` - `const ResourceSharingListResponseTargetTypeAccount ResourceSharingListResponseTargetType = "account"` - `const ResourceSharingListResponseTargetTypeOrganization ResourceSharingListResponseTargetType = "organization"` - `AssociatedRecipientCount int64` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `AssociatingRecipientCount int64` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `DisassociatedRecipientCount int64` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `DisassociatingRecipientCount int64` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `Kind ResourceSharingListResponseKind` - `const ResourceSharingListResponseKindSent ResourceSharingListResponseKind = "sent"` - `const ResourceSharingListResponseKindReceived ResourceSharingListResponseKind = "received"` - `Resources []ResourceSharingListResponseResource` 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 Time` When the share was created. - `Meta unknown` Resource Metadata. - `Modified Time` When the share was modified. - `ResourceAccountID string` Account identifier. - `ResourceID string` Share Resource identifier. - `ResourceType ResourceSharingListResponseResourcesResourceType` Resource Type. - `const ResourceSharingListResponseResourcesResourceTypeCustomRuleset ResourceSharingListResponseResourcesResourceType = "custom-ruleset"` - `const ResourceSharingListResponseResourcesResourceTypeGatewayPolicy ResourceSharingListResponseResourcesResourceType = "gateway-policy"` - `const ResourceSharingListResponseResourcesResourceTypeGatewayDestinationIP ResourceSharingListResponseResourcesResourceType = "gateway-destination-ip"` - `const ResourceSharingListResponseResourcesResourceTypeGatewayBlockPageSettings ResourceSharingListResponseResourcesResourceType = "gateway-block-page-settings"` - `const ResourceSharingListResponseResourcesResourceTypeGatewayExtendedEmailMatching ResourceSharingListResponseResourcesResourceType = "gateway-extended-email-matching"` - `const ResourceSharingListResponseResourcesResourceTypeIdPFederationGrant ResourceSharingListResponseResourcesResourceType = "idp-federation-grant"` - `ResourceVersion int64` Resource Version. - `Status ResourceSharingListResponseResourcesStatus` Resource Status. - `const ResourceSharingListResponseResourcesStatusActive ResourceSharingListResponseResourcesStatus = "active"` - `const ResourceSharingListResponseResourcesStatusDeleting ResourceSharingListResponseResourcesStatus = "deleting"` - `const ResourceSharingListResponseResourcesStatusDeleted ResourceSharingListResponseResourcesStatus = "deleted"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/resource_sharing" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) page, err := client.ResourceSharing.List(context.TODO(), resource_sharing.ResourceSharingListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### 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(ctx, shareID, params) (*ResourceSharingGetResponse, error)` **get** `/accounts/{account_id}/shares/{share_id}` Fetches share by ID. ### Parameters - `shareID string` Share identifier tag. - `params ResourceSharingGetParams` - `AccountID param.Field[string]` Path param: Account identifier. - `IncludeRecipientCounts param.Field[bool]` Query param: Include recipient counts in the response. - `IncludeResources param.Field[bool]` Query param: Include resources in the response. ### Returns - `type ResourceSharingGetResponse struct{…}` - `ID string` Share identifier tag. - `AccountID string` Account identifier. - `AccountName string` The display name of an account. - `Created Time` When the share was created. - `Modified Time` When the share was modified. - `Name string` The name of the share. - `OrganizationID string` Organization identifier. - `Status ResourceSharingGetResponseStatus` - `const ResourceSharingGetResponseStatusActive ResourceSharingGetResponseStatus = "active"` - `const ResourceSharingGetResponseStatusDeleting ResourceSharingGetResponseStatus = "deleting"` - `const ResourceSharingGetResponseStatusDeleted ResourceSharingGetResponseStatus = "deleted"` - `TargetType ResourceSharingGetResponseTargetType` - `const ResourceSharingGetResponseTargetTypeAccount ResourceSharingGetResponseTargetType = "account"` - `const ResourceSharingGetResponseTargetTypeOrganization ResourceSharingGetResponseTargetType = "organization"` - `AssociatedRecipientCount int64` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `AssociatingRecipientCount int64` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `DisassociatedRecipientCount int64` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `DisassociatingRecipientCount int64` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `Kind ResourceSharingGetResponseKind` - `const ResourceSharingGetResponseKindSent ResourceSharingGetResponseKind = "sent"` - `const ResourceSharingGetResponseKindReceived ResourceSharingGetResponseKind = "received"` - `Resources []ResourceSharingGetResponseResource` 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 Time` When the share was created. - `Meta unknown` Resource Metadata. - `Modified Time` When the share was modified. - `ResourceAccountID string` Account identifier. - `ResourceID string` Share Resource identifier. - `ResourceType ResourceSharingGetResponseResourcesResourceType` Resource Type. - `const ResourceSharingGetResponseResourcesResourceTypeCustomRuleset ResourceSharingGetResponseResourcesResourceType = "custom-ruleset"` - `const ResourceSharingGetResponseResourcesResourceTypeGatewayPolicy ResourceSharingGetResponseResourcesResourceType = "gateway-policy"` - `const ResourceSharingGetResponseResourcesResourceTypeGatewayDestinationIP ResourceSharingGetResponseResourcesResourceType = "gateway-destination-ip"` - `const ResourceSharingGetResponseResourcesResourceTypeGatewayBlockPageSettings ResourceSharingGetResponseResourcesResourceType = "gateway-block-page-settings"` - `const ResourceSharingGetResponseResourcesResourceTypeGatewayExtendedEmailMatching ResourceSharingGetResponseResourcesResourceType = "gateway-extended-email-matching"` - `const ResourceSharingGetResponseResourcesResourceTypeIdPFederationGrant ResourceSharingGetResponseResourcesResourceType = "idp-federation-grant"` - `ResourceVersion int64` Resource Version. - `Status ResourceSharingGetResponseResourcesStatus` Resource Status. - `const ResourceSharingGetResponseResourcesStatusActive ResourceSharingGetResponseResourcesStatus = "active"` - `const ResourceSharingGetResponseResourcesStatusDeleting ResourceSharingGetResponseResourcesStatus = "deleting"` - `const ResourceSharingGetResponseResourcesStatusDeleted ResourceSharingGetResponseResourcesStatus = "deleted"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/resource_sharing" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) resourceSharing, err := client.ResourceSharing.Get( context.TODO(), "3fd85f74b32742f1bff64a85009dda07", resource_sharing.ResourceSharingGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", 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.New(ctx, params) (*ResourceSharingNewResponse, error)` **post** `/accounts/{account_id}/shares` Creates a new resource share for sharing Cloudflare resources with other accounts or organizations. ### Parameters - `params ResourceSharingNewParams` - `AccountID param.Field[string]` Path param: Account identifier. - `Name param.Field[string]` Body param: The name of the share. - `Recipients param.Field[[]ResourceSharingNewParamsRecipient]` Body param - `AccountID string` 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`). - `OrganizationID string` Organization identifier. - `RecipientAccountID string` The account that will receive the share. - `Resources param.Field[[]ResourceSharingNewParamsResource]` Body param - `Meta unknown` Resource Metadata. - `ResourceAccountID string` Account identifier. - `ResourceID string` Share Resource identifier. - `ResourceType ResourceSharingNewParamsResourcesResourceType` Resource Type. - `const ResourceSharingNewParamsResourcesResourceTypeCustomRuleset ResourceSharingNewParamsResourcesResourceType = "custom-ruleset"` - `const ResourceSharingNewParamsResourcesResourceTypeGatewayPolicy ResourceSharingNewParamsResourcesResourceType = "gateway-policy"` - `const ResourceSharingNewParamsResourcesResourceTypeGatewayDestinationIP ResourceSharingNewParamsResourcesResourceType = "gateway-destination-ip"` - `const ResourceSharingNewParamsResourcesResourceTypeGatewayBlockPageSettings ResourceSharingNewParamsResourcesResourceType = "gateway-block-page-settings"` - `const ResourceSharingNewParamsResourcesResourceTypeGatewayExtendedEmailMatching ResourceSharingNewParamsResourcesResourceType = "gateway-extended-email-matching"` - `const ResourceSharingNewParamsResourcesResourceTypeIdPFederationGrant ResourceSharingNewParamsResourcesResourceType = "idp-federation-grant"` ### Returns - `type ResourceSharingNewResponse struct{…}` - `ID string` Share identifier tag. - `AccountID string` Account identifier. - `AccountName string` The display name of an account. - `Created Time` When the share was created. - `Modified Time` When the share was modified. - `Name string` The name of the share. - `OrganizationID string` Organization identifier. - `Status ResourceSharingNewResponseStatus` - `const ResourceSharingNewResponseStatusActive ResourceSharingNewResponseStatus = "active"` - `const ResourceSharingNewResponseStatusDeleting ResourceSharingNewResponseStatus = "deleting"` - `const ResourceSharingNewResponseStatusDeleted ResourceSharingNewResponseStatus = "deleted"` - `TargetType ResourceSharingNewResponseTargetType` - `const ResourceSharingNewResponseTargetTypeAccount ResourceSharingNewResponseTargetType = "account"` - `const ResourceSharingNewResponseTargetTypeOrganization ResourceSharingNewResponseTargetType = "organization"` - `AssociatedRecipientCount int64` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `AssociatingRecipientCount int64` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `DisassociatedRecipientCount int64` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `DisassociatingRecipientCount int64` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `Kind ResourceSharingNewResponseKind` - `const ResourceSharingNewResponseKindSent ResourceSharingNewResponseKind = "sent"` - `const ResourceSharingNewResponseKindReceived ResourceSharingNewResponseKind = "received"` - `Resources []ResourceSharingNewResponseResource` 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 Time` When the share was created. - `Meta unknown` Resource Metadata. - `Modified Time` When the share was modified. - `ResourceAccountID string` Account identifier. - `ResourceID string` Share Resource identifier. - `ResourceType ResourceSharingNewResponseResourcesResourceType` Resource Type. - `const ResourceSharingNewResponseResourcesResourceTypeCustomRuleset ResourceSharingNewResponseResourcesResourceType = "custom-ruleset"` - `const ResourceSharingNewResponseResourcesResourceTypeGatewayPolicy ResourceSharingNewResponseResourcesResourceType = "gateway-policy"` - `const ResourceSharingNewResponseResourcesResourceTypeGatewayDestinationIP ResourceSharingNewResponseResourcesResourceType = "gateway-destination-ip"` - `const ResourceSharingNewResponseResourcesResourceTypeGatewayBlockPageSettings ResourceSharingNewResponseResourcesResourceType = "gateway-block-page-settings"` - `const ResourceSharingNewResponseResourcesResourceTypeGatewayExtendedEmailMatching ResourceSharingNewResponseResourcesResourceType = "gateway-extended-email-matching"` - `const ResourceSharingNewResponseResourcesResourceTypeIdPFederationGrant ResourceSharingNewResponseResourcesResourceType = "idp-federation-grant"` - `ResourceVersion int64` Resource Version. - `Status ResourceSharingNewResponseResourcesStatus` Resource Status. - `const ResourceSharingNewResponseResourcesStatusActive ResourceSharingNewResponseResourcesStatus = "active"` - `const ResourceSharingNewResponseResourcesStatusDeleting ResourceSharingNewResponseResourcesStatus = "deleting"` - `const ResourceSharingNewResponseResourcesStatusDeleted ResourceSharingNewResponseResourcesStatus = "deleted"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/resource_sharing" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) resourceSharing, err := client.ResourceSharing.New(context.TODO(), resource_sharing.ResourceSharingNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Name: cloudflare.F("My Shared WAF Managed Rule"), Recipients: cloudflare.F([]resource_sharing.ResourceSharingNewParamsRecipient{resource_sharing.ResourceSharingNewParamsRecipient{ }}), Resources: cloudflare.F([]resource_sharing.ResourceSharingNewParamsResource{resource_sharing.ResourceSharingNewParamsResource{ Meta: cloudflare.F[any](map[string]interface{}{ }), ResourceAccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), ResourceID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), ResourceType: cloudflare.F(resource_sharing.ResourceSharingNewParamsResourcesResourceTypeCustomRuleset), }}), }) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", 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(ctx, shareID, params) (*ResourceSharingUpdateResponse, error)` **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` - `AccountID param.Field[string]` Path param: Account identifier. - `Name param.Field[string]` Body param: The name of the share. ### Returns - `type ResourceSharingUpdateResponse struct{…}` - `ID string` Share identifier tag. - `AccountID string` Account identifier. - `AccountName string` The display name of an account. - `Created Time` When the share was created. - `Modified Time` When the share was modified. - `Name string` The name of the share. - `OrganizationID string` Organization identifier. - `Status ResourceSharingUpdateResponseStatus` - `const ResourceSharingUpdateResponseStatusActive ResourceSharingUpdateResponseStatus = "active"` - `const ResourceSharingUpdateResponseStatusDeleting ResourceSharingUpdateResponseStatus = "deleting"` - `const ResourceSharingUpdateResponseStatusDeleted ResourceSharingUpdateResponseStatus = "deleted"` - `TargetType ResourceSharingUpdateResponseTargetType` - `const ResourceSharingUpdateResponseTargetTypeAccount ResourceSharingUpdateResponseTargetType = "account"` - `const ResourceSharingUpdateResponseTargetTypeOrganization ResourceSharingUpdateResponseTargetType = "organization"` - `AssociatedRecipientCount int64` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `AssociatingRecipientCount int64` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `DisassociatedRecipientCount int64` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `DisassociatingRecipientCount int64` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `Kind ResourceSharingUpdateResponseKind` - `const ResourceSharingUpdateResponseKindSent ResourceSharingUpdateResponseKind = "sent"` - `const ResourceSharingUpdateResponseKindReceived ResourceSharingUpdateResponseKind = "received"` - `Resources []ResourceSharingUpdateResponseResource` 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 Time` When the share was created. - `Meta unknown` Resource Metadata. - `Modified Time` When the share was modified. - `ResourceAccountID string` Account identifier. - `ResourceID string` Share Resource identifier. - `ResourceType ResourceSharingUpdateResponseResourcesResourceType` Resource Type. - `const ResourceSharingUpdateResponseResourcesResourceTypeCustomRuleset ResourceSharingUpdateResponseResourcesResourceType = "custom-ruleset"` - `const ResourceSharingUpdateResponseResourcesResourceTypeGatewayPolicy ResourceSharingUpdateResponseResourcesResourceType = "gateway-policy"` - `const ResourceSharingUpdateResponseResourcesResourceTypeGatewayDestinationIP ResourceSharingUpdateResponseResourcesResourceType = "gateway-destination-ip"` - `const ResourceSharingUpdateResponseResourcesResourceTypeGatewayBlockPageSettings ResourceSharingUpdateResponseResourcesResourceType = "gateway-block-page-settings"` - `const ResourceSharingUpdateResponseResourcesResourceTypeGatewayExtendedEmailMatching ResourceSharingUpdateResponseResourcesResourceType = "gateway-extended-email-matching"` - `const ResourceSharingUpdateResponseResourcesResourceTypeIdPFederationGrant ResourceSharingUpdateResponseResourcesResourceType = "idp-federation-grant"` - `ResourceVersion int64` Resource Version. - `Status ResourceSharingUpdateResponseResourcesStatus` Resource Status. - `const ResourceSharingUpdateResponseResourcesStatusActive ResourceSharingUpdateResponseResourcesStatus = "active"` - `const ResourceSharingUpdateResponseResourcesStatusDeleting ResourceSharingUpdateResponseResourcesStatus = "deleting"` - `const ResourceSharingUpdateResponseResourcesStatusDeleted ResourceSharingUpdateResponseResourcesStatus = "deleted"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/resource_sharing" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) resourceSharing, err := client.ResourceSharing.Update( context.TODO(), "3fd85f74b32742f1bff64a85009dda07", resource_sharing.ResourceSharingUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Name: cloudflare.F("My Shared WAF Managed Rule"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", 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(ctx, shareID, body) (*ResourceSharingDeleteResponse, error)` **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. - `body ResourceSharingDeleteParams` - `AccountID param.Field[string]` Account identifier. ### Returns - `type ResourceSharingDeleteResponse struct{…}` - `ID string` Share identifier tag. - `AccountID string` Account identifier. - `AccountName string` The display name of an account. - `Created Time` When the share was created. - `Modified Time` When the share was modified. - `Name string` The name of the share. - `OrganizationID string` Organization identifier. - `Status ResourceSharingDeleteResponseStatus` - `const ResourceSharingDeleteResponseStatusActive ResourceSharingDeleteResponseStatus = "active"` - `const ResourceSharingDeleteResponseStatusDeleting ResourceSharingDeleteResponseStatus = "deleting"` - `const ResourceSharingDeleteResponseStatusDeleted ResourceSharingDeleteResponseStatus = "deleted"` - `TargetType ResourceSharingDeleteResponseTargetType` - `const ResourceSharingDeleteResponseTargetTypeAccount ResourceSharingDeleteResponseTargetType = "account"` - `const ResourceSharingDeleteResponseTargetTypeOrganization ResourceSharingDeleteResponseTargetType = "organization"` - `AssociatedRecipientCount int64` The number of recipients in the 'associated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `AssociatingRecipientCount int64` The number of recipients in the 'associating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `DisassociatedRecipientCount int64` The number of recipients in the 'disassociated' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `DisassociatingRecipientCount int64` The number of recipients in the 'disassociating' state. This field is only included when requested via the 'include_recipient_counts' parameter. - `Kind ResourceSharingDeleteResponseKind` - `const ResourceSharingDeleteResponseKindSent ResourceSharingDeleteResponseKind = "sent"` - `const ResourceSharingDeleteResponseKindReceived ResourceSharingDeleteResponseKind = "received"` - `Resources []ResourceSharingDeleteResponseResource` 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 Time` When the share was created. - `Meta unknown` Resource Metadata. - `Modified Time` When the share was modified. - `ResourceAccountID string` Account identifier. - `ResourceID string` Share Resource identifier. - `ResourceType ResourceSharingDeleteResponseResourcesResourceType` Resource Type. - `const ResourceSharingDeleteResponseResourcesResourceTypeCustomRuleset ResourceSharingDeleteResponseResourcesResourceType = "custom-ruleset"` - `const ResourceSharingDeleteResponseResourcesResourceTypeGatewayPolicy ResourceSharingDeleteResponseResourcesResourceType = "gateway-policy"` - `const ResourceSharingDeleteResponseResourcesResourceTypeGatewayDestinationIP ResourceSharingDeleteResponseResourcesResourceType = "gateway-destination-ip"` - `const ResourceSharingDeleteResponseResourcesResourceTypeGatewayBlockPageSettings ResourceSharingDeleteResponseResourcesResourceType = "gateway-block-page-settings"` - `const ResourceSharingDeleteResponseResourcesResourceTypeGatewayExtendedEmailMatching ResourceSharingDeleteResponseResourcesResourceType = "gateway-extended-email-matching"` - `const ResourceSharingDeleteResponseResourcesResourceTypeIdPFederationGrant ResourceSharingDeleteResponseResourcesResourceType = "idp-federation-grant"` - `ResourceVersion int64` Resource Version. - `Status ResourceSharingDeleteResponseResourcesStatus` Resource Status. - `const ResourceSharingDeleteResponseResourcesStatusActive ResourceSharingDeleteResponseResourcesStatus = "active"` - `const ResourceSharingDeleteResponseResourcesStatusDeleting ResourceSharingDeleteResponseResourcesStatus = "deleting"` - `const ResourceSharingDeleteResponseResourcesStatusDeleted ResourceSharingDeleteResponseResourcesStatus = "deleted"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/resource_sharing" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) resourceSharing, err := client.ResourceSharing.Delete( context.TODO(), "3fd85f74b32742f1bff64a85009dda07", resource_sharing.ResourceSharingDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", 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" } ] } } ``` # Recipients ## List share recipients by share ID `client.ResourceSharing.Recipients.List(ctx, shareID, params) (*V4PagePaginationArray[RecipientListResponse], error)` **get** `/accounts/{account_id}/shares/{share_id}/recipients` List share recipients by share ID. ### Parameters - `shareID string` Share identifier tag. - `params RecipientListParams` - `AccountID param.Field[string]` Path param: Account identifier. - `IncludeResources param.Field[bool]` Query param: Include resources in the response. - `Page param.Field[int64]` Query param: 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. - `PerPage param.Field[int64]` Query param: 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 - `type RecipientListResponse struct{…}` - `ID string` Share Recipient identifier tag. - `AccountID string` Account identifier. - `AssociationStatus RecipientListResponseAssociationStatus` Share Recipient association status. - `const RecipientListResponseAssociationStatusAssociating RecipientListResponseAssociationStatus = "associating"` - `const RecipientListResponseAssociationStatusAssociated RecipientListResponseAssociationStatus = "associated"` - `const RecipientListResponseAssociationStatusDisassociating RecipientListResponseAssociationStatus = "disassociating"` - `const RecipientListResponseAssociationStatusDisassociated RecipientListResponseAssociationStatus = "disassociated"` - `Created Time` When the share was created. - `Modified Time` When the share was modified. - `Resources []RecipientListResponseResource` - `Error string` Share Recipient error message. - `ResourceID string` Share Resource identifier. - `ResourceVersion int64` Resource Version. - `Terminal bool` Whether the error is terminal or will be continually retried. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/resource_sharing" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) page, err := client.ResourceSharing.Recipients.List( context.TODO(), "3fd85f74b32742f1bff64a85009dda07", resource_sharing.RecipientListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### 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(ctx, shareID, recipientID, params) (*RecipientGetResponse, error)` **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` - `AccountID param.Field[string]` Path param: Account identifier. - `IncludeResources param.Field[bool]` Query param: Include resources in the response. ### Returns - `type RecipientGetResponse struct{…}` - `ID string` Share Recipient identifier tag. - `AccountID string` Account identifier. - `AssociationStatus RecipientGetResponseAssociationStatus` Share Recipient association status. - `const RecipientGetResponseAssociationStatusAssociating RecipientGetResponseAssociationStatus = "associating"` - `const RecipientGetResponseAssociationStatusAssociated RecipientGetResponseAssociationStatus = "associated"` - `const RecipientGetResponseAssociationStatusDisassociating RecipientGetResponseAssociationStatus = "disassociating"` - `const RecipientGetResponseAssociationStatusDisassociated RecipientGetResponseAssociationStatus = "disassociated"` - `Created Time` When the share was created. - `Modified Time` When the share was modified. - `Resources []RecipientGetResponseResource` - `Error string` Share Recipient error message. - `ResourceID string` Share Resource identifier. - `ResourceVersion int64` Resource Version. - `Terminal bool` Whether the error is terminal or will be continually retried. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/resource_sharing" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) recipient, err := client.ResourceSharing.Recipients.Get( context.TODO(), "3fd85f74b32742f1bff64a85009dda07", "3fd85f74b32742f1bff64a85009dda07", resource_sharing.RecipientGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", 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.New(ctx, shareID, params) (*RecipientNewResponse, error)` **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 RecipientNewParams` - `PathAccountID param.Field[string]` Path param: Account identifier. - `PathAccountID param.Field[string]` Path param: Account identifier. - `OrganizationID param.Field[string]` Body param: Organization identifier. - `RecipientAccountID param.Field[string]` Body param: The account that will receive the share. ### Returns - `type RecipientNewResponse struct{…}` - `ID string` Share Recipient identifier tag. - `AccountID string` Account identifier. - `AssociationStatus RecipientNewResponseAssociationStatus` Share Recipient association status. - `const RecipientNewResponseAssociationStatusAssociating RecipientNewResponseAssociationStatus = "associating"` - `const RecipientNewResponseAssociationStatusAssociated RecipientNewResponseAssociationStatus = "associated"` - `const RecipientNewResponseAssociationStatusDisassociating RecipientNewResponseAssociationStatus = "disassociating"` - `const RecipientNewResponseAssociationStatusDisassociated RecipientNewResponseAssociationStatus = "disassociated"` - `Created Time` When the share was created. - `Modified Time` When the share was modified. - `Resources []RecipientNewResponseResource` - `Error string` Share Recipient error message. - `ResourceID string` Share Resource identifier. - `ResourceVersion int64` Resource Version. - `Terminal bool` Whether the error is terminal or will be continually retried. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/resource_sharing" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) recipient, err := client.ResourceSharing.Recipients.New( context.TODO(), "3fd85f74b32742f1bff64a85009dda07", resource_sharing.RecipientNewParams{ PathAccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", 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(ctx, shareID, recipientID, body) (*RecipientDeleteResponse, error)` **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. - `body RecipientDeleteParams` - `AccountID param.Field[string]` Account identifier. ### Returns - `type RecipientDeleteResponse struct{…}` - `ID string` Share Recipient identifier tag. - `AccountID string` Account identifier. - `AssociationStatus RecipientDeleteResponseAssociationStatus` Share Recipient association status. - `const RecipientDeleteResponseAssociationStatusAssociating RecipientDeleteResponseAssociationStatus = "associating"` - `const RecipientDeleteResponseAssociationStatusAssociated RecipientDeleteResponseAssociationStatus = "associated"` - `const RecipientDeleteResponseAssociationStatusDisassociating RecipientDeleteResponseAssociationStatus = "disassociating"` - `const RecipientDeleteResponseAssociationStatusDisassociated RecipientDeleteResponseAssociationStatus = "disassociated"` - `Created Time` When the share was created. - `Modified Time` When the share was modified. - `Resources []RecipientDeleteResponseResource` - `Error string` Share Recipient error message. - `ResourceID string` Share Resource identifier. - `ResourceVersion int64` Resource Version. - `Terminal bool` Whether the error is terminal or will be continually retried. ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/resource_sharing" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) recipient, err := client.ResourceSharing.Recipients.Delete( context.TODO(), "3fd85f74b32742f1bff64a85009dda07", "3fd85f74b32742f1bff64a85009dda07", resource_sharing.RecipientDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", 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 } ] } } ``` # Resources ## List share resources by share ID `client.ResourceSharing.Resources.List(ctx, shareID, params) (*V4PagePaginationArray[ResourceListResponse], error)` **get** `/accounts/{account_id}/shares/{share_id}/resources` List share resources by share ID. ### Parameters - `shareID string` Share identifier tag. - `params ResourceListParams` - `AccountID param.Field[string]` Path param: Account identifier. - `Page param.Field[int64]` Query param: 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. - `PerPage param.Field[int64]` Query param: 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. - `ResourceType param.Field[ResourceListParamsResourceType]` Query param: Filter share resources by resource_type. - `const ResourceListParamsResourceTypeCustomRuleset ResourceListParamsResourceType = "custom-ruleset"` - `const ResourceListParamsResourceTypeGatewayPolicy ResourceListParamsResourceType = "gateway-policy"` - `const ResourceListParamsResourceTypeGatewayDestinationIP ResourceListParamsResourceType = "gateway-destination-ip"` - `const ResourceListParamsResourceTypeGatewayBlockPageSettings ResourceListParamsResourceType = "gateway-block-page-settings"` - `const ResourceListParamsResourceTypeGatewayExtendedEmailMatching ResourceListParamsResourceType = "gateway-extended-email-matching"` - `const ResourceListParamsResourceTypeIdPFederationGrant ResourceListParamsResourceType = "idp-federation-grant"` - `Status param.Field[ResourceListParamsStatus]` Query param: Filter share resources by status. - `const ResourceListParamsStatusActive ResourceListParamsStatus = "active"` - `const ResourceListParamsStatusDeleting ResourceListParamsStatus = "deleting"` - `const ResourceListParamsStatusDeleted ResourceListParamsStatus = "deleted"` ### Returns - `type ResourceListResponse struct{…}` - `ID string` Share Resource identifier. - `Created Time` When the share was created. - `Meta unknown` Resource Metadata. - `Modified Time` When the share was modified. - `ResourceAccountID string` Account identifier. - `ResourceID string` Share Resource identifier. - `ResourceType ResourceListResponseResourceType` Resource Type. - `const ResourceListResponseResourceTypeCustomRuleset ResourceListResponseResourceType = "custom-ruleset"` - `const ResourceListResponseResourceTypeGatewayPolicy ResourceListResponseResourceType = "gateway-policy"` - `const ResourceListResponseResourceTypeGatewayDestinationIP ResourceListResponseResourceType = "gateway-destination-ip"` - `const ResourceListResponseResourceTypeGatewayBlockPageSettings ResourceListResponseResourceType = "gateway-block-page-settings"` - `const ResourceListResponseResourceTypeGatewayExtendedEmailMatching ResourceListResponseResourceType = "gateway-extended-email-matching"` - `const ResourceListResponseResourceTypeIdPFederationGrant ResourceListResponseResourceType = "idp-federation-grant"` - `ResourceVersion int64` Resource Version. - `Status ResourceListResponseStatus` Resource Status. - `const ResourceListResponseStatusActive ResourceListResponseStatus = "active"` - `const ResourceListResponseStatusDeleting ResourceListResponseStatus = "deleting"` - `const ResourceListResponseStatusDeleted ResourceListResponseStatus = "deleted"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/resource_sharing" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) page, err := client.ResourceSharing.Resources.List( context.TODO(), "3fd85f74b32742f1bff64a85009dda07", resource_sharing.ResourceListParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", page) } ``` #### 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(ctx, shareID, shareResourceID, query) (*ResourceGetResponse, error)` **get** `/accounts/{account_id}/shares/{share_id}/resources/{share_resource_id}` Get share resource by ID. ### Parameters - `shareID string` Share identifier tag. - `shareResourceID string` Share Resource identifier. - `query ResourceGetParams` - `AccountID param.Field[string]` Account identifier. ### Returns - `type ResourceGetResponse struct{…}` - `ID string` Share Resource identifier. - `Created Time` When the share was created. - `Meta unknown` Resource Metadata. - `Modified Time` When the share was modified. - `ResourceAccountID string` Account identifier. - `ResourceID string` Share Resource identifier. - `ResourceType ResourceGetResponseResourceType` Resource Type. - `const ResourceGetResponseResourceTypeCustomRuleset ResourceGetResponseResourceType = "custom-ruleset"` - `const ResourceGetResponseResourceTypeGatewayPolicy ResourceGetResponseResourceType = "gateway-policy"` - `const ResourceGetResponseResourceTypeGatewayDestinationIP ResourceGetResponseResourceType = "gateway-destination-ip"` - `const ResourceGetResponseResourceTypeGatewayBlockPageSettings ResourceGetResponseResourceType = "gateway-block-page-settings"` - `const ResourceGetResponseResourceTypeGatewayExtendedEmailMatching ResourceGetResponseResourceType = "gateway-extended-email-matching"` - `const ResourceGetResponseResourceTypeIdPFederationGrant ResourceGetResponseResourceType = "idp-federation-grant"` - `ResourceVersion int64` Resource Version. - `Status ResourceGetResponseStatus` Resource Status. - `const ResourceGetResponseStatusActive ResourceGetResponseStatus = "active"` - `const ResourceGetResponseStatusDeleting ResourceGetResponseStatus = "deleting"` - `const ResourceGetResponseStatusDeleted ResourceGetResponseStatus = "deleted"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/resource_sharing" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) resource, err := client.ResourceSharing.Resources.Get( context.TODO(), "3fd85f74b32742f1bff64a85009dda07", "023e105f4ecef8ad9ca31a8372d0c353", resource_sharing.ResourceGetParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", 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.New(ctx, shareID, params) (*ResourceNewResponse, error)` **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 ResourceNewParams` - `AccountID param.Field[string]` Path param: Account identifier. - `Meta param.Field[unknown]` Body param: Resource Metadata. - `ResourceAccountID param.Field[string]` Body param: Account identifier. - `ResourceID param.Field[string]` Body param: Share Resource identifier. - `ResourceType param.Field[ResourceNewParamsResourceType]` Body param: Resource Type. - `const ResourceNewParamsResourceTypeCustomRuleset ResourceNewParamsResourceType = "custom-ruleset"` - `const ResourceNewParamsResourceTypeGatewayPolicy ResourceNewParamsResourceType = "gateway-policy"` - `const ResourceNewParamsResourceTypeGatewayDestinationIP ResourceNewParamsResourceType = "gateway-destination-ip"` - `const ResourceNewParamsResourceTypeGatewayBlockPageSettings ResourceNewParamsResourceType = "gateway-block-page-settings"` - `const ResourceNewParamsResourceTypeGatewayExtendedEmailMatching ResourceNewParamsResourceType = "gateway-extended-email-matching"` - `const ResourceNewParamsResourceTypeIdPFederationGrant ResourceNewParamsResourceType = "idp-federation-grant"` ### Returns - `type ResourceNewResponse struct{…}` - `ID string` Share Resource identifier. - `Created Time` When the share was created. - `Meta unknown` Resource Metadata. - `Modified Time` When the share was modified. - `ResourceAccountID string` Account identifier. - `ResourceID string` Share Resource identifier. - `ResourceType ResourceNewResponseResourceType` Resource Type. - `const ResourceNewResponseResourceTypeCustomRuleset ResourceNewResponseResourceType = "custom-ruleset"` - `const ResourceNewResponseResourceTypeGatewayPolicy ResourceNewResponseResourceType = "gateway-policy"` - `const ResourceNewResponseResourceTypeGatewayDestinationIP ResourceNewResponseResourceType = "gateway-destination-ip"` - `const ResourceNewResponseResourceTypeGatewayBlockPageSettings ResourceNewResponseResourceType = "gateway-block-page-settings"` - `const ResourceNewResponseResourceTypeGatewayExtendedEmailMatching ResourceNewResponseResourceType = "gateway-extended-email-matching"` - `const ResourceNewResponseResourceTypeIdPFederationGrant ResourceNewResponseResourceType = "idp-federation-grant"` - `ResourceVersion int64` Resource Version. - `Status ResourceNewResponseStatus` Resource Status. - `const ResourceNewResponseStatusActive ResourceNewResponseStatus = "active"` - `const ResourceNewResponseStatusDeleting ResourceNewResponseStatus = "deleting"` - `const ResourceNewResponseStatusDeleted ResourceNewResponseStatus = "deleted"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/resource_sharing" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) resource, err := client.ResourceSharing.Resources.New( context.TODO(), "3fd85f74b32742f1bff64a85009dda07", resource_sharing.ResourceNewParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Meta: cloudflare.F[any](map[string]interface{}{ }), ResourceAccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), ResourceID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), ResourceType: cloudflare.F(resource_sharing.ResourceNewParamsResourceTypeCustomRuleset), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", 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(ctx, shareID, shareResourceID, params) (*ResourceUpdateResponse, error)` **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 - `shareID string` Share identifier tag. - `shareResourceID string` Share Resource identifier. - `params ResourceUpdateParams` - `AccountID param.Field[string]` Path param: Account identifier. - `Meta param.Field[unknown]` Body param: Resource Metadata. ### Returns - `type ResourceUpdateResponse struct{…}` - `ID string` Share Resource identifier. - `Created Time` When the share was created. - `Meta unknown` Resource Metadata. - `Modified Time` When the share was modified. - `ResourceAccountID string` Account identifier. - `ResourceID string` Share Resource identifier. - `ResourceType ResourceUpdateResponseResourceType` Resource Type. - `const ResourceUpdateResponseResourceTypeCustomRuleset ResourceUpdateResponseResourceType = "custom-ruleset"` - `const ResourceUpdateResponseResourceTypeGatewayPolicy ResourceUpdateResponseResourceType = "gateway-policy"` - `const ResourceUpdateResponseResourceTypeGatewayDestinationIP ResourceUpdateResponseResourceType = "gateway-destination-ip"` - `const ResourceUpdateResponseResourceTypeGatewayBlockPageSettings ResourceUpdateResponseResourceType = "gateway-block-page-settings"` - `const ResourceUpdateResponseResourceTypeGatewayExtendedEmailMatching ResourceUpdateResponseResourceType = "gateway-extended-email-matching"` - `const ResourceUpdateResponseResourceTypeIdPFederationGrant ResourceUpdateResponseResourceType = "idp-federation-grant"` - `ResourceVersion int64` Resource Version. - `Status ResourceUpdateResponseStatus` Resource Status. - `const ResourceUpdateResponseStatusActive ResourceUpdateResponseStatus = "active"` - `const ResourceUpdateResponseStatusDeleting ResourceUpdateResponseStatus = "deleting"` - `const ResourceUpdateResponseStatusDeleted ResourceUpdateResponseStatus = "deleted"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/resource_sharing" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) resource, err := client.ResourceSharing.Resources.Update( context.TODO(), "3fd85f74b32742f1bff64a85009dda07", "023e105f4ecef8ad9ca31a8372d0c353", resource_sharing.ResourceUpdateParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), Meta: cloudflare.F[any](map[string]interface{}{ }), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", 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(ctx, shareID, shareResourceID, body) (*ResourceDeleteResponse, error)` **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 - `shareID string` Share identifier tag. - `shareResourceID string` Share Resource identifier. - `body ResourceDeleteParams` - `AccountID param.Field[string]` Account identifier. ### Returns - `type ResourceDeleteResponse struct{…}` - `ID string` Share Resource identifier. - `Created Time` When the share was created. - `Meta unknown` Resource Metadata. - `Modified Time` When the share was modified. - `ResourceAccountID string` Account identifier. - `ResourceID string` Share Resource identifier. - `ResourceType ResourceDeleteResponseResourceType` Resource Type. - `const ResourceDeleteResponseResourceTypeCustomRuleset ResourceDeleteResponseResourceType = "custom-ruleset"` - `const ResourceDeleteResponseResourceTypeGatewayPolicy ResourceDeleteResponseResourceType = "gateway-policy"` - `const ResourceDeleteResponseResourceTypeGatewayDestinationIP ResourceDeleteResponseResourceType = "gateway-destination-ip"` - `const ResourceDeleteResponseResourceTypeGatewayBlockPageSettings ResourceDeleteResponseResourceType = "gateway-block-page-settings"` - `const ResourceDeleteResponseResourceTypeGatewayExtendedEmailMatching ResourceDeleteResponseResourceType = "gateway-extended-email-matching"` - `const ResourceDeleteResponseResourceTypeIdPFederationGrant ResourceDeleteResponseResourceType = "idp-federation-grant"` - `ResourceVersion int64` Resource Version. - `Status ResourceDeleteResponseStatus` Resource Status. - `const ResourceDeleteResponseStatusActive ResourceDeleteResponseStatus = "active"` - `const ResourceDeleteResponseStatusDeleting ResourceDeleteResponseStatus = "deleting"` - `const ResourceDeleteResponseStatusDeleted ResourceDeleteResponseStatus = "deleted"` ### Example ```go package main import ( "context" "fmt" "github.com/cloudflare/cloudflare-go" "github.com/cloudflare/cloudflare-go/option" "github.com/cloudflare/cloudflare-go/resource_sharing" ) func main() { client := cloudflare.NewClient( option.WithAPIKey("144c9defac04969c7bfad8efaa8ea194"), option.WithAPIEmail("user@example.com"), ) resource, err := client.ResourceSharing.Resources.Delete( context.TODO(), "3fd85f74b32742f1bff64a85009dda07", "023e105f4ecef8ad9ca31a8372d0c353", resource_sharing.ResourceDeleteParams{ AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"), }, ) if err != nil { panic(err.Error()) } fmt.Printf("%+v\n", 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" } } ```