vcsprovider

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: MPL-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package vcsprovider is responsible for VCS providers

Index

Constants

View Source
const (
	GithubAPIURL  = "https://api.github.com"
	GithubHTTPURL = "https://github.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateOptions

type CreateOptions struct {
	Organization string
	Name         string
	Kind         *vcs.Kind

	// Specify either token or github app install ID
	Token              *string
	GithubAppInstallID *int64
}

type Options

type Options struct {
	*internal.HostnameService
	*sql.DB
	*tfeapi.Responder
	html.Renderer
	logr.Logger
	vcs.Subscriber

	GithubAppService    *github.Service
	GithubHostname      string
	GitlabHostname      string
	SkipTLSVerification bool
	Authorizer          *authz.Authorizer
}

type Service

type Service struct {
	logr.Logger
	*authz.Authorizer

	*internal.HostnameService
	// contains filtered or unexported fields
}

func NewService

func NewService(opts Options) *Service

func (*Service) AddHandlers added in v0.2.2

func (a *Service) AddHandlers(r *mux.Router)

func (*Service) BeforeDeleteVCSProvider added in v0.1.8

func (a *Service) BeforeDeleteVCSProvider(hook func(context.Context, *VCSProvider) error)

func (*Service) Create added in v0.2.2

func (a *Service) Create(ctx context.Context, opts CreateOptions) (*VCSProvider, error)

func (*Service) Delete added in v0.2.2

func (a *Service) Delete(ctx context.Context, id resource.ID) (*VCSProvider, error)

func (*Service) Get added in v0.2.2

func (a *Service) Get(ctx context.Context, id resource.ID) (*VCSProvider, error)

func (*Service) GetVCSClient

func (a *Service) GetVCSClient(ctx context.Context, providerID resource.ID) (vcs.Client, error)

func (*Service) List added in v0.2.2

func (a *Service) List(ctx context.Context, organization string) ([]*VCSProvider, error)

func (*Service) ListAllVCSProviders added in v0.0.53

func (a *Service) ListAllVCSProviders(ctx context.Context) ([]*VCSProvider, error)

func (*Service) ListVCSProvidersByGithubAppInstall added in v0.1.14

func (a *Service) ListVCSProvidersByGithubAppInstall(ctx context.Context, installID int64) ([]*VCSProvider, error)

ListVCSProvidersByGithubAppInstall is unauthenticated: only for internal use.

func (*Service) Update added in v0.2.2

func (a *Service) Update(ctx context.Context, id resource.ID, opts UpdateOptions) (*VCSProvider, error)

type UpdateOptions added in v0.1.11

type UpdateOptions struct {
	Token *string
	Name  string
}

type VCSProvider

type VCSProvider struct {
	ID           resource.ID
	Name         string
	CreatedAt    time.Time
	Organization string // name of OTF organization
	Hostname     string // hostname of github/gitlab etc

	Kind  vcs.Kind // github/gitlab etc. Not necessary if GithubApp is non-nil.
	Token *string  // personal access token.

	GithubApp *github.InstallCredentials // mutually exclusive with Token.
	// contains filtered or unexported fields
}

VCSProvider provides authenticated access to a VCS.

func (*VCSProvider) LogValue

func (t *VCSProvider) LogValue() slog.Value

LogValue implements slog.LogValuer.

func (*VCSProvider) NewClient

func (t *VCSProvider) NewClient() (vcs.Client, error)

func (*VCSProvider) String

func (t *VCSProvider) String() string

String provides a human meaningful description of the vcs provider, using the name if set; otherwise a name is constructed using both the underlying cloud kind and the auth kind.

func (*VCSProvider) Update added in v0.1.11

func (t *VCSProvider) Update(opts UpdateOptions) error

Jump to

Keyboard shortcuts

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