Ce contenu n'est pas disponible dans la langue sélectionnée.

Chapter 3. Managing Service Registry content using the web console


You can manage schema and API artifacts stored in Service Registry by using the Service Registry web console. This includes uploading and browsing Service Registry content, configuring optional rules for content, and generating client sdk code:

3.1. Viewing artifacts using the Service Registry web console

You can use the Service Registry web console to browse the schema and API artifacts stored in Service Registry. This section shows a simple example of viewing Service Registry artifacts, groups, versions, and artifact rules.

Prerequisites

  • Service Registry is installed and running in your environment.
  • You are logged in to the Service Registry web console:

    http://MY_REGISTRY_URL/ui

  • Artifacts have been added to Service Registry using the web console, command line, Maven plug-in, or a Java client application.

Procedure

  1. On the Artifacts tab, browse the list of artifacts stored in Service Registry, or enter a search string to find an artifact. You can select from the list to search by specific criteria such as name, group, labels, or global ID.

    Figure 3.1. Artifacts in Service Registry web console

    Artifacts in Registry web console
  2. Click an artifact to view the following details:

    • Overview: Displays artifact version metadata such as artifact name, artifact ID, global ID, content ID, labels, properties, and so on. Also displays rules for validity and compatibility that you can configure for artifact content.
    • Documentation (OpenAPI and AsyncAPI only): Displays automatically-generated REST API documentation.
    • Content: Displays a read-only view of the full artifact content. For JSON content, you can click JSON or YAML to display your preferred format.
    • References: Displays a read-only view of all artifacts referenced by this artifact. You can also click View artifacts that reference this artifact.
  3. If additional versions of this artifact have been added, you can select them from the Version list in page header.
  4. To save the artifact contents to a local file, for example, my-openapi.json or my-protobuf-schema.proto, and click Download at the end of the page.

3.2. Adding artifacts using the Service Registry web console

You can use the Service Registry web console to upload schema and API artifacts to Service Registry. This section shows simple examples of uploading Service Registry artifacts and adding new artifact versions.

Prerequisites

  • Service Registry is installed and running in your environment.
  • You are logged in to the Service Registry web console:

    http://MY_REGISTRY_URL/ui

Procedure

  1. On the Artifacts tab, click Upload artifact, and specify the following details:

    • Group & ID: Use the default empty settings to automatically generate an artifact ID and add the artifact to the default artifact group. Alternatively, you can enter an optional artifact group name or ID.
    • Type: Use the default Auto-Detect setting to automatically detect the artifact type, or select the artifact type from the list, for example, Avro Schema or OpenAPI. You must manually select the Kafka Connect Schema artifact type, which cannot be automatically detected.
    • Artifact: Specify the artifact location using either of the following options:

      • From file: Click Browse, and select a file, or drag and drop a file. For example, my-openapi.json or my-schema.proto. Alternatively, you can enter the file contents in the text box.
      • From URL: Enter a valid and accessible URL, and click Fetch. For example: https://petstore3.swagger.io/api/v3/openapi.json.
  2. Click Upload and view the artifact details:

    • Overview: Displays artifact version metadata such as artifact name, artifact ID, global ID, content ID, labels, properties, and so on. Also displays rules for validity and compatibility that you can configure for artifact content.
    • Documentation (OpenAPI and AsyncAPI only): Displays automatically-generated REST API documentation.
    • Content: Displays a read-only view of the full artifact content. For JSON content, you can click JSON or YAML to display your preferred format.
    • References: Displays a read-only view of all artifacts referenced by this artifact. You can also click View artifacts that reference this artifact. You can add artifact references using the Service Registry Maven plug-in or REST API only.

      The following example shows an example OpenAPI artifact:

      Figure 3.2. Artifact details in Service Registry web console

      Artifact details in Registry web console
  3. On the Overview tab, click the Edit pencil icon to edit artifact metadata such as name or description.

    You can also enter an optional comma-separated list of labels for searching, or add key-value pairs of arbitrary properties associated with the artifact. To add properties, perform the following steps:

    1. Click Add property.
    2. Enter the key name and the value.
    3. Repeat the first two steps to add multiple properties.
    4. Click Save.
  4. To save the artifact contents to a local file, for example, my-protobuf-schema.proto or my-openapi.json, click Download at the end of the page.
  5. To add a new artifact version, click Upload new version in the page header, and drag and drop or click Browse to upload the file, for example, my-avro-schema.json or my-openapi.json.
  6. To delete an artifact, click Delete in the page header.

    Warning

    Deleting an artifact deletes the artifact and all of its versions, and cannot be undone.

3.3. Configuring content rules using the Service Registry web console

