zookeeper

package
v0.0.0-...-6603b5a Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AdminPermissions = Permissions{
	Cluster: AllowAll,
	Topic:   AllowAll,
	Group:   AllowAll,
}
View Source
var AllowAll = []Permission{{"All", "Allow", "LITERAL", "*"}}
View Source
var (
	PathDoesNotExistsErr = errors.New("Zookeeper: Path does not exists")
)

Functions

func Brokers

func Brokers() ([]int, error)

func Connect

func Connect(urls []string) error

func CreateAcl

func CreateAcl(req AclRequest) error

func CreateUser

func CreateUser(name, password string) error

func DeleteAcl

func DeleteAcl(req AclRequest) error

func DeleteUser

func DeleteUser(name string) error

func Exists

func Exists(path string) bool

func Get

func Get(path string, v interface{}) error

func Metrics

func Metrics(uri string) map[string]int

func Stats

func Stats(uri string) map[string]interface{}

func Stop

func Stop()

func TopicConfig

func TopicConfig(name string) ([]byte, error)

func Topics

func Topics(p Permissions) ([]string, error)

func User

func User(name string) ([]byte, error)

func Users

func Users(username string, p Permissions) (users, error)

func ValidateScramLogin

func ValidateScramLogin(user, pass string) bool

func WatchBrokers

func WatchBrokers(ch chan []HostPort)

func WatchChildren

func WatchChildren(path string) ([]string, *zk.Stat, <-chan zk.Event, error)

func WatchTopics

func WatchTopics(ch chan []T)

Types

type ACLResource

type ACLResource struct {
	Name         string `json:"name"`
	ResourceType string `json:"resource_type"`
	PatternType  string `json:"pattern_type"`
}

type ACLRule

type ACLRule struct {
	Resource ACLResource `json:"resource"`
	Users    []UserACL   `json:"users"`
}

func Acl

func Acl(p Permissions, resourceType, name, patternType string) (ACLRule, error)

func (ACLRule) MarshalJSON

func (r ACLRule) MarshalJSON() ([]byte, error)

type ACLRules

type ACLRules []ACLRule

func Acls

func Acls(p Permissions) (ACLRules, error)

func ClusterAcls

func ClusterAcls(p Permissions) (ACLRules, error)

func GroupAcls

func GroupAcls(p Permissions) (ACLRules, error)

func TopicAcls

func TopicAcls(p Permissions) (ACLRules, error)

func (ACLRules) Get

func (me ACLRules) Get(i int) interface{}

func (ACLRules) Size

func (me ACLRules) Size() int

type AclPatternType

type AclPatternType int
const (
	LiteralPattern  AclPatternType = 0
	PrefixedPattern AclPatternType = 1
)

func AclPatternTypeFromString

func AclPatternTypeFromString(v string) (AclPatternType, error)

type AclRequest

type AclRequest struct {
	PatternType    AclPatternType
	ResourceType   AclResourceType
	Name           string
	Principal      string
	Permission     string
	PermissionType string
	Host           string
}

func (AclRequest) Data

func (me AclRequest) Data() map[string]string

func (AclRequest) Equal

func (me AclRequest) Equal(acl map[string]string) bool

func (AclRequest) Path

func (me AclRequest) Path() string

type AclResourceType

type AclResourceType int
const (
	ClusterResource AclResourceType = 0
	TopicResource   AclResourceType = 1
	GroupResource   AclResourceType = 2
)

func AclResourceFromString

func AclResourceFromString(v string) (AclResourceType, error)

func (AclResourceType) String

func (me AclResourceType) String() string

type AllFunc

type AllFunc func(Permissions) ([]string, error)

type B

type B struct {
	Version   int      `json:"-"`
	JmxPort   int      `json:"jmx_port"`
	Timestamp string   `json:"timestamp"`
	Endpoints []string `json:"endpoints"`
	Host      string   `json:"host"`
	Port      int      `json:"port"`
	Id        int      `json:"id"`
}

