client

package
v0.0.0-...-d537c09 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultServerURL = "http://localhost:8090/kafkacruisecontrol"
	DefaultUserAgent = "go-cruise-control"

	DefaultRequestTimeout = 30 * time.Second
)
View Source
const (
	ServerURLEnvKey   = prefix + "SERVER_URL"
	AuthTypeEnvKey    = prefix + "AUTH_TYPE"
	UsernameEnvKey    = prefix + "USERNAME"
	PasswordEnvKey    = prefix + "PASSWORD"
	AccessTokenEnvKey = prefix + "ACCESS_TOKEN"
	UserAgentEnvKey   = prefix + "USER_AGENT"
)
View Source
const (
	HTTPHeaderUserAgent   = "User-Agent"
	HTTPHeaderAccept      = "Accept"
	HTTPHeaderContentType = "Content-Type"
	MIMETypeJSON          = "application/json"
	ChartSetUTF8          = "utf-8"
)
View Source
const (
	HTTPHeaderAuthorization = "Authorization"
)

Variables

This section is empty.

Functions

func MarshalRequest

func MarshalRequest(v interface{}) (*http.Request, error)

Types

type AccessTokenAuth

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

func (AccessTokenAuth) Apply

func (a AccessTokenAuth) Apply(r *http.Request) error

type AuthInfo

type AuthInfo interface {
	Apply(r *http.Request) error
}

type AuthType

type AuthType int8
const (
	AuthTypeNone AuthType = iota
	AuthTypeBasic
	AuthTypeAccessToken
)

func AuthTypeFromString

func AuthTypeFromString(s string) AuthType

func (AuthType) String

func (t AuthType) String() string

type BasicAuth

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

func (BasicAuth) Apply

func (a BasicAuth) Apply(r *http.Request) error

type Client

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

func NewClient

func NewClient(ctx context.Context, opts *Config) (*Client, error)

NewClient returns a new API client with the provided configuration. It returns an error if the configuration is invalid.

func NewDefaultClient

func NewDefaultClient() (*Client, error)

NewDefaultClient return a new API client with default configuration. It returns an error if the configuration is invalid.

func (*Client) AddBroker

func (c *Client) AddBroker(r *api.AddBrokerRequest) (*api.AddBrokerResponse, error)

func (*Client) Admin

func (c *Client) Admin(r *api.AdminRequest) (*api.AdminResponse, error)

func (*Client) Bootstrap

func (c *Client) Bootstrap(r *api.BootstrapRequest) (*api.BootstrapResponse, error)

func (*Client) Context

func (c *Client) Context() context.Context

func (*Client) DemoteBroker

func (c *Client) DemoteBroker(r *api.DemoteBrokerRequest) (*api.DemoteBrokerResponse, error)

func (*Client) FixOfflineReplicas

func (*Client) KafkaClusterLoad

func (*Client) KafkaClusterState

func (*Client) KafkaPartitionLoad

func (*Client) PauseSampling

func (c *Client) PauseSampling(r *api.PauseSamplingRequest) (*api.PauseSamplingResponse, error)

func (*Client) Proposals

func (c *Client) Proposals(r *api.ProposalsRequest) (*api.ProposalsResponse, error)

func (*Client) Rebalance

func (c *Client) Rebalance(r *api.RebalanceRequest) (*api.RebalanceResponse, error)

func (*Client) RemoveBroker

func (c *Client) RemoveBroker(r *api.RemoveBrokerRequest) (*api.RemoveBrokerResponse, error)

func (*Client) ResumeSampling

func (c *Client) ResumeSampling(r *api.ResumeSamplingRequest) (*api.ResumeSamplingResponse, error)

func (*Client) Review

func (c *Client) Review(r *api.ReviewRequest) (*api.ReviewResponse, error)

func (*Client) ReviewBoard

func (c *Client) ReviewBoard(r *api.ReviewBoardRequest) (*api.ReviewBoardResponse, error)

ReviewBoard returns a list of Cruise Control requests with their review state.

func (*Client) Rightsize

func (c *Client) Rightsize(r *api.RightsizeRequest) (*api.RightsizeResponse, error)

Rightsize allows manually invoke provisioner rightsizing of the cluster.

func (*Client) State

func (c *Client) State(r *api.StateRequest) (*api.StateResponse, error)

State reports back the Cruise Control state.

func (*Client) StopProposalExecution

StopProposalExecution invoke stopping of ongoing proposal execution in Cruise Control.

func (Client) String

func (c Client) String() string

func (*Client) TopicConfiguration

TopicConfiguration allows changing Kafka topic configuration using Cruise Control.

func (*Client) Train

func (c *Client) Train(r *api.TrainRequest) (*api.TrainResponse, error)

Train Cruise Control to better model broker cpu usage.

func (*Client) UserTasks

func (c *Client) UserTasks(r *api.UserTasksRequest) (*api.UserTasksResponse, error)

UserTasks returns the list of recent tasks performed by Cruise Control.

type Config

type Config struct {
	ServerURL   string
	AuthType    AuthType
	Username    string
	Password    string
	AccessToken string
	UserAgent   string
}

Config contains the configuration parameters for the API Client

func (*Config) ReadFromEnvironment

func (c *Config) ReadFromEnvironment()

type ContentType

type ContentType struct {
	MIMEType string
	ChartSet string
	Boundary string
}

type RequestMarshaler

type RequestMarshaler interface {
	MarshalRequest() (*http.Request, error)
}

RequestMarshaler is the interface implemented by types that can marshal themselves into valid http.Request

type RequestOptions

type RequestOptions interface {
	// contains filtered or unexported methods
}

func WithAcceptJSON

func WithAcceptJSON() RequestOptions

func WithAuthInfo

func WithAuthInfo(a AuthInfo) RequestOptions

func WithContentTypeJSON

func WithContentTypeJSON() RequestOptions

func WithContext

func WithContext(ctx context.Context) RequestOptions

func WithEndpoint

func WithEndpoint(endpoint types.APIEndpoint) RequestOptions

func WithHeader

func WithHeader(h string, v string) RequestOptions

func WithJSONQuery

func WithJSONQuery() RequestOptions

func WithMethod

func WithMethod(m string) RequestOptions

func WithServerURL

func WithServerURL(u *url.URL) RequestOptions

func WithUserAgent

func WithUserAgent(agent string) RequestOptions

Jump to

Keyboard shortcuts

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