accesskey

package
v0.0.0-...-9fdd194 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2024 License: Apache-2.0, MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("not found")

Functions

func Delete

func Delete(key string) (err error)

func Disable

func Disable(key string) (err error)

func Enable

func Enable(key string) (err error)

func InitService

func InitService(providers providers.Providerser, options ...Option)

func Reset

func Reset(key string) (err error)

Types

type AccessKey

type AccessKey struct {
	Key       string    `json:"key"`
	Secret    string    `json:"secret"`
	Enable    bool      `json:"enable"`
	IsDeleted bool      `json:"is_deleted"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

func Generate

func Generate() (ack *AccessKey, err error)

func Get

func Get(key string) (record *AccessKey, err error)

func List

func List() (list []*AccessKey, err error)

type Option

type Option func(svc *service)

func WithLock

func WithLock(lock ctxmu.MultiCtxRWLocker) Option

func WithSecretLength

func WithSecretLength(length int) Option

func WithStoreKeyPrefix

func WithStoreKeyPrefix(prefix string) Option

func WithWaitLockTimout

func WithWaitLockTimout(timout time.Duration) Option

type Service

type Service interface {
	Generate() (record *AccessKey, err error)
	Enable(key string) (err error)
	Disable(key string) (err error)
	Reset(key string) (err error)
	Delete(key string) (err error)
	Get(key string) (ack *AccessKey, err error)
	List() (list []*AccessKey, err error)
}

func GetServiceInstance

func GetServiceInstance() Service

func NewService

func NewService(providers providers.Providerser, options ...Option) Service

Jump to

Keyboard shortcuts

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