Skip to content

Apicurio/apicurio-registry-client-sdk-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

56 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Apicurio Registry Client SDK for Go

Apicurio Registry is a datastore for standard event schemas and API designs. Apicurio Registry enables developers to manage and share the structure of their data using a REST interface. For example, client applications can dynamically push or pull the latest updates to or from the registry without needing to redeploy. Apicurio Registry also enables developers to create rules that govern how registry content can evolve over time. For example, this includes rules for content validation and version compatibility.

The Apicurio Registry REST API enables client applications to manage the artifacts in the registry. This API provides create, read, update, and delete operations for schema and API artifacts, rules, versions, and metadata.

The supported artifact types include:

  • Apache Avro schema
  • AsyncAPI specification
  • Google protocol buffers
  • GraphQL schema
  • JSON Schema
  • Kafka Connect schema
  • OpenAPI specification
  • Web Services Description Language
  • XML Schema Definition

Important: The Apicurio Registry REST API is available from https://MY-REGISTRY-URL/apis/registry/v2 by default. Therefore you must prefix all API operation paths with ../apis/registry/v2 in this case. For example: ../apis/registry/v2/ids/globalIds/{globalId}.

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

Installation

Install the client SDK library to your Go project:

go get github.com/Apicurio/apicurio-registry-client-sdk-go

Add the following import to use it:

import "github.com/Apicurio/apicurio-registry-client-sdk-go"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Creating an API client

To create an API client using the default configuration options:

cfg := registryclient.NewConfiguration()
registryClient := registryclient.NewAPIClient(&cfg)

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), registryclient.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), registryclient.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), registryclient.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), registryclient.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to http://localhost

