2016-04-20 01:37:53 +00:00
|
|
|
package client
|
|
|
|
|
|
|
|
import (
|
|
|
|
"io"
|
|
|
|
|
2016-04-23 11:27:28 +00:00
|
|
|
"github.com/drone/drone/model"
|
2016-04-20 01:37:53 +00:00
|
|
|
"github.com/drone/drone/queue"
|
|
|
|
)
|
|
|
|
|
2016-04-22 01:05:54 +00:00
|
|
|
// Client is used to communicate with a Drone server.
|
|
|
|
type Client interface {
|
2016-05-06 17:59:36 +00:00
|
|
|
// Self returns the currently authenticated user.
|
|
|
|
Self() (*model.User, error)
|
|
|
|
|
|
|
|
// User returns a user by login.
|
|
|
|
User(string) (*model.User, error)
|
|
|
|
|
|
|
|
// UserList returns a list of all registered users.
|
|
|
|
UserList() ([]*model.User, error)
|
|
|
|
|
|
|
|
// UserPost creates a new user account.
|
|
|
|
UserPost(*model.User) (*model.User, error)
|
|
|
|
|
|
|
|
// UserPatch updates a user account.
|
|
|
|
UserPatch(*model.User) (*model.User, error)
|
|
|
|
|
|
|
|
// UserDel deletes a user account.
|
|
|
|
UserDel(string) error
|
|
|
|
|
|
|
|
// // UserFeed returns the user's activity feed.
|
|
|
|
// UserFeed() ([]*Activity, error)
|
|
|
|
|
|
|
|
// Repo returns a repository by name.
|
|
|
|
Repo(string, string) (*model.Repo, error)
|
|
|
|
|
2016-05-11 05:19:45 +00:00
|
|
|
// RepoList returns a list of all repositories to which the user has explicit
|
|
|
|
// access in the host system.
|
2016-05-06 17:59:36 +00:00
|
|
|
RepoList() ([]*model.Repo, error)
|
|
|
|
|
|
|
|
// RepoPost activates a repository.
|
|
|
|
RepoPost(string, string) (*model.Repo, error)
|
|
|
|
|
|
|
|
// RepoPatch updates a repository.
|
|
|
|
RepoPatch(*model.Repo) (*model.Repo, error)
|
|
|
|
|
2016-07-08 22:40:29 +00:00
|
|
|
// RepoChown updates a repository owner.
|
|
|
|
RepoChown(string, string) (*model.Repo, error)
|
|
|
|
|
2016-05-06 17:59:36 +00:00
|
|
|
// RepoDel deletes a repository.
|
|
|
|
RepoDel(string, string) error
|
|
|
|
|
2016-04-23 11:27:28 +00:00
|
|
|
// Sign returns a cryptographic signature for the input string.
|
|
|
|
Sign(string, string, []byte) ([]byte, error)
|
|
|
|
|
2016-06-27 21:06:02 +00:00
|
|
|
// SecretList returns a list of all repository secrets.
|
|
|
|
SecretList(string, string) ([]*model.Secret, error)
|
|
|
|
|
2016-04-23 11:27:28 +00:00
|
|
|
// SecretPost create or updates a repository secret.
|
|
|
|
SecretPost(string, string, *model.Secret) error
|
|
|
|
|
|
|
|
// SecretDel deletes a named repository secret.
|
|
|
|
SecretDel(string, string, string) error
|
|
|
|
|
2016-07-25 15:03:54 +00:00
|
|
|
// TeamSecretList returns a list of all team secrets.
|
|
|
|
TeamSecretList(string) ([]*model.Secret, error)
|
|
|
|
|
|
|
|
// TeamSecretPost create or updates a team secret.
|
|
|
|
TeamSecretPost(string, *model.Secret) error
|
|
|
|
|
|
|
|
// TeamSecretDel deletes a named team secret.
|
|
|
|
TeamSecretDel(string, string) error
|
|
|
|
|
2016-05-06 17:59:36 +00:00
|
|
|
// Build returns a repository build by number.
|
|
|
|
Build(string, string, int) (*model.Build, error)
|
|
|
|
|
2016-05-11 05:19:45 +00:00
|
|
|
// BuildLast returns the latest repository build by branch. An empty branch
|
|
|
|
// will result in the default branch.
|
2016-05-06 17:59:36 +00:00
|
|
|
BuildLast(string, string, string) (*model.Build, error)
|
|
|
|
|
|
|
|
// BuildList returns a list of recent builds for the
|
|
|
|
// the specified repository.
|
|
|
|
BuildList(string, string) ([]*model.Build, error)
|
|
|
|
|
2016-05-11 05:19:45 +00:00
|
|
|
// BuildQueue returns a list of enqueued builds.
|
|
|
|
BuildQueue() ([]*model.Feed, error)
|
|
|
|
|
2016-05-06 17:59:36 +00:00
|
|
|
// BuildStart re-starts a stopped build.
|
2016-07-27 21:11:54 +00:00
|
|
|
BuildStart(string, string, int, map[string]string) (*model.Build, error)
|
2016-05-06 17:59:36 +00:00
|
|
|
|
|
|
|
// BuildStop stops the specified running job for given build.
|
|
|
|
BuildStop(string, string, int, int) error
|
|
|
|
|
2016-05-11 05:19:45 +00:00
|
|
|
// BuildFork re-starts a stopped build with a new build number, preserving
|
|
|
|
// the prior history.
|
2016-07-27 21:11:54 +00:00
|
|
|
BuildFork(string, string, int, map[string]string) (*model.Build, error)
|
2016-05-06 17:59:36 +00:00
|
|
|
|
|
|
|
// BuildLogs returns the build logs for the specified job.
|
|
|
|
BuildLogs(string, string, int, int) (io.ReadCloser, error)
|
|
|
|
|
2016-05-11 05:19:45 +00:00
|
|
|
// Deploy triggers a deployment for an existing build using the specified
|
|
|
|
// target environment.
|
2016-07-27 21:11:54 +00:00
|
|
|
Deploy(string, string, int, string, map[string]string) (*model.Build, error)
|
2016-05-06 17:59:36 +00:00
|
|
|
|
2016-05-12 01:43:24 +00:00
|
|
|
// AgentList returns a list of build agents.
|
|
|
|
AgentList() ([]*model.Agent, error)
|
|
|
|
|
2016-05-06 17:59:36 +00:00
|
|
|
//
|
2016-05-12 01:43:24 +00:00
|
|
|
// below items for Queue (internal use only)
|
2016-05-06 17:59:36 +00:00
|
|
|
//
|
|
|
|
|
2016-04-22 01:05:54 +00:00
|
|
|
// Pull pulls work from the server queue.
|
|
|
|
Pull(os, arch string) (*queue.Work, error)
|
2016-04-20 01:37:53 +00:00
|
|
|
|
2016-04-22 01:05:54 +00:00
|
|
|
// Push pushes an update to the server.
|
|
|
|
Push(*queue.Work) error
|
2016-04-20 01:37:53 +00:00
|
|
|
|
2016-04-22 01:05:54 +00:00
|
|
|
// Stream streams the build logs to the server.
|
|
|
|
Stream(int64, io.ReadCloser) error
|
2016-04-20 01:37:53 +00:00
|
|
|
|
2016-05-23 21:35:58 +00:00
|
|
|
LogStream(int64) (StreamWriter, error)
|
|
|
|
|
|
|
|
LogPost(int64, io.ReadCloser) error
|
|
|
|
|
2016-04-22 01:05:54 +00:00
|
|
|
// Wait waits for the job to the complete.
|
|
|
|
Wait(int64) *Wait
|
2016-05-11 21:37:56 +00:00
|
|
|
|
|
|
|
// Ping the server
|
|
|
|
Ping() error
|
2016-04-20 01:37:53 +00:00
|
|
|
}
|