Documentation
¶
Index ¶
- Constants
- func ContextWithReason(ctx context.Context, reason string) context.Context
- func MarshalRequest(v interface{}) (*http.Request, error)
- func ReasonFromContext(ctx context.Context) (string, bool)
- type AccessTokenAuth
- type AuthInfo
- type AuthType
- type BasicAuth
- type Client
- func (c *Client) AddBroker(ctx context.Context, r *api.AddBrokerRequest) (*api.AddBrokerResponse, error)
- func (c *Client) Admin(ctx context.Context, r *api.AdminRequest) (*api.AdminResponse, error)
- func (c *Client) Bootstrap(ctx context.Context, r *api.BootstrapRequest) (*api.BootstrapResponse, error)
- func (c *Client) DemoteBroker(ctx context.Context, r *api.DemoteBrokerRequest) (*api.DemoteBrokerResponse, error)
- func (c *Client) FixOfflineReplicas(ctx context.Context, r *api.FixOfflineReplicasRequest) (*api.FixOfflineReplicasResponse, error)
- func (c *Client) KafkaClusterLoad(ctx context.Context, r *api.KafkaClusterLoadRequest) (*api.KafkaClusterLoadResponse, error)
- func (c *Client) KafkaClusterState(ctx context.Context, r *api.KafkaClusterStateRequest) (*api.KafkaClusterStateResponse, error)
- func (c *Client) KafkaPartitionLoad(ctx context.Context, r *api.KafkaPartitionLoadRequest) (*api.KafkaPartitionLoadResponse, error)
- func (c *Client) PauseSampling(ctx context.Context, r *api.PauseSamplingRequest) (*api.PauseSamplingResponse, error)
- func (c *Client) Proposals(ctx context.Context, r *api.ProposalsRequest) (*api.ProposalsResponse, error)
- func (c *Client) Rebalance(ctx context.Context, r *api.RebalanceRequest) (*api.RebalanceResponse, error)
- func (c *Client) RemoveBroker(ctx context.Context, r *api.RemoveBrokerRequest) (*api.RemoveBrokerResponse, error)
- func (c *Client) ResumeSampling(ctx context.Context, r *api.ResumeSamplingRequest) (*api.ResumeSamplingResponse, error)
- func (c *Client) Review(ctx context.Context, r *api.ReviewRequest) (*api.ReviewResponse, error)
- func (c *Client) ReviewBoard(ctx context.Context, r *api.ReviewBoardRequest) (*api.ReviewBoardResponse, error)
- func (c *Client) Rightsize(ctx context.Context, r *api.RightsizeRequest) (*api.RightsizeResponse, error)
- func (c *Client) State(ctx context.Context, r *api.StateRequest) (*api.StateResponse, error)
- func (c *Client) StopProposalExecution(ctx context.Context, r *api.StopProposalExecutionRequest) (*api.StopProposalExecutionResponse, error)
- func (c Client) String() string
- func (c *Client) TopicConfiguration(ctx context.Context, r *api.TopicConfigurationRequest) (*api.TopicConfigurationResponse, error)
- func (c *Client) Train(ctx context.Context, r *api.TrainRequest) (*api.TrainResponse, error)
- func (c *Client) UserTasks(ctx context.Context, r *api.UserTasksRequest) (*api.UserTasksResponse, error)
- type Config
- type ContentType
- type RequestMarshaler
- type RequestOptionApplier
- func WithAcceptJSON() RequestOptionApplier
- func WithAuthInfo(a AuthInfo) RequestOptionApplier
- func WithContentTypeJSON() RequestOptionApplier
- func WithContext(ctx context.Context) RequestOptionApplier
- func WithEndpoint(endpoint types.APIEndpoint) RequestOptionApplier
- func WithHeader(h string, v string) RequestOptionApplier
- func WithJSONQuery() RequestOptionApplier
- func WithMethod(m string) RequestOptionApplier
- func WithQuery(k, v string) RequestOptionApplier
- func WithReasonFromContext(ctx context.Context) RequestOptionApplier
- func WithServerURL(u *url.URL) RequestOptionApplier
- func WithUserAgent(agent string) RequestOptionApplier
- type RequestOptions
Constants ¶
const ( DefaultServerURL = "http://localhost:8090/kafkacruisecontrol" DefaultUserAgent = "go-cruise-control" )
const ( ServerURLEnvKey = prefix + "SERVER_URL" AuthTypeEnvKey = prefix + "AUTH_TYPE" UsernameEnvKey = prefix + "USERNAME" PasswordEnvKey = prefix + "PASSWORD" AccessTokenEnvKey = prefix + "ACCESS_TOKEN" UserAgentEnvKey = prefix + "USER_AGENT" )
const ( HTTPHeaderUserAgent = "User-Agent" HTTPHeaderAccept = "Accept" HTTPHeaderContentType = "Content-Type" MIMETypeJSON = "application/json" ChartSetUTF8 = "utf-8" JSONQueryParam = "json" ReasonQueryParam = "reason" )
const (
HTTPHeaderAuthorization = "Authorization"
)
Variables ¶
This section is empty.
Functions ¶
func ContextWithReason ¶ added in v0.5.0
func MarshalRequest ¶
Types ¶
type AccessTokenAuth ¶
type AccessTokenAuth struct {
// contains filtered or unexported fields
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
NewClient returns a new API client with the provided configuration. It returns an error if the configuration is invalid.
func NewDefaultClient ¶
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(ctx context.Context, r *api.AddBrokerRequest) (*api.AddBrokerResponse, error)
func (*Client) Admin ¶
func (c *Client) Admin(ctx context.Context, r *api.AdminRequest) (*api.AdminResponse, error)
func (*Client) Bootstrap ¶
func (c *Client) Bootstrap(ctx context.Context, r *api.BootstrapRequest) (*api.BootstrapResponse, error)
func (*Client) DemoteBroker ¶
func (c *Client) DemoteBroker(ctx context.Context, r *api.DemoteBrokerRequest) (*api.DemoteBrokerResponse, error)
func (*Client) FixOfflineReplicas ¶
func (c *Client) FixOfflineReplicas(ctx context.Context, r *api.FixOfflineReplicasRequest) (*api.FixOfflineReplicasResponse, error)
func (*Client) KafkaClusterLoad ¶
func (c *Client) KafkaClusterLoad(ctx context.Context, r *api.KafkaClusterLoadRequest) (*api.KafkaClusterLoadResponse, error)
func (*Client) KafkaClusterState ¶
func (c *Client) KafkaClusterState(ctx context.Context, r *api.KafkaClusterStateRequest) (*api.KafkaClusterStateResponse, error)
func (*Client) KafkaPartitionLoad ¶
func (c *Client) KafkaPartitionLoad(ctx context.Context, r *api.KafkaPartitionLoadRequest) (*api.KafkaPartitionLoadResponse, error)
func (*Client) PauseSampling ¶
func (c *Client) PauseSampling(ctx context.Context, r *api.PauseSamplingRequest) (*api.PauseSamplingResponse, error)
func (*Client) Proposals ¶
func (c *Client) Proposals(ctx context.Context, r *api.ProposalsRequest) (*api.ProposalsResponse, error)
func (*Client) Rebalance ¶
func (c *Client) Rebalance(ctx context.Context, r *api.RebalanceRequest) (*api.RebalanceResponse, error)
func (*Client) RemoveBroker ¶
func (c *Client) RemoveBroker(ctx context.Context, r *api.RemoveBrokerRequest) (*api.RemoveBrokerResponse, error)
func (*Client) ResumeSampling ¶
func (c *Client) ResumeSampling(ctx context.Context, r *api.ResumeSamplingRequest) (*api.ResumeSamplingResponse, error)
func (*Client) Review ¶
func (c *Client) Review(ctx context.Context, r *api.ReviewRequest) (*api.ReviewResponse, error)
func (*Client) ReviewBoard ¶
func (c *Client) ReviewBoard(ctx context.Context, 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(ctx context.Context, r *api.RightsizeRequest) (*api.RightsizeResponse, error)
Rightsize allows manually invoke provisioner rightsizing of the cluster.
func (*Client) State ¶
func (c *Client) State(ctx context.Context, r *api.StateRequest) (*api.StateResponse, error)
State reports back the Cruise Control state.
func (*Client) StopProposalExecution ¶
func (c *Client) StopProposalExecution(ctx context.Context, r *api.StopProposalExecutionRequest) (*api.StopProposalExecutionResponse, error)
StopProposalExecution invoke stopping of ongoing proposal execution in Cruise Control.
func (*Client) TopicConfiguration ¶
func (c *Client) TopicConfiguration(ctx context.Context, r *api.TopicConfigurationRequest) (*api.TopicConfigurationResponse, error)
TopicConfiguration allows changing Kafka topic configuration using Cruise Control.
func (*Client) Train ¶
func (c *Client) Train(ctx context.Context, r *api.TrainRequest) (*api.TrainResponse, error)
Train Cruise Control to better model broker cpu usage.
func (*Client) UserTasks ¶
func (c *Client) UserTasks(ctx context.Context, 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 HTTPClient *http.Client }
Config contains the configuration parameters for the API Client
func (*Config) ReadFromEnvironment ¶
func (c *Config) ReadFromEnvironment()
type ContentType ¶
type RequestMarshaler ¶
RequestMarshaler is the interface implemented by types that can marshal themselves into valid http.Request
type RequestOptionApplier ¶ added in v0.4.0
func WithAcceptJSON ¶
func WithAcceptJSON() RequestOptionApplier
func WithAuthInfo ¶
func WithAuthInfo(a AuthInfo) RequestOptionApplier
func WithContentTypeJSON ¶
func WithContentTypeJSON() RequestOptionApplier
func WithContext ¶
func WithContext(ctx context.Context) RequestOptionApplier
func WithEndpoint ¶
func WithEndpoint(endpoint types.APIEndpoint) RequestOptionApplier
func WithHeader ¶
func WithHeader(h string, v string) RequestOptionApplier
func WithJSONQuery ¶
func WithJSONQuery() RequestOptionApplier
func WithMethod ¶
func WithMethod(m string) RequestOptionApplier
func WithQuery ¶ added in v0.5.0
func WithQuery(k, v string) RequestOptionApplier
func WithReasonFromContext ¶ added in v0.5.0
func WithReasonFromContext(ctx context.Context) RequestOptionApplier
func WithServerURL ¶
func WithServerURL(u *url.URL) RequestOptionApplier
func WithUserAgent ¶
func WithUserAgent(agent string) RequestOptionApplier
type RequestOptions ¶
type RequestOptions interface {
// contains filtered or unexported methods
}