factory

package
v1.5.161 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2020 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultIdentifier = NewDriverIdentifier()

DefaultIdentifier is the default driver identifier used by FromRepoURL.

View Source
var MissingGitServerURL = fmt.Errorf("No git serverURL was specified")

MissingGitServerURL the error returned if you use a git driver that needs a git server URL

Functions

func Client

func Client(httpClient *http.Client) clientOptionFunc

func FromRepoURL

func FromRepoURL(repoURL string) (*scm.Client, error)

FromRepoURL parses a URL of the form https://:authtoken@host/ and attempts to determine the driver and creates a client to authenticate to the endpoint.

func NewClient

func NewClient(driver, serverURL, oauthToken string, opts ...clientOptionFunc) (*scm.Client, error)

NewClient creates a new client for a given driver, serverURL and OAuth token

func NewClientFromEnvironment

func NewClientFromEnvironment() (*scm.Client, error)

NewClientFromEnvironment creates a new client using environment variables $GIT_KIND, $GIT_SERVER, $GIT_TOKEN defaulting to github if no $GIT_KIND or $GIT_SERVER

func NewWebHookService

func NewWebHookService(driver string) (scm.WebhookService, error)

Types

type HostDriverIdentifier

type HostDriverIdentifier map[string]string

HostDriverIdentifier is a mapping of hostname to scm driver.

func NewDriverIdentifier

func NewDriverIdentifier(extras ...MappingFunc) HostDriverIdentifier

NewDriverIdentifier creates and returns a new HostDriverIdentifier.

func (HostDriverIdentifier) Identify

func (u HostDriverIdentifier) Identify(host string) (string, error)

Identify looks up the provided hostname, and returns the driver mapping.

If no mapping exists, then it returns an error.

type MappingFunc

type MappingFunc func(HostDriverIdentifier)

MappingFunc is a type for adding names to the list of mappings from hosts to drivers.

func Mapping

func Mapping(host, driver string) MappingFunc

Mapping adds a host,driver combination to the DriverIdentifier.

Directories

Path Synopsis
examples
pr
ref

Jump to

Keyboard shortcuts

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