vcsprovider

package
v0.0.47 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: MPL-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package vcsprovider is responsible for VCS providers

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewService

func NewService(opts Options) *service

Types

type CloudService

type CloudService cloud.Service

type CreateOptions

type CreateOptions struct {
	Organization string
	Token        string
	Name         string
	Cloud        string
	ID           *string
	CreatedAt    *time.Time
}

type Options

type Options struct {
	CloudService
	internal.DB
	html.Renderer
	logr.Logger
}

type Service

type Service interface {
	CreateVCSProvider(ctx context.Context, opts CreateOptions) (*VCSProvider, error)
	GetVCSProvider(ctx context.Context, id string) (*VCSProvider, error)
	ListVCSProviders(ctx context.Context, organization string) ([]*VCSProvider, error)
	DeleteVCSProvider(ctx context.Context, id string) (*VCSProvider, error)

	// GetVCSClient combines retrieving a vcs provider and construct a cloud
	// client from that provider.
	//
	// TODO: rename vcs provider to cloud client; the central purpose of the vcs
	// provider is, after all, to construct a cloud client.
	GetVCSClient(ctx context.Context, providerID string) (cloud.Client, error)
}

type VCSProvider

type VCSProvider struct {
	ID           string
	CreatedAt    time.Time
	Name         string       // TODO: rename to description (?)
	CloudConfig  cloud.Config // cloud config for creating client
	Token        string       // credential for creating client
	Organization string       // vcs provider belongs to an organization
}

VCSProvider provides authenticated access to a VCS. Equivalent to an OAuthClient in TFE.

func (*VCSProvider) LogValue

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

LogValue implements slog.LogValuer.

func (*VCSProvider) NewClient

func (t *VCSProvider) NewClient(ctx context.Context) (cloud.Client, error)

func (*VCSProvider) String

func (t *VCSProvider) String() string

type VCSProviderService

type VCSProviderService Service

Alias services so they don't conflict when nested together in struct

Jump to

Keyboard shortcuts

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