remoteprovider

package
v0.0.0-...-4d3a7dc Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2021 License: MIT Imports: 3 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupClientFromContext

func SetupClientFromContext(client Client, remoteProviderURL string, c *gin.Context) bool

Types

type BaseClient

type BaseClient struct {
	apiclient.BaseClient
	RemoteProviderURL string
}

BaseClient implements a subset of the Client interface, and has fields that are common to all current implementations of it.

func NewClient

func NewClient(ctx context.Context, token, remoteProviderURL string) *BaseClient

func (*BaseClient) GetRemoteProviderURL

func (c *BaseClient) GetRemoteProviderURL() string

func (*BaseClient) SetRemoteProviderURL

func (c *BaseClient) SetRemoteProviderURL(remoteProviderURL string)

type Client

type Client interface {
	apiclient.Client

	// FetchFile fetches a file from the API.
	FetchFile(projectIdentifiers ProjectIdentifier, fileName string) ([]byte, error)
	// FetchBranches fetches branches for a specific project from the API.
	FetchBranches(projectIdentifier ProjectIdentifier) ([]WharfBranch, error)
	// FetchProjectByGroupAndProjectName should only be used if the remote
	// project ID for the project is not available. If it is available then
	// FetchProjectByID should be used instead.
	//
	// Mainly used for migrations for projects added prior to when we started
	// tracking projects by their remote project ID in wharf-api.
	FetchProjectByGroupAndProjectName(groupName, projectName string) (WharfProject, error)

	// GetRemoteProviderURL returns the set remote provider URL.
	//
	// Implemented by BaseClient for convenience.
	GetRemoteProviderURL() string

	// SetRemoteProviderURL sets the remote provider URL.
	//
	// Implemented by BaseClient for convenience.
	SetRemoteProviderURL(remoteProviderURL string)

	// WharfProjectToIdentifier extracts the required information to uniquely
	// identify a project when communicating with the API, and returns it in the
	// form of a ProjectIdentifier object.
	//
	// The order of the values are up to the implementation.
	WharfProjectToIdentifier(project WharfProject) ProjectIdentifier
}

type ProjectIdentifier

type ProjectIdentifier struct {
	Values []string
}

ProjectIdentifier holds the values necessary to uniquely identify a project when communicating with the remote provider.

Instances of this object should be obtained through the Client.WharfProjectToIdentifier method.

type WharfBranch

type WharfBranch = apiclient.WharfBranch

WharfBranch is an alias for apiclient's WharfBranch.

type WharfProject

type WharfProject = apiclient.WharfProject

WharfProject is an alias for apiclient's WharfProject.

Jump to

Keyboard shortcuts

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