vcs

package
v0.8.1 Latest Latest
Warning

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

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

Documentation

Overview

Package vcs package

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewVCSProviderMap

func NewVCSProviderMap(
	logger logger.Logger,
	client *http.Client,
	phobosURL string,
) (map[models.VCSProviderType]Provider, error)

NewVCSProviderMap returns a map containing a handler for each VCS provider type.

Types

type CreateOrganizationVCSProviderInput

type CreateOrganizationVCSProviderInput struct {
	URL                 *string
	OAuthClientID       *string
	OAuthClientSecret   *string
	PersonalAccessToken *string
	OrganizationID      string
	Name                string
	Description         string
	Type                models.VCSProviderType
	AuthType            models.VCSProviderAuthType
	ExtraOAuthScopes    []string
}

CreateOrganizationVCSProviderInput is the input for creating an organization VCS provider.

type CreateProjectVCSProviderInput

type CreateProjectVCSProviderInput struct {
	URL                 *string
	OAuthClientID       *string
	OAuthClientSecret   *string
	PersonalAccessToken *string
	ProjectID           string
	Name                string
	Description         string
	Type                models.VCSProviderType
	AuthType            models.VCSProviderAuthType
	ExtraOAuthScopes    []string
}

CreateProjectVCSProviderInput is the input for creating a project VCS provider.

type CreateVCSProviderResponse

type CreateVCSProviderResponse struct {
	VCSProvider           *models.VCSProvider
	OAuthAuthorizationURL *string
}

CreateVCSProviderResponse is the response for creating a VCS provider

type CreateVCSTokenForPipelineInput added in v0.8.0

type CreateVCSTokenForPipelineInput struct {
	ProviderID string
	PipelineID string
}

CreateVCSTokenForPipelineInput is the input for creating a VCS token.

type CreateVCSTokenForPipelineResponse added in v0.8.0

type CreateVCSTokenForPipelineResponse struct {
	ExpiresAt   *time.Time
	AccessToken string
}

CreateVCSTokenForPipelineResponse is the response for creating a VCS token.

type DeleteVCSProviderInput

type DeleteVCSProviderInput struct {
	Version *int
	ID      string
}

DeleteVCSProviderInput is the input for deleting a VCS provider.

type GetRepositoryArchiveInput

type GetRepositoryArchiveInput struct {
	Ref            *string
	ProviderID     string
	RepositoryPath string
}

GetRepositoryArchiveInput is the input for retrieving a repository archive.

type GetVCSProvidersInput

type GetVCSProvidersInput struct {
	// Sort specifies the field to sort on and direction
	Sort *db.VCSProviderSortableField
	// PaginationOptions supports cursor based pagination
	PaginationOptions *pagination.Options
	// Search returns only the VCS providers with a name that
	// starts with the value of search
	Search *string
	// OrganizationID is the organization ID to filter VCS providers on
	OrganizationID *string
	// ProjectID is the project ID to filter VCS provider on
	ProjectID *string
}

GetVCSProvidersInput is the input for listing VCS providers.

type MockProvider

type MockProvider struct {
	mock.Mock
}

MockProvider is an autogenerated mock type for the Provider type

func NewMockProvider

func NewMockProvider(t mockConstructorTestingTNewMockProvider) *MockProvider

NewMockProvider creates a new instance of MockProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockProvider) BuildOAuthAuthorizationURL

func (_m *MockProvider) BuildOAuthAuthorizationURL(input *types.BuildOAuthAuthorizationURLInput) (string, error)

BuildOAuthAuthorizationURL provides a mock function with given fields: input

func (*MockProvider) BuildRepositoryURL

func (_m *MockProvider) BuildRepositoryURL(input *types.BuildRepositoryURLInput) (string, error)

BuildRepositoryURL provides a mock function with given fields: input

func (*MockProvider) CreateAccessToken

func (_m *MockProvider) CreateAccessToken(ctx context.Context, input *types.CreateAccessTokenInput) (*types.AccessTokenPayload, error)

CreateAccessToken provides a mock function with given fields: ctx, input

func (*MockProvider) DefaultURL

func (_m *MockProvider) DefaultURL() url.URL

DefaultURL provides a mock function with given fields:

func (*MockProvider) GetArchive

func (_m *MockProvider) GetArchive(ctx context.Context, input *types.GetArchiveInput) (*http.Response, error)

GetArchive provides a mock function with given fields: ctx, input

func (*MockProvider) TestConnection

func (_m *MockProvider) TestConnection(ctx context.Context, input *types.TestConnectionInput) error

TestConnection provides a mock function with given fields: ctx, input

type ProcessOAuthInput

type ProcessOAuthInput struct {
	AuthorizationCode string
	State             string
}

ProcessOAuthInput is the input for processing OAuth callback.

type Provider

type Provider interface {
	DefaultURL() url.URL
	BuildOAuthAuthorizationURL(input *types.BuildOAuthAuthorizationURLInput) (string, error)
	BuildRepositoryURL(input *types.BuildRepositoryURLInput) (string, error)
	TestConnection(ctx context.Context, input *types.TestConnectionInput) error
	GetArchive(ctx context.Context, input *types.GetArchiveInput) (*http.Response, error)
	CreateAccessToken(ctx context.Context, input *types.CreateAccessTokenInput) (*types.AccessTokenPayload, error)
}

Provider handles the logic for a specific type of vcs provider.

type ResetVCSProviderOAuthTokenInput

type ResetVCSProviderOAuthTokenInput struct {
	ProviderID string
}

ResetVCSProviderOAuthTokenInput is the input for

type ResetVCSProviderOAuthTokenResponse

type ResetVCSProviderOAuthTokenResponse struct {
	VCSProvider           *models.VCSProvider
	OAuthAuthorizationURL string
}

ResetVCSProviderOAuthTokenResponse is the response for resetting a VCS OAuth token.

type Service

type Service interface {
	GetVCSProviderByID(ctx context.Context, id string) (*models.VCSProvider, error)
	GetVCSProviderByPRN(ctx context.Context, prn string) (*models.VCSProvider, error)
	GetVCSProviders(ctx context.Context, input *GetVCSProvidersInput) (*db.VCSProvidersResult, error)
	GetVCSProvidersByIDs(ctx context.Context, idList []string) ([]models.VCSProvider, error)
	CreateOrganizationVCSProvider(ctx context.Context, input *CreateOrganizationVCSProviderInput) (*CreateVCSProviderResponse, error)
	CreateProjectVCSProvider(ctx context.Context, input *CreateProjectVCSProviderInput) (*CreateVCSProviderResponse, error)
	UpdateVCSProvider(ctx context.Context, input *UpdateVCSProviderInput) (*models.VCSProvider, error)
	DeleteVCSProvider(ctx context.Context, input *DeleteVCSProviderInput) error
	ResetVCSProviderOAuthToken(ctx context.Context, input *ResetVCSProviderOAuthTokenInput) (*ResetVCSProviderOAuthTokenResponse, error)
	ProcessOAuth(ctx context.Context, input *ProcessOAuthInput) error
	GetRepositoryArchive(ctx context.Context, input *GetRepositoryArchiveInput) (io.ReadCloser, error)
	CreateVCSTokenForPipeline(ctx context.Context, input *CreateVCSTokenForPipelineInput) (*CreateVCSTokenForPipelineResponse, error)
}

Service implements all the functionality related to VCSProviders.

func NewService

func NewService(
	logger logger.Logger,
	dbClient *db.Client,
	limitChecker limits.LimitChecker,
	activityService activityevent.Service,
	httpClient *http.Client,
	phobosURL string,
) (Service, error)

NewService returns an instance of Service.

type UpdateVCSProviderInput

type UpdateVCSProviderInput struct {
	Version             *int
	Description         *string
	OAuthClientID       *string
	OAuthClientSecret   *string
	PersonalAccessToken *string
	ID                  string
	ExtraOAuthScopes    []string
}

UpdateVCSProviderInput is the input for updating a VCS provider.

Directories

Path Synopsis
Package github package
Package github package
Package gitlab package
Package gitlab package
Package types package
Package types package

Jump to

Keyboard shortcuts

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