git

package
v0.0.0-...-e3fd340 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns true if the error represents a NotFound response from an upstream service.

Types

type ClientFactory

type ClientFactory interface {
	// Create creates a new client, using the provided token for authentication.
	Create(url, token string) (SCM, error)
}

ClientFactory is an interface for creating SCM clients based on the URL to be fetched.

type SCM

type SCM interface {
	// FileContents returns the contents of a file within a repo.
	FileContents(ctx context.Context, repo, path, ref string) ([]byte, error)
}

SCM is a wrapper around go-scm's Client implementation.

type SCMClient

type SCMClient struct {
	Client *scm.Client
	// contains filtered or unexported fields
}

SCMClient is a wrapper for the go-scm scm.Client with a simplified API.

func New

func New(c *scm.Client, m metrics.Interface) *SCMClient

New creates and returns a new SCMClient.

func (*SCMClient) FileContents

func (c *SCMClient) FileContents(ctx context.Context, repo, path, ref string) ([]byte, error)

FileContents reads the specific revision of a file from a repository.

If an HTTP error is returned by the upstream service, an error with the response status code is returned.

type SCMClientFactory

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

SCMClientFactory is an implementation of the GitClientFactory interface that can create clients based on go-scm.

func NewClientFactory

func NewClientFactory(m metrics.Interface) *SCMClientFactory

NewClientFactory creates and returns an SCMClientFactory.

func (*SCMClientFactory) Create

func (s *SCMClientFactory) Create(url, token string) (SCM, error)

type SCMError

type SCMError struct {
	Status int
	// contains filtered or unexported fields
}

func (SCMError) Error

func (s SCMError) Error() string

Jump to

Keyboard shortcuts

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