schemaregistry

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// None is no compatibility
	None
	// Backward compatibility
	Backward
	// Forward compatibility
	Forward
	// Full compatibility
	Full
	// BackwardTransitive compatibility
	BackwardTransitive
	// ForwardTransitive compatibility
	ForwardTransitive
	// FullTransitive compatibility
	FullTransitive
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	Register(subject string, schema SchemaInfo, normalize bool) (id int, err error)
	GetBySubjectAndID(subject string, id int) (schema SchemaInfo, err error)
	GetID(subject string, schema SchemaInfo, normalize bool) (id int, err error)
	GetLatestSchemaMetadata(subject string) (SchemaMetadata, error)
	GetSchemaMetadata(subject string, version int) (SchemaMetadata, error)
	GetAllVersions(subject string) ([]int, error)
	GetVersion(subject string, schema SchemaInfo, normalize bool) (version int, err error)
	GetAllSubjects() ([]string, error)
	DeleteSubject(subject string, permanent bool) ([]int, error)
	DeleteSubjectVersion(subject string, version int, permanent bool) (deletes int, err error)
	GetCompatibility(subject string) (compatibility Compatibility, err error)
	UpdateCompatibility(subject string, update Compatibility) (compatibility Compatibility, err error)
	TestCompatibility(subject string, version int, schema SchemaInfo) (compatible bool, err error)
	GetDefaultCompatibility() (compatibility Compatibility, err error)
	UpdateDefaultCompatibility(update Compatibility) (compatibility Compatibility, err error)
}

Client is an interface for clients interacting with the Confluent Schema Registry. The Schema Registry's REST interface is further explained in Confluent's Schema Registry API documentation https://github.com/confluentinc/schema-registry/blob/master/client/src/main/java/io/confluent/kafka/schemaregistry/client/SchemaRegistryClient.java

func NewClient

func NewClient(conf *Config) (Client, error)

NewClient returns a Client implementation

type Compatibility

type Compatibility int

Compatibility options

func (Compatibility) MarshalJSON

func (c Compatibility) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Compatibility) ParseString

func (c *Compatibility) ParseString(val string) error

ParseString returns a Compatibility for the given string

func (Compatibility) String

func (c Compatibility) String() string

func (*Compatibility) UnmarshalJSON

func (c *Compatibility) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler

type Config

type Config struct {
	// SchemaRegistryURL determines the URL of Schema Registry.
	SchemaRegistryURL string

	// BasicAuthUserInfo specifies the user info in the form of {username}:{password}.
	BasicAuthUserInfo string
	// BasicAuthCredentialsSource specifies how to determine the credentials, one of URL, USER_INFO, and SASL_INHERIT.
	BasicAuthCredentialsSource string

	// SaslMechanism specifies the SASL mechanism used for client connections, which defaults to GSSAPI.
	SaslMechanism string
	// SaslUsername specifies the username for SASL.
	SaslUsername string
	// SaslUsername specifies the password for SASL.
	SaslPassword string

	// SslCertificateLocation specifies the location of SSL certificates.
	SslCertificateLocation string
	// SslKeyLocation specifies the location of SSL keys.
	SslKeyLocation string
	// SslCaLocation specifies the location of SSL certificate authorities.
	SslCaLocation string
	// SslDisableEndpointVerification determines whether to disable endpoint verification.
	SslDisableEndpointVerification bool

	// ConnectionTimeoutMs determines the connection timeout in milliseconds.
	ConnectionTimeoutMs int
	// RequestTimeoutMs determines the request timeout in milliseconds.
	RequestTimeoutMs int
	// CacheCapacity positive integer or zero for unbounded capacity
	CacheCapacity int
}

Config is used to pass multiple configuration options to the Schema Registry client.

func NewConfig

func NewConfig(url string) *Config

NewConfig returns a new configuration instance with sane defaults.

func NewConfigWithAuthentication

func NewConfigWithAuthentication(url string, username string, password string) *Config

NewConfigWithAuthentication returns a new configuration instance using basic authentication. For Confluent Cloud, use the API key for the username and the API secret for the password.

type Reference

type Reference struct {
	Name    string `json:"name"`
	Subject string `json:"subject"`
	Version int    `json:"version"`
}

Reference represents a schema reference

type RestError

type RestError struct {
	Code    int    `json:"error_code"`
	Message string `json:"message"`
}

RestError represents a Schema Registry HTTP Error response

func (*RestError) Error

func (err *RestError) Error() string

Error implements the errors.Error interface

type SchemaInfo

type SchemaInfo struct {
	Schema     string      `json:"schema,omitempty"`
	SchemaType string      `json:"schemaType,omitempty"`
	References []Reference `json:"references,omitempty"`
}

SchemaInfo represents basic schema information

func (*SchemaInfo) MarshalJSON

func (sd *SchemaInfo) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*SchemaInfo) UnmarshalJSON

func (sd *SchemaInfo) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller interface

type SchemaMetadata

type SchemaMetadata struct {
	SchemaInfo
	ID      int    `json:"id,omitempty"`
	Subject string `json:"subject,omitempty"`
	Version int    `json:"version,omitempty"`
}

SchemaMetadata represents schema metadata

func (*SchemaMetadata) MarshalJSON

func (sd *SchemaMetadata) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface

func (*SchemaMetadata) UnmarshalJSON

func (sd *SchemaMetadata) UnmarshalJSON(b []byte) error

UnmarshalJSON implements the json.Unmarshaller interface

Directories

Path Synopsis
Code generated by github.com/actgardner/gogen-avro/v10.
Code generated by github.com/actgardner/gogen-avro/v10.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL