connectors

package
v0.0.0-...-6284b21 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseClient

type BaseClient interface {
	GetAll() (GetAllConnectorsResponse, error)
	GetConnector(req ConnectorRequest) (ConnectorResponse, error)
	CreateConnector(req CreateConnectorRequest) (ConnectorResponse, error)
	UpdateConnector(req CreateConnectorRequest) (ConnectorResponse, error)
	DeleteConnector(req ConnectorRequest) (EmptyResponse, error)
	GetConnectorConfig(req ConnectorRequest) (GetConnectorConfigResponse, error)
	GetConnectorStatus(req ConnectorRequest) (GetConnectorStatusResponse, error)
	RestartConnector(req ConnectorRequest) (EmptyResponse, error)
	PauseConnector(req ConnectorRequest) (EmptyResponse, error)
	ResumeConnector(req ConnectorRequest) (EmptyResponse, error)
	GetAllTasks(req ConnectorRequest) (GetAllTasksResponse, error)
	GetTaskStatus(req TaskRequest) (TaskStatusResponse, error)
	RestartTask(req TaskRequest) (EmptyResponse, error)

	SetInsecureSSL()
	SetDebug()
	SetClientCertificates(certs ...tls.Certificate)
	SetBasicAuth(username string, password string)
}

BaseClient implement the kafka-connect contract as a client handle retries on 409 response

type ConnectorRequest

type ConnectorRequest struct {
	Name string `json:"name"`
}

ConnectorRequest is generic request used when interacting with connector endpoint

type ConnectorResponse

type ConnectorResponse struct {
	EmptyResponse
	Name   string                 `json:"name"`
	Config map[string]interface{} `json:"config"`
	Tasks  []TaskID               `json:"tasks"`
}

ConnectorResponse is generic response when interacting with connector endpoint

type CreateConnectorRequest

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

CreateConnectorRequest is request used for creating connector

type EmptyResponse

type EmptyResponse struct {
	Code int
	ErrorResponse
}

EmptyResponse is response returned by multiple endpoint when only StatusCode matter

type ErrorResponse

type ErrorResponse struct {
	ErrorCode int    `json:"error_code,omitempty"`
	Message   string `json:"message,omitempty"`
}

ErrorResponse is generic error returned by kafka connect

func (ErrorResponse) Error

func (err ErrorResponse) Error() string

type GetAllConnectorsResponse

type GetAllConnectorsResponse struct {
	EmptyResponse
	Connectors []string
}

GetAllConnectorsResponse is request used to get list of available connectors

type GetAllTasksResponse

type GetAllTasksResponse struct {
	Code  int
	Tasks []TaskDetails
}

GetAllTasksResponse is response to get all tasks of a specific endpoint

type GetConnectorConfigResponse

type GetConnectorConfigResponse struct {
	EmptyResponse
	Config map[string]interface{}
}

GetConnectorConfigResponse is response returned by GetConfig endpoint

type GetConnectorStatusResponse

type GetConnectorStatusResponse struct {
	EmptyResponse
	Name            string            `json:"name"`
	ConnectorStatus map[string]string `json:"connector"`
	TasksStatus     []TaskStatus      `json:"tasks"`
}

GetConnectorStatusResponse is response returned by GetStatus endpoint

type HighLevelClient

type HighLevelClient interface {
	// kafka-connect api
	GetAll() (GetAllConnectorsResponse, error)
	GetConnector(req ConnectorRequest) (ConnectorResponse, error)
	CreateConnector(req CreateConnectorRequest, sync bool) (ConnectorResponse, error)
	UpdateConnector(req CreateConnectorRequest, sync bool) (ConnectorResponse, error)
	DeleteConnector(req ConnectorRequest, sync bool) (EmptyResponse, error)
	GetConnectorConfig(req ConnectorRequest) (GetConnectorConfigResponse, error)
	GetConnectorStatus(req ConnectorRequest) (GetConnectorStatusResponse, error)
	RestartConnector(req ConnectorRequest) (EmptyResponse, error)
	PauseConnector(req ConnectorRequest, sync bool) (EmptyResponse, error)
	ResumeConnector(req ConnectorRequest, sync bool) (EmptyResponse, error)
	GetAllTasks(req ConnectorRequest) (GetAllTasksResponse, error)
	GetTaskStatus(req TaskRequest) (TaskStatusResponse, error)
	RestartTask(req TaskRequest) (EmptyResponse, error)

	// custom features, mostly composition of previous ones
	IsUpToDate(connector string, config map[string]interface{}) (bool, error)
	DeployConnector(req CreateConnectorRequest) (err error)
	DeployMultipleConnector(connectors []CreateConnectorRequest) (err error)
	SetInsecureSSL()
	SetDebug()
	SetClientCertificates(certs ...tls.Certificate)
	SetParallelism(value int)
	SetBasicAuth(username string, password string)
}

