connect

package module
v0.0.0-...-27c93e3 Latest Latest
Warning

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

Go to latest
Published: May 23, 2024 License: Apache-2.0 Imports: 8 Imported by: 6

README

connect-client

A HTTP client to talk to Kafka connect clusters.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiError

type ApiError struct {
	ErrorCode int    `json:"error_code"`
	Message   string `json:"message"`
}

ApiError is the standard error message format for all returned errors (status codes in the 400 or 500 range).

func (ApiError) Error

func (a ApiError) Error() string

type Client

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

Client that talks to the Kafka Connect instances via HTTP

func NewClient

func NewClient(opts ...ClientOption) *Client

func (*Client) CreateConnector

func (c *Client) CreateConnector(ctx context.Context, req CreateConnectorRequest) (ConnectorInfo, error)

func (*Client) DeleteConnector

func (c *Client) DeleteConnector(ctx context.Context, connectorName string) error

func (*Client) GetClient

func (c *Client) GetClient() *http.Client

func (*Client) GetConnector

func (c *Client) GetConnector(ctx context.Context, connectorName string) (ConnectorInfo, error)

func (*Client) GetConnectorConfig

func (c *Client) GetConnectorConfig(ctx context.Context, connectorName string) (map[string]string, error)

func (*Client) GetConnectorPlugins

func (c *Client) GetConnectorPlugins(ctx context.Context) ([]ConnectorPluginInfo, error)

func (*Client) GetConnectorStatus

func (c *Client) GetConnectorStatus(ctx context.Context, connectorName string) (ConnectorStateInfo, error)

func (*Client) GetConnectorTopics

func (c *Client) GetConnectorTopics(ctx context.Context, connectorName string) (map[string]ConnectorTopics, error)

func (*Client) GetRoot

func (c *Client) GetRoot(ctx context.Context) (RootResource, error)

func (*Client) ListConnectors

func (c *Client) ListConnectors(ctx context.Context) ([]string, error)

func (*Client) ListConnectorsExpanded

func (c *Client) ListConnectorsExpanded(ctx context.Context) (map[string]ListConnectorsResponseExpanded, error)

func (*Client) PauseConnector

func (c *Client) PauseConnector(ctx context.Context, connectorName string) error

func (*Client) PutConnectorConfig

func (c *Client) PutConnectorConfig(ctx context.Context, connectorName string, options PutConnectorConfigOptions) (ConnectorInfo, error)

func (*Client) PutValidateConnectorConfig

func (c *Client) PutValidateConnectorConfig(ctx context.Context, pluginClassName string, options ValidateConnectorConfigOptions) (ConnectorValidationResult, error)

func (*Client) ResetConnectorTopics

func (c *Client) ResetConnectorTopics(ctx context.Context, connectorName string) error

func (*Client) RestartConnector

func (c *Client) RestartConnector(ctx context.Context, connectorName string, options RestartConnectorOptions) error

// RestartConnector restart the connector.

func (*Client) RestartConnectorTask

func (c *Client) RestartConnectorTask(ctx context.Context, connectorName string, taskID int) error

func (*Client) ResumeConnector

func (c *Client) ResumeConnector(ctx context.Context, connectorName string) error

func (*Client) StopConnector

func (c *Client) StopConnector(ctx context.Context, connectorName string) error

type ClientOption

type ClientOption func(c *Client)

func WithAuthToken

func WithAuthToken(token string) ClientOption

func WithBasicAuth

func WithBasicAuth(username string, password string) ClientOption

func WithHost

func WithHost(host string) ClientOption

func WithTLSConfig

func WithTLSConfig(tlsCfg *tls.Config) ClientOption

func WithTimeout

func WithTimeout(timeout time.Duration) ClientOption

func WithUserAgent

func WithUserAgent(userAgent string) ClientOption

type ConnectorInfo

type ConnectorInfo struct {
	Name   string            `json:"name"`
	Config map[string]string `json:"config"`
	Tasks  []ConnectorTaskID `json:"tasks"`
	Type   string            `json:"type,omitempty"`
}

type ConnectorPluginInfo

type ConnectorPluginInfo struct {
	Class   string `json:"class"`
	Type    string `json:"type,omitempty"`
	Version string `json:"version,omitempty"`
}

