Documentation
¶
Index ¶
- Constants
- type Connector
- func NewAppConnector(ctx context.Context, apiEndpoint string, app *credentialspb.GitHubApp) (Connector, error)
- func NewBasicAuthConnector(ctx context.Context, apiEndpoint, clonePath string, ...) (Connector, error)
- func NewTokenConnector(ctx context.Context, apiEndpoint, token, clonePath string, authInUrl bool, ...) (Connector, error)
- func NewUnauthenticatedConnector(ctx context.Context, apiEndpoint, clonePath string) (Connector, error)
- type GistUnit
- type RepoUnit
- type Source
- func (s *Source) ChunkUnit(ctx context.Context, unit sources.SourceUnit, reporter sources.ChunkReporter) error
- func (s *Source) Chunks(ctx context.Context, chunksChan chan *sources.Chunk, ...) error
- func (s *Source) Enumerate(ctx context.Context, reporter sources.UnitReporter) error
- func (s *Source) Init(aCtx context.Context, name string, jobID sources.JobID, ...) error
- func (s *Source) JobID() sources.JobID
- func (s *Source) SourceID() sources.SourceID
- func (s *Source) Type() sourcespb.SourceType
- func (s *Source) Validate(ctx context.Context) []error
- func (s *Source) WithCustomContentWriter()
- func (s *Source) WithScanOptions(scanOptions *git.ScanOptions)
Constants ¶
const (
SourceType = sourcespb.SourceType_SOURCE_TYPE_GITHUB
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Connector ¶
type Connector interface {
// APIClient returns a configured GitHub client that can be used for GitHub API operations.
APIClient() *github.Client
// GraphQLClient returns a client that can be used for GraphQL operations.
GraphQLClient() *githubv4.Client
// Clone clones a repository using the configured authentication information.
Clone(ctx context.Context, repoURL string, args ...string) (string, *gogit.Repository, error)
}
Connector abstracts over the authenticated ways to interact with GitHub: cloning and API operations.
func NewAppConnector ¶
func NewBasicAuthConnector ¶
func NewTokenConnector ¶
type GistUnit ¶
func (GistUnit) SourceUnitID ¶
func (g GistUnit) SourceUnitID() (string, sources.SourceUnitKind)
type RepoUnit ¶
func (RepoUnit) SourceUnitID ¶
func (r RepoUnit) SourceUnitID() (string, sources.SourceUnitKind)
type Source ¶
type Source struct {
sources.Progress
sources.CommonSourceUnitUnmarshaller
// contains filtered or unexported fields
}
func (*Source) ChunkUnit ¶
func (s *Source) ChunkUnit(ctx context.Context, unit sources.SourceUnit, reporter sources.ChunkReporter) error
func (*Source) Chunks ¶
func (s *Source) Chunks(ctx context.Context, chunksChan chan *sources.Chunk, targets ...sources.ChunkingTarget) error
Chunks emits chunks of bytes over a channel.
func (*Source) Enumerate ¶
Enumerate enumerates the GitHub source based on authentication method and user configuration. It populates s.filteredRepoCache, s.repoInfoCache, s.memberCache, s.totalRepoSize, s.orgsCache, and s.repos. Additionally, repositories and gists are reported to the provided UnitReporter.
func (*Source) Init ¶
func (s *Source) Init(aCtx context.Context, name string, jobID sources.JobID, sourceID sources.SourceID, verify bool, connection *anypb.Any, concurrency int) error
Init returns an initialized GitHub source.
func (*Source) Type ¶
func (s *Source) Type() sourcespb.SourceType
Type returns the type of source. It is used for matching source types in configuration and job input.
func (*Source) WithCustomContentWriter ¶
func (s *Source) WithCustomContentWriter()
WithCustomContentWriter sets the useCustomContentWriter flag on the source.
func (*Source) WithScanOptions ¶
func (s *Source) WithScanOptions(scanOptions *git.ScanOptions)