scm

package
v0.3.5-hr Latest Latest
Warning

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

Go to latest
Published: May 9, 2018 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateSCMToken added in v0.3.0

func GenerateSCMToken(config *api.SCMConfig) error

GenerateSCMToken generates the SCM token according to the config. Make sure the type, server of the SCM is provided. If the SCM is Github, the username is required. If the access token is provided, it should be checked whether has authority of repos. Generate new token only when the username and password are provided at the same time.

func RegisterManager added in v0.3.5

func RegisterManager(scmType string, manager SCMManager) error

RegisterManager registers SCM managers

func RegisterProvider added in v0.3.0

func RegisterProvider(scmType api.SCMType, provider SCMProvider) error

RegisterProvider registers SCM providers.

Types

type Manager

type Manager struct {
	DataStore *store.DataStore
}

Manager represents the manager for scm.

func (*Manager) FindScm

func (scm *Manager) FindScm(scmType string) (SCMManager, error)

FindScm returns the scm by scm type.

type SCMManager added in v0.3.5

type SCMManager interface {
	Authcallback(code, state string) (string, error)
	GetRepos(string) ([]api.Repository, string, string, error)
	LogOut(projectID string) error
	GetAuthCodeURL(state string, scmType string) (string, error)
}

SCM is the interface of all operations needed for scm repository.

func GetSCMManager added in v0.3.5

func GetSCMManager(scmType string) (SCMManager, error)

GetSCMProvider gets the SCM provider by the type.

type SCMProvider added in v0.3.0

type SCMProvider interface {
	GetToken(scm *api.SCMConfig) (string, error)
	ListRepos(scm *api.SCMConfig) ([]api.Repository, error)
	ListBranches(scm *api.SCMConfig, repo string) ([]string, error)
	CheckToken(scm *api.SCMConfig) bool
}

SCMProvider represents the interface of SCM provider.

func GetSCMProvider added in v0.3.0

func GetSCMProvider(scmType api.SCMType) (SCMProvider, error)

GetSCMProvider gets the SCM provider by the type.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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