type ConnectorState

type ConnectorState struct {
	State    string `json:"state"`
	WorkerID string `json:"worker_id"`
	Trace    string `json:"trace,omitempty"`
}

type ConnectorStateInfo

type ConnectorStateInfo struct {
	Name      string         `json:"name"`
	Connector ConnectorState `json:"connector"`
	Tasks     []TaskState    `json:"tasks"`
	Type      string         `json:"type"`
}

type ConnectorTaskID

type ConnectorTaskID struct {
	Connector string `json:"connector"`
	Task      int    `json:"task"`
}

type ConnectorTopics

type ConnectorTopics struct {
	Topics []string `json:"topics"`
}

type ConnectorValidationResult

type ConnectorValidationResult struct {
	Name       string                            `json:"name"`
	ErrorCount int                               `json:"error_count"`
	Groups     []string                          `json:"groups"`
	Configs    []ConnectorValidationResultConfig `json:"configs"`
}

type ConnectorValidationResultConfig

type ConnectorValidationResultConfig struct {
	Definition map[string]interface{} `json:"definition"`
	Value      map[string]interface{} `json:"value"`
}

type CreateConnectorRequest

type CreateConnectorRequest struct {
	Name   string                 `json:"name"`
	Config map[string]interface{} `json:"config"`
}

func (*CreateConnectorRequest) Validate

func (c *CreateConnectorRequest) Validate() error

type ListConnectorsOptions

type ListConnectorsOptions struct {
	ExpandStatus bool
	ExpandInfo   bool
}

ListConnectorsOptions describe the available options to list connectors. Either Status or Info must be set to true.

func (*ListConnectorsOptions) Validate

func (l *ListConnectorsOptions) Validate() error

type ListConnectorsResponseExpanded

type ListConnectorsResponseExpanded struct {
	Info   ConnectorInfo      `json:"info"`
	Status ConnectorStateInfo `json:"status"`
}

ListConnectorsResponseExpanded is the response to /connectors if the expand query parameters are set.

type ListConnectorsResponseExpandedInfo

type ListConnectorsResponseExpandedInfo struct {
	Name   string            `json:"name"`
	Config map[string]string `json:"config"`
	Tasks  []struct {
		Connector string `json:"connector"`
		Task      int    `json:"task"`
	} `json:"tasks"`
	Type string `json:"type"`
}

ListConnectorsResponseExpandedInfo represents the Info object for described connectors. Deprecated: Use ConnectorInfo instead, the same information is available there

type ListConnectorsResponseExpandedStatus

type ListConnectorsResponseExpandedStatus struct {
	Name      string `json:"name"`
	Connector struct {
		State    string `json:"state"`
		WorkerID string `json:"worker_id"`
		Trace    string `json:"trace,omitempty"`
	}
	Tasks []struct {
		ID       int    `json:"id"`
		State    string `json:"state"`
		WorkerID string `json:"worker_id"`
		Trace    string `json:"trace,omitempty"`
	} `json:"tasks"`
	Type string `json:"type"`
}

ListConnectorsResponseExpandedStatus represents the Status object for described connectors. Deprecated: Use ConnectorStateInfo instead, the same information is available there

type PutConnectorConfigOptions

type PutConnectorConfigOptions struct {
	Config map[string]interface{}
}

type RestartConnectorOptions

type RestartConnectorOptions struct {
	// Specifies whether to restart the connector instance and task instances
	// or just the connector instance. Default is false.
	IncludeTasks bool
	// Specifies whether to restart just the instances with a FAILED status
	// or all instances. Default is false.
	OnlyFailed bool
}

RestartConnectorOptions describe the available options to restart connectors.

type RootResource

type RootResource struct {
	Version        string `json:"version"`
	Commit         string `json:"commit"`
	KafkaClusterID string `json:"kafka_cluster_id"`
}

type TaskState

type TaskState struct {
	ID       int    `json:"id"`
	State    string `json:"state"`
	WorkerID string `json:"worker_id"`
	Trace    string `json:"trace"`
}

type ValidateConnectorConfigOptions

type ValidateConnectorConfigOptions struct {
	Config map[string]interface{}
}

Jump to

Keyboard shortcuts

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