HighLevelClient support all function of kafka-connect API + some more features

func NewClient

func NewClient(url string) HighLevelClient

NewClient generates a new client

type MockBaseClient

type MockBaseClient struct {
	mock.Mock
}

MockBaseClient is an autogenerated mock type for the BaseClient type

func (*MockBaseClient) CreateConnector

func (_m *MockBaseClient) CreateConnector(req CreateConnectorRequest) (ConnectorResponse, error)

CreateConnector provides a mock function with given fields: req

func (*MockBaseClient) DeleteConnector

func (_m *MockBaseClient) DeleteConnector(req ConnectorRequest) (EmptyResponse, error)

DeleteConnector provides a mock function with given fields: req

func (*MockBaseClient) GetAll

GetAll provides a mock function with given fields:

func (*MockBaseClient) GetAllTasks

func (_m *MockBaseClient) GetAllTasks(req ConnectorRequest) (GetAllTasksResponse, error)

GetAllTasks provides a mock function with given fields: req

func (*MockBaseClient) GetConnector

func (_m *MockBaseClient) GetConnector(req ConnectorRequest) (ConnectorResponse, error)

GetConnector provides a mock function with given fields: req

func (*MockBaseClient) GetConnectorConfig

func (_m *MockBaseClient) GetConnectorConfig(req ConnectorRequest) (GetConnectorConfigResponse, error)

GetConnectorConfig provides a mock function with given fields: req

func (*MockBaseClient) GetConnectorStatus

func (_m *MockBaseClient) GetConnectorStatus(req ConnectorRequest) (GetConnectorStatusResponse, error)

GetConnectorStatus provides a mock function with given fields: req

func (*MockBaseClient) GetTaskStatus

func (_m *MockBaseClient) GetTaskStatus(req TaskRequest) (TaskStatusResponse, error)

GetTaskStatus provides a mock function with given fields: req

func (*MockBaseClient) PauseConnector

func (_m *MockBaseClient) PauseConnector(req ConnectorRequest) (EmptyResponse, error)

PauseConnector provides a mock function with given fields: req

func (*MockBaseClient) RestartConnector

func (_m *MockBaseClient) RestartConnector(req ConnectorRequest) (EmptyResponse, error)

RestartConnector provides a mock function with given fields: req

func (*MockBaseClient) RestartTask

func (_m *MockBaseClient) RestartTask(req TaskRequest) (EmptyResponse, error)

RestartTask provides a mock function with given fields: req

func (*MockBaseClient) ResumeConnector

func (_m *MockBaseClient) ResumeConnector(req ConnectorRequest) (EmptyResponse, error)

ResumeConnector provides a mock function with given fields: req

func (*MockBaseClient) SetBasicAuth

func (_m *MockBaseClient) SetBasicAuth(username string, password string)

SetBasicAuth provides a mock function with given fields: username, password

func (*MockBaseClient) SetClientCertificates

func (_m *MockBaseClient) SetClientCertificates(certs ...tls.Certificate)

SetClientCertificates provides a mock function with given fields: certs

func (*MockBaseClient) SetDebug

func (_m *MockBaseClient) SetDebug()

SetDebug provides a mock function with given fields:

func (*MockBaseClient) SetInsecureSSL

func (_m *MockBaseClient) SetInsecureSSL()

SetInsecureSSL provides a mock function with given fields:

func (*MockBaseClient) UpdateConnector

func (_m *MockBaseClient) UpdateConnector(req CreateConnectorRequest) (ConnectorResponse, error)

UpdateConnector provides a mock function with given fields: req

type MockHighLevelClient

type MockHighLevelClient struct {
	mock.Mock
}

MockHighLevelClient is an autogenerated mock type for the HighLevelClient type

func (*MockHighLevelClient) CreateConnector

func (_m *MockHighLevelClient) CreateConnector(req CreateConnectorRequest, sync bool) (ConnectorResponse, error)

