remote

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2017 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Activate added in v0.4.2

func Activate(c context.Context, u *model.User, r *model.Repo, link string) error

Activate activates a repository by creating the post-commit hook and adding the SSH deploy key, if applicable.

func Auth added in v0.4.2

func Auth(c context.Context, token, secret string) (string, error)

Auth authenticates the session and returns the remote user login for the given token and secret

func Deactivate added in v0.4.2

func Deactivate(c context.Context, u *model.User, r *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 File added in v0.4.2

func File(c context.Context, u *model.User, r *model.Repo, b *model.Build, f string) (out []byte, err error)

File fetches a file from the remote repository and returns in string format.

func Hook added in v0.4.2

func Hook(c context.Context, r *http.Request) (*model.Repo, *model.Build, error)

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

func Login added in v0.4.2

Login authenticates the session and returns the remote user details.

func Netrc added in v0.4.2

func Netrc(c context.Context, u *model.User, r *model.Repo) (*model.Netrc, error)

Netrc returns a .netrc file that can be used to clone private repositories from a remote system.

func Perm added in v0.4.2

func Perm(c context.Context, u *model.User, owner, repo string) (*model.Perm, error)

Perm fetches the named repository permissions from the remote system for the specified user.

func Refresh added in v0.4.2

func Refresh(c context.Context, u *model.User) (bool, error)

Refresh refreshes an oauth token and expiration for the given user. It returns true if the token was refreshed, false if the token was not refreshed, and error if it failed to refersh.

func Repo added in v0.4.2

func Repo(c context.Context, u *model.User, owner, repo string) (*model.Repo, error)

Repo fetches the named repository from the remote system.

func Repos added in v0.4.2

func Repos(c context.Context, u *model.User) ([]*model.Repo, error)

Repos fetches a list of repos from the remote system.

func Status added in v0.4.2

func Status(c context.Context, u *model.User, r *model.Repo, b *model.Build, link string) error

Status sends the commit status to the remote system. An example would be the GitHub pull request status.

func Teams added in v0.5.0

func Teams(c context.Context, u *model.User) ([]*model.Team, error)

Teams fetches a list of team memberships from the remote system.

func ToContext

func ToContext(c Setter, r Remote)

ToContext adds the Remote to this context if it supports the Setter interface.

Types

type AuthError added in v0.5.0

type AuthError struct {
	Err         string
	Description string
	URI         string
}

AuthError represents remote authentication error.

func (*AuthError) Error added in v0.5.0

func (ae *AuthError) Error() string

Error implements error interface.

type Refresher

type Refresher interface {
	Refresh(*model.User) (bool, error)
}

Refresher refreshes an oauth token and expiration for the given user. It returns true if the token was refreshed, false if the token was not refreshed, and error if it failed to refersh.

type Remote

type Remote interface {
	// Login authenticates the session and returns the
	// remote user details.
	Login(w http.ResponseWriter, r *http.Request) (*model.User, error)

	// Auth authenticates the session and returns the remote user
	// login for the given token and secret
	Auth(token, secret string) (string, error)

	// Teams fetches a list of team memberships from the remote system.
	Teams(u *model.User) ([]*model.Team, error)

	// Repo fetches the named repository from the remote system.
	Repo(u *model.User, owner, repo string) (*model.Repo, error)

	// Repos fetches a list of repos from the remote system.
	Repos(u *model.User) ([]*model.Repo, error)

	// Perm fetches the named repository permissions from
	// the remote system for the specified user.
	Perm(u *model.User, owner, repo string) (*model.Perm, error)

	// File fetches a file from the remote repository and returns in string
	// format.
	File(u *model.User, r *model.Repo, b *model.Build, f string) ([]byte, error)

	// FileRef fetches a file from the remote repository for the given ref
	// and returns in string format.
	FileRef(u *model.User, r *model.Repo, ref, f string) ([]byte, error)

	// Status sends the commit status to the remote system.
	// An example would be the GitHub pull request status.
	Status(u *model.User, r *model.Repo, b *model.Build, link string) error

	// Netrc returns a .netrc file that can be used to clone
	// private repositories from a remote system.
	Netrc(u *model.User, r *model.Repo) (*model.Netrc, error)

	// Activate activates a repository by creating the post-commit hook.
	Activate(u *model.User, r *model.Repo, link string) error

	// Deactivate deactivates a repository by removing all previously created
	// post-commit hooks matching the given link.
	Deactivate(u *model.User, r *model.Repo, link string) error

	// Hook parses the post-commit hook from the Request body and returns the
	// required data in a standard format.
	Hook(r *http.Request) (*model.Repo, *model.Build, error)
}

func FromContext

func FromContext(c context.Context) Remote

FromContext returns the Remote associated with this context.

type Setter

type Setter interface {
	Set(string, interface{})
}

Setter defines a context that enables setting values.

Jump to

Keyboard shortcuts

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