func Broker

func Broker(id int) (B, error)

type C

type C struct {
	Timestamp string `json:"timestamp"`
	BrokerId  int    `json:"brokerid"`
	Version   int    `json:"version"`
}

Controller struct from Zookeeper Path "/controller"

func Controller

func Controller() (C, error)

type HostPort

type HostPort struct {
	Id   int
	Host string
	Port int
}

type Permission

type Permission struct {
	Operation    string
	ResourceType string
	PatternType  string
	Resource     string
}

func (Permission) All

func (p Permission) All() bool

func (Permission) Allow

func (p Permission) Allow() bool

func (Permission) Alter

func (p Permission) Alter(resource string) bool

func (Permission) AlterConfigs

func (p Permission) AlterConfigs(resource string) bool

func (Permission) CheckResource

func (p Permission) CheckResource(resource string) bool

Check if rule matches resource on name

func (Permission) Create

func (p Permission) Create(resource string) bool

func (Permission) Delete

func (p Permission) Delete(resource string) bool

func (Permission) Deny

func (p Permission) Deny() bool

func (Permission) Describe

func (p Permission) Describe(resource string) bool

func (Permission) DescribeConfigs

func (p Permission) DescribeConfigs(resource string) bool

func (Permission) IdempotentWrite

func (p Permission) IdempotentWrite(resource string) bool

func (Permission) Read

func (p Permission) Read(resource string) bool

func (Permission) Write

func (p Permission) Write(resource string) bool

type PermissionFunc

type PermissionFunc func(string) bool

type Permissions

type Permissions struct {
	Cluster []Permission
	Topic   []Permission
	Group   []Permission
}

func PermissionsFor

func PermissionsFor(username string) (Permissions, error)

func (Permissions) AlterConfigsCluster

func (p Permissions) AlterConfigsCluster() bool

func (Permissions) CreateAcl

func (p Permissions) CreateAcl() bool

func (Permissions) CreateTopic

func (p Permissions) CreateTopic(resource string) bool

func (Permissions) CreateUser

func (p Permissions) CreateUser() bool

func (Permissions) DeleteAcl

func (p Permissions) DeleteAcl() bool

func (Permissions) DeleteTopic

func (p Permissions) DeleteTopic(resource string) bool

func (Permissions) DeleteUser

func (p Permissions) DeleteUser() bool

func (Permissions) DescribeAcls

func (p Permissions) DescribeAcls() bool

func (Permissions) DescribeConfigs

func (p Permissions) DescribeConfigs() bool

func (Permissions) DescribeGroup

func (p Permissions) DescribeGroup(resource string) bool

func (Permissions) DescribeTopic

func (p Permissions) DescribeTopic(resource string) bool

func (Permissions) ListAcls

func (p Permissions) ListAcls() bool

func (Permissions) ListBrokers

func (p Permissions) ListBrokers() bool

func (Permissions) ListGroups

func (p Permissions) ListGroups() bool

func (Permissions) ListUsers

func (p Permissions) ListUsers() bool

func (Permissions) ReadCluster

func (p Permissions) ReadCluster(resource string) bool

func (Permissions) ReadGroup

func (p Permissions) ReadGroup(resource string) bool

func (Permissions) ReadTopic

func (p Permissions) ReadTopic(resource string) bool

func (Permissions) UpdateTopic

func (p Permissions) UpdateTopic(resource string) bool

func (Permissions) WriteCluster

func (p Permissions) WriteCluster(resource string) bool

type T

type T struct {
	Name       string                 `json:"name,omitempty"`
	Config     map[string]interface{} `json:"config"`
	Partitions map[string][]int       `json:"partitions"`
}

func Topic

func Topic(name string) (T, error)

type UserACL

type UserACL struct {
	Principal      string `json:"principal"`
	PermissionType string `json:"permission_type"`
	Operation      string `json:"operation"`
	Host           string `json:"host"`
}

Jump to

Keyboard shortcuts

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