Documentation ¶
Index ¶
- Variables
- type ErrTeamStillUsed
- type Group
- type GroupService
- type GroupStorage
- type MockGroupService
- type MockTeamService
- func (m *MockTeamService) Create(ctx context.Context, teamName string, tags []string, user *User) error
- func (m *MockTeamService) FindByName(ctx context.Context, teamName string) (*Team, error)
- func (m *MockTeamService) FindByNames(ctx context.Context, teamNames []string) ([]Team, error)
- func (m *MockTeamService) List(ctx context.Context) ([]Team, error)
- func (m *MockTeamService) Remove(ctx context.Context, teamName string) error
- func (m *MockTeamService) Update(ctx context.Context, teamName string, tags []string) error
- type MockTeamStorage
- func (m *MockTeamStorage) Delete(ctx context.Context, t Team) error
- func (m *MockTeamStorage) FindAll(ctx context.Context) ([]Team, error)
- func (m *MockTeamStorage) FindByName(ctx context.Context, name string) (*Team, error)
- func (m *MockTeamStorage) FindByNames(ctx context.Context, names []string) ([]Team, error)
- func (m *MockTeamStorage) Insert(ctx context.Context, t Team) error
- func (m *MockTeamStorage) Update(ctx context.Context, t Team) error
- type NamedToken
- type RoleInstance
- type SchemeData
- type SchemeInfo
- type Team
- type TeamService
- type TeamStorage
- type TeamToken
- type TeamTokenCreateArgs
- type TeamTokenService
- type TeamTokenStorage
- type TeamTokenUpdateArgs
- type Token
- type User
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidTeamName = &tsuruErrors.ValidationError{ Message: "Invalid team name, team names should start with a letter and" + "contain only lower case letters, numbers, dashes and underscore", } ErrTeamAlreadyExists = errors.New("team already exists") ErrTeamNotFound = errors.New("team not found") )
Functions ¶
This section is empty.
Types ¶
type ErrTeamStillUsed ¶
func (*ErrTeamStillUsed) Error ¶
func (e *ErrTeamStillUsed) Error() string
type Group ¶
type Group struct { Name string `json:"name"` Roles []RoleInstance `json:"roles,omitempty"` }
type GroupService ¶
type GroupStorage ¶
type GroupStorage interface { GroupService }
type MockGroupService ¶
type MockGroupService struct { OnAddRole func(name, roleName, contextValue string) error OnRemoveRole func(name, roleName, contextValue string) error OnList func(filter []string) ([]Group, error) }
func (*MockGroupService) AddRole ¶
func (m *MockGroupService) AddRole(name string, roleName, contextValue string) error
func (*MockGroupService) RemoveRole ¶
func (m *MockGroupService) RemoveRole(name, roleName, contextValue string) error
type MockTeamService ¶
type MockTeamService struct { OnCreate func(string, []string, *User) error OnUpdate func(string, []string) error OnList func() ([]Team, error) OnFindByName func(string) (*Team, error) OnFindByNames func([]string) ([]Team, error) OnRemove func(string) error }
func (*MockTeamService) FindByName ¶
func (*MockTeamService) FindByNames ¶
type MockTeamStorage ¶
type MockTeamStorage struct { OnInsert func(Team) error OnUpdate func(Team) error OnFindAll func() ([]Team, error) OnFindByName func(string) (*Team, error) OnFindByNames func([]string) ([]Team, error) OnDelete func(Team) error }
MockTeamStorage implements TeamStorage interface
func (*MockTeamStorage) Delete ¶
func (m *MockTeamStorage) Delete(ctx context.Context, t Team) error
func (*MockTeamStorage) FindAll ¶
func (m *MockTeamStorage) FindAll(ctx context.Context) ([]Team, error)
func (*MockTeamStorage) FindByName ¶
func (*MockTeamStorage) FindByNames ¶
type NamedToken ¶
type NamedToken interface {
GetTokenName() string
}
type RoleInstance ¶
type SchemeData ¶
type SchemeData struct { // OIDC fields ClientID string `json:"clientID,omitempty"` Scopes []string `json:"scopes,omitempty"` AuthURL string `json:"authURL,omitempty"` TokenURL string `json:"tokenURL,omitempty"` Port string `json:"port,omitempty"` // OAuth fields AuthorizeURL string `json:"authorizeUrl,omitempty"` }
type SchemeInfo ¶
type SchemeInfo struct { Name string `json:"name"` Default bool `json:"default,omitempty"` Data SchemeData `json:"data"` }
type Team ¶
type Team struct { Name string `json:"name"` CreatingUser string `json:"creatingUser"` Tags []string `json:"tags"` Quota quota.Quota `json:"quota"` }
Team represents a real world team, a team has one creating user and a name.
type TeamService ¶
type TeamService interface { Create(context.Context, string, []string, *User) error Update(context.Context, string, []string) error List(context.Context) ([]Team, error) FindByName(context.Context, string) (*Team, error) FindByNames(context.Context, []string) ([]Team, error) Remove(context.Context, string) error }
type TeamStorage ¶
type TeamToken ¶
type TeamToken struct { Token string `json:"token"` TokenID string `json:"token_id"` Description string `json:"description"` CreatedAt time.Time `json:"created_at"` ExpiresAt time.Time `json:"expires_at"` LastAccess time.Time `json:"last_access"` CreatorEmail string `json:"creator_email"` Team string `json:"team"` Roles []RoleInstance `json:"roles,omitempty"` }
type TeamTokenCreateArgs ¶
type TeamTokenService ¶
type TeamTokenService interface { Create(ctx context.Context, args TeamTokenCreateArgs, token Token) (TeamToken, error) Info(ctx context.Context, tokenID string, token Token) (TeamToken, error) Update(ctx context.Context, args TeamTokenUpdateArgs, token Token) (TeamToken, error) Delete(ctx context.Context, tokenID string) error Authenticate(ctx context.Context, header string) (Token, error) FindByTokenID(ctx context.Context, tokenID string) (TeamToken, error) FindByUserToken(ctx context.Context, t Token) ([]TeamToken, error) AddRole(ctx context.Context, tokenID string, roleName, contextValue string) error RemoveRole(ctx context.Context, tokenID string, roleName, contextValue string) error }
type TeamTokenStorage ¶
type TeamTokenStorage interface { Insert(context.Context, TeamToken) error FindByTokenID(ctx context.Context, tokenID string) (*TeamToken, error) FindByToken(ctx context.Context, token string) (*TeamToken, error) FindByTeams(ctx context.Context, teams []string) ([]TeamToken, error) UpdateLastAccess(ctx context.Context, token string) error Update(context.Context, TeamToken) error Delete(ctx context.Context, tokenID string) error }
type TeamTokenUpdateArgs ¶
type Token ¶
type Token interface { GetValue() string GetUserName() string User() (*User, error) Engine() string Permissions() ([]permission.Permission, error) }
type User ¶
type User struct { Quota quota.Quota Email string Password string APIKey string Roles []RoleInstance Groups []string // FromToken denotes whether the user was generated from team token. // In other words, it does not exist in the storage. FromToken bool Disabled bool APIKeyLastAccess time.Time APIKeyUsageCounter int64 }
Click to show internal directories.
Click to hide internal directories.