You can list the schema registries in your project. This document shows you how to list schema registries using the Google Cloud console, the Google Cloud CLI, or the Managed Kafka API.
Required roles and permissions
To get the permissions that
you need to list schema registries,
ask your administrator to grant you the
Managed Kafka Schema Registry Viewer (roles/managedkafka.schemaRegistryViewer)
IAM role on your project and location.
For more information about granting roles, see Manage access to projects, folders, and organizations.
This predefined role contains the permissions required to list schema registries. To see the exact permissions that are required, expand the Required permissions section:
Required permissions
The following permissions are required to list schema registries:
-
Grant the following permission on the parent location:
managedkafka.schemaRegistries.list
You might also be able to get these permissions with custom roles or other predefined roles.
Higher-level roles like Managed Kafka Schema Registry Editor
(roles/managedkafka.schemaRegistryEditor) and
Managed Kafka Schema Registry Admin (roles/managedkafka.schemaRegistryAdmin)
also lets you list schema registries.
For more information about predefined roles, see the Managed Service for Apache Kafka predefined roles.
List your schema registries
To list all your schema registries within your project, follow these steps.
Console
- In the Google Cloud console, go to the Schema registries page.
The page displays a list of schema registries in your project. The list includes columns for the following properties:
- Name: the unique identifier for the schema registry.
- Region: the Google Cloud region where the schema registry is hosted.
gcloud
-
Install the Google Cloud CLI. After installation, initialize the Google Cloud CLI by running the following command:
gcloud initIf you're using an external identity provider (IdP), you must first sign in to the gcloud CLI with your federated identity.
- Run the
gcloud beta managed-kafka schema-registries listcommand: - LOCATION (required): the Google Cloud region for which to list schema registries.
gcloud beta managed-kafka schema-registries list \ --location=LOCATION \
Replace the following:
For example, to list all schema registries in the us-central1
location, run the following command:
gcloud beta managed-kafka schema-registries list --location=us-central1
Sample output:
NAME LOCATION sr_docs us-central1 sr_docs23 us-central1 sr23wert us-central1
REST
To list schema registries, use the
projects.locations.schemaRegistries.list method.
Before using any of the request data, make the following replacements:
-
PROJECT_ID: your Google Cloud project ID -
LOCATION: the location where you want to get the list of schema registries; for example,us-central1
HTTP method and URL:
GET https://managedkafka.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/schemaRegistries?view=SCHEMA_REGISTRY_VIEW_FULL
To send your request, expand one of these options:
You should receive a JSON response similar to the following:
{
"schemaRegistries": [
{
"name": "projects/PROJECT_ID/locations/LOCATION/REGISTRY_ID",
"contexts": [
"projects/PROJECT_ID/locations/LOCATION/REGISTRY_ID/contexts/.",
"projects/PROJECT_ID/locations/LOCATION/REGISTRY_ID/contexts/CONTEXT_NAME"
]
}
}
The returned JSON object includes a list of schema registries found in the specified location.
If the view query parameter is SCHEMA_REGISTRY_VIEW_FULL, the response
also includes the contexts associated with each schema registry.