2015-04-08 22:00:27 +00:00
|
|
|
package remote
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
|
2015-05-17 20:51:42 +00:00
|
|
|
common "github.com/drone/drone/pkg/types"
|
2015-04-08 22:00:27 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Remote interface {
|
|
|
|
// Login authenticates the session and returns the
|
|
|
|
// remote user details.
|
|
|
|
Login(token, secret string) (*common.User, error)
|
|
|
|
|
2015-04-15 07:20:00 +00:00
|
|
|
// Orgs fetches the organizations for the given user.
|
|
|
|
Orgs(u *common.User) ([]string, error)
|
|
|
|
|
2015-04-08 22:00:27 +00:00
|
|
|
// Repo fetches the named repository from the remote system.
|
|
|
|
Repo(u *common.User, owner, repo string) (*common.Repo, error)
|
|
|
|
|
2015-04-21 22:48:06 +00:00
|
|
|
// Perm fetches the named repository permissions from
|
|
|
|
// the remote system for the specified user.
|
2015-04-08 22:00:27 +00:00
|
|
|
Perm(u *common.User, owner, repo string) (*common.Perm, error)
|
|
|
|
|
|
|
|
// Script fetches the build script (.drone.yml) from the remote
|
|
|
|
// repository and returns in string format.
|
2015-06-23 03:45:08 +00:00
|
|
|
Script(u *common.User, r *common.Repo, b *common.Build) ([]byte, error)
|
2015-04-08 22:00:27 +00:00
|
|
|
|
|
|
|
// Status sends the commit status to the remote system.
|
|
|
|
// An example would be the GitHub pull request status.
|
2015-06-23 03:45:08 +00:00
|
|
|
Status(u *common.User, r *common.Repo, b *common.Build) error
|
2015-04-08 22:00:27 +00:00
|
|
|
|
2015-04-28 21:39:48 +00:00
|
|
|
// Netrc returns a .netrc file that can be used to clone
|
|
|
|
// private repositories from a remote system.
|
2015-04-28 22:08:21 +00:00
|
|
|
Netrc(u *common.User) (*common.Netrc, error)
|
2015-04-28 21:39:48 +00:00
|
|
|
|
2015-04-08 22:00:27 +00:00
|
|
|
// Activate activates a repository by creating the post-commit hook and
|
|
|
|
// adding the SSH deploy key, if applicable.
|
|
|
|
Activate(u *common.User, r *common.Repo, k *common.Keypair, 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 *common.User, r *common.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) (*common.Hook, error)
|
2015-07-11 22:08:04 +00:00
|
|
|
|
|
|
|
// Default scope for remote
|
|
|
|
Scope() string
|
2015-04-08 22:00:27 +00:00
|
|
|
}
|