Documentation
¶
Overview ¶
Package connect provides a client for the Kafka Connect REST API.
Index ¶
- Constants
- type APIError
- type Client
- func (c *Client) CreateConnector(conn *Connector) (*http.Response, error)
- func (c *Client) DeleteConnector(name string) (*http.Response, error)
- func (c *Client) Do(req *http.Request, v interface{}) (*http.Response, error)
- func (c *Client) GetConnector(name string) (*Connector, *http.Response, error)
- func (c *Client) GetConnectorConfig(name string) (ConnectorConfig, *http.Response, error)
- func (c *Client) GetConnectorStatus(name string) (*ConnectorStatus, *http.Response, error)
- func (c *Client) GetConnectorTasks(name string) ([]Task, *http.Response, error)
- func (c *Client) Host() string
- func (c *Client) ListConnectors() ([]string, *http.Response, error)
- func (c *Client) NewRequest(method, path string, body interface{}) (*http.Request, error)
- func (c *Client) PauseConnector(name string) (*http.Response, error)
- func (c *Client) RestartConnector(name string) (*http.Response, error)
- func (c *Client) ResumeConnector(name string) (*http.Response, error)
- func (c *Client) UpdateConnectorConfig(name string, config ConnectorConfig) (*Connector, *http.Response, error)
- type Connector
- type ConnectorConfig
- type ConnectorState
- type ConnectorStatus
- type Task
- type TaskID
- type TaskState
Constants ¶
const ( // DefaultHostURL is the default HTTP host used for connecting to a Kafka // Connect REST API. DefaultHostURL = "http://localhost:8083/" )
const ( // StatusUnprocessableEntity is the status code returned when sending a // request with invalid fields. StatusUnprocessableEntity = 422 )
const Version = "0.9.0"
Version is the go-kafka/connect library version.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct { Code int `json:"error_code"` Message string `json:"message"` Response *http.Response // HTTP response that caused this error }
APIError holds information returned from a Kafka Connect API instance about why an API call failed.
type Client ¶
type Client struct { // HTTP client used to communicate with the API. By default // http.DefaultClient will be used. HTTPClient *http.Client // User agent used when communicating with the Kafka Connect API. UserAgent string // contains filtered or unexported fields }
A Client manages communication with the Kafka Connect REST API.
func NewClient ¶
NewClient returns a new Kafka Connect API client that communicates with the optional host. If no host is given, DefaultHostURL (localhost) is used.
func (*Client) CreateConnector ¶
CreateConnector creates a new connector instance. If successful, conn is updated with the connector's state returned by the API, including Tasks.
Passing an object that already contains Tasks produces an error.
See: http://docs.confluent.io/current/connect/userguide.html#post--connectors
func (*Client) DeleteConnector ¶
DeleteConnector deletes a connector with the given name, halting all tasks and deleting its configuration.
See: http://docs.confluent.io/current/connect/userguide.html#delete--connectors-(string-name)-
func (*Client) Do ¶
Do sends an API request and returns the API response. The API response is JSON-decoded and stored in the value pointed to by v, or returned as an error if an API or HTTP error has occurred.
func (*Client) GetConnector ¶
GetConnector retrieves information about a connector with the given name.
See: http://docs.confluent.io/current/connect/userguide.html#get--connectors-(string-name)
func (*Client) GetConnectorConfig ¶
GetConnectorConfig retrieves configuration for a connector with the given name.
See: http://docs.confluent.io/current/connect/userguide.html#get--connectors-(string-name)-config
func (*Client) GetConnectorStatus ¶
GetConnectorStatus gets current status of the connector, including whether it is running, failed or paused, which worker it is assigned to, error information if it has failed, and the state of all its tasks.
See: http://docs.confluent.io/current/connect/userguide.html#get--connectors-(string-name)-status
func (*Client) GetConnectorTasks ¶
GetConnectorTasks retrieves a list of tasks currently running for a connector with the given name.
See: http://docs.confluent.io/current/connect/userguide.html#get--connectors-(string-name)-tasks
func (*Client) ListConnectors ¶
ListConnectors retrieves a list of active connector names.
See: http://docs.confluent.io/current/connect/userguide.html#get--connectors
func (*Client) NewRequest ¶
NewRequest creates an API request. A relative URL can be provided in path, in which case it is resolved relative to the BaseURL of the Client. Relative URLs should always be specified without a preceding slash. If specified, the value pointed to by body is JSON-encoded and included as the request body.
func (*Client) PauseConnector ¶
PauseConnector pauses a connector and its tasks, which stops message processing until the connector is resumed. Tasks will transition to PAUSED state asynchronously.
See: http://docs.confluent.io/current/connect/userguide.html#put--connectors-(string-name)-pause
func (*Client) RestartConnector ¶
RestartConnector restarts a connector and its tasks.
See http://docs.confluent.io/current/connect/userguide.html#post--connectors-(string-name)-restart
func (*Client) ResumeConnector ¶
ResumeConnector resumes a paused connector. Tasks will transition to RUNNING state asynchronously.
See: http://docs.confluent.io/current/connect/userguide.html#put--connectors-(string-name)-resume
func (*Client) UpdateConnectorConfig ¶
func (c *Client) UpdateConnectorConfig(name string, config ConnectorConfig) (*Connector, *http.Response, error)
UpdateConnectorConfig updates configuration for an existing connector with the given name, returning the new state of the Connector.
If the connector does not exist, it will be created, and the returned HTTP response will indicate a 201 Created status.
See: http://docs.confluent.io/current/connect/userguide.html#put--connectors-(string-name)-config
type Connector ¶
type Connector struct { Name string `json:"name"` Config ConnectorConfig `json:"config,omitempty"` Tasks []TaskID `json:"tasks,omitempty"` }
A Connector represents a Kafka Connect connector instance.
See: http://docs.confluent.io/current/connect/userguide.html#connectors-tasks-and-workers
type ConnectorConfig ¶
ConnectorConfig is a key-value mapping of configuration for connectors, where keys are in the form of Java properties.
See: http://docs.confluent.io/current/connect/userguide.html#configuring-connectors
type ConnectorState ¶
ConnectorState reflects the running state of a Connector and the worker where it is running.
type ConnectorStatus ¶
type ConnectorStatus struct { Name string `json:"name"` Connector ConnectorState `json:"connector"` Tasks []TaskState `json:"tasks"` }
ConnectorStatus reflects the status of a Connector and state of its Tasks.
Having connector name and a "connector" object at top level is a little awkward and produces stuttering, but it's their design, not ours.
type Task ¶
A Task is a unit of work dispatched by a Connector to parallelize the work of a data copy job.
See: http://docs.confluent.io/current/connect/userguide.html#connectors-tasks-and-workers
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
kafka-connect
kafka-connect is a command line utility for managing Kafka Connect.
|
kafka-connect is a command line utility for managing Kafka Connect. |