Documentation ¶
Index ¶
- Constants
- Variables
- type APIClient
- func (apiClient *APIClient) Alive(ctx context.Context) (bool, error)
- func (apiClient *APIClient) Cancel(ctx context.Context, jobID string, reason string) (*model.JobState, error)
- func (apiClient *APIClient) Debug(ctx context.Context) (map[string]model.DebugInfo, error)
- func (apiClient *APIClient) DoPost(ctx context.Context, api string, reqData, resData interface{}) error
- func (apiClient *APIClient) Get(ctx context.Context, jobID string) (*model.JobWithInfo, bool, error)
- func (apiClient *APIClient) GetEvents(ctx context.Context, jobID string, options legacymodels.EventFilterOptions) (events []model.JobHistory, err error)
- func (apiClient *APIClient) GetJobState(ctx context.Context, jobID string) (model.JobState, error)
- func (apiClient *APIClient) GetJobStateResolver() *legacy_job.StateResolver
- func (apiClient *APIClient) GetResults(ctx context.Context, jobID string) (results []model.PublishedResult, err error)
- func (apiClient *APIClient) List(ctx context.Context, idFilter string, includeTags []string, ...) ([]*model.JobWithInfo, error)
- func (apiClient *APIClient) Logs(ctx context.Context, jobID string, executionID string, withHistory bool, ...) (*websocket.Conn, error)
- func (apiClient *APIClient) Nodes(ctx context.Context) ([]models.NodeInfo, error)
- func (apiClient *APIClient) Submit(ctx context.Context, j *model.Job) (*model.Job, error)
- func (apiClient *APIClient) Version(ctx context.Context) (*models.BuildVersionInfo, error)
- type LegacyTLSSupport
Constants ¶
const APIRetryCount = 5
APIRetryCount - for some queries (like read events and read state) we want to fail early (10 seconds should be ample time) but retry a number of times - this is to avoid network flakes failing the canary
const APIShortTimeoutSeconds = 10
Variables ¶
var NoTLS = LegacyTLSSupport{UseTLS: false}
Functions ¶
This section is empty.
Types ¶
type APIClient ¶
type APIClient struct { BaseURI *url.URL DefaultHeaders map[string]string Client *http.Client Signer system.Signer ClientID string }
APIClient is a utility for interacting with a node's API server against v1 APIs.
func NewAPIClient ¶
func NewAPIClient( tlsinfo LegacyTLSSupport, cfg types.UserConfig, host string, port uint16, path ...string, ) (*APIClient, error)
NewAPIClient returns a new client for a node's API server against v1 APIs the client will use /api/v1 path by default is no custom path is defined Deprecated: use util.GetAPIClient TODOD(forrest) [WTF]: just more spaghetti. This needs to be a private method called from util.GetAPIClient
func (*APIClient) Cancel ¶
func (apiClient *APIClient) Cancel(ctx context.Context, jobID string, reason string) (*model.JobState, error)
Cancel will request that the job with the specified ID is stopped. The JobInfo will be returned if the cancel was submitted. If no match is found, Cancel returns false with a nil error.
func (*APIClient) Get ¶
func (apiClient *APIClient) Get(ctx context.Context, jobID string) (*model.JobWithInfo, bool, error)
Get returns job data for a particular job ID. If no match is found, Get returns false with a nil error.
func (*APIClient) GetEvents ¶
func (apiClient *APIClient) GetEvents( ctx context.Context, jobID string, options legacymodels.EventFilterOptions) (events []model.JobHistory, err error)
func (*APIClient) GetJobState ¶
func (*APIClient) GetJobStateResolver ¶
func (apiClient *APIClient) GetJobStateResolver() *legacy_job.StateResolver
func (*APIClient) GetResults ¶
func (*APIClient) List ¶
func (apiClient *APIClient) List( ctx context.Context, idFilter string, includeTags []string, excludeTags []string, maxJobs int, returnAll bool, sortBy string, sortReverse bool, ) ( []*model.JobWithInfo, error)
List returns the list of jobs in the node's transport.
func (*APIClient) Logs ¶
func (apiClient *APIClient) Logs( ctx context.Context, jobID string, executionID string, withHistory bool, follow bool) (*websocket.Conn, error)
Logs will retrieve the address of an endpoint where a client connection can be made to stream the results of an execution back to a TTY
type LegacyTLSSupport ¶ added in v1.2.1
LegacyTLSSupport contains information on how to use TLS (or not) to communicate with the v1 APIs