Manage data exchanges
As an Analytics Hub administrator, you can perform the following tasks:
- Create, update, view, share, and delete data exchanges.
- Create, update, delete, and share listings.
- Manage Analytics Hub administrators, listing administrators, publishers, subscribers, and viewers.
By default, a data exchange
is private and only users or groups that have access
to that exchange can view or subscribe to the data. However, if you want the
listings to be discovered
and subscribed to
by Google Cloud users (allAuthenticatedUsers
),
then you can request to make your data exchange public.
Before you begin
To get started with Analytics Hub, you need to enable the Analytics Hub API inside your Google Cloud project.
Required permissions
To enable the Analytics Hub API, you need the following Identity and Access Management (IAM) permissions:
serviceUsage.services.get
serviceUsage.services.list
serviceUsage.services.enable
The following predefined IAM role includes the permissions that you need to enable the Analytics Hub API:
roles/serviceusage.serviceUsageAdmin
For more information about IAM roles in BigQuery, see Predefined roles and permissions.
Enable the Analytics Hub API
To enable the Analytics Hub API, do the following:
Console
Go to the Analytics Hub API for your Google Cloud project and enable it.
gcloud
Run the gcloud services enable command:
gcloud services enable analyticshub.googleapis.com
Required permissions
To manage data exchanges, you must have the Analytics Hub Admin role
(roles/analyticshub.admin
). For more information, see Analytics Hub Admin
role. To learn how to
grant this role to other users, see Create Analytics Hub
administrators.
Create a data exchange
To create a data exchange, follow these steps:
Console
Go to the Analytics Hub page.
Click
Create exchange.In the Create exchange dialog, select a Project and a Region for your data exchange. You cannot update the project and region after you create the data exchange.
For Display name, enter a name for your data exchange.
Optional: Enter values in the following fields:
- Primary contact: enter the URL or the email address of the primary contact for the data exchange.
- Description: enter a description for the data exchange.
To turn on public discoverability, click the Public discoverability toggle. Once an exchange is publicly discoverable, all listings in the exchange are displayed and searchable in the catalog. If you enable public discoverability, you must configure the exchange permissions. Due to permission inheritance, all listings by default will be set with the same public discoverability type of the exchange. Therefore, public exchanges cannot have private listings, but private exchanges can have public listings (for example, you can set the public discoverability type at the individual listing level). The project that you are creating the data exchange in must have an associated organization and billing account.
Click Create Exchange.
Optional: In the Exchange permissions section, do the following steps:
Enter email addresses in the following fields to grant the Analytics Hub user roles:
- Administrators: these users are assigned the Analytics Hub Admin role.
- Publishers: these users are assigned the Analytics Hub Publisher role. For information about the tasks that publishers can perform, see Manage listings.
- Subscribers: these users are assigned the Analytics Hub Subscriber role. For information about the tasks that subscribers can perform, see View and subscribe to listings.
- Viewers: these users are assigned the Analytics Hub Viewer
role.
Viewers can view listings.
- If public discoverability is enabled, grant the Analytics Hub
Viewer role (
roles/analyticshub.viewer
) toallUsers
orallAuthenticatedUsers
.
- If public discoverability is enabled, grant the Analytics Hub
Viewer role (
To save permissions, click Set permissions.
If you didn't set permissions for your data exchange, click Skip.
API
Use the projects.locations.dataExchanges.create
method.
POST https://analyticshub.googleapis.com/v1/projects/PROJECT_ID/location/LOCATION/dataExchanges?dataExchangeId=DATAEXCHANGE_ID
Replace the following:
PROJECT_ID
: the ID of the project in which you want to create the data exchange.LOCATION
: the location for your data exchange. For more information about locations that support Analytics Hub, see Supported regions.DATAEXCHANGE_ID
: the ID for your data exchange.
In the body of the request, provide the data exchange details. If the request is successful, then the response body contains details of the data exchange.
For more information about the tasks that you can perform on data exchanges using
APIs, see projects.locations.dataExchanges
methods.
Update a data exchange
To update a data exchange, follow these steps:
Console
Go to the Analytics Hub page.
From the list of data exchanges, click a data exchange that you want to update.
Click
Edit exchange.In the Edit exchange dialog, update the following fields:
- Display name
- Primary contact
- Description
- Public discoverability
- If you enable public discoverability, grant the Analytics Hub
Viewer role (
roles/analyticshub.viewer
) toallUsers
orallAuthenticatedUsers
. - If you disable public discoverability,
remove the Analytics Hub
Viewer role (
roles/analyticshub.viewer
) fromallUsers
orallAuthenticatedUsers
. Public exchanges can't have private listings, but private exchanges can have public listings.
- If you enable public discoverability, grant the Analytics Hub
Viewer role (
Click Save.
API
Use the projects.locations.dataExchanges.patch
method.
PATCH https://analyticshub.googleapis.com/v1/projects/PROJECT_ID/location/LOCATION/dataExchanges/DATAEXCHANGE_ID?updateMask=UPDATEMASK
Replace UPDATEMASK
with the list of fields
that you want to update. For updating multiple values, use a comma-separated
list—for example, to update the display name and primary contact for a
data exchange, enter displayName,primaryContact
.
In the body of the request, specify the updated values for the following fields:
- Display name
- Description
- Documentation
- Icon
- Primary contact
- Public discoverability
For more information about the tasks that you can perform on data exchanges using
APIs, see projects.locations.dataExchanges
methods.
View data exchanges
To view all data exchanges in your organization you have access to, follow these steps:
Console
Go to the Analytics Hub page.
View the list of data exchanges within your Google Cloud organization.
API
Use the organizations.locations.dataExchanges.list
method.
GET https://analyticshub.googleapis.com/v1/organizations/ORGANIZATION_ID/location/LOCATION/dataExchanges
Replace the following:
- ORGANIZATION_ID: the organization ID. For more information, see Getting your organization ID.
- LOCATION: the location for which you want to list the existing data exchanges.
Share a data exchange
If the Analytics Hub publisher belongs to a different organization than the organization that contains the data exchange, the publisher cannot view your data exchange in Analytics Hub. You must share a link to the data exchange with the publisher.
Go to the Analytics Hub page.
From the list of data exchanges, click
More options.Click
Copy share link.
Give users access to a data exchange
To give users access to a data exchange, you must set the IAM policy for that data exchange. For information about predefined IAM user roles, see Analytics Hub user roles. To do so, follow these steps:
Console
In the Google Cloud console, go to the Analytics Hub page.
Click the data exchange name for which you want to set permissions.
Click
Set permissions.To add principals, click
Add principal.In the New principals field, add the emails to which you want to grant access.
For Select a role, hold the pointer over Analytics Hub, and then select one of the following Identity and Access Management (IAM) roles:
- Analytics Hub Admin
- Analytics Hub Publisher
- Analytics Hub Listing Admin
- Analytics Hub Subscriber
- Analytics Hub Viewer
Click Save.
API
Read the existing policy with the listing
getIamPolicy
method by using theprojects.locations.dataExchanges.getIamPolicy
method:POST https://analyticshub.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/dataExchanges/DATAEXCHANGE_ID:getIamPolicy
Replace the following:
PROJECT_ID
: the project ID—for example,my-project-1
.LOCATION
: the location for your data exchange.DATAEXCHANGE_ID
: the data exchange ID.
Analytics Hub returns the current policy.
To add or remove members and their associated Identity and Access Management (IAM) roles, edit the policy with a text editor. Use the following format to add members:
user:test-user@gmail.com
group:admins@example.com
serviceAccount:test123@example.domain.com
domain:example.domain.com
For example, to grant the
roles/analyticshub.subscriber
role togroup:subscribers@example.com
, add the following binding to the policy:{ "members": [ "group:subscribers@example.com" ], "role":"roles/analyticshub.subscriber" }
Write the updated policy by using the
projects.locations.dataExchanges.setIamPolicy
method. In the body of the request, provide the updated IAM policy from the previous step.POST https://analyticshub.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/dataExchanges/DATAEXCHANGE_ID:setIamPolicy
In the body of the request, provide the listing details. If the request is successful, then the response body contains details of the listing.
Create Analytics Hub administrators
To manage data exchanges, you must create Analytics Hub
administrators. To create exchange administrators, you need to grant users
the Analytics Hub Admin role (roles/analyticshub.admin
)
at the project or the data exchange level.
If you want administrators to manage all data exchanges in a project, then grant the Analytics Hub Admin role for that project. If you want administrators to manage a specific data exchange, then grant the Analytics Hub Admin role for that data exchange.
Make a data exchange public
By default, a data exchange is private and only users or groups that have access
to that exchange can view or subscribe to its listings. However, you can
choose to make a data exchange public. Listings in public data exchanges can be
discovered and subscribed to by Google Cloud users
(allAuthenticatedUsers
).
To make a data exchange public, follow these steps:
To let
allAuthenticatedUsers
view listings, you must grant them the Analytics Hub Viewer role at the data exchange level.To let
allAuthenticatedUsers
subscribe to listings, you must grant them the Analytics Hub Subscriber role at the data exchange level.Turn public discoverability on when you create or update a data exchange. Specify the appropriate permissions when you make a data exchange public.
Delete a data exchange
When a data exchange is deleted, all the listings within it are also deleted. However, the shared datasets and linked datasets are not deleted. Also, when a project is deleted, the data exchanges within it are not deleted. You need to delete these data exchanges before deleting the project. If you delete a data exchange, you cannot undo it.
To delete a data exchange, follow these steps:
Console
Go to the Analytics Hub page.
From the list of data exchanges, click the data exchange that you want to delete.
Click
Delete exchange.In the Delete exchange? dialog, confirm deletion by typing delete.
Click Delete.
API
Use the projects.locations.dataExchanges.delete
method.
DELETE https://analyticshub.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/dataExchanges/DATAEXCHANGE_ID
For more information about the tasks that you can perform on data exchanges using
APIs, see projects.locations.dataExchanges
methods.
What's next
- Learn about managing listings.
- Learn how to grant Analytics Hub user roles.
- Learn how to view and subscribe to listings.
- Learn about Analytics Hub audit logging.