Skip to content

SDK for communicating with Confluent Schema Registry using Golang

License

Notifications You must be signed in to change notification settings

confluentinc/schema-registry-sdk-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

67 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go API client for schemaregistry

No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

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.

  • API version: v1
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import sw "./schemaregistry"

To use a proxy, set the environment variable HTTP_PROXY:

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

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(), sw.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(), sw.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(), sw.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), sw.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
DefaultApi AsyncapiParsePut Put /asyncapi/parse
DefaultApi AsyncapiPut Put /asyncapi
DefaultApi CreateBusinessMetadata Post /catalog/v1/entity/businessmetadata Bulk API to create multiple business metadata.
DefaultApi CreateBusinessMetadataDefs Post /catalog/v1/types/businessmetadatadefs Bulk create API for business metadata definitions.
DefaultApi CreateDek Post /dek-registry/v1/keks/{name}/deks Create a dek.
DefaultApi CreateExporter Post /exporters Create an exporter.
DefaultApi CreateKek Post /dek-registry/v1/keks Create a kek.
DefaultApi CreateOrUpdate Post /catalog/v1/entity
DefaultApi CreateTagDefs Post /catalog/v1/types/tagdefs Bulk create API for tag definitions.
DefaultApi CreateTags Post /catalog/v1/entity/tags Bulk API to create multiple tags.
DefaultApi DeleteBusinessMetadata Delete /catalog/v1/entity/type/{typeName}/name/{qualifiedName}/businessmetadata/{bmName} Delete a business metadata on an entity.
DefaultApi DeleteBusinessMetadataDef Delete /catalog/v1/types/businessmetadatadefs/{bmName} Delete API for business metadata definition identified by its name.
DefaultApi DeleteByUniqueAttributes Delete /catalog/v1/entity/type/{typeName}/name/{qualifiedName}
DefaultApi DeleteDekVersion Delete /dek-registry/v1/keks/{name}/deks/{subject}/versions/{version} Delete a dek version.
DefaultApi DeleteDekVersions Delete /dek-registry/v1/keks/{name}/deks/{subject} Delete all versions of a dek.
DefaultApi DeleteExporter Delete /exporters/{name} Delete an exporter.
DefaultApi DeleteKek Delete /dek-registry/v1/keks/{name} Delete a kek.
DefaultApi DeleteSchemaVersion Delete /subjects/{subject}/versions/{version} Deletes a specific version of the schema registered under this subject. This only deletes the version and the schema ID remains intact making it still possible to decode data using the schema ID. This API is recommended to be used only in development environments or under extreme circumstances where-in, its required to delete a previously registered schema for compatibility purposes or re-register previously registered schema.
DefaultApi DeleteSubject Delete /subjects/{subject} Deletes the specified subject and its associated compatibility level if registered. It is recommended to use this API only when a topic needs to be recycled or in development environment.
DefaultApi DeleteSubjectConfig Delete /config/{subject} Deletes the specified subject-level compatibility level config and revert to the global default.
DefaultApi DeleteSubjectMode Delete /mode/{subject} Deletes the specified subject-level mode and revert to the global default.
DefaultApi DeleteTag Delete /catalog/v1/entity/type/{typeName}/name/{qualifiedName}/tags/{tagName} Delete a tag on an entity.
DefaultApi DeleteTagDef Delete /catalog/v1/types/tagdefs/{tagName} Delete API for tag definition identified by its name.
DefaultApi DeleteTopLevelConfig Delete /config Delete global compatibility level
DefaultApi Get Get / Schema Registry Root Resource
DefaultApi GetAllBusinessMetadataDefs Get /catalog/v1/types/businessmetadatadefs Bulk retrieval API for retrieving business metadata definitions.
DefaultApi GetAllTagDefs Get /catalog/v1/types/tagdefs Bulk retrieval API for retrieving tag definitions.
DefaultApi GetBusinessMetadata Get /catalog/v1/entity/type/{typeName}/name/{qualifiedName}/businessmetadata Gets the list of business metadata for a given entity represented by a qualified name.
DefaultApi GetBusinessMetadataDefByName Get /catalog/v1/types/businessmetadatadefs/{bmName} Get the business metadata definition with the given name.
DefaultApi GetByUniqueAttributes Get /catalog/v1/entity/type/{typeName}/name/{qualifiedName} Fetch complete definition of an entity given its type and unique attribute.
DefaultApi GetClusterId Get /v1/metadata/id Get the server metadata
DefaultApi GetDek Get /dek-registry/v1/keks/{name}/deks/{subject} Get a dek by subject.
DefaultApi GetDekByVersion Get /dek-registry/v1/keks/{name}/deks/{subject}/versions/{version} Get a dek by subject and version.
DefaultApi GetDekSubjects Get /dek-registry/v1/keks/{name}/deks Get a list of dek subjects.
DefaultApi GetDekVersions Get /dek-registry/v1/keks/{name}/deks/{subject}/versions List versions of dek.
DefaultApi GetExporterConfig Get /exporters/{name}/config Get the config for an exporter.
DefaultApi GetExporterInfo Get /exporters/{name} Get the info for an exporter.
DefaultApi GetExporterStatus Get /exporters/{name}/status Get the status for an exporter.
DefaultApi GetExporters Get /exporters Get a list of exporter names.
DefaultApi GetKek Get /dek-registry/v1/keks/{name} Get a kek by name.
DefaultApi GetKekNames Get /dek-registry/v1/keks Get a list of kek names.
DefaultApi GetMode Get /mode/{subject} Get mode for a subject.
DefaultApi GetReferencedBy Get /subjects/{subject}/versions/{version}/referencedby Get the schemas that reference the specified schema.
DefaultApi GetSchema Get /schemas/ids/{id} Get the schema string identified by the input ID.
DefaultApi GetSchemaByVersion Get /subjects/{subject}/versions/{version} Get a specific version of the schema registered under this subject.
DefaultApi GetSchemaOnly Get /subjects/{subject}/versions/{version}/schema Get the schema for the specified version of this subject. The unescaped schema only is returned.
DefaultApi GetSchemaTypes Get /schemas/types Get the schema types supported by this registry.
DefaultApi GetSchemas Get /schemas Get the schemas.
DefaultApi GetSubjectLevelConfig Get /config/{subject} Get compatibility level for a subject.
DefaultApi GetSubjects Get /schemas/ids/{id}/subjects Get all the subjects associated with the input ID.
DefaultApi GetTagDefByName Get /catalog/v1/types/tagdefs/{tagName} Get the tag definition with the given name.
DefaultApi GetTags Get /catalog/v1/entity/type/{typeName}/name/{qualifiedName}/tags Gets the list of classifications for a given entity represented by a qualifed name.
DefaultApi GetTopLevelConfig Get /config Get global compatibility level
DefaultApi GetTopLevelMode Get /mode Get global mode.
DefaultApi GetVersions Get /schemas/ids/{id}/versions Get all the subject-version pairs associated with the input ID.
DefaultApi List Get /subjects Get a list of registered subjects.
DefaultApi ListContexts Get /contexts Get a list of contexts.
DefaultApi ListVersions Get /subjects/{subject}/versions Get a list of versions registered under the specified subject.
DefaultApi LookUpSchemaUnderSubject Post /subjects/{subject} Check if a schema has already been registered under the specified subject. If so, this returns the schema string along with its globally unique identifier, its version under this subject and the subject name.
DefaultApi PartialUpdateByUniqueAttributes Put /catalog/v1/entity
DefaultApi PauseExporter Put /exporters/{name}/pause Pause an exporter.
DefaultApi Post Post /
DefaultApi PutExporter Put /exporters/{name} Alters an exporter.
DefaultApi PutExporterConfig Put /exporters/{name}/config Alters the config of an exporter.
DefaultApi PutKek Put /dek-registry/v1/keks/{name} Alters a kek.
DefaultApi Register Post /subjects/{subject}/versions Register schema under a subject
DefaultApi ResetExporter Put /exporters/{name}/reset Reset an exporter.
DefaultApi ResumeExporter Put /exporters/{name}/resume Resume an exporter.
DefaultApi SearchUsingAttribute Get /catalog/v1/search/attribute Retrieve data for the specified attribute search query.
DefaultApi SearchUsingBasic Get /catalog/v1/search/basic Retrieve data for the specified fulltext query.
DefaultApi TestCompatibilityBySubjectName Post /compatibility/subjects/{subject}/versions/{version} Test input schema against a particular version of a subject's schema for compatibility.
DefaultApi TestCompatibilityForSubject Post /compatibility/subjects/{subject}/versions Test input schema against a subject's schemas for compatibility, based on the compatibility level of the subject configured. In other word, it will perform the same compatibility check as register for that subject
DefaultApi UndeleteDekVersion Post /dek-registry/v1/keks/{name}/deks/{subject}/versions/{version}/undelete Undelete a dek version.
DefaultApi UndeleteDekVersions Post /dek-registry/v1/keks/{name}/deks/{subject}/undelete Undelete all versions of a dek.
DefaultApi UndeleteKek Post /dek-registry/v1/keks/{name}/undelete Undelete a kek.
DefaultApi UpdateBusinessMetadata Put /catalog/v1/entity/businessmetadata Bulk API to update multiple business metadata.
DefaultApi UpdateBusinessMetadataDefs Put /catalog/v1/types/businessmetadatadefs Bulk update API for business metadata definitions.
DefaultApi UpdateMode Put /mode/{subject} Update mode for the specified subject.
DefaultApi UpdateSubjectLevelConfig Put /config/{subject} Update compatibility level for the specified subject.
DefaultApi UpdateTagDefs Put /catalog/v1/types/tagdefs Bulk update API for tag definitions.
DefaultApi UpdateTags Put /catalog/v1/entity/tags Bulk API to update multiple tags.
DefaultApi UpdateTopLevelConfig Put /config Update global compatibility level
DefaultApi UpdateTopLevelMode Put /mode Update global mode.

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