Documentation ¶
Index ¶
- Variables
- type Token
- type TokenManager
- func (tm *TokenManager) CreateToken(token, role string, topics, groups []string) error
- func (tm *TokenManager) DeleteToken(token string) error
- func (tm *TokenManager) GetToken(token string, sync bool) *Token
- func (tm *TokenManager) IsAllowConsume(token, group string) bool
- func (tm *TokenManager) IsAllowProduce(token, topic string) bool
- func (tm *TokenManager) IsTokenExists(token string) bool
- func (tm *TokenManager) ListToken(sync bool) []string
- func (tm *TokenManager) UpdateToken(token string, isAdd bool, role string, topics, groups []string) error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrTokenExists = errors.New("the token has already exists") ErrTokenNotFound = errors.New("the token was not found") )
Functions ¶
This section is empty.
Types ¶
type Token ¶
type Token struct {
// contains filtered or unexported fields
}
type TokenManager ¶
type TokenManager struct {
// contains filtered or unexported fields
}
func NewTokenManager ¶
func NewTokenManager(zkCli *zk_wrapper.Conn, logger *logrus.Logger) (*TokenManager, error)
NewTokenManager create the token manger and it would sync the tokens from zk
func (*TokenManager) CreateToken ¶
func (tm *TokenManager) CreateToken(token, role string, topics, groups []string) error
CreateTokenh create the new token
func (*TokenManager) DeleteToken ¶
func (tm *TokenManager) DeleteToken(token string) error
func (*TokenManager) GetToken ¶
func (tm *TokenManager) GetToken(token string, sync bool) *Token
GetToken return token in token manager
func (*TokenManager) IsAllowConsume ¶
func (tm *TokenManager) IsAllowConsume(token, group string) bool
IsAllowProduce check whether the token has the permission to consume message or not
func (*TokenManager) IsAllowProduce ¶
func (tm *TokenManager) IsAllowProduce(token, topic string) bool
IsAllowProduce check whether the token has the permission to send message or not
func (*TokenManager) IsTokenExists ¶
func (tm *TokenManager) IsTokenExists(token string) bool
IsTokenExists check the token was exists or not
func (*TokenManager) ListToken ¶
func (tm *TokenManager) ListToken(sync bool) []string
ListToken return token list in token manager
func (*TokenManager) UpdateToken ¶
func (tm *TokenManager) UpdateToken(token string, isAdd bool, role string, topics, groups []string) error
UpdateToken update the token role or topics/groups
Click to show internal directories.
Click to hide internal directories.