Back to godoc.org

Package api

v0.0.0-...-835b2a8
Latest Go to latest

The latest major version is .

Published: Apr 5, 2020 | License: Apache-2.0 | Module: github.com/cloudhut/kafka-owl/backend

Index

func LoadConfig

func LoadConfig(filename string, cfg *Config) error

LoadConfig read YAML-formatted config from filename into cfg.

type API

type API struct {
	Cfg *Config

	Logger   *zap.Logger
	KafkaSvc *kafka.Service
	OwlSvc   *owl.Service

	Hooks *Hooks // Hooks to add additional functionality from the outside at different places (used by Kafka Owl Business)
	// contains filtered or unexported fields
}

API represents the server and all it's dependencies to serve incoming user requests

func New

func New(cfg *Config) *API

New creates a new API instance

func (*API) Start

func (api *API) Start()

Start the API server and block

type Config

type Config struct {
	ConfigFilepath   string
	MetricsNamespace string `yaml:"metricsNamespace"`
	ServeFrontend    bool   `yaml:"serveFrontend"`

	REST   rest.Config    `yaml:"server"`
	Kafka  kafka.Config   `yaml:"kafka"`
	Logger logging.Config `yaml:"logger"`
}

Config holds all (subdependency)Configs needed to run the API

func (*Config) RegisterFlags

func (c *Config) RegisterFlags(f *flag.FlagSet)

RegisterFlags for all (sub)configs

func (*Config) SetDefaults

func (c *Config) SetDefaults()

func (*Config) Validate

func (c *Config) Validate() error

type GetConsumerGroupsResponse

type GetConsumerGroupsResponse struct {
	ConsumerGroups []*owl.ConsumerGroupOverview `json:"consumerGroups"`
}

GetConsumerGroupsResponse represents the data which is returned for listing topics

type GetTopicMessagesResponse

type GetTopicMessagesResponse struct {
	KafkaMessages *kafka.ListMessageResponse `json:"kafkaMessages"`
}

GetTopicMessagesResponse is a wrapper for an array of TopicMessage

type Hooks

type Hooks struct {
	Route RouteHooks
	Owl   OwlHooks
}

Hooks are a way to extend the Kafka Owl functionality from the outside. By default all hooks have no additional functionality. In order to run your own Hooks you must construct an Hooks instance and run attach them to your own instance of Api.

type KafkaHealthCheck

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

KafkaHealthCheck implements the gosundheit HealthCheck interface

func (*KafkaHealthCheck) Execute

func (k *KafkaHealthCheck) Execute() (interface{}, error)

Execute runs a single time check, and returns an error when the check fails, and an optional details object.

func (*KafkaHealthCheck) Name

func (k *KafkaHealthCheck) Name() string

Name indicates the probe name

type OwlHooks

type OwlHooks interface {
	CanSeeTopic(ctx context.Context, topicName string) (bool, *rest.Error)
	CanViewTopicPartitions(ctx context.Context, topicName string) (bool, *rest.Error)
	CanViewTopicConfig(ctx context.Context, topicName string) (bool, *rest.Error)
	CanViewTopicMessages(ctx context.Context, topicName string) (bool, *rest.Error)
	CanViewTopicConsumers(ctx context.Context, topicName string) (bool, *rest.Error)
}

OwlHooks include all functions which allow you to modify

type RouteHooks

type RouteHooks interface {
	// ConfigAPIRouter allows you to modify the router responsible for all /api routes
	ConfigAPIRouter(router chi.Router)

	// ConfigRouter allows you to modify the router responsible for all non /api and non /admin routes.
	// By default we serve the frontend on these routes.
	ConfigRouter(router chi.Router)
}

RouteHooks allow you to modify the Router

Package Files

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier