stash

package
v0.2.1-0...-0398299 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2015 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetHook

func GetHook(user *model.User, repo *model.Repo, link string) string

func GetKeyTitle

func GetKeyTitle(rawurl string) (string, error)

GetKeyTitle is a helper function that generates a title for the RSA public key based on the username and domain name.

func Register

func Register()

Registers the Stash plugin using the default settings from the config file or environment variables

Types

type Stash

type Stash struct {
	URL        string
	API        string
	Secret     string
	PrivateKey string
	Hook       string
	Open       bool
}

func New

func New(url, api, secret, private_key, hook string, open bool) *Stash

func (*Stash) Activate

func (r *Stash) Activate(user *model.User, repo *model.Repo, link string) error

Activate activates a repository by adding a Post-Commit hook and a Public Deploy key, if applicable.

func (*Stash) Authorize

func (r *Stash) Authorize(w http.ResponseWriter, req *http.Request) (*model.Login, error)

GetLogin handles authentication to third party, remote services and returns the required user data in a standard format.

func (*Stash) Deactivate

func (r *Stash) Deactivate(user *model.User, repo *model.Repo, link string) error

Deactivate removes a repository by removing all the post-commit hooks which are equal to link. SSH key is not removed as this is on the user, not the repo

func (*Stash) GetHost

func (r *Stash) GetHost() string

GetHost returns the url.Host of this remote system.

func (*Stash) GetKind

func (r *Stash) GetKind() string

GetKind returns the internal identifier of this remote Stash instance.

func (*Stash) GetRepos

func (r *Stash) GetRepos(user *model.User) ([]*model.Repo, error)

GetRepos fetches all repositories that the specified user has access to in the remote system.

func (*Stash) GetScript

func (r *Stash) GetScript(user *model.User, repo *model.Repo, hook *model.Hook) ([]byte, error)

GetScript fetches the build script (.drone.yml) from the remote repository and returns in string format.

func (*Stash) GetToken

func (s *Stash) GetToken(user *model.User) (*model.Token, error)

func (*Stash) OpenRegistration

func (s *Stash) OpenRegistration() bool

func (*Stash) ParseHook

func (r *Stash) ParseHook(req *http.Request) (*model.Hook, error)

ParseHook parses the post-commit hook from the Request body and returns the required data in a standard format.

Jump to

Keyboard shortcuts

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