Documentation
¶
Index ¶
- type APIKeysDependencies
- type APIKeysStore
- func (a *APIKeysStore) Create(ctx context.Context, key *models.APIKey) (*models.APIKey, error)
- func (a *APIKeysStore) Delete(ctx context.Context, id int, userID int) error
- func (a *APIKeysStore) Get(ctx context.Context, id int, userID int) (*models.APIKey, error)
- func (a *APIKeysStore) GetByAPIKeyID(ctx context.Context, id string) (*models.APIKey, error)
- func (a *APIKeysStore) List(ctx context.Context, userID int) ([]*models.APIKey, error)
- type CommandDependencies
- type CommandRunDependencies
- type CommandRunStore
- func (a *CommandRunStore) CreateRun(ctx context.Context, cmdRun *models.CommandRun) (*models.CommandRun, error)
- func (a *CommandRunStore) Get(ctx context.Context, id int) (*models.CommandRun, error)
- func (a *CommandRunStore) UpdateRunStatus(ctx context.Context, id int, status string, outcome string) error
- type CommandStore
- func (s *CommandStore) AcquireLock(ctx context.Context, name string) (io.Closer, error)
- func (s *CommandStore) AddCommandRelForPlatform(ctx context.Context, commandID int, platformID int) error
- func (s *CommandStore) AddCommandRelForRepository(ctx context.Context, commandID int, repositoryID int) error
- func (s *CommandStore) Create(ctx context.Context, c *models.Command) (*models.Command, error)
- func (s *CommandStore) CreateSetting(ctx context.Context, setting *models.CommandSetting) error
- func (s *CommandStore) Delete(ctx context.Context, id int) error
- func (s *CommandStore) DeleteSetting(ctx context.Context, id int) error
- func (s *CommandStore) Get(ctx context.Context, id int) (*models.Command, error)
- func (s *CommandStore) GetByName(ctx context.Context, name string) (*models.Command, error)
- func (s *CommandStore) GetSetting(ctx context.Context, id int) (*models.CommandSetting, error)
- func (s *CommandStore) IsPlatformSupported(ctx context.Context, commandID, platformID int) (bool, error)
- func (s *CommandStore) List(ctx context.Context, opts *models.ListOptions) ([]*models.Command, error)
- func (s *CommandStore) ListSettings(ctx context.Context, commandID int) ([]*models.CommandSetting, error)
- func (s *CommandStore) RemoveCommandRelForPlatform(ctx context.Context, commandID int, platformID int) error
- func (s *CommandStore) RemoveCommandRelForRepository(ctx context.Context, commandID int, repositoryID int) error
- func (s *CommandStore) Update(ctx context.Context, c *models.Command) (*models.Command, error)
- func (s *CommandStore) UpdateSetting(ctx context.Context, setting *models.CommandSetting) error
- type Config
- type Connector
- type Dependencies
- type EventsStore
- func (e *EventsStore) Create(ctx context.Context, event *models.Event) (*models.Event, error)
- func (e *EventsStore) GetEvent(ctx context.Context, id int) (*models.Event, error)
- func (e *EventsStore) ListEventsForRepository(ctx context.Context, repoID int, options *models.ListOptions) ([]*models.Event, error)
- type EventsStoreDependencies
- type RepositoryDependencies
- type RepositoryStore
- func (r *RepositoryStore) Create(ctx context.Context, c *models.Repository) (*models.Repository, error)
- func (r *RepositoryStore) Delete(ctx context.Context, id int) error
- func (r *RepositoryStore) Get(ctx context.Context, id int) (*models.Repository, error)
- func (r *RepositoryStore) GetByName(ctx context.Context, name string) (*models.Repository, error)
- func (r *RepositoryStore) List(ctx context.Context, opts *models.ListOptions) ([]*models.Repository, error)
- func (r *RepositoryStore) Update(ctx context.Context, c *models.Repository) (*models.Repository, error)
- type UserDependencies
- type UserStore
- func (s *UserStore) Create(ctx context.Context, user *models.User) (*models.User, error)
- func (s *UserStore) Delete(ctx context.Context, id int) error
- func (s *UserStore) Get(ctx context.Context, id int) (*models.User, error)
- func (s *UserStore) GetByEmail(ctx context.Context, email string) (*models.User, error)
- func (s *UserStore) List(ctx context.Context) ([]*models.User, error)
- func (s *UserStore) Update(ctx context.Context, user *models.User) (*models.User, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIKeysDependencies ¶
type APIKeysDependencies struct { Dependencies Connector *Connector }
APIKeysDependencies APIKeysStore specific dependencies.
type APIKeysStore ¶
type APIKeysStore struct {
APIKeysDependencies
}
APIKeysStore is a postgres based store for APIKeysStore.
func NewAPIKeysStore ¶
func NewAPIKeysStore(deps APIKeysDependencies) *APIKeysStore
NewAPIKeysStore creates a new APIKeysStore
func (*APIKeysStore) GetByAPIKeyID ¶
GetByAPIKeyID an apikey by it's generated id.
type CommandDependencies ¶
type CommandDependencies struct { Dependencies Connector *Connector Vault providers.Vault }
CommandDependencies command specific dependencies such as, the repository store. In order to not repeat some SQL, the command store will require the repository store and the repository store will require the command store.
type CommandRunDependencies ¶
type CommandRunDependencies struct { Dependencies Connector *Connector }
CommandRunDependencies CommandRunStore specific dependencies.
type CommandRunStore ¶
type CommandRunStore struct {
CommandRunDependencies
}
CommandRunStore is a postgres based store for CommandRunStore.
func NewCommandRunStore ¶
func NewCommandRunStore(deps CommandRunDependencies) *CommandRunStore
NewCommandRunStore creates a new CommandRunStore
func (*CommandRunStore) CreateRun ¶
func (a *CommandRunStore) CreateRun(ctx context.Context, cmdRun *models.CommandRun) (*models.CommandRun, error)
CreateRun creates a new Command run entry.
func (*CommandRunStore) Get ¶
func (a *CommandRunStore) Get(ctx context.Context, id int) (*models.CommandRun, error)
Get returns a single command run.
func (*CommandRunStore) UpdateRunStatus ¶
func (a *CommandRunStore) UpdateRunStatus(ctx context.Context, id int, status string, outcome string) error
UpdateRunStatus takes an id a status and an outcome and updates a run with it. This is a convenient method around update which breaks the normal update flow so it's easy to call by the providers.
type CommandStore ¶
type CommandStore struct {
CommandDependencies
}
CommandStore is a postgres based store for commands.
func NewCommandStore ¶
func NewCommandStore(deps CommandDependencies) (*CommandStore, error)
NewCommandStore creates a new CommandStore
func (*CommandStore) AcquireLock ¶
AcquireLock acquires a lock on a file so no other process deals with the same file.
func (*CommandStore) AddCommandRelForPlatform ¶
func (s *CommandStore) AddCommandRelForPlatform(ctx context.Context, commandID int, platformID int) error
AddCommandRelForPlatform adds a relationship for a platform on a command. This means that this command will support this platform. If the relationship doesn't exist this command will not run on that platform.
func (*CommandStore) AddCommandRelForRepository ¶
func (s *CommandStore) AddCommandRelForRepository(ctx context.Context, commandID int, repositoryID int) error
AddCommandRelForRepository add an assignment for a command to a repository.
func (*CommandStore) CreateSetting ¶
func (s *CommandStore) CreateSetting(ctx context.Context, setting *models.CommandSetting) error
CreateSetting will create a setting for a command.
func (*CommandStore) Delete ¶
func (s *CommandStore) Delete(ctx context.Context, id int) error
Delete will remove a command.
func (*CommandStore) DeleteSetting ¶
func (s *CommandStore) DeleteSetting(ctx context.Context, id int) error
DeleteSetting takes a
func (*CommandStore) GetSetting ¶
func (s *CommandStore) GetSetting(ctx context.Context, id int) (*models.CommandSetting, error)
GetSetting returns a single setting for an ID.
func (*CommandStore) IsPlatformSupported ¶
func (s *CommandStore) IsPlatformSupported(ctx context.Context, commandID, platformID int) (bool, error)
IsPlatformSupported returns if a command supports a platform or not.
func (*CommandStore) List ¶
func (s *CommandStore) List(ctx context.Context, opts *models.ListOptions) ([]*models.Command, error)
List gets all the command records.
func (*CommandStore) ListSettings ¶
func (s *CommandStore) ListSettings(ctx context.Context, commandID int) ([]*models.CommandSetting, error)
ListSettings lists all settings for a command.
func (*CommandStore) RemoveCommandRelForPlatform ¶
func (s *CommandStore) RemoveCommandRelForPlatform(ctx context.Context, commandID int, platformID int) error
RemoveCommandRelForPlatform removes the above relationship, disabling this command for that platform. Meaning this command will not be executed if that platform is detected.
func (*CommandStore) RemoveCommandRelForRepository ¶
func (s *CommandStore) RemoveCommandRelForRepository(ctx context.Context, commandID int, repositoryID int) error
RemoveCommandRelForRepository remove a relation to a repository for a command.
func (*CommandStore) UpdateSetting ¶
func (s *CommandStore) UpdateSetting(ctx context.Context, setting *models.CommandSetting) error
UpdateSetting updates the value of a setting. Transferring values is not supported. Aka.: If a value was in Vault it must remain in vault. If it was in db it must remain in db. Updating the key is also not supported. Update: Only the value can be modified.
type Connector ¶
type Connector struct { Config Dependencies }
Connector defines the connector's structure.
func NewDatabaseConnector ¶
func NewDatabaseConnector(cfg Config, deps Dependencies) *Connector
NewDatabaseConnector defines some common functionality between the database dependent providers.
type Dependencies ¶
type Dependencies struct { Logger zerolog.Logger Converter providers.EnvironmentConverter }
Dependencies defines the dependencies of this command store
type EventsStore ¶
type EventsStore struct {
EventsStoreDependencies
}
EventsStore is a postgres based store for eventStorer.
func NewEventsStorer ¶
func NewEventsStorer(deps EventsStoreDependencies) *EventsStore
NewEventsStorer creates a new eventsStore
func (*EventsStore) ListEventsForRepository ¶
func (e *EventsStore) ListEventsForRepository(ctx context.Context, repoID int, options *models.ListOptions) ([]*models.Event, error)
ListEventsForRepository gets paginated list of events for a repository. It does not return the command runs and the payloads to prevent potentially big chunks of transfer data. To get those, one must do a Get.
type EventsStoreDependencies ¶
type EventsStoreDependencies struct { Dependencies Connector *Connector }
EventsStoreDependencies eventsStoreStore specific dependencies.
type RepositoryDependencies ¶
type RepositoryDependencies struct { Dependencies Connector *Connector Vault providers.Vault }
RepositoryDependencies repository specific dependencies such as, the command store.
type RepositoryStore ¶
type RepositoryStore struct {
RepositoryDependencies
}
RepositoryStore is a postgres based store for repositories.
func NewRepositoryStore ¶
func NewRepositoryStore(deps RepositoryDependencies) *RepositoryStore
NewRepositoryStore creates a new RepositoryStore
func (*RepositoryStore) Create ¶
func (r *RepositoryStore) Create(ctx context.Context, c *models.Repository) (*models.Repository, error)
Create creates a repository. Upon creating we don't assign any commands yet. So we don't save those here. We do save auth information into the vault.
func (*RepositoryStore) Delete ¶
func (r *RepositoryStore) Delete(ctx context.Context, id int) error
Delete removes a repository and all.
func (*RepositoryStore) Get ¶
func (r *RepositoryStore) Get(ctx context.Context, id int) (*models.Repository, error)
Get retrieves a single repository using its ID.
func (*RepositoryStore) GetByName ¶
func (r *RepositoryStore) GetByName(ctx context.Context, name string) (*models.Repository, error)
GetByName retrieves a single repository using its name.
func (*RepositoryStore) List ¶
func (r *RepositoryStore) List(ctx context.Context, opts *models.ListOptions) ([]*models.Repository, error)
List all repositories or the ones specified by the filter opts. We are ignoring auth information here.
func (*RepositoryStore) Update ¶
func (r *RepositoryStore) Update(ctx context.Context, c *models.Repository) (*models.Repository, error)
Update can only update the name of the repository. If auth information is updated for the repository, it has to be re-created. Since auth is stored elsewhere.
type UserDependencies ¶
type UserDependencies struct { Dependencies Connector *Connector APIKeys providers.APIKeysStorer Time providers.Clock }
UserDependencies user specific dependencies.
type UserStore ¶
type UserStore struct {
UserDependencies
}
UserStore is a postgres based store for users.
func NewUserStore ¶
func NewUserStore(deps UserDependencies) *UserStore
NewUserStore creates a new UserStore
func (*UserStore) GetByEmail ¶
GetByEmail retrieves a user by its email address.