Categorygithub.com/ahawker/kafka-connect-go-sdk
modulepackage
0.0.2
Repository: https://github.com/ahawker/kafka-connect-go-sdk.git
Documentation: pkg.go.dev

# README

Go API client for openapi

Kafka Connect REST API https://docs.confluent.io/platform/current/connect/references/restapi.html

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: 0.1.9
  • Package version: 1.0.0
  • Build package: org.openapitools.codegen.languages.GoClientCodegen

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/oauth2
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import openapi "github.com/GIT_USER_ID/GIT_REPO_ID"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value sw.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value sw.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using sw.ContextOperationServerIndices and sw.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to http://localhost

ClassMethodHTTP requestDescription
DefaultApiCreateConnectorPost /connectorsCreate a new connector, returning the current connector info if successful. Return 409 (Conflict) if rebalance is in process, or if the connector already exists.
DefaultApiDeleteConnectorDelete /connectors/{name}Delete a connector, halting all tasks and deleting its configuration.
DefaultApiGetClusterInfoGet /Top-level (root) request that gets the version of the Connect worker that serves the REST request, the git commit ID of the source code, and the Kafka cluster ID that the worker is connected to.
DefaultApiGetConnectorGet /connectors/{name}Get information about the connector.
DefaultApiGetConnectorConfigGet /connectors/{name}/configGet the configuration for the connector.
DefaultApiGetConnectorStatusGet /connectors/{name}/statusGets the current status of the connector, including: * whether it is running or restarting, or if it has failed or paused * which worker it is assigned to * error information if it has failed * the state of all its tasks
DefaultApiGetConnectorTaskStatusGet /connectors/{name}/tasks/{task_id}/statusGet a task's status.
DefaultApiListConnectorTasksGet /connectors/{name}/tasksGet a list of tasks currently running for the connector.
DefaultApiListConnectorTopicsGet /connectors/{name}/topicsReturns a list of connector topic names. There is no defined order in which the topics are returned and consecutive calls may return the same topic names but in different order. This request is independent of whether a connector is running, and will return an empty set of topics, both for connectors that don't have active topics as well as non-existent connectors.
DefaultApiListConnectorsGet /connectorsGet a list of active connectors.
DefaultApiPauseConnectorPut /connectors/{name}/pausePause the connector and its tasks, which stops message processing until the connector is resumed. This call asynchronous and the tasks will not transition to PAUSED state at the same time.
DefaultApiRestartConnectorPost /connectors/{name}/restartRestart the connector. You may use the following query parameters to restart any combination of the Connector and/or Task instances for the connector.
DefaultApiRestartConnectorTaskPost /connectors/{name}/tasks/{task_id}/restartRestart an individual task.
DefaultApiResumeConnectorPut /connectors/{name}/resumeResume a paused connector or do nothing if the connector is not paused. This call asynchronous and the tasks will not transition to RUNNING state at the same time.
DefaultApiUpdateConnectorConfigPut /connectors/{name}/configUpdate or create a connector with the given configuration.

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author

# Functions

