Documentation
¶
Index ¶
- Constants
- type AuthToken
- type Options
- type Service
- func (s *Service) Close() error
- func (s *Service) CreateOrUpdateUser(ctx context.Context, email, name, photoURL string) (*database.User, error)
- func (s *Service) CreateProject(ctx context.Context, proj *database.Project) (*database.Project, error)
- func (s *Service) GetUserGithubInstallation(ctx context.Context, userID, githubURL string) (int64, bool, error)
- func (s *Service) IssueAuthCode(ctx context.Context, clientID string) (*database.AuthCode, error)
- func (s *Service) IssueUserAuthToken(ctx context.Context, userID, clientID, displayName string) (AuthToken, error)
- func (s *Service) LookupGithubRepo(ctx context.Context, installationID int64, githubURL string) (*github.Repository, error)
- func (s *Service) ProcessGithubEvent(ctx context.Context, rawEvent any) error
- func (s *Service) ProcessUserGithubInstallation(ctx context.Context, userID string, installationID int64) error
- func (s *Service) RevokeAuthToken(ctx context.Context, token string) error
- func (s *Service) TeardownProject(ctx context.Context, p *database.Project) error
- func (s *Service) TriggerReconcile(ctx context.Context, deploymentID string) error
- func (s *Service) UpdateProject(ctx context.Context, p *database.Project) (*database.Project, error)
- func (s *Service) ValidateAuthToken(ctx context.Context, token string) (AuthToken, error)
Constants ¶
const AuthCodeTTL = 10 * time.Minute
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthToken ¶ added in v0.23.0
AuthToken is the interface package admin uses to provide a consolidated view of a token string and its DB model.
type Service ¶
func (*Service) CreateOrUpdateUser ¶ added in v0.23.0
func (*Service) CreateProject ¶ added in v0.23.0
func (*Service) GetUserGithubInstallation ¶ added in v0.23.0
func (s *Service) GetUserGithubInstallation(ctx context.Context, userID, githubURL string) (int64, bool, error)
GetUserGithubInstallation returns a Github installation ID iff the Github App is installed on the repository AND we have a confirmed relationship between the user and that installation. The githubURL should be a HTTPS URL for a Github repository without the .git suffix.
func (*Service) IssueAuthCode ¶ added in v0.23.0
func (*Service) IssueUserAuthToken ¶ added in v0.23.0
func (s *Service) IssueUserAuthToken(ctx context.Context, userID, clientID, displayName string) (AuthToken, error)
IssueUserAuthToken generates and persists a new auth token for a user.
func (*Service) LookupGithubRepo ¶ added in v0.23.0
func (s *Service) LookupGithubRepo(ctx context.Context, installationID int64, githubURL string) (*github.Repository, error)
LookupGithubRepo calls the Github API using an installation token to get information about a Github repo. The githubURL should be a HTTPS URL for a Github repository without the .git suffix.
func (*Service) ProcessGithubEvent ¶ added in v0.23.0
ProcessGithubEvent processes a Github event (usually received over webhooks). After validating that the event is a valid Github event, it moves further processing to the background and returns a nil error.
func (*Service) ProcessUserGithubInstallation ¶ added in v0.23.0
func (s *Service) ProcessUserGithubInstallation(ctx context.Context, userID string, installationID int64) error
ProcessGithubInstallation tracks a confirmed relationship between a user and an installation of the Github App.
func (*Service) RevokeAuthToken ¶ added in v0.23.0
RevokeAuthToken removes an auth token from persistent storage.