Documentation ¶
Index ¶
- Constants
- Variables
- func AddUser(role, user, pass string) error
- func Close() error
- func CreateRoleWithPermission(role string, perms []*Permission) (err error)
- func Get(serviceKey string, withPrefix bool) (err error, vals []string)
- func GetWithPrefix(serviceKey string) (err error, vals []string)
- func GrantUser(user, role string) error
- func NewEtcd(options *Options) error
- func Register(serviceKey string, val string, interval time.Duration, ttl time.Duration)
- func Set(key, val string) error
- func Unregister(serviceKey string)
- func Watcher(serviceKey string, callback EtcdWatchCallback)
- type AuthOptions
- type EtcdWatchCallback
- type Options
- type Permission
Constants ¶
View Source
const ( Expire = "EXPIRE" Put = "PUT" Del = "DELETE" )
Variables ¶
View Source
var (
EtcdNoAuthClientError = errors.New("etcd auth client is nil")
)
Functions ¶
func CreateRoleWithPermission ¶
func CreateRoleWithPermission(role string, perms []*Permission) (err error)
*
* * perms := []*Permission{ &Permission{Key:"/warden/", RangeEnd:"/warden/z", Type: clientv3.PermReadWrite}, &Permission{Key:"/web/", RangeEnd:"/web/z", Type: clientv3.PermReadWrite}, } if err := createRoleWithPermission("web", perms , authAPI); err != nil { log.Fatal(err) } *
func GetWithPrefix ¶
func Unregister ¶
func Unregister(serviceKey string)
Types ¶
type AuthOptions ¶
type EtcdWatchCallback ¶
type Options ¶
type Permission ¶
type Permission struct { Key string RangeEnd string Type authpb.Permission_Type }
Click to show internal directories.
Click to hide internal directories.