CacheExpires helper function to determine remaining time before repeating a request.
NewAPIClient creates a new API client.
NewAPIResponse returns a new APIResponse object.
NewAPIResponseWithError returns a new APIResponse object with the provided error message.
NewConfiguration returns a new Configuration object.
NewConnectorStatus instantiates a new ConnectorStatus object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewConnectorStatusWithDefaults instantiates a new ConnectorStatus object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewConnectorTypeFromValue returns a pointer to a valid ConnectorType for the value passed as argument, or an error if the value passed is not allowed by the enum.
NewCreateConnectorRequest instantiates a new CreateConnectorRequest object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewCreateConnectorRequestWithDefaults instantiates a new CreateConnectorRequest object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewCreateConnectorResponse instantiates a new CreateConnectorResponse object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewCreateConnectorResponseTasksInner instantiates a new CreateConnectorResponseTasksInner object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewCreateConnectorResponseTasksInnerWithDefaults instantiates a new CreateConnectorResponseTasksInner object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewCreateConnectorResponseWithDefaults instantiates a new CreateConnectorResponse object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewError instantiates a new Error object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewErrorWithDefaults instantiates a new Error object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewGetClusterInfoResponse instantiates a new GetClusterInfoResponse object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewGetClusterInfoResponseWithDefaults instantiates a new GetClusterInfoResponse object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewGetConnectorResponse instantiates a new GetConnectorResponse object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewGetConnectorResponseWithDefaults instantiates a new GetConnectorResponse object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewGetConnectorStatusResponse instantiates a new GetConnectorStatusResponse object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewGetConnectorStatusResponseWithDefaults instantiates a new GetConnectorStatusResponse object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewGetConnectorTaskStatusResponse instantiates a new GetConnectorTaskStatusResponse object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewGetConnectorTaskStatusResponseWithDefaults instantiates a new GetConnectorTaskStatusResponse object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewListConnectorsResponseValue instantiates a new ListConnectorsResponseValue object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewListConnectorsResponseValueInfo instantiates a new ListConnectorsResponseValueInfo object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewListConnectorsResponseValueInfoTasksInner instantiates a new ListConnectorsResponseValueInfoTasksInner object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewListConnectorsResponseValueInfoTasksInnerWithDefaults instantiates a new ListConnectorsResponseValueInfoTasksInner object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewListConnectorsResponseValueInfoWithDefaults instantiates a new ListConnectorsResponseValueInfo object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewListConnectorsResponseValueStatus instantiates a new ListConnectorsResponseValueStatus object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewListConnectorsResponseValueStatusWithDefaults instantiates a new ListConnectorsResponseValueStatus object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewListConnectorsResponseValueWithDefaults instantiates a new ListConnectorsResponseValue object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewListConnectorTasksResponse instantiates a new ListConnectorTasksResponse object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewListConnectorTasksResponseTasksInner instantiates a new ListConnectorTasksResponseTasksInner object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewListConnectorTasksResponseTasksInnerId instantiates a new ListConnectorTasksResponseTasksInnerId object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewListConnectorTasksResponseTasksInnerIdWithDefaults instantiates a new ListConnectorTasksResponseTasksInnerId object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewListConnectorTasksResponseTasksInnerWithDefaults instantiates a new ListConnectorTasksResponseTasksInner object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewListConnectorTasksResponseWithDefaults instantiates a new ListConnectorTasksResponse object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewListConnectorTopicsResponseValue instantiates a new ListConnectorTopicsResponseValue object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewListConnectorTopicsResponseValueWithDefaults instantiates a new ListConnectorTopicsResponseValue object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
NewRestartConnectorResponse instantiates a new RestartConnectorResponse object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewRestartConnectorResponseWithDefaults instantiates a new RestartConnectorResponse object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewStateFromValue returns a pointer to a valid State for the value passed as argument, or an error if the value passed is not allowed by the enum.
NewTaskStatus instantiates a new TaskStatus object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewTaskStatusWithDefaults instantiates a new TaskStatus object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
NewUpdateConnectorConfigResponse instantiates a new UpdateConnectorConfigResponse object This constructor will assign default values to properties that have it defined, and makes sure properties required by API are set, but the set of arguments will change when the set of required properties is changed.
NewUpdateConnectorConfigResponseWithDefaults instantiates a new UpdateConnectorConfigResponse object This constructor will only assign default values to properties that have it defined, but it doesn't guarantee that properties required by API are set.
PtrBool is a helper routine that returns a pointer to given boolean value.
PtrFloat32 is a helper routine that returns a pointer to given float value.
PtrFloat64 is a helper routine that returns a pointer to given float value.
PtrInt is a helper routine that returns a pointer to given integer value.
PtrInt32 is a helper routine that returns a pointer to given integer value.
PtrInt64 is a helper routine that returns a pointer to given integer value.
PtrString is a helper routine that returns a pointer to given string value.
PtrTime is helper routine that returns a pointer to given Time value.

# Constants

List of State.
List of State.
List of State.
List of State.
List of State.
List of ConnectorType.
List of ConnectorType.
List of State.

# Variables

All allowed values of ConnectorType enum.
All allowed values of State enum.
ContextAccessToken takes a string oauth2 access token as authentication for the request.
ContextAPIKeys takes a string apikey as authentication for the request.
ContextBasicAuth takes BasicAuth as authentication for the request.
ContextHttpSignatureAuth takes HttpSignatureAuth as authentication for the request.
ContextOAuth2 takes an oauth2.TokenSource as authentication for the request.
ContextOperationServerIndices uses a server configuration from the index mapping.
ContextOperationServerVariables overrides a server configuration variables using operation specific values.
ContextServerIndex uses a server configuration from the index.
ContextServerVariables overrides a server configuration variables.

# Structs

APIClient manages communication with the Kafka Connect REST API API v0.1.9 In most cases there should be only one, shared, APIClient.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
APIKey provides API key based authentication to a request passed via context using ContextAPIKey.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
APIResponse stores the API response returned by the server.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth.
Configuration stores the configuration of the API client.
ConnectorStatus Connector status.
CreateConnectorRequest struct for CreateConnectorRequest.
CreateConnectorResponse struct for CreateConnectorResponse.
CreateConnectorResponseTasksInner struct for CreateConnectorResponseTasksInner.
Error Generic error.
GenericOpenAPIError Provides access to the body, error and model on returned errors.
GetClusterInfoResponse struct for GetClusterInfoResponse.
GetConnectorResponse Connector info.
GetConnectorStatusResponse Connector status.
GetConnectorTaskStatusResponse Task status.
ListConnectorsResponseValue Connector with expanded info and status details.
ListConnectorsResponseValueInfo struct for ListConnectorsResponseValueInfo.
ListConnectorsResponseValueInfoTasksInner struct for ListConnectorsResponseValueInfoTasksInner.
ListConnectorsResponseValueStatus struct for ListConnectorsResponseValueStatus.
ListConnectorTasksResponse Connector tasks fetched.
ListConnectorTasksResponseTasksInner struct for ListConnectorTasksResponseTasksInner.
ListConnectorTasksResponseTasksInnerId Task ID.
ListConnectorTopicsResponseValue Connector topics.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
RestartConnectorResponse Connector restarted.
ServerConfiguration stores the information about a server.
ServerVariable stores the information about a server variable.
TaskStatus Status of a task.
UpdateConnectorConfigResponse Connector info.

# Type aliases

ConnectorType Type of connector.
DefaultApiService DefaultApi service.
ServerConfigurations stores multiple ServerConfiguration items.
State State of a connector/task/worker.