revok

package
v92.0.0+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 22, 2017 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRepoSet

func NewRepoSet(sizeHint int) *repoSet

Types

type ChangeFetcher

type ChangeFetcher struct {
	// contains filtered or unexported fields
}

func NewChangeFetcher

func NewChangeFetcher(
	logger lager.Logger,
	gitClient GitFetchClient,
	ghClient GithubService,
	notificationComposer ChangeFetcherNotificationComposer,
	repositoryRepository db.RepositoryRepository,
	fetchRepository db.FetchRepository,
	emitter metrics.Emitter,
) *ChangeFetcher

func (*ChangeFetcher) Fetch

func (c *ChangeFetcher) Fetch(
	ctx context.Context,
	logger lager.Logger,
	owner string,
	name string,
	reenable bool,
) error

type ChangeFetcherNotificationComposer

type ChangeFetcherNotificationComposer interface {
	ScanAndNotify(context.Context, lager.Logger, string, string, map[string]struct{}, string, string, string) error
}

type ChangeScheduler

type ChangeScheduler struct {
	// contains filtered or unexported fields
}

func NewChangeScheduler

func NewChangeScheduler(logger lager.Logger, repoRepo db.RepositoryRepository, scheduler Scheduler, fetcher SchedulerChangeFetcher) *ChangeScheduler

func (*ChangeScheduler) Run

func (s *ChangeScheduler) Run(signals <-chan os.Signal, ready chan<- struct{}) error

func (*ChangeScheduler) ScheduleActiveRepos

func (s *ChangeScheduler) ScheduleActiveRepos(logger lager.Logger) error

func (*ChangeScheduler) ScheduleRepo

func (s *ChangeScheduler) ScheduleRepo(logger lager.Logger, repo db.Repository)

type CloneMsg

type CloneMsg struct {
	Repository string
	Owner      string
	URL        string
}

type Cloner

type Cloner struct {
	// contains filtered or unexported fields
}

func NewCloner

func NewCloner(
	logger lager.Logger,
	workdir string,
	workCh chan CloneMsg,
	gitClient GitBranchCloneClient,
	repositoryRepository db.RepositoryRepository,
	notificationComposer ClonerNotificationComposer,
	emitter metrics.Emitter,
	scheduler RepoChangeScheduler,
) *Cloner

func (*Cloner) Run

func (c *Cloner) Run(signals <-chan os.Signal, ready chan<- struct{}) error

type ClonerNotificationComposer

type ClonerNotificationComposer interface {
	ScanAndNotify(context.Context, lager.Logger, string, string, map[string]struct{}, string, string, string) error
}

type GitBranchCloneClient

type GitBranchCloneClient interface {
	Clone(string, string) error
	BranchTargets(repoPath string) (map[string]string, error)
}

type GitBranchCredentialsCounterClient

type GitBranchCredentialsCounterClient interface {
	BranchTargets(repoPath string) (map[string]string, error)
	BranchCredentialCounts(lager.Logger, string, sniff.Sniffer) (map[string]uint, error)
}

type GitFetchClient

type GitFetchClient interface {
	Fetch(string) (map[string][]string, error)
}

type GitGCClient

type GitGCClient interface {
	GC(repoPath string) error
}

type GitGCRunner

type GitGCRunner struct {
	// contains filtered or unexported fields
}

func NewGitGCRunner

func NewGitGCRunner(
	logger lager.Logger,
	clock clock.Clock,
	repoRepo db.RepositoryRepository,
	gitClient GitGCClient,
	retryInterval time.Duration,
) *GitGCRunner

func (*GitGCRunner) Run

func (g *GitGCRunner) Run(signals <-chan os.Signal, ready chan<- struct{}) error

type GitGetParentsDiffClient

type GitGetParentsDiffClient interface {
	GetParents(string, string) ([]string, error)
	Diff(repoPath, parent, child string) (string, error)
}

type GitHubClient

type GitHubClient struct {
	// contains filtered or unexported fields
}

func NewGitHubClient

func NewGitHubClient(
	ghRepositoryService GithubRepositoryService,
) *GitHubClient

func (*GitHubClient) GetRepo

func (c *GitHubClient) GetRepo(logger lager.Logger, owner, repoName string) (*GitHubRepository, error)

func (*GitHubClient) ListRepositoriesByOrg

func (c *GitHubClient) ListRepositoriesByOrg(logger lager.Logger, orgName string) ([]GitHubRepository, error)

func (*GitHubClient) ListRepositoriesByUser

func (c *GitHubClient) ListRepositoriesByUser(logger lager.Logger, userName string) ([]GitHubRepository, error)

type GitHubOrganization

type GitHubOrganization struct {
	Name string `json:"login"`
}

type GitHubRepository

type GitHubRepository struct {
	Name          string
	Owner         string
	SSHURL        string
	Private       bool
	DefaultBranch string
	RawJSON       []byte
}

type GithubRepositoryService

type GithubRepositoryService interface {
	ListByOrg(ctx context.Context, org string, opt *github.RepositoryListByOrgOptions) ([]*github.Repository, *github.Response, error)
	List(ctx context.Context, user string, opt *github.RepositoryListOptions) ([]*github.Repository, *github.Response, error)
	Get(ctx context.Context, owner, repo string) (*github.Repository, *github.Response, error)
}

type GithubService