CreateConnector provides a mock function with given fields: req, sync

func (*MockHighLevelClient) DeleteConnector

func (_m *MockHighLevelClient) DeleteConnector(req ConnectorRequest, sync bool) (EmptyResponse, error)

DeleteConnector provides a mock function with given fields: req, sync

func (*MockHighLevelClient) DeployConnector

func (_m *MockHighLevelClient) DeployConnector(req CreateConnectorRequest) error

DeployConnector provides a mock function with given fields: req

func (*MockHighLevelClient) DeployMultipleConnector

func (_m *MockHighLevelClient) DeployMultipleConnector(connectors []CreateConnectorRequest) error

DeployMultipleConnector provides a mock function with given fields: connectors

func (*MockHighLevelClient) GetAll

GetAll provides a mock function with given fields:

func (*MockHighLevelClient) GetAllTasks

GetAllTasks provides a mock function with given fields: req

func (*MockHighLevelClient) GetConnector

GetConnector provides a mock function with given fields: req

func (*MockHighLevelClient) GetConnectorConfig

GetConnectorConfig provides a mock function with given fields: req

func (*MockHighLevelClient) GetConnectorStatus

GetConnectorStatus provides a mock function with given fields: req

func (*MockHighLevelClient) GetTaskStatus

func (_m *MockHighLevelClient) GetTaskStatus(req TaskRequest) (TaskStatusResponse, error)

GetTaskStatus provides a mock function with given fields: req

func (*MockHighLevelClient) IsUpToDate

func (_m *MockHighLevelClient) IsUpToDate(connector string, config map[string]interface{}) (bool, error)

IsUpToDate provides a mock function with given fields: connector, config

func (*MockHighLevelClient) PauseConnector

func (_m *MockHighLevelClient) PauseConnector(req ConnectorRequest, sync bool) (EmptyResponse, error)

PauseConnector provides a mock function with given fields: req, sync

func (*MockHighLevelClient) RestartConnector

func (_m *MockHighLevelClient) RestartConnector(req ConnectorRequest) (EmptyResponse, error)

RestartConnector provides a mock function with given fields: req

func (*MockHighLevelClient) RestartTask

func (_m *MockHighLevelClient) RestartTask(req TaskRequest) (EmptyResponse, error)

RestartTask provides a mock function with given fields: req

func (*MockHighLevelClient) ResumeConnector

func (_m *MockHighLevelClient) ResumeConnector(req ConnectorRequest, sync bool) (EmptyResponse, error)

ResumeConnector provides a mock function with given fields: req, sync

func (*MockHighLevelClient) SetBasicAuth

func (_m *MockHighLevelClient) SetBasicAuth(username string, password string)

SetBasicAuth provides a mock function with given fields: username, password

func (*MockHighLevelClient) SetClientCertificates

func (_m *MockHighLevelClient) SetClientCertificates(certs ...tls.Certificate)

SetClientCertificates provides a mock function with given fields: certs

func (*MockHighLevelClient) SetDebug

func (_m *MockHighLevelClient) SetDebug()

SetDebug provides a mock function with given fields:

func (*MockHighLevelClient) SetInsecureSSL

func (_m *MockHighLevelClient) SetInsecureSSL()

SetInsecureSSL provides a mock function with given fields:

func (*MockHighLevelClient) SetParallelism

func (_m *MockHighLevelClient) SetParallelism(value int)

SetParallelism provides a mock function with given fields: value

func (*MockHighLevelClient) UpdateConnector

func (_m *MockHighLevelClient) UpdateConnector(req CreateConnectorRequest, sync bool) (ConnectorResponse, error)

UpdateConnector provides a mock function with given fields: req, sync

type TaskDetails

type TaskDetails struct {
	ID     TaskID                 `json:"id"`
	Config map[string]interface{} `json:"config"`
}

TaskDetails is detail of a specific task on a specific endpoint

type TaskID

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

TaskID identify a task and its connector

type TaskRequest

type TaskRequest struct {
	Connector string
	TaskID    int
}

TaskRequest is generic request when interacting with task endpoint

type TaskStatus

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

TaskStatus define task status

type TaskStatusResponse

type TaskStatusResponse struct {
	Code   int
	Status TaskStatus
}

TaskStatusResponse is response returned by get task status endpoint

Jump to

Keyboard shortcuts

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