schemaregistry

package
v0.0.0-...-e5673ba Latest Latest
Warning

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

Go to latest
Published: May 7, 2023 License: MIT Imports: 19 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) (int, error)
	GetBySubjectAndID(subject string, id int) (SchemaInfo, error)
	GetID(subject string, schema SchemaInfo, normalize bool) (int, 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) (int, error)
	GetAllSubjects() ([]string, error)
	DeleteSubject(subject string, permanent bool) ([]int, error)
	DeleteSubjectVersion(subject string, version int, permanent bool) (int, error)
	GetCompatibility(subject string) (compatibility Compatibility, err error)
	UpdateCompatibility(subject string, update Compatibility) (Compatibility, error)
	TestCompatibility(subject string, version int, schema SchemaInfo) (bool, error)
	GetDefaultCompatibility() (Compatibility, error)
	UpdateDefaultCompatibility(update Compatibility) (Compatibility, error)
}

Client is an interface for clients interacting with the Confluent Schema Registry.

func NewClient

func NewClient(c Config) (Client, error)

NewClient returns a Client implementation.

func NewMockClient

func NewMockClient() (Client, error)

NewMockClient returns a mock 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 {
	URL                            string
	BasicAuthUserInfo              string
	BasicAuthCredentialsSource     string
	SASLMechanism                  string
	SASLUsername                   string
	SASLPassword                   string
	SSLCertificateLocation         string
	SSLKeyLocation                 string
	SSLCaLocation                  string
	SSLDisableEndpointVerification bool
	ConnectionTimeout              time.Duration
	RequestTimeout                 time.Duration
	CacheCapacity                  int
}

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

func NewConfig

func NewConfig(url string, options ...Option) Config

NewConfig returns a new configuration instance with sane defaults.

type Option

type Option func(*Config)

Option is used to pass configuration options to the Schema registry client.

func WithBasicAuth

func WithBasicAuth(username, password string) Option

WithBasictAuth sets the username and password for basic authentication. Default source: USER_INFO.

func WithConnectionTimeout

func WithConnectionTimeout(d time.Duration) Option

WithConnectionTimeout sets the connection timeout.

func WithRequestTimeout

func WithRequestTimeout(d time.Duration) Option

WithRequestTimeout sets the request timeout.

func WithSASLAuth

func WithSASLAuth(mechanism, username, password string) Option

WithSASLAuth sets the SASL mechanism.

func WithSSL

func WithSSL(certLocation, caLocation, keyLocation string, disableVerify bool) Option

WithSSL sets the SSL configuration.

func WithURL

func WithURL(url string) Option

WithURL sets the URL of the Schema Registry client.

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

Jump to

Keyboard shortcuts

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