memory

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Reset added in v0.8.2

func Reset()

Types

type InMemoryDataAccess

type InMemoryDataAccess struct {
	// contains filtered or unexported fields
}

InMemoryDataAccess is an entirely in-memory representation of a data access layer. Great for testing and development. Terrible for production.

func NewInMemoryDataAccess

func NewInMemoryDataAccess() *InMemoryDataAccess

NewInMemoryDataAccess returns a new InMemoryDataAccess instance.

func (*InMemoryDataAccess) BundleCreate

func (da *InMemoryDataAccess) BundleCreate(ctx context.Context, bundle data.Bundle) error

BundleCreate TBD

func (*InMemoryDataAccess) BundleDelete

func (da *InMemoryDataAccess) BundleDelete(ctx context.Context, name, version string) error

BundleDelete TBD

func (*InMemoryDataAccess) BundleDisable

func (da *InMemoryDataAccess) BundleDisable(ctx context.Context, name, version string) error

BundleDisable TBD

func (*InMemoryDataAccess) BundleEnable

func (da *InMemoryDataAccess) BundleEnable(ctx context.Context, name, version string) error

BundleEnable TBD

func (*InMemoryDataAccess) BundleEnabledVersion

func (da *InMemoryDataAccess) BundleEnabledVersion(ctx context.Context, name string) (string, error)

BundleEnabledVersion TBD

func (*InMemoryDataAccess) BundleExists

func (da *InMemoryDataAccess) BundleExists(ctx context.Context, name, version string) (bool, error)

BundleExists TBD

func (*InMemoryDataAccess) BundleGet

func (da *InMemoryDataAccess) BundleGet(ctx context.Context, name, version string) (data.Bundle, error)

BundleGet TBD

func (*InMemoryDataAccess) BundleList

func (da *InMemoryDataAccess) BundleList(ctx context.Context) ([]data.Bundle, error)

BundleList TBD

func (*InMemoryDataAccess) BundleUpdate

func (da *InMemoryDataAccess) BundleUpdate(ctx context.Context, bundle data.Bundle) error

BundleUpdate TBD

func (*InMemoryDataAccess) BundleVersionList

func (da *InMemoryDataAccess) BundleVersionList(ctx context.Context, name string) ([]data.Bundle, error)

BundleListVersions TBD

func (*InMemoryDataAccess) FindCommandEntry

func (da *InMemoryDataAccess) FindCommandEntry(ctx context.Context, bundleName, commandName string) ([]data.CommandEntry, error)

FindCommandEntry is used to find the enabled commands with the provided bundle and command names. If either is empty, it is treated as a wildcard. Importantly, this must only return ENABLED commands!

func (*InMemoryDataAccess) GroupCreate

func (da *InMemoryDataAccess) GroupCreate(ctx context.Context, group rest.Group) error

GroupCreate creates a new user group.

func (*InMemoryDataAccess) GroupDelete

func (da *InMemoryDataAccess) GroupDelete(ctx context.Context, groupname string) error

GroupDelete delete a group.

func (*InMemoryDataAccess) GroupExists

func (da *InMemoryDataAccess) GroupExists(ctx context.Context, groupname string) (bool, error)

GroupExists is used to determine whether a group exists in the data store.

func (*InMemoryDataAccess) GroupGet

func (da *InMemoryDataAccess) GroupGet(ctx context.Context, groupname string) (rest.Group, error)

GroupGet gets a specific group.

func (*InMemoryDataAccess) GroupList

func (da *InMemoryDataAccess) GroupList(ctx context.Context) ([]rest.Group, error)

GroupList returns a list of all known groups in the datastore. Passwords are not included. Nice try.

func (*InMemoryDataAccess) GroupPermissionList

func (da *InMemoryDataAccess) GroupPermissionList(ctx context.Context, groupname string) (rest.RolePermissionList, error)

func (*InMemoryDataAccess) GroupRoleAdd

func (da *InMemoryDataAccess) GroupRoleAdd(ctx context.Context, groupname, rolename string) error

GroupRoleAdd grants one or more roles to a group.

func (*InMemoryDataAccess) GroupRoleDelete

func (da *InMemoryDataAccess) GroupRoleDelete(ctx context.Context, groupname, rolename string) error

GroupRoleDelete revokes one or more roles from a group.

func (*InMemoryDataAccess) GroupRoleList

func (da *InMemoryDataAccess) GroupRoleList(ctx context.Context, groupname string) ([]rest.Role, error)

func (*InMemoryDataAccess) GroupUpdate

func (da *InMemoryDataAccess) GroupUpdate(ctx context.Context, group rest.Group) error

