gitlab

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2015 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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 GetRandom

func GetRandom() string

GetRandom is a helper function that generates a 32-bit random key, base32 encoded as a string value.

func IsAdmin

func IsAdmin(proj *gogitlab.Project) bool

IsAdmin is a helper function that returns true if the user has Admin access to the repository.

func IsRead

func IsRead(proj *gogitlab.Project) bool

IsRead is a helper function that returns true if the user has Read-only access to the repository.

func IsWrite

func IsWrite(proj *gogitlab.Project) bool

IsWrite is a helper function that returns true if the user has Read-Write access to the repository.

func NewClient

func NewClient(url, accessToken string, skipVerify bool) *gogitlab.Gitlab

NewClient is a helper function that returns a new GitHub client using the provided OAuth token.

func NewOauthConfig

func NewOauthConfig(g *Gitlab, host string) *oauth.Config

func Register

func Register()

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

Types

type Gitlab

type Gitlab struct {
	SkipVerify bool
	Open       bool
	Client     string
	Secret     string
	// contains filtered or unexported fields
}

func New

func New(url string, skipVerify, open bool, client, secret string) *Gitlab

func (*Gitlab) Activate

func (r *Gitlab) 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 (*Gitlab) Authorize

func (r *Gitlab) Authorize(res http.ResponseWriter, req *http.Request) (*model.Login, error)

Authorize handles authentication with thrid party remote systems, such as github or bitbucket, and returns user data.

func (*Gitlab) Deactivate

func (r *Gitlab) 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 and removing the SSH deploy key.

func (*Gitlab) GetHost

func (r *Gitlab) GetHost() string

GetHost returns the hostname of this remote GitHub instance.

func (*Gitlab) GetKind

func (r *Gitlab) GetKind() string

GetKind returns the identifier of this remote GitHub instane.

func (*Gitlab) GetRepos

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

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

func (*Gitlab) GetScript

func (r *Gitlab) 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 (*Gitlab) GetToken

func (r *Gitlab) GetToken(user *model.User) (*model.Token, error)

func (*Gitlab) OpenRegistration

func (r *Gitlab) OpenRegistration() bool

func (*Gitlab) ParseHook

func (r *Gitlab) 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