You can use the Service Registry web console to configure optional rules to prevent invalid or incompatible content from being added to Service Registry. All configured artifact-specific rules or global rules must pass before a new artifact version can be uploaded to Service Registry. Configured artifact-specific rules override any configured global rules. This section shows a simple example of configuring global and artifact-specific rules.

Prerequisites

  • Service Registry is installed and running in your environment.
  • You are logged in to the Service Registry web console:

    http://MY_REGISTRY_URL/ui

  • Artifacts have been added to Service Registry using the web console, command line, Maven plug-in, or a Java client application.
  • When role-based authorization is enabled, you have administrator access for global rules and artifact-specific rules, or developer access for artifact-specific rules only.

Procedure

  1. On the Artifacts tab, browse the list of artifacts in Service Registry, or enter a search string to find an artifact. You can select from the list to search by specific criteria such as artifact name, group, labels, or global ID.
  2. Click an artifact to view its version details and content rules.
  3. In Artifact-specific rules, click Enable to configure a validity, compatibility, or integrity rule for artifact content, and select the appropriate rule configuration from the list. For example, for Validity rule, select Full.

    Figure 3.3. Artifact content rules in Service Registry web console

    Configure rules in Registry web console
  4. To access global rules, click the Global rules tab. Click Enable to configure global validity, compatibility, or integrity rules for all artifact content, and select the appropriate rule configuration from the list.
  5. To disable an artifact rule or global rule, click the trash icon next to the rule.

3.4. Generating client SDKs for OpenAPI artifacts using the Service Registry web console

You can use the Service Registry web console to configure, generate, and download client software development kits (SDKs) for OpenAPI artifacts. You can then use the generated client SDKs to build your client applications for specific platforms based on the OpenAPI.

Service Registry generates client SDKs for the following programming languages:

  • C#
  • Go
  • Java
  • PHP
  • Python
  • Ruby
  • Swift
  • TypeScript
Note

Client SDK generation for OpenAPI artifacts runs in your browser only, and cannot be automated by using an API. You must regenerate the client SDK each time a new artifact version is added in Service Registry.

Prerequisites

  • Service Registry is installed and running in your environment.
  • You are logged in to the Service Registry web console:

    http://MY_REGISTRY_URL/ui

  • An OpenAPI artifact has been added to Service Registry using the web console, command line, Maven plug-in, or a Java client application.