GroupUpdate is used to update an existing group. An error is returned if the groupname is empty or if the group doesn't exist. TODO Should we let this create groups that don't exist?

func (*InMemoryDataAccess) GroupUserAdd

func (da *InMemoryDataAccess) GroupUserAdd(ctx context.Context, groupname string, username string) error

GroupUserAdd adds a user to a group

func (*InMemoryDataAccess) GroupUserDelete

func (da *InMemoryDataAccess) GroupUserDelete(ctx context.Context, groupname string, username string) error

GroupUserDelete removes one or more users from a group.

func (*InMemoryDataAccess) GroupUserList

func (da *InMemoryDataAccess) GroupUserList(ctx context.Context, groupname string) ([]rest.User, error)

func (*InMemoryDataAccess) Initialize

func (da *InMemoryDataAccess) Initialize(ctx context.Context) error

Initialize initializes an InMemoryDataAccess instance.

func (*InMemoryDataAccess) RequestBegin

func (da *InMemoryDataAccess) RequestBegin(ctx context.Context, req *data.CommandRequest) error

Will not implement

func (*InMemoryDataAccess) RequestClose

func (da *InMemoryDataAccess) RequestClose(ctx context.Context, envelope data.CommandResponseEnvelope) error

Will not implement

func (*InMemoryDataAccess) RequestError

func (da *InMemoryDataAccess) RequestError(ctx context.Context, result data.CommandRequest, err error) error

Will not implement

func (*InMemoryDataAccess) RequestUpdate

func (da *InMemoryDataAccess) RequestUpdate(ctx context.Context, result data.CommandRequest) error

Will not implement

func (*InMemoryDataAccess) RoleCreate

func (da *InMemoryDataAccess) RoleCreate(ctx context.Context, rolename string) error

RoleCreate creates a new role.

func (*InMemoryDataAccess) RoleDelete

func (da *InMemoryDataAccess) RoleDelete(ctx context.Context, name string) error

RoleDelete

func (*InMemoryDataAccess) RoleExists

func (da *InMemoryDataAccess) RoleExists(ctx context.Context, name string) (bool, error)

RoleExists is used to determine whether a group exists in the data store.

func (*InMemoryDataAccess) RoleGet

func (da *InMemoryDataAccess) RoleGet(ctx context.Context, rolename string) (rest.Role, error)

RoleGet gets a specific group.

func (*InMemoryDataAccess) RoleGroupAdd

func (da *InMemoryDataAccess) RoleGroupAdd(ctx context.Context, rolename, groupname string) error

func (*InMemoryDataAccess) RoleGroupDelete

func (da *InMemoryDataAccess) RoleGroupDelete(ctx context.Context, rolename, groupname string) error

func (*InMemoryDataAccess) RoleGroupExists

func (da *InMemoryDataAccess) RoleGroupExists(ctx context.Context, rolename, groupname string) (bool, error)

func (*InMemoryDataAccess) RoleGroupList

func (da *InMemoryDataAccess) RoleGroupList(ctx context.Context, rolename string) ([]rest.Group, error)

func (*InMemoryDataAccess) RoleList

func (da *InMemoryDataAccess) RoleList(ctx context.Context) ([]rest.Role, error)

RoleList

func (*InMemoryDataAccess) RolePermissionAdd

func (da *InMemoryDataAccess) RolePermissionAdd(ctx context.Context, rolename, bundlename, permission string) error

func (*InMemoryDataAccess) RolePermissionDelete

func (da *InMemoryDataAccess) RolePermissionDelete(ctx context.Context, rolename, bundlename, permission string) error

func (*InMemoryDataAccess) RolePermissionExists

func (da *InMemoryDataAccess) RolePermissionExists(ctx context.Context, rolename, bundlename, permission string) (bool, error)

RolePermissionExists returns true if the given role has been granted the specified permission. It returns an error if rolename is empty or if no such role exists.

func (*InMemoryDataAccess) RolePermissionList

func (da *InMemoryDataAccess) RolePermissionList(ctx context.Context, rolename string) (rest.RolePermissionList, error)

RolePermissionList returns returns an alphabetically-sorted list of fully-qualified (i.e., "bundle:permission") permissions granted to the role.

func (*InMemoryDataAccess) TokenEvaluate

func (da *InMemoryDataAccess) TokenEvaluate(ctx context.Context, tokenString string) bool

TokenEvaluate will test a token for validity. It returns true if the token exists and is still within its valid period; false otherwise.

func (*InMemoryDataAccess) TokenGenerate

