aiven

package module
v0.0.0-...-8a812a6 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2018 License: Apache-2.0 Imports: 11 Imported by: 0

README

aiven

GoDoc

golang client and console cli for aiven

Status: project has very limited functionality and is under heavy development

Installation
go get github.com/savaki/aiven/...
Console Usage

sample input

aiven kafka topics --email XXX --password XXX --project XXX --service XXX

sample output

[
  {
    "cleanup_policy": "compact",
    "partitions": 3,
    "replication": 3,
    "retention_hours": 72,
    "state": "ACTIVE",
    "topic_name": "sample"
  }
]
Usage
NAME:
   aiven - console interface to aiven

USAGE:
   aiven [global options] command [command options] [arguments...]

VERSION:
   SNAPSHOT

COMMANDS:
     kafka    kafka related commands
     help, h  Shows a list of commands or help for one command

GLOBAL OPTIONS:
   --help, -h     show help
   --version, -v  print the version

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client represents an authenticated gateway to aiven

func EnvAuth

func EnvAuth() (*Client, error)

EnvAuth constructs a new client from environment variables: AIVEN_EMAIL, AIVEN_PASSWORD, and AIVEN_OTP

func New

func New(email, password string) (*Client, error)

New returns a new aiven client with the specified email and password

func NewOTP

func NewOTP(email, password, otp string) (*Client, error)

NewOTP accepts credentials plus a one time password to return a new aiven client

func (*Client) Delete

func (c *Client) Delete(ctx context.Context, url string, in, out interface{}) error

Delete to specified url with authentication

func (*Client) Do

func (c *Client) Do(ctx context.Context, method, url string, in, out interface{}) error

Do provides a generic handle for request content from aiven

func (*Client) Get

func (c *Client) Get(ctx context.Context, url string, out interface{}) error

Get specified url with authentication

func (*Client) Kafka

func (c *Client) Kafka() *Kafka

func (*Client) Post

func (c *Client) Post(ctx context.Context, url string, in, out interface{}) error

Post to specified url with authentication

type Error

type Error struct {
	Message  string `json:"message"`
	MoreInfo string `json:"more_info"`
	Status   int    `json:"status"`
}

type Kafka

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

Kafka provides an api into aiven kafka

func (*Kafka) CreateTopic

func (k *Kafka) CreateTopic(ctx context.Context, in KafkaCreateTopicIn) error

func (*Kafka) DeleteTopic

func (k *Kafka) DeleteTopic(ctx context.Context, in KafkaDeleteTopicIn) error

func (*Kafka) ListTopics

func (k *Kafka) ListTopics(ctx context.Context, in KafkaListTopicsIn) ([]KafkaTopic, error)

ListTopics returns the list of all topics

func (*Kafka) TopicInfo

func (k *Kafka) TopicInfo(ctx context.Context, in KafkaTopicInfoIn) (KafkaTopicInfoOut, error)

KafkaTopicInfo returns topic metadata

See https://api.aiven.io/doc/#api-Service__Kafka-ServiceKafkaTopicGet

type KafkaConsumerGroupInfo

type KafkaConsumerGroupInfo struct {
	GroupName string `json:"group_name"`
	Offset    int64  `json:"offset"`
}

type KafkaCreateTopicIn

type KafkaCreateTopicIn struct {
	Project        string `json:"-"`
	Service        string `json:"-"`
	CleanupPolicy  string `json:"cleanup_policy"`
	Partitions     int    `json:"partitions"`
	Replication    int    `json:"replication"`
	RetentionHours int    `json:"retention_hours"`
	TopicName      string `json:"topic_name"`
}

type KafkaDeleteTopicIn

type KafkaDeleteTopicIn struct {
	Project   string
	Service   string
	TopicName string
}

type KafkaListTopicsIn

type KafkaListTopicsIn struct {
	Project string
	Service string
}

type KafkaPartitionInfo

type KafkaPartitionInfo struct {
	ConsumerGroups []KafkaConsumerGroupInfo `json:"consumer_groups"`
	EarliestOffset int64                    `json:"earliest_offset"`
	InSyncReplicas int                      `json:"isr"`
	LatestOffset   int64                    `json:"latest_offset"`
	Partition      int32                    `json:"partition"`
	Size           int64                    `json:"size"`
}

type KafkaTopic

type KafkaTopic struct {
	CleanupPolicy  string `json:"cleanup_policy"`
	Partitions     int    `json:"partitions"`
	Replication    int    `json:"replication"`
	RetentionHours int    `json:"retention_hours"`
	State          string `json:"state"`
	TopicName      string `json:"topic_name"`
}

KafkaTopic represents the Kafka topics

type KafkaTopicInfo

type KafkaTopicInfo struct {
	CleanupPolicy     string               `json:"cleanup_policy"`
	MinInsyncReplicas int                  `json:"min_insync_replicas"`
	Partitions        []KafkaPartitionInfo `json:"partitions"`
	Replication       int                  `json:"replication"`
	RetentionBytes    int64                `json:"retention_bytes"`
	RetentionHours    int                  `json:"retention_hours"`
	State             string               `json:"state"`
	TopicName         string               `json:"topic_name"`
}

type KafkaTopicInfoIn

type KafkaTopicInfoIn struct {
	Project   string
	Service   string
	TopicName string
}

type KafkaTopicInfoOut

type KafkaTopicInfoOut struct {
	Errors  []Error        `json:"errors"`
	Message string         `json:"message"`
	Topic   KafkaTopicInfo `json:"topic"`
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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