Procedure

  1. On the Artifacts tab, browse the list of artifacts stored in Service Registry, or enter a search string to find a specific OpenAPI artifact. You can select from the list to search by criteria such as name, group, labels, or global ID.
  2. Click the OpenAPI artifact in the list to view its details.
  3. In the Version metadata section, click Generate client SDK, and configure the following settings in the dialog:

    • Language: Select the programming language in which to generate the client SDK, for example, Java.
    • Generated client class name: Enter the class name for the client SDK, for example, MyJavaClientSDK.
    • Generated client package name: Enter the package name for the client SDK, for example, io.my.example.sdk
  4. Click Show advanced settings to configure optional comma-separated lists of path patterns to include or exclude:

    • Include path patterns: Enter specific paths to include when generating the client SDK, for example, **/.*, **/my-path/*. If this field is empty, all paths are included.
    • Exclude path patterns: Enter specific paths to exclude when generating the client SDK, for example, **/my-other-path/*. If this field is empty, no paths are excluded.

      Figure 3.4. Generate a Java client SDK in Service Registry web console

      Generate a Java client SDK in the registry web console
  5. When you have configured the settings in the dialog, click Generate and download.
  6. Enter a file name for the client SDK in the dialog, for example, my-client-java.zip, and click Save to download.

Additional resources

  • Service Registry uses Kiota from Microsoft to generate the client SDKs. For more information, see the Kiota project in GitHub.
  • For more details and examples of using the generated SDKs to build client applications, see the Kiota documentation.

3.5. Changing an artifact owner using the Service Registry web console

As an administrator or as an owner of a schema or API artifact, you can use the Service Registry web console to change the artifact owner to another user account.

For example, this feature is useful if the Artifact owner-only authorization option is set for the Service Registry instance on the Settings tab so that only owners or administrators can modify artifacts. You might need to change owner if the owner user leaves the organization or the owner account is deleted.

Note

The Artifact owner-only authorization setting and the artifact Owner field are displayed only if authentication was enabled when the Service Registry instance was deployed. For more details, see Installing and deploying Service Registry on OpenShift.

Prerequisites

  • The Service Registry instance is deployed and the artifact is created.
  • You are logged in to the Service Registry web console as the artifact’s current owner or as an administrator:

    http://MY_REGISTRY_URL/ui

Procedure

  1. On the Artifacts tab, browse the list of artifacts stored in Service Registry, or enter a search string to find the artifact. You can select from the list to search by criteria such as name, group, labels, or global ID.
  2. Click the artifact that you want to reassign.
  3. In the Version metadata section, click the pencil icon next to the Owner field.
  4. In the New owner field, select or enter an account name.
  5. Click Change owner.

3.6. Configuring Service Registry instance settings using the web console

As an administrator, you can use the Service Registry web console to configure dynamic settings for Service Registry instances at runtime. You can manage configuration options for features such as authentication, authorization, and API compatibility.

Note

Authentication and authorization settings are only displayed in the web console if authentication was already enabled when the Service Registry instance was deployed. For more details, see the Installing and deploying Service Registry on OpenShift.

Prerequisites

  • The Service Registry instance is already deployed.
  • You are logged in to the Service Registry web console with administrator access:

    http://MY_REGISTRY_URL/ui

Procedure

  1. In the Service Registry web console, click the Settings tab.
  2. Select the settings that you want to configure for this Service Registry instance:

    Table 3.1. Authentication settings
    SettingDescription

    HTTP basic authentication

    Displayed only when authentication is already enabled. When selected, Service Registry users can authenticate using HTTP basic authentication, in addition to OAuth. Not selected by default.

    Table 3.2. Authorization settings
    SettingDescription

    Anonymous read access

    Displayed only when authentication is already selected. When selected, Service Registry grants read-only access to requests from anonymous users without any credentials. This setting is useful if you want to use this instance to publish schemas or APIs externally. Not selected by default.

    Artifact owner-only authorization

    Displayed only when authentication is already enabled. When selected, only the user who created an artifact can modify that artifact. Not selected by default.

    Artifact group owner-only authorization

    Displayed only when authentication is already enabled and Artifact owner-only authorization is selected. When selected, only the user who created an artifact group has write access to that artifact group, for example, to add or remove artifacts in that group. Not selected by default.

    Authenticated read access

    Displayed only when authentication is already enabled. When selected, Service Registry grants at least read-only access to requests from any authenticated user regardless of their user role. Not selected by default.

    Table 3.3. Compatibility settings
    SettingDescription

    Legacy ID mode (compatibility API)

    When selected, the Confluent Schema Registry compatibility API uses globalId instead of contentId as an artifact identifier. This setting is useful when migrating from legacy Service Registry instances based on the v1 Core Registry API. Not selected by default.

    Table 3.4. Web console settings
    SettingDescription

    Download link expiry

    The number of seconds that a generated link to a .zip download file is active before expiring for security reasons, for example, when exporting artifact data from the instance. Defaults to 30 seconds.

    UI read-only mode

    When selected, the Service Registry web console is set to read-only, preventing create, read, update, or delete operations. Changes made using the Core Registry API are not affected by this setting. Not selected by default.

    Table 3.5. Additional properties
    SettingDescription

    Delete artifact version

    When selected, users are permitted to delete artifact versions in this instance by using the Core Registry API. Not selected by default.

3.7. Exporting and importing data using the Service Registry web console

As an administrator, you can use the Service Registry web console to export data from one Service Registry instance, and import this data into another Service Registry instance. You can use this feature to easily migrate data between different instances.

The following example shows how to export and import existing data in a .zip file from one Service Registry instance to another instance. All of the artifact data contained in the Service Registry instance is exported in the .zip file.

Note

You can import only Service Registry data that has been exported from another Service Registry instance.

Prerequisites

  • Service Registry instances have been created as follows:

    • The source instance that you are exporting from contains at least one schema or API artifact
    • The target instance that you are importing into is empty to preserve unique IDs
  • You are logged into the Service Registry web console with administrator access:

    http://MY_REGISTRY_URL/ui

Procedure

  1. In the web console for the source Service Registry instance, view the Artifacts tab.
  2. Click the options icon (three vertical dots) next to Upload artifact, and select Download all artifacts (.zip file) to export the data for this Service Registry instance to a .zip download file.
  3. In the the web console for the target Service Registry instance, view the Artifacts tab.
  4. Click the options icon next to Upload artifact, and select Upload multiple artifacts.
  5. Drag and drop or browse to the .zip download file that you exported earlier.
  6. Click Upload and wait for the data to be imported.
Red Hat logoGithubRedditYoutubeTwitter

Apprendre

Essayez, achetez et vendez

Communautés

À propos de la documentation Red Hat

Nous aidons les utilisateurs de Red Hat à innover et à atteindre leurs objectifs grâce à nos produits et services avec un contenu auquel ils peuvent faire confiance.

Rendre l’open source plus inclusif

Red Hat s'engage à remplacer le langage problématique dans notre code, notre documentation et nos propriétés Web. Pour plus de détails, consultez leBlog Red Hat.

À propos de Red Hat

Nous proposons des solutions renforcées qui facilitent le travail des entreprises sur plusieurs plates-formes et environnements, du centre de données central à la périphérie du réseau.

© 2024 Red Hat, Inc.