Documentation ¶
Index ¶
- func Activate(c context.Context, u *model.User, r *model.Repo, k *model.Key, link string) error
- func Auth(c context.Context, token, secret string) (string, error)
- func Deactivate(c context.Context, u *model.User, r *model.Repo, link string) error
- func Hook(c context.Context, r *http.Request) (*model.Repo, *model.Build, error)
- func Login(c context.Context, w http.ResponseWriter, r *http.Request) (*model.User, bool, error)
- func Netrc(c context.Context, u *model.User, r *model.Repo) (*model.Netrc, error)
- func Perm(c context.Context, u *model.User, owner, repo string) (*model.Perm, error)
- func Refresh(c context.Context, u *model.User) (bool, error)
- func Repo(c context.Context, u *model.User, owner, repo string) (*model.Repo, error)
- func Repos(c context.Context, u *model.User) ([]*model.RepoLite, error)
- func Script(c context.Context, u *model.User, r *model.Repo, b *model.Build) ([]byte, []byte, error)
- func Status(c context.Context, u *model.User, r *model.Repo, b *model.Build, link string) error
- func ToContext(c Setter, r Remote)
- type Refresher
- type Remote
- type Setter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Activate ¶
Activate activates a repository by creating the post-commit hook and adding the SSH deploy key, if applicable.
func Auth ¶
Auth authenticates the session and returns the remote user login for the given token and secret
func Deactivate ¶
Deactivate removes a repository by removing all the post-commit hooks which are equal to link and removing the SSH deploy key.
func Hook ¶
Hook parses the post-commit hook from the Request body and returns the required data in a standard format.
func Netrc ¶
Netrc returns a .netrc file that can be used to clone private repositories from a remote system.
func Perm ¶
Perm fetches the named repository permissions from the remote system for the specified user.
func Refresh ¶
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 Script ¶
func Script(c context.Context, u *model.User, r *model.Repo, b *model.Build) ([]byte, []byte, error)
Script fetches the build script (.drone.yml) from the remote repository and returns in string format.
Types ¶
type Remote ¶
type Remote interface { // Login authenticates the session and returns the // remote user details. Login(w http.ResponseWriter, r *http.Request) (*model.User, bool, error) // Auth authenticates the session and returns the remote user // login for the given token and secret Auth(token, secret string) (string, 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.RepoLite, 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) // Script fetches the build script (.drone.yml) from the remote // repository and returns in string format. Script(u *model.User, r *model.Repo, b *model.Build) ([]byte, []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 and // adding the SSH deploy key, if applicable. Activate(u *model.User, r *model.Repo, k *model.Key, 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. 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 ¶
FromContext returns the Remote associated with this context.