internal

package
v2.5.1 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Base                   = ".."
	Schemas                = "/schemas/ids/%d"
	SchemasBySubject       = "/schemas/ids/%d?subject=%s"
	Subject                = "/subjects"
	Subjects               = Subject + "/%s"
	SubjectsNormalize      = Subject + "/%s?normalize=%t"
	SubjectsDelete         = Subjects + "?permanent=%t"
	LatestWithMetadata     = Subjects + "/metadata?deleted=%t%s"
	Version                = Subjects + "/versions"
	VersionNormalize       = Subjects + "/versions?normalize=%t"
	Versions               = Version + "/%v"
	VersionsIncludeDeleted = Versions + "?deleted=%t"
	VersionsDelete         = Versions + "?permanent=%t"
	SubjectCompatibility   = "/compatibility" + Version
	Compatibility          = "/compatibility" + Versions
	Config                 = "/config"
	SubjectConfig          = Config + "/%s"
	SubjectConfigDefault   = SubjectConfig + "?defaultToGlobal=%t"
	Mode                   = "/mode"
	SubjectMode            = Mode + "/%s"

	Keks          = "/dek-registry/v1/keks"
	KekByName     = Keks + "/%s?deleted=%t"
	Deks          = Keks + "/%s/deks"
	DeksBySubject = Deks + "/%s?deleted=%t"
	DeksByVersion = Deks + "/%s/versions/%v?deleted=%t"

	TargetSRClusterKey      = "Target-Sr-Cluster"
	TargetIdentityPoolIDKey = "Confluent-Identity-Pool-Id"
)

Relative Confluent Schema Registry REST API endpoints as described in the Confluent documentation https://docs.confluent.io/current/schema-registry/docs/api.html

Variables

This section is empty.

Functions

func ConfigureTLS

func ConfigureTLS(conf *ClientConfig, tlsConf *tls.Config) error

ConfigureTLS populates tlsConf

func NewAuthHeader

func NewAuthHeader(service *url.URL, conf *ClientConfig) (http.Header, error)

NewAuthHeader returns a base64 encoded userinfo string identified on the configured credentials source

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API represents a REST API request

func NewRequest

func NewRequest(method string, endpoint string, body interface{}, arguments ...interface{}) *API

NewRequest returns new Confluent Schema Registry API request */

type ClientConfig

type ClientConfig 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

	// BearerAuthToken specifies the token for authentication.
	BearerAuthToken string
	// BearerAuthCredentialsSource specifies how to determine the credentials.
	BearerAuthCredentialsSource string
	// BearerAuthLogicalCluster specifies the target SR logical cluster id. It is required for Confluent Cloud Schema Registry
	BearerAuthLogicalCluster string
	// BearerAuthIdentityPoolID specifies the identity pool ID. It is required for Confluent Cloud Schema Registry
	BearerAuthIdentityPoolID 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
	// CacheLatestTTLSecs ttl in secs for caching the latest schema
	CacheLatestTTLSecs int

	// HTTP client
	HTTPClient *http.Client
}

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

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 RestService

type RestService struct {
	*http.Client
	// contains filtered or unexported fields
}

RestService represents a REST client

func NewRestService

func NewRestService(conf *ClientConfig) (*RestService, error)

NewRestService returns a new REST client for the Confluent Schema Registry

func (*RestService) HandleRequest

func (rs *RestService) HandleRequest(request *API, response interface{}) error

HandleRequest sends a HTTP(S) request to the Schema Registry, placing results into the response object

Jump to

Keyboard shortcuts

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