Documentation ¶
Index ¶
- type InMemoryDataAccess
- func (da *InMemoryDataAccess) BundleCreate(ctx context.Context, bundle data.Bundle) error
- func (da *InMemoryDataAccess) BundleDelete(ctx context.Context, name, version string) error
- func (da *InMemoryDataAccess) BundleDisable(ctx context.Context, name string) error
- func (da *InMemoryDataAccess) BundleEnable(ctx context.Context, name, version string) error
- func (da *InMemoryDataAccess) BundleEnabledVersion(ctx context.Context, name string) (string, error)
- func (da *InMemoryDataAccess) BundleExists(ctx context.Context, name, version string) (bool, error)
- func (da *InMemoryDataAccess) BundleGet(ctx context.Context, name, version string) (data.Bundle, error)
- func (da *InMemoryDataAccess) BundleList(ctx context.Context) ([]data.Bundle, error)
- func (da *InMemoryDataAccess) BundleListVersions(ctx context.Context, name string) ([]data.Bundle, error)
- func (da *InMemoryDataAccess) BundleUpdate(ctx context.Context, bundle data.Bundle) error
- func (da *InMemoryDataAccess) FindCommandEntry(ctx context.Context, bundleName, commandName string) ([]data.CommandEntry, error)
- func (da *InMemoryDataAccess) GroupAddUser(ctx context.Context, groupname string, username string) error
- func (da *InMemoryDataAccess) GroupCreate(ctx context.Context, group rest.Group) error
- func (da *InMemoryDataAccess) GroupDelete(ctx context.Context, groupname string) error
- func (da *InMemoryDataAccess) GroupExists(ctx context.Context, groupname string) (bool, error)
- func (da *InMemoryDataAccess) GroupGet(ctx context.Context, groupname string) (rest.Group, error)
- func (da *InMemoryDataAccess) GroupList(ctx context.Context) ([]rest.Group, error)
- func (da *InMemoryDataAccess) GroupListRoles(ctx context.Context, groupname string) ([]rest.Role, error)
- func (da *InMemoryDataAccess) GroupListUsers(ctx context.Context, groupname string) ([]rest.User, error)
- func (da *InMemoryDataAccess) GroupRemoveUser(ctx context.Context, groupname string, username string) error
- func (da *InMemoryDataAccess) GroupRoleAdd(ctx context.Context, groupname, rolename string) error
- func (da *InMemoryDataAccess) GroupRoleDelete(ctx context.Context, groupname, rolename string) error
- func (da *InMemoryDataAccess) GroupUpdate(ctx context.Context, group rest.Group) error
- func (da *InMemoryDataAccess) GroupUserAdd(ctx context.Context, group string, user string) error
- func (da *InMemoryDataAccess) GroupUserDelete(ctx context.Context, group string, user string) error
- func (da *InMemoryDataAccess) Initialize(ctx context.Context) error
- func (da *InMemoryDataAccess) RequestBegin(ctx context.Context, req *data.CommandRequest) error
- func (da *InMemoryDataAccess) RequestClose(ctx context.Context, result data.CommandResponse) error
- func (da *InMemoryDataAccess) RequestError(ctx context.Context, result data.CommandRequest, err error) error
- func (da *InMemoryDataAccess) RequestUpdate(ctx context.Context, result data.CommandRequest) error
- func (da *InMemoryDataAccess) RoleCreate(ctx context.Context, name string) error
- func (da *InMemoryDataAccess) RoleDelete(ctx context.Context, name string) error
- func (da *InMemoryDataAccess) RoleExists(ctx context.Context, name string) (bool, error)
- func (da *InMemoryDataAccess) RoleGet(ctx context.Context, name string) (rest.Role, error)
- func (da *InMemoryDataAccess) RoleHasPermission(ctx context.Context, rolename, bundlename, permission string) (bool, error)
- func (da *InMemoryDataAccess) RolePermissionAdd(ctx context.Context, rolename, bundlename, permission string) error
- func (da *InMemoryDataAccess) RolePermissionDelete(ctx context.Context, rolename, bundlename, permission string) error
- func (da *InMemoryDataAccess) RolePermissionList(ctx context.Context, rolename string) ([]rest.RolePermission, error)
- func (da *InMemoryDataAccess) TokenEvaluate(ctx context.Context, tokenString string) bool
- func (da *InMemoryDataAccess) TokenGenerate(ctx context.Context, username string, duration time.Duration) (rest.Token, error)
- func (da *InMemoryDataAccess) TokenInvalidate(ctx context.Context, tokenString string) error
- func (da *InMemoryDataAccess) TokenRetrieveByToken(ctx context.Context, tokenString string) (rest.Token, error)
- func (da *InMemoryDataAccess) TokenRetrieveByUser(ctx context.Context, username string) (rest.Token, error)
- func (da *InMemoryDataAccess) UserAuthenticate(ctx context.Context, username string, password string) (bool, error)
- func (da *InMemoryDataAccess) UserCreate(ctx context.Context, user rest.User) error
- func (da *InMemoryDataAccess) UserDelete(ctx context.Context, username string) error
- func (da *InMemoryDataAccess) UserExists(ctx context.Context, username string) (bool, error)
- func (da *InMemoryDataAccess) UserGet(ctx context.Context, username string) (rest.User, error)
- func (da *InMemoryDataAccess) UserGetByEmail(ctx context.Context, email string) (rest.User, error)
- func (da *InMemoryDataAccess) UserGroupAdd(ctx context.Context, username string, groupname string) error
- func (da *InMemoryDataAccess) UserGroupDelete(ctx context.Context, username string, groupname string) error
- func (da *InMemoryDataAccess) UserGroupList(ctx context.Context, username string) ([]rest.Group, error)
- func (da *InMemoryDataAccess) UserList(ctx context.Context) ([]rest.User, error)
- func (da *InMemoryDataAccess) UserPermissions(ctx context.Context, username string) ([]string, error)
- func (da *InMemoryDataAccess) UserUpdate(ctx context.Context, user rest.User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
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 ¶
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 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 ¶
BundleExists TBD
func (*InMemoryDataAccess) BundleGet ¶
func (da *InMemoryDataAccess) BundleGet(ctx context.Context, name, version string) (data.Bundle, error)
BundleGet TBD
func (*InMemoryDataAccess) BundleList ¶
BundleList TBD
func (*InMemoryDataAccess) BundleListVersions ¶
func (da *InMemoryDataAccess) BundleListVersions(ctx context.Context, name string) ([]data.Bundle, error)
BundleListVersions TBD
func (*InMemoryDataAccess) BundleUpdate ¶
BundleUpdate 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) GroupAddUser ¶
func (da *InMemoryDataAccess) GroupAddUser(ctx context.Context, groupname string, username string) error
GroupAddUser adds a user to a group
func (*InMemoryDataAccess) GroupCreate ¶
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 ¶
GroupExists is used to determine whether a group exists in the data store.
func (*InMemoryDataAccess) GroupList ¶
GroupList returns a list of all known groups in the datastore. Passwords are not included. Nice try.
func (*InMemoryDataAccess) GroupListRoles ¶
func (*InMemoryDataAccess) GroupListUsers ¶
func (*InMemoryDataAccess) GroupRemoveUser ¶
func (da *InMemoryDataAccess) GroupRemoveUser(ctx context.Context, groupname string, username string) error
GroupRemoveUser removes one or more users from a group.
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) GroupUpdate ¶
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 ¶
GroupUserAdd comments TBD
func (*InMemoryDataAccess) GroupUserDelete ¶
GroupUserDelete comments TBD
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, result data.CommandResponse) 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, name string) error
RoleCreate creates a new role.
func (*InMemoryDataAccess) RoleDelete ¶
func (da *InMemoryDataAccess) RoleDelete(ctx context.Context, name string) error
RoleDelete
func (*InMemoryDataAccess) RoleExists ¶
RoleExists is used to determine whether a group exists in the data store.
func (*InMemoryDataAccess) RoleHasPermission ¶
func (da *InMemoryDataAccess) RoleHasPermission(ctx context.Context, rolename, bundlename, permission string) (bool, error)
RoleHasPermission 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) 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) RolePermissionList ¶
func (da *InMemoryDataAccess) RolePermissionList(ctx context.Context, rolename string) ([]rest.RolePermission, 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 ¶
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 ¶
UserExists is used to determine whether a Gort user with the given username exists in the data store.
func (*InMemoryDataAccess) UserGet ¶
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 ¶
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) 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 ¶
UserList returns a list of all known users in the datastore. Passwords are not included. Nice try.
func (*InMemoryDataAccess) UserPermissions ¶
func (da *InMemoryDataAccess) UserPermissions(ctx context.Context, username string) ([]string, error)
UserPermissions returns an alphabetically-sorted list of fully-qualified (i.e., "bundle:permission") permissions available to the specified user.
func (*InMemoryDataAccess) UserUpdate ¶
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?