func (da *InMemoryDataAccess) TokenGenerate(ctx context.Context, username string, duration time.Duration) (rest.Token, error)

TokenGenerate generates a new token for the given user with a specified expiration duration. Any existing token for this user will be automatically invalidated. If the user doesn't exist an error is returned.

func (*InMemoryDataAccess) TokenInvalidate

func (da *InMemoryDataAccess) TokenInvalidate(ctx context.Context, tokenString string) error

TokenInvalidate immediately invalidates the specified token. An error is returned if the token doesn't exist.

func (*InMemoryDataAccess) TokenRetrieveByToken

func (da *InMemoryDataAccess) TokenRetrieveByToken(ctx context.Context, tokenString string) (rest.Token, error)

TokenRetrieveByToken retrieves the token by its value. An error is returned if no such token exists.

func (*InMemoryDataAccess) TokenRetrieveByUser

func (da *InMemoryDataAccess) TokenRetrieveByUser(ctx context.Context, username string) (rest.Token, error)

TokenRetrieveByUser retrieves the token associated with a username. An error is returned if no such token (or user) exists.

func (*InMemoryDataAccess) UserAuthenticate

func (da *InMemoryDataAccess) UserAuthenticate(ctx context.Context, username string, password string) (bool, error)

UserAuthenticate authenticates a username/password combination.

func (*InMemoryDataAccess) UserCreate

func (da *InMemoryDataAccess) UserCreate(ctx context.Context, user rest.User) error

UserCreate is used to create a new Gort user in the data store. An error is returned if the username is empty or if a user already exists.

func (*InMemoryDataAccess) UserDelete

func (da *InMemoryDataAccess) UserDelete(ctx context.Context, username string) error

UserDelete deletes an existing user from the data store. An error is returned if the username parameter is empty of if the user doesn't exist.

func (*InMemoryDataAccess) UserExists

func (da *InMemoryDataAccess) UserExists(ctx context.Context, username string) (bool, error)

UserExists is used to determine whether a Gort user with the given username exists in the data store.

func (*InMemoryDataAccess) UserGet

func (da *InMemoryDataAccess) UserGet(ctx context.Context, username string) (rest.User, error)

UserGet returns a user from the data store. An error is returned if the username parameter is empty or if the user doesn't exist.

func (*InMemoryDataAccess) UserGetByEmail

func (da *InMemoryDataAccess) UserGetByEmail(ctx context.Context, email string) (rest.User, error)

UserGetByEmail returns a user from the data store. An error is returned if the email parameter is empty or if the user doesn't exist.

func (*InMemoryDataAccess) UserGetByID added in v0.8.4

func (da *InMemoryDataAccess) UserGetByID(ctx context.Context, adapter, id string) (rest.User, error)

UserGetByID returns a user from the data store. An error is returned if either parameter is empty or if the user doesn't exist.

func (*InMemoryDataAccess) UserGroupAdd

func (da *InMemoryDataAccess) UserGroupAdd(ctx context.Context, username string, groupname string) error

UserGroupAdd comments TBD

func (*InMemoryDataAccess) UserGroupDelete

func (da *InMemoryDataAccess) UserGroupDelete(ctx context.Context, username string, groupname string) error

UserGroupDelete comments TBD

func (*InMemoryDataAccess) UserGroupList

func (da *InMemoryDataAccess) UserGroupList(ctx context.Context, username string) ([]rest.Group, error)

UserGroupList returns a slice of Group values representing the specified user's group memberships. The groups' Users slice is never populated, and is always nil.

func (*InMemoryDataAccess) UserList

func (da *InMemoryDataAccess) UserList(ctx context.Context) ([]rest.User, error)

UserList returns a list of all known users in the datastore. Passwords are not included. Nice try.

func (*InMemoryDataAccess) UserPermissionList

func (da *InMemoryDataAccess) UserPermissionList(ctx context.Context, username string) (rest.RolePermissionList, error)

UserPermissionList returns an alphabetically-sorted list of permissions available to the specified user.

func (*InMemoryDataAccess) UserRoleList

func (da *InMemoryDataAccess) UserRoleList(ctx context.Context, username string) ([]rest.Role, error)

UserRoleList returns a slice of Role values representing the specified user's indirect roles (indirect because users are members of groups, and groups have roles).

func (*InMemoryDataAccess) UserUpdate

func (da *InMemoryDataAccess) UserUpdate(ctx context.Context, user rest.User) error

UserUpdate is used to update an existing user. An error is returned if the username is empty or if the user doesn't exist. TODO Should we let this create users that don't exist?

Jump to

Keyboard shortcuts

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