Documentation ¶
Overview ¶
Package sparks provides the interfaces and manager for cloud providers
Index ¶
- Variables
- func Getenv(key string, prov ...Provider) string
- func GetenvParams(key string, prov ...Provider) types.Params
- func LookupEnv(key string, prov ...Provider) ([]byte, error)
- func RegisterProvider(name string, provider NewFunc)
- type Attributes
- type EncryptionProvider
- type NewFunc
- type ObjectProvider
- type ObjectStore
- type Params
- type Provider
- type Queue
- type QueueError
- type QueueMessage
- type QueueProvider
- type User
- type UserPool
- type UserProvider
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUserPoolNotFound is returned when a user pool does not exist ErrUserPoolNotFound = errors.New("user pool not found") // ErrUserNotFound is returned when a user does not exist ErrUserNotFound = errors.New("user not found") // ErrUserExists is returned when a user exists and there is a conflict ErrUserExists = errors.New("user with that username exists") // ErrUserDisabled is returned when a user is disabled ErrUserDisabled = errors.New("user disabled") // ErrPasswordExpired is returned when a user's password is expired ErrPasswordExpired = errors.New("password expired") // ErrObjectStoreNotFound is returned when an object store does not exist ErrObjectStoreNotFound = errors.New("store not found") // ErrObjectNotFound is returned when a object does not exist ErrObjectNotFound = errors.New("object not found") // ErrNotImplemented is returns when an interface method is not implemented or supported ErrNotImplemented = errors.New("not implemented") )
var ( // QueueErrorScanCancel can be returned by the scan handler to stop scanning QueueErrorScanCancel = QueueError(errors.New("scan canceled")) )
Functions ¶
func GetenvParams ¶
GetenvParams returns a parameters structure from the env var
func RegisterProvider ¶
RegisterProvider makes a database provider available by the provided name. If RegisterProvider is called twice with the same name or if provider is nil, it panics.
Types ¶
type EncryptionProvider ¶
type EncryptionProvider interface { // Decrypt descrypts the bytes Decrypt([]byte, Params) ([]byte, error) // Encrypt encrypts the bytes Encrypt([]byte, Params) ([]byte, error) }
EncryptionProvider is an interface that provides generic encryption mechanisms
type NewFunc ¶
NewFunc is a function registered with the cloud layer for creating a new instance of the provider.
type ObjectProvider ¶
type ObjectProvider interface { // OpenObjectStore store returns an object store with the given name and parameter OpenObjectStore(name string, params ...Params) (ObjectStore, error) }
ObjectProvider provides an object store
type ObjectStore ¶
type ObjectStore interface { // GetObject returns an io.Reader that allows for getting the object data GetObject(key string, params ...Params) (io.Reader, error) // GetObjectLink returns a secure http link to the object GetObjectLink(key string, timeout time.Duration, write ...bool) (*types.Link, error) // PutObject set the value PutObject(key string, r io.Reader, params ...Params) error // DeleteObject deletes and object DeleteObject(key string, params ...Params) error // StatObject returns properties of the object StatObject(key string) (types.StringMap, error) // ListObjects returns a list of object keys for the specified prefix ListObjects(prefix string) ([]os.FileInfo, error) // Name returns the object store name Name() string }
ObjectStore is an interface for kv object stores implemented by providers
func DefaultObjectStore ¶
func DefaultObjectStore() ObjectStore
DefaultObjectStore returns the default object store based on the env or panics
type Provider ¶
type Provider interface { // Name returns the provider name Name() string // Close is called to cleanup the provider Close() }
Provider is a base interface that must be implemented by cloud providers
func DefaultProvider ¶
func DefaultProvider() Provider
DefaultProvider returns the default based on the environment provider or panics
type Queue ¶
type Queue interface { // Publish publishes the message body with optioanl attributes and return the id Publish(body []byte, attributes ...Attributes) (string, error) // Scan performs a canceleable scan on the queue Scan(ctx context.Context, handler func(msg QueueMessage) error) error }
Queue defines a queue interface
type QueueMessage ¶
type QueueMessage interface { // MessageID returns a unique message identifier MessageID() string // Body returns the message body as []byte Body() []byte // Attributes returns the message attributes as a map Attributes() types.StringMap }
QueueMessage is a queue message interface
type QueueProvider ¶
QueueProvider defines a queue provider interface
type User ¶
type User interface { // Login returns the user login i.e. username Login() string // Attributes returns a map of user attributes Attributes() types.StringMap // Status returns the user status as a string Status() string // Enabled represents the user's status Enabled() bool // Groups returns a list of groups the user belongs to Groups() []string }
User is a common user interface
type UserPool ¶
type UserPool interface { // AuthenticateUser authenticates the user and returns an AuthToken AuthenticateUser(username, password string) (keychain.AuthToken, error) // CreateUser creates a new user CreateUser(username, password string, attributes map[string]string, options ...Params) (User, error) // ChangeUserPassword attempts to change the users password from current to the proposed ChangeUserPassword(username, current, proposed string) error // GetUser returns a user GetUser(username string) (User, error) // UpdateUser updates a users attributes UpdateUser(username string, attributes types.StringMap) error // DeleteUser deletes a user record DeleteUser(username string) error // DisableUser disables a user account DisableUser(username string) error }
UserPool is an interface implemented by providers that support users