Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotFound is returned when a requested team wasn't found ErrNotFound = errors.New("not found") // ErrConflict is returned when a team there is a clash of team IDs ErrConflict = errors.New("conflict") // ErrCannotDelete is returned when a request attempts to delete a team that // is not allowed to be deleted such as the "admins" team. ErrCannotDelete = errors.New("cannot delete") // If this name changes, we need a migration to change the name, see 02_add-deletable-column.up.sql. AdminsTeamName = "admins" // NonDeletableTeams contains all the teams that are not allowed to be deleted. // If this name changes, we need a migration to add the new team, see 02_add-deletable-column.up.sql. NonDeletableTeams = []string{AdminsTeamName} )
Errors returned from the backend
Functions ¶
func IsTeamDeletable ¶
IsTeamDeletable returns whether or not an input team is deletable by name.
Types ¶
type Resetter ¶
Resetter is, if exposed, used for tests to reset the storage backend to a pristine state.
type Storage ¶
type Storage interface { DeleteTeam(context.Context, uuid.UUID) (Team, error) EditTeam(context.Context, Team) (Team, error) GetTeams(context.Context) ([]Team, error) GetTeam(context.Context, uuid.UUID) (Team, error) StoreTeam(ctx context.Context, name string, description string) (Team, error) StoreTeamWithProjects(ctx context.Context, name string, description string, projects []string) (Team, error) RemoveUsers(ctx context.Context, id uuid.UUID, users []string) (Team, error) GetTeamByName(ctx context.Context, teamName string) (Team, error) PurgeUserMembership(ctx context.Context, userID string) (teamsUpdated []uuid.UUID, err error) AddUsers(ctx context.Context, teamID uuid.UUID, users []string) (Team, error) GetTeamsForUser(ctx context.Context, userID string) ([]Team, error) GetUserIDsForTeam(ctx context.Context, teamID uuid.UUID) ([]string, error) // Added for V2. When deprecating V1, review functions above this comment // to see what is still needed and what can be removed. DeleteTeamByName(context.Context, string) (Team, error) EditTeamByName(context.Context, string, string, []string) (Team, error) UpgradeToV2(context.Context) error }
WARNING TODO (tc): The storage interface is still using V1 verbiage, so name is really the ID in V2 terms. We'll refactor at GA when V1 is removed.
Storage is the interface provided by our various storage backends.
Click to show internal directories.
Click to hide internal directories.