providers

package
v0.0.47 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Overview

Package providers contains general utilities for interacting with providers.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidCredential = errors.New("invalid credential type")

ErrInvalidCredential is returned when the credential is not of the required type

Functions

func DBToPBAuthFlow added in v0.0.35

func DBToPBAuthFlow(t db.AuthorizationFlow) (minderv1.AuthorizationFlow, bool)

DBToPBAuthFlow converts a database authorization flow to a protobuf authorization flow.

func DBToPBType added in v0.0.30

func DBToPBType(t db.ProviderType) (minderv1.ProviderType, bool)

DBToPBType converts a database provider type to a protobuf provider type.

func GetCredentialStateForProvider added in v0.0.37

func GetCredentialStateForProvider(
	ctx context.Context,
	prov db.Provider,
	s db.Store,
	cryptoEngine crypto.Engine,
	provCfg *serverconfig.ProviderConfig,
) string

GetCredentialStateForProvider returns the credential state for the given provider.

func GetProviderClassString added in v0.0.38

func GetProviderClassString(prov db.Provider) string

GetProviderClassString returns the string representation of the provider class.

func ListProviderClasses added in v0.0.38

func ListProviderClasses() []string

ListProviderClasses returns a list of provider classes.

Types

type ErrProviderNotFoundBy added in v0.0.43

type ErrProviderNotFoundBy struct {
	Name  string
	Trait string
}

ErrProviderNotFoundBy is an error type which is returned when a provider is not found

func (ErrProviderNotFoundBy) Error added in v0.0.43

func (e ErrProviderNotFoundBy) Error() string

type ProviderBuilder

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

ProviderBuilder is a utility struct which allows for the creation of provider clients.

func GetProviderBuilder

func GetProviderBuilder(
	ctx context.Context,
	prov db.Provider,
	store db.Store,
	crypteng crypto.Engine,
	provCfg *serverconfig.ProviderConfig,
	fallbackTokenClient *gogithub.Client,
	opts ...ProviderBuilderOption,
) (*ProviderBuilder, error)

GetProviderBuilder is a utility function which allows for the creation of a provider factory.

func NewProviderBuilder

func NewProviderBuilder(
	p *db.Provider,
	ownerFilter sql.NullString,
	isOrg bool,
	credential provinfv1.Credential,
	cfg *serverconfig.ProviderConfig,
	fallbackTokenClient *gogithub.Client,
	opts ...ProviderBuilderOption,
) *ProviderBuilder

NewProviderBuilder creates a new provider builder.

func (*ProviderBuilder) GetGit

func (pb *ProviderBuilder) GetGit() (provinfv1.Git, error)

GetGit returns a git client for the provider.

func (*ProviderBuilder) GetGitHub

func (pb *ProviderBuilder) GetGitHub() (provinfv1.GitHub, error)

GetGitHub returns a github client for the provider.

func (*ProviderBuilder) GetHTTP

func (pb *ProviderBuilder) GetHTTP() (provinfv1.REST, error)

GetHTTP returns a github client for the provider.

func (*ProviderBuilder) GetName

func (pb *ProviderBuilder) GetName() string

GetName returns the name of the provider instance as defined in the database.

func (*ProviderBuilder) GetRepoLister

func (pb *ProviderBuilder) GetRepoLister() (provinfv1.RepoLister, error)

GetRepoLister returns a repo lister for the provider.

func (*ProviderBuilder) Implements

func (pb *ProviderBuilder) Implements(impl db.ProviderType) bool

Implements returns true if the provider implements the given type.

type ProviderBuilderOption

type ProviderBuilderOption func(*ProviderBuilder)

ProviderBuilderOption is a function which can be used to set options on the ProviderBuilder.

func WithProviderMetrics

func WithProviderMetrics(metrics telemetry.ProviderMetrics) ProviderBuilderOption

WithProviderMetrics sets the metrics for the ProviderBuilder

func WithRestClientCache added in v0.0.31

func WithRestClientCache(cache ratecache.RestClientCache) ProviderBuilderOption

WithRestClientCache sets the rest client cache for the ProviderBuilder

type ProviderClassDefinition added in v0.0.38

type ProviderClassDefinition struct {
	Traits             []db.ProviderType
	AuthorizationFlows []db.AuthorizationFlow
}

ProviderClassDefinition contains the static fields needed when creating a provider

func GetProviderClassDefinition added in v0.0.38

func GetProviderClassDefinition(class string) (ProviderClassDefinition, error)

GetProviderClassDefinition returns the provider definition for the given provider class

type ProviderStore added in v0.0.39

type ProviderStore interface {
	// GetByID returns the provider identified by its UUID primary key.
	// It is assumed that the caller carries out some kind of validation to
	// ensure that whoever made the request is authorized to access this
	// provider.
	GetByID(ctx context.Context, providerID uuid.UUID) (*db.Provider, error)
	// GetByName returns the provider instance in the database as
	// identified by its project ID and name. All parent projects of the
	// specified project are included in the search.
	GetByName(ctx context.Context, projectID uuid.UUID, name string) (*db.Provider, error)
	// GetByNameInSpecificProject returns the provider instance in the database as
	// identified by its project ID and name. Unlike `GetByName` it will only
	// search in the specified project, and ignore the project hierarchy.
	GetByNameInSpecificProject(ctx context.Context, projectID uuid.UUID, name string) (*db.Provider, error)
	// GetByNameAndTrait returns the providers in the project which match the
	// specified trait. All parent projects of the specified project are
	// included in the search.
	// Note that if error is nil, there will always be at least one element
	// in the list of providers which is returned.
	GetByNameAndTrait(
		ctx context.Context,
		projectID uuid.UUID,
		name string,
		trait db.ProviderType,
	) ([]db.Provider, error)
}

ProviderStore provides methods for retrieving Providers from the database

func NewProviderStore added in v0.0.39

func NewProviderStore(store db.Store) ProviderStore

NewProviderStore returns a new instance of ProviderStore.

Directories

Path Synopsis
Package credentials provides the implementations for the credentials
Package credentials provides the implementations for the credentials
Package git provides a client for interacting with Git providers
Package git provides a client for interacting with Git providers
Package github provides a client for interacting with the GitHub API
Package github provides a client for interacting with the GitHub API
app
Package app provides the GitHub App specific operations
Package app provides the GitHub App specific operations
common
Package common provides common utilities for the GitHub provider
Package common provides common utilities for the GitHub provider
installations
Package installations contains logic relating to GitHub provider installations
Package installations contains logic relating to GitHub provider installations
mock
Package mockgh is a generated GoMock package.
Package mockgh is a generated GoMock package.
oauth
Package oauth provides a client for interacting with the GitHub API using OAuth 2.0 authorization
Package oauth provides a client for interacting with the GitHub API using OAuth 2.0 authorization
service
Package service contains the github
Package service contains the github
service/mock
Package mockghprovsvc is a generated GoMock package.
Package mockghprovsvc is a generated GoMock package.
Package http implements an HTTP client for interacting with an HTTP API.
Package http implements an HTTP client for interacting with an HTTP API.
Package ratecache provides a cache for the REST clients
Package ratecache provides a cache for the REST clients
mock
Package mockratecache is a generated GoMock package.
Package mockratecache is a generated GoMock package.
Package telemetry provides the telemetry interfaces and implementations for providers
Package telemetry provides the telemetry interfaces and implementations for providers

Jump to

Keyboard shortcuts

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