type GithubService interface {
	ListRepositoriesByOrg(logger lager.Logger, orgName string) ([]GitHubRepository, error)
	ListRepositoriesByUser(logger lager.Logger, userName string) ([]GitHubRepository, error)
	GetRepo(logger lager.Logger, owner, repoName string) (*GitHubRepository, error)
}

type HeadCredentialCounter

type HeadCredentialCounter struct {
	// contains filtered or unexported fields
}

func NewHeadCredentialCounter

func NewHeadCredentialCounter(
	logger lager.Logger,
	branchRepository db.BranchRepository,
	repositoryRepository db.RepositoryRepository,
	clock clock.Clock,
	interval time.Duration,
	gitClient GitBranchCredentialsCounterClient,
	sniffer sniff.Sniffer,
) *HeadCredentialCounter

func (*HeadCredentialCounter) Run

func (c *HeadCredentialCounter) Run(signals <-chan os.Signal, ready chan<- struct{}) error

type NotificationComposer

type NotificationComposer struct {
	// contains filtered or unexported fields
}

func NewNotificationComposer

func NewNotificationComposer(
	repositoryRepository db.RepositoryRepository,
	router notifications.Router,
	scanner NotificationComposerScanner,
) *NotificationComposer

func (*NotificationComposer) ScanAndNotify

func (n *NotificationComposer) ScanAndNotify(
	ctx context.Context,
	logger lager.Logger,
	owner string,
	repository string,
	scannedOids map[string]struct{},
	branch string,
	startSHA string,
	stopSHA string,
) error

type NotificationComposerScanner

type NotificationComposerScanner interface {
	Scan(lager.Logger, string, string, map[string]struct{}, string, string, string) ([]db.Credential, error)
}

type ObliviousHealthCheck

type ObliviousHealthCheck struct{}

func NewObliviousHealthCheck

func NewObliviousHealthCheck() *ObliviousHealthCheck

func (*ObliviousHealthCheck) ServeHTTP

func (hc *ObliviousHealthCheck) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RepoChangeScheduler

type RepoChangeScheduler interface {
	ScheduleRepo(lager.Logger, db.Repository)
}

type RepoDiscoverer

type RepoDiscoverer struct {
	// contains filtered or unexported fields
}

func NewRepoDiscoverer

func NewRepoDiscoverer(
	logger lager.Logger,
	workdir string,
	cloneMsgCh chan CloneMsg,
	ghClient RepoDiscovererGitHubClient,
	clock clock.Clock,
	interval time.Duration,
	orgs []string,
	users []string,
	repositoryRepository db.RepositoryRepository,
) *RepoDiscoverer

func (*RepoDiscoverer) Run

func (r *RepoDiscoverer) Run(signals <-chan os.Signal, ready chan<- struct{}) error

type RepoDiscovererGitHubClient

type RepoDiscovererGitHubClient interface {
	ListRepositoriesByOrg(lager.Logger, string) ([]GitHubRepository, error)
	ListRepositoriesByUser(lager.Logger, string) ([]GitHubRepository, error)
}

type Rescanner

type Rescanner struct {
	// contains filtered or unexported fields
}

func NewRescanner

func NewRescanner(
	logger lager.Logger,
	scanRepo db.ScanRepository,
	credRepo db.CredentialRepository,
	scanner RescannerScanner,
	router notifications.Router,
	emitter metrics.Emitter,
) *Rescanner

func (*Rescanner) Run

func (r *Rescanner) Run(signals <-chan os.Signal, ready chan<- struct{}) error

type RescannerScanner

type RescannerScanner interface {
	Scan(lager.Logger, string, string, map[string]struct{}, string, string, string) ([]db.Credential, error)
}

type Scanner

type Scanner struct {
	// contains filtered or unexported fields
}

func NewScanner

func NewScanner(
	gitClient GitGetParentsDiffClient,
	repositoryRepository db.RepositoryRepository,
	scanRepository db.ScanRepository,
	credentialRepository db.CredentialRepository,
	sniffer sniff.Sniffer,
) *Scanner

func (*Scanner) Scan

func (s *Scanner) Scan(
	logger lager.Logger,
	owner string,
	repository string,
	scannedOids map[string]struct{},
	branch string,
	startSHA string,
	stopSHA string,
) ([]db.Credential, error)

type ScheduleRunner

type ScheduleRunner struct {
	// contains filtered or unexported fields
}

func NewScheduleRunner

func NewScheduleRunner(logger lager.Logger) *ScheduleRunner

func Schedule

func Schedule(logger lager.Logger, cron string, work func()) *ScheduleRunner

func (*ScheduleRunner) Run

func (s *ScheduleRunner) Run(signals <-chan os.Signal, ready chan<- struct{}) error

func (*ScheduleRunner) ScheduleWork

func (s *ScheduleRunner) ScheduleWork(cron string, work func())

type Scheduler

type Scheduler interface {
	ScheduleWork(string, func())
}

type SchedulerChangeFetcher

type SchedulerChangeFetcher interface {
	Fetch(ctx context.Context, logger lager.Logger, owner, name string, reenable bool) error
}

type Sink

type Sink struct {
}

Sink is the type that represents the sink that will emit errors to Sentry.

func NewSentrySink

func NewSentrySink(dsn, env string) *Sink

NewSentrySink creates a new Sink for use with Lager.

func (*Sink) Log

func (s *Sink) Log(line lager.LogFormat)

Log will send any error log lines up to Sentry.

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL