api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2019 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRunsLimit = 25
	MaxRunsLimit     = 40
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ArchivesHandler

type ArchivesHandler struct {
	// contains filtered or unexported fields
}

func NewArchivesHandler

func NewArchivesHandler(logger *zap.Logger, ost *objectstorage.ObjStorage) *ArchivesHandler

func (*ArchivesHandler) ServeHTTP

func (h *ArchivesHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type CacheCreateHandler

type CacheCreateHandler struct {
	// contains filtered or unexported fields
}

func NewCacheCreateHandler

func NewCacheCreateHandler(logger *zap.Logger, ost *objectstorage.ObjStorage) *CacheCreateHandler

func (*CacheCreateHandler) ServeHTTP

func (h *CacheCreateHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type CacheHandler

type CacheHandler struct {
	// contains filtered or unexported fields
}

func NewCacheHandler

func NewCacheHandler(logger *zap.Logger, ost *objectstorage.ObjStorage) *CacheHandler

func (*CacheHandler) ServeHTTP

func (h *CacheHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ChangeGroupsUpdateTokensHandler

type ChangeGroupsUpdateTokensHandler struct {
	// contains filtered or unexported fields
}

func NewChangeGroupsUpdateTokensHandler

func NewChangeGroupsUpdateTokensHandler(logger *zap.Logger, readDB *readdb.ReadDB) *ChangeGroupsUpdateTokensHandler

func (*ChangeGroupsUpdateTokensHandler) ServeHTTP

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client represents a Gogs API client.

func NewClient

func NewClient(url string) *Client

NewClient initializes and returns a API client.

func (*Client) ApproveRunTask

func (c *Client) ApproveRunTask(ctx context.Context, runID, taskID string, changeGroupsUpdateToken string) (*http.Response, error)

func (*Client) CheckCache

func (c *Client) CheckCache(ctx context.Context, key string, prefix bool) (*http.Response, error)

func (*Client) CreateRun

func (c *Client) CreateRun(ctx context.Context, req *RunCreateRequest) (*RunResponse, *http.Response, error)

func (*Client) GetArchive

func (c *Client) GetArchive(ctx context.Context, taskID string, step int) (*http.Response, error)

func (*Client) GetCache

func (c *Client) GetCache(ctx context.Context, key string, prefix bool) (*http.Response, error)

func (*Client) GetExecutorTask

func (c *Client) GetExecutorTask(ctx context.Context, executorID, etID string) (*rstypes.ExecutorTask, *http.Response, error)

func (*Client) GetExecutorTasks

func (c *Client) GetExecutorTasks(ctx context.Context, executorID string) ([]*rstypes.ExecutorTask, *http.Response, error)

func (*Client) GetGroupFirstQueuedRuns

func (c *Client) GetGroupFirstQueuedRuns(ctx context.Context, group string, changeGroups []string) (*GetRunsResponse, *http.Response, error)

func (*Client) GetGroupLastRun

func (c *Client) GetGroupLastRun(ctx context.Context, group string, changeGroups []string) (*GetRunsResponse, *http.Response, error)

func (*Client) GetGroupQueuedRuns

func (c *Client) GetGroupQueuedRuns(ctx context.Context, group string, limit int, changeGroups []string) (*GetRunsResponse, *http.Response, error)

func (*Client) GetGroupRunningRuns

func (c *Client) GetGroupRunningRuns(ctx context.Context, group string, limit int, changeGroups []string) (*GetRunsResponse, *http.Response, error)

func (*Client) GetLogs

func (c *Client) GetLogs(ctx context.Context, runID, taskID string, setup bool, step int, follow bool) (*http.Response, error)

func (*Client) GetQueuedRuns

func (c *Client) GetQueuedRuns(ctx context.Context, start string, limit int, changeGroups []string) (*GetRunsResponse, *http.Response, error)

func (*Client) GetRun

func (c *Client) GetRun(ctx context.Context, runID string, changeGroups []string) (*RunResponse, *http.Response, error)

func (*Client) GetRunEvents

func (c *Client) GetRunEvents(ctx context.Context, startRunEventID string) (*http.Response, error)

func (*Client) GetRunningRuns

func (c *Client) GetRunningRuns(ctx context.Context, start string, limit int, changeGroups []string) (*GetRunsResponse, *http.Response, error)

func (*Client) GetRuns

func (c *Client) GetRuns(ctx context.Context, phaseFilter, resultFilter, groups []string, lastRun bool, changeGroups []string, start string, limit int, asc bool) (*GetRunsResponse, *http.Response, error)

func (*Client) PutCache

func (c *Client) PutCache(ctx context.Context, key string, size int64, r io.Reader) (*http.Response, error)

func (*Client) RunActions

func (c *Client) RunActions(ctx context.Context, runID string, req *RunActionsRequest) (*http.Response, error)

func (*Client) RunTaskActions

func (c *Client) RunTaskActions(ctx context.Context, runID, taskID string, req *RunTaskActionsRequest) (*http.Response, error)

func (*Client) RunTaskSetAnnotations

func (c *Client) RunTaskSetAnnotations(ctx context.Context, runID, taskID string, annotations map[string]string, changeGroupsUpdateToken string) (*http.Response, error)

func (*Client) SendExecutorStatus

func (c *Client) SendExecutorStatus(ctx context.Context, executor *rstypes.Executor) (*http.Response, error)

func (*Client) SendExecutorTaskStatus

func (c *Client) SendExecutorTaskStatus(ctx context.Context, executorID string, et *rstypes.ExecutorTask) (*http.Response, error)

func (*Client) SetHTTPClient

func (c *Client) SetHTTPClient(client *http.Client)

SetHTTPClient replaces default http.Client with user given one.

func (*Client) StartRun

func (c *Client) StartRun(ctx context.Context, runID string, changeGroupsUpdateToken string) (*http.Response, error)

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"`
}

func ErrorResponseFromError

func ErrorResponseFromError(err error) *ErrorResponse

type ExecutorDeleteHandler

type ExecutorDeleteHandler struct {
	// contains filtered or unexported fields
}

func NewExecutorDeleteHandler

func NewExecutorDeleteHandler(logger *zap.Logger, ah *action.ActionHandler) *ExecutorDeleteHandler

func (*ExecutorDeleteHandler) ServeHTTP

type ExecutorStatusHandler

type ExecutorStatusHandler struct {
	// contains filtered or unexported fields
}

func NewExecutorStatusHandler

func NewExecutorStatusHandler(logger *zap.Logger, e *etcd.Store, ah *action.ActionHandler) *ExecutorStatusHandler

func (*ExecutorStatusHandler) ServeHTTP

type ExecutorTaskHandler

type ExecutorTaskHandler struct {
	// contains filtered or unexported fields
}

func NewExecutorTaskHandler

func NewExecutorTaskHandler(e *etcd.Store) *ExecutorTaskHandler

func (*ExecutorTaskHandler) ServeHTTP

func (h *ExecutorTaskHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ExecutorTaskStatusHandler

type ExecutorTaskStatusHandler struct {
	// contains filtered or unexported fields
}

func NewExecutorTaskStatusHandler

func NewExecutorTaskStatusHandler(e *etcd.Store, c chan<- *types.ExecutorTask) *ExecutorTaskStatusHandler

func (*ExecutorTaskStatusHandler) ServeHTTP

type ExecutorTasksHandler

type ExecutorTasksHandler struct {
	// contains filtered or unexported fields
}

func NewExecutorTasksHandler

func NewExecutorTasksHandler(e *etcd.Store) *ExecutorTasksHandler

func (*ExecutorTasksHandler) ServeHTTP

func (h *ExecutorTasksHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type GetRunsResponse

type GetRunsResponse struct {
	Runs                    []*types.Run `json:"runs"`
	ChangeGroupsUpdateToken string       `json:"change_groups_update_tokens"`
}

type LogsHandler

type LogsHandler struct {
	// contains filtered or unexported fields
}

func NewLogsHandler

func NewLogsHandler(logger *zap.Logger, e *etcd.Store, ost *objectstorage.ObjStorage, dm *datamanager.DataManager) *LogsHandler

func (*LogsHandler) ServeHTTP

func (h *LogsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RunActionType

type RunActionType string
const (
	RunActionTypeChangePhase RunActionType = "changephase"
	RunActionTypeStop        RunActionType = "stop"
)

type RunActionsHandler

type RunActionsHandler struct {
	// contains filtered or unexported fields
}

func NewRunActionsHandler

func NewRunActionsHandler(logger *zap.Logger, ah *action.ActionHandler) *RunActionsHandler

func (*RunActionsHandler) ServeHTTP

func (h *RunActionsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RunActionsRequest

type RunActionsRequest struct {
	ActionType RunActionType `json:"action_type"`

	Phase                   types.RunPhase `json:"phase"`
	ChangeGroupsUpdateToken string         `json:"change_groups_update_tokens"`
}

type RunCreateHandler

type RunCreateHandler struct {
	// contains filtered or unexported fields
}

func NewRunCreateHandler

func NewRunCreateHandler(logger *zap.Logger, ah *action.ActionHandler) *RunCreateHandler

func (*RunCreateHandler) ServeHTTP

func (h *RunCreateHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RunCreateRequest

type RunCreateRequest struct {
	// new run fields
	RunConfigTasks    map[string]*types.RunConfigTask `json:"run_config_tasks"`
	Name              string                          `json:"name"`
	Group             string                          `json:"group"`
	SetupErrors       []string                        `json:"setup_errors"`
	StaticEnvironment map[string]string               `json:"static_environment"`
	CacheGroup        string                          `json:"cache_group"`

	// existing run fields
	RunID      string   `json:"run_id"`
	FromStart  bool     `json:"from_start"`
	ResetTasks []string `json:"reset_tasks"`

	// common fields
	Environment map[string]string `json:"environment"`
	Annotations map[string]string `json:"annotations"`

	ChangeGroupsUpdateToken string `json:"changeup_update_tokens"`
}

type RunEventsHandler

type RunEventsHandler struct {
	// contains filtered or unexported fields
}

func NewRunEventsHandler

func NewRunEventsHandler(logger *zap.Logger, e *etcd.Store, ost *objectstorage.ObjStorage, dm *datamanager.DataManager) *RunEventsHandler

func (*RunEventsHandler) ServeHTTP

func (h *RunEventsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RunHandler

type RunHandler struct {
	// contains filtered or unexported fields
}

func NewRunHandler

func NewRunHandler(logger *zap.Logger, e *etcd.Store, dm *datamanager.DataManager, readDB *readdb.ReadDB) *RunHandler

func (*RunHandler) ServeHTTP

func (h *RunHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RunResponse

type RunResponse struct {
	Run                     *types.Run       `json:"run"`
	RunConfig               *types.RunConfig `json:"run_config"`
	ChangeGroupsUpdateToken string           `json:"change_groups_update_tokens"`
}

type RunTaskActionType

type RunTaskActionType string
const (
	RunTaskActionTypeSetAnnotations RunTaskActionType = "setannotations"
	RunTaskActionTypeApprove        RunTaskActionType = "approve"
)

type RunTaskActionsHandler

type RunTaskActionsHandler struct {
	// contains filtered or unexported fields
}

func NewRunTaskActionsHandler

func NewRunTaskActionsHandler(logger *zap.Logger, ah *action.ActionHandler) *RunTaskActionsHandler

func (*RunTaskActionsHandler) ServeHTTP

type RunTaskActionsRequest

type RunTaskActionsRequest struct {
	ActionType RunTaskActionType `json:"action_type"`

	// set Annotations fields
	Annotations map[string]string `json:"annotations,omitempty"`

	// global fields
	ChangeGroupsUpdateToken string `json:"change_groups_update_tokens"`
}

type RunsHandler

type RunsHandler struct {
	// contains filtered or unexported fields
}

func NewRunsHandler

func NewRunsHandler(logger *zap.Logger, readDB *readdb.ReadDB) *RunsHandler

func (*RunsHandler) ServeHTTP

func (h *RunsHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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