Class Method HTTP request Description
AdminAPI CreateGlobalRule Post /admin/rules Create global rule
AdminAPI CreateRoleMapping Post /admin/roleMappings Create a new role mapping
AdminAPI DeleteAllGlobalRules Delete /admin/rules Delete all global rules
AdminAPI DeleteGlobalRule Delete /admin/rules/{rule} Delete global rule
AdminAPI DeleteRoleMapping Delete /admin/roleMappings/{principalId} Delete a role mapping
AdminAPI ExportData Get /admin/export Export registry data
AdminAPI GetConfigProperty Get /admin/config/properties/{propertyName} Get configuration property value
AdminAPI GetGlobalRuleConfig Get /admin/rules/{rule} Get global rule configuration
AdminAPI GetRoleMapping Get /admin/roleMappings/{principalId} Return a single role mapping
AdminAPI ImportData Post /admin/import Import registry data
AdminAPI ListArtifactTypes Get /admin/artifactTypes List artifact types
AdminAPI ListConfigProperties Get /admin/config/properties List all configuration properties
AdminAPI ListGlobalRules Get /admin/rules List global rules
AdminAPI ListRoleMappings Get /admin/roleMappings List all role mappings
AdminAPI ResetConfigProperty Delete /admin/config/properties/{propertyName} Reset a configuration property
AdminAPI UpdateConfigProperty Put /admin/config/properties/{propertyName} Update a configuration property
AdminAPI UpdateGlobalRuleConfig Put /admin/rules/{rule} Update global rule configuration
AdminAPI UpdateRoleMapping Put /admin/roleMappings/{principalId} Update a role mapping
ArtifactRulesAPI CreateArtifactRule Post /groups/{groupId}/artifacts/{artifactId}/rules Create artifact rule
ArtifactRulesAPI DeleteArtifactRule Delete /groups/{groupId}/artifacts/{artifactId}/rules/{rule} Delete artifact rule
ArtifactRulesAPI DeleteArtifactRules Delete /groups/{groupId}/artifacts/{artifactId}/rules Delete artifact rules
ArtifactRulesAPI GetArtifactRuleConfig Get /groups/{groupId}/artifacts/{artifactId}/rules/{rule} Get artifact rule configuration
ArtifactRulesAPI ListArtifactRules Get /groups/{groupId}/artifacts/{artifactId}/rules List artifact rules
ArtifactRulesAPI TestUpdateArtifact Put /groups/{groupId}/artifacts/{artifactId}/test Test update artifact
ArtifactRulesAPI UpdateArtifactRuleConfig Put /groups/{groupId}/artifacts/{artifactId}/rules/{rule} Update artifact rule configuration
ArtifactTypeAPI ListArtifactTypes Get /admin/artifactTypes List artifact types
ArtifactsAPI CreateArtifact Post /groups/{groupId}/artifacts Create artifact
ArtifactsAPI DeleteArtifact Delete /groups/{groupId}/artifacts/{artifactId} Delete artifact
ArtifactsAPI DeleteArtifactsInGroup Delete /groups/{groupId}/artifacts Delete artifacts in group
ArtifactsAPI GetContentByGlobalId Get /ids/globalIds/{globalId} Get artifact by global ID
ArtifactsAPI GetContentByHash Get /ids/contentHashes/{contentHash}/ Get artifact content by SHA-256 hash
ArtifactsAPI GetContentById Get /ids/contentIds/{contentId}/ Get artifact content by ID
ArtifactsAPI GetLatestArtifact Get /groups/{groupId}/artifacts/{artifactId} Get latest artifact
ArtifactsAPI ListArtifactsInGroup Get /groups/{groupId}/artifacts List artifacts in group
ArtifactsAPI ReferencesByContentHash Get /ids/contentHashes/{contentHash}/references List artifact references by hash
ArtifactsAPI ReferencesByContentId Get /ids/contentIds/{contentId}/references List artifact references by content ID
ArtifactsAPI ReferencesByGlobalId Get /ids/globalIds/{globalId}/references List artifact references by global ID
ArtifactsAPI SearchArtifacts Get /search/artifacts Search for artifacts
ArtifactsAPI SearchArtifactsByContent Post /search/artifacts Search for artifacts by content
ArtifactsAPI UpdateArtifact Put /groups/{groupId}/artifacts/{artifactId} Update artifact
ArtifactsAPI UpdateArtifactState Put /groups/{groupId}/artifacts/{artifactId}/state Update artifact state
GroupsAPI CreateGroup Post /groups Create a new group
GroupsAPI DeleteGroupById Delete /groups/{groupId} Delete a group by the specified ID.
GroupsAPI GetGroupById Get /groups/{groupId} Get a group by the specified ID.
GroupsAPI ListGroups Get /groups List groups
MetadataAPI DeleteArtifactVersionMetaData Delete /groups/{groupId}/artifacts/{artifactId}/versions/{version}/meta Delete artifact version metadata
MetadataAPI GetArtifactMetaData Get /groups/{groupId}/artifacts/{artifactId}/meta Get artifact metadata
MetadataAPI GetArtifactOwner Get /groups/{groupId}/artifacts/{artifactId}/owner Get artifact owner
MetadataAPI GetArtifactVersionMetaData Get /groups/{groupId}/artifacts/{artifactId}/versions/{version}/meta Get artifact version metadata
MetadataAPI GetArtifactVersionMetaDataByContent Post /groups/{groupId}/artifacts/{artifactId}/meta Get artifact version metadata by content
MetadataAPI UpdateArtifactMetaData Put /groups/{groupId}/artifacts/{artifactId}/meta Update artifact metadata
MetadataAPI UpdateArtifactOwner Put /groups/{groupId}/artifacts/{artifactId}/owner Update artifact owner
MetadataAPI UpdateArtifactVersionMetaData Put /groups/{groupId}/artifacts/{artifactId}/versions/{version}/meta Update artifact version metadata
SystemAPI GetResourceLimits Get /system/limits Get resource limits information
SystemAPI GetSystemInfo Get /system/info Get system information
UsersAPI GetCurrentUserInfo Get /users/me Get current user
VersionsAPI AddArtifactVersionComment Post /groups/{groupId}/artifacts/{artifactId}/versions/{version}/comments Add new comment
VersionsAPI CreateArtifactVersion Post /groups/{groupId}/artifacts/{artifactId}/versions Create artifact version
VersionsAPI DeleteArtifactVersion Delete /groups/{groupId}/artifacts/{artifactId}/versions/{version} Delete artifact version
VersionsAPI DeleteArtifactVersionComment Delete /groups/{groupId}/artifacts/{artifactId}/versions/{version}/comments/{commentId} Delete a single comment
VersionsAPI GetArtifactVersion Get /groups/{groupId}/artifacts/{artifactId}/versions/{version} Get artifact version
VersionsAPI GetArtifactVersionComments Get /groups/{groupId}/artifacts/{artifactId}/versions/{version}/comments Get artifact version comments
VersionsAPI GetArtifactVersionReferences Get /groups/{groupId}/artifacts/{artifactId}/versions/{version}/references Get artifact version references
VersionsAPI ListArtifactVersions Get /groups/{groupId}/artifacts/{artifactId}/versions List artifact versions
VersionsAPI UpdateArtifactVersionComment Put /groups/{groupId}/artifacts/{artifactId}/versions/{version}/comments/{commentId} Update a comment
VersionsAPI UpdateArtifactVersionState Put /groups/{groupId}/artifacts/{artifactId}/versions/{version}/state Update artifact version state

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

[email protected]