Documentation ¶
Index ¶
- func DialAsyncResult[In apimodels.Request, Out any](ctx context.Context, client Client, endpoint string, r In) (<-chan *concurrency.AsyncResult[Out], error)
- type API
- type Agent
- func (c *Agent) Alive(ctx context.Context) (*apimodels.IsAliveResponse, error)
- func (c *Agent) Config(ctx context.Context) (*apimodels.GetAgentConfigResponse, error)
- func (c *Agent) Node(ctx context.Context, req *apimodels.GetAgentNodeRequest) (*apimodels.GetAgentNodeResponse, error)
- func (c *Agent) Version(ctx context.Context) (*apimodels.GetVersionResponse, error)
- type Auth
- type AuthenticatingClient
- func (t *AuthenticatingClient) Delete(ctx context.Context, path string, in apimodels.PutRequest, ...) error
- func (t *AuthenticatingClient) Dial(ctx context.Context, path string, in apimodels.Request) (<-chan *concurrency.AsyncResult[[]byte], error)
- func (t *AuthenticatingClient) Get(ctx context.Context, path string, in apimodels.GetRequest, ...) error
- func (t *AuthenticatingClient) List(ctx context.Context, path string, in apimodels.ListRequest, ...) error
- func (t *AuthenticatingClient) Post(ctx context.Context, path string, in apimodels.PutRequest, ...) error
- func (t *AuthenticatingClient) Put(ctx context.Context, path string, in apimodels.PutRequest, ...) error
- type Client
- type Config
- type Jobs
- func (j *Jobs) Executions(ctx context.Context, r *apimodels.ListJobExecutionsRequest) (*apimodels.ListJobExecutionsResponse, error)
- func (j *Jobs) Get(ctx context.Context, r *apimodels.GetJobRequest) (*apimodels.GetJobResponse, error)
- func (j *Jobs) History(ctx context.Context, r *apimodels.ListJobHistoryRequest) (*apimodels.ListJobHistoryResponse, error)
- func (j *Jobs) List(ctx context.Context, r *apimodels.ListJobsRequest) (*apimodels.ListJobsResponse, error)
- func (j *Jobs) Logs(ctx context.Context, r *apimodels.GetLogsRequest) (<-chan *concurrency.AsyncResult[models.ExecutionLog], error)
- func (j *Jobs) Put(ctx context.Context, r *apimodels.PutJobRequest) (*apimodels.PutJobResponse, error)
- func (j *Jobs) Results(ctx context.Context, r *apimodels.ListJobResultsRequest) (*apimodels.ListJobResultsResponse, error)
- func (j *Jobs) Stop(ctx context.Context, r *apimodels.StopJobRequest) (*apimodels.StopJobResponse, error)
- type Nodes
- func (c *Nodes) Get(ctx context.Context, r *apimodels.GetNodeRequest) (*apimodels.GetNodeResponse, error)
- func (c *Nodes) List(ctx context.Context, r *apimodels.ListNodesRequest) (*apimodels.ListNodesResponse, error)
- func (c *Nodes) Put(ctx context.Context, r *apimodels.PutNodeRequest) (*apimodels.PutNodeResponse, error)
- type OptionFn
- func WithAppID(appID string) OptionFn
- func WithCACertificate(cacert string) OptionFn
- func WithHTTPClient(client *http.Client) OptionFn
- func WithHeaders(headers http.Header) OptionFn
- func WithInsecureTLS(insecure bool) OptionFn
- func WithNamespace(namespace string) OptionFn
- func WithTLS(active bool) OptionFn
- func WithTimeout(timeout time.Duration) OptionFn
- func WithWebsocketChannelBuffer(buffer int) OptionFn
- type TLSConfig
- type UnexpectedResponseError
- func (e UnexpectedResponseError) Additional() error
- func (e UnexpectedResponseError) Body() string
- func (e UnexpectedResponseError) Error() string
- func (e UnexpectedResponseError) ExpectedStatuses() []int
- func (e UnexpectedResponseError) HasAdditional() bool
- func (e UnexpectedResponseError) HasBody() bool
- func (e UnexpectedResponseError) HasError() bool
- func (e UnexpectedResponseError) HasStatusCode() bool
- func (e UnexpectedResponseError) HasStatusText() bool
- func (e UnexpectedResponseError) StatusCode() int
- func (e UnexpectedResponseError) StatusText() string
- func (e UnexpectedResponseError) Unwrap() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DialAsyncResult ¶ added in v1.2.3
func DialAsyncResult[In apimodels.Request, Out any]( ctx context.Context, client Client, endpoint string, r In, ) (<-chan *concurrency.AsyncResult[Out], error)
DialAsyncResult makes a Dial call to the passed client and interprets any received messages as AsyncResult objects, decoding them and posting them on the returned channel.
Types ¶
type API ¶ added in v1.2.2
API is the root of the Bacalhau server API. The structure mirrors the structure of the API: each method returns an object that can submit requests to control a single part of the system.
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
func (*Agent) Node ¶
func (c *Agent) Node(ctx context.Context, req *apimodels.GetAgentNodeRequest) (*apimodels.GetAgentNodeResponse, error)
Node is used to get the agent node info.
type Auth ¶ added in v1.2.1
type Auth struct {
// contains filtered or unexported fields
}
func (*Auth) Authenticate ¶ added in v1.2.1
func (auth *Auth) Authenticate(ctx context.Context, r *apimodels.AuthnRequest) (*apimodels.AuthnResponse, error)
func (*Auth) Methods ¶ added in v1.2.1
func (auth *Auth) Methods(ctx context.Context, r *apimodels.ListAuthnMethodsRequest) (*apimodels. ListAuthnMethodsResponse, error)
type AuthenticatingClient ¶ added in v1.2.2
type AuthenticatingClient struct { Client Client // Credential should be any existing client credential for the user. It is // allowed to be nil, representing no existing client credential. Credential *apimodels.HTTPCredential // PersistCredential will be called when the system should remember a new // auth token for a user. The supplied auth token may be nil, in which case // any existing tokens should be deleted. PersistCredential func(*apimodels.HTTPCredential) error // Authenticate will be called when the system should run an authentication // flow using the passed Auth API. Authenticate func(context.Context, *Auth) (*apimodels.HTTPCredential, error) }
AuthenticatingClient is a client implementation that will automatically run user authentication when a new authorization token is required. This is either when the user does not yet have an authorization token that matches the remote server or if the token is used but the server says it is invalid (e.g. because it has expired).
Since authentication is normally an interactive affair, this client requires an authentication callback that will be called to actually authenticate.
Authorization tokens can be optionally persisted by supplying a callback. This client will keep track of any authorization tokens it collects.
func (*AuthenticatingClient) Delete ¶ added in v1.2.2
func (t *AuthenticatingClient) Delete(ctx context.Context, path string, in apimodels.PutRequest, out apimodels.Response) error
func (*AuthenticatingClient) Dial ¶ added in v1.2.3
func (t *AuthenticatingClient) Dial( ctx context.Context, path string, in apimodels.Request, ) (<-chan *concurrency.AsyncResult[[]byte], error)
func (*AuthenticatingClient) Get ¶ added in v1.2.2
func (t *AuthenticatingClient) Get(ctx context.Context, path string, in apimodels.GetRequest, out apimodels.GetResponse) error
func (*AuthenticatingClient) List ¶ added in v1.2.2
func (t *AuthenticatingClient) List(ctx context.Context, path string, in apimodels.ListRequest, out apimodels.ListResponse) error
func (*AuthenticatingClient) Post ¶ added in v1.2.2
func (t *AuthenticatingClient) Post(ctx context.Context, path string, in apimodels.PutRequest, out apimodels.PutResponse) error
func (*AuthenticatingClient) Put ¶ added in v1.2.2
func (t *AuthenticatingClient) Put(ctx context.Context, path string, in apimodels.PutRequest, out apimodels.PutResponse) error
type Client ¶
type Client interface { Get(context.Context, string, apimodels.GetRequest, apimodels.GetResponse) error List(context.Context, string, apimodels.ListRequest, apimodels.ListResponse) error Put(context.Context, string, apimodels.PutRequest, apimodels.PutResponse) error Post(context.Context, string, apimodels.PutRequest, apimodels.PutResponse) error Delete(context.Context, string, apimodels.PutRequest, apimodels.Response) error Dial(context.Context, string, apimodels.Request) (<-chan *concurrency.AsyncResult[[]byte], error) }
Client is the object that makes transport-level requests to specified APIs. Users should make use of the `API` object for a higher level interface.
func NewHTTPClient ¶ added in v1.2.2
New creates a new transport.
type Config ¶ added in v1.2.1
type Config struct { // Namespace is the default namespace to use for all requests. Namespace string // The optional application specific identifier appended to the User-Agent header. AppID string // HTTPClient is the client to use. Default will be used if not provided. // If set, other configuration options will be ignored, such as Timeout HTTPClient *http.Client // Timeout is the timeout for requests. Timeout time.Duration // Headers is a map of headers to add to all requests. Headers http.Header // TLSConfig provides info on how we want to use TLS TLS TLSConfig // WebsocketChannelBuffer is the size of the channel buffer for websocket messages WebsocketChannelBuffer int }
func DefaultConfig ¶ added in v1.2.2
func DefaultConfig() Config
DefaultConfig returns a default configuration for the client.
type Jobs ¶
type Jobs struct {
// contains filtered or unexported fields
}
func (*Jobs) Executions ¶
func (j *Jobs) Executions(ctx context.Context, r *apimodels.ListJobExecutionsRequest) (*apimodels.ListJobExecutionsResponse, error)
Executions returns executions for a job.
func (*Jobs) Get ¶
func (j *Jobs) Get(ctx context.Context, r *apimodels.GetJobRequest) (*apimodels.GetJobResponse, error)
Get is used to get a job by ID.
func (*Jobs) History ¶
func (j *Jobs) History(ctx context.Context, r *apimodels.ListJobHistoryRequest) (*apimodels.ListJobHistoryResponse, error)
History returns history events for a job.
func (*Jobs) List ¶
func (j *Jobs) List(ctx context.Context, r *apimodels.ListJobsRequest) (*apimodels.ListJobsResponse, error)
List is used to list all jobs in the cluster.
func (*Jobs) Logs ¶ added in v1.2.2
func (j *Jobs) Logs(ctx context.Context, r *apimodels.GetLogsRequest) (<-chan *concurrency.AsyncResult[models.ExecutionLog], error)
Logs returns a stream of logs for a given job/execution.
func (*Jobs) Put ¶
func (j *Jobs) Put(ctx context.Context, r *apimodels.PutJobRequest) (*apimodels.PutJobResponse, error)
Put is used to submit a new job to the cluster, or update an existing job with matching ID.
func (*Jobs) Results ¶
func (j *Jobs) Results(ctx context.Context, r *apimodels.ListJobResultsRequest) (*apimodels.ListJobResultsResponse, error)
Results returns results for a job.
func (*Jobs) Stop ¶
func (j *Jobs) Stop(ctx context.Context, r *apimodels.StopJobRequest) (*apimodels.StopJobResponse, error)
Stop is used to stop a job by ID.
type Nodes ¶
type Nodes struct {
// contains filtered or unexported fields
}
func (*Nodes) Get ¶
func (c *Nodes) Get(ctx context.Context, r *apimodels.GetNodeRequest) (*apimodels.GetNodeResponse, error)
Get is used to get a node by ID.
func (*Nodes) List ¶
func (c *Nodes) List(ctx context.Context, r *apimodels.ListNodesRequest) (*apimodels.ListNodesResponse, error)
List is used to list all nodes in the cluster.
func (*Nodes) Put ¶ added in v1.3.0
func (c *Nodes) Put(ctx context.Context, r *apimodels.PutNodeRequest) (*apimodels.PutNodeResponse, error)
Put is used to update a node's state with a node action (pause, drain, approve etc)
type OptionFn ¶
type OptionFn func(*Config)
OptionFn is a function that can be used to configure the client.
func WithAppID ¶
WithAppID sets the optional application specific identifier appended to the User-Agent header.
func WithCACertificate ¶ added in v1.2.1
CACert specifies the location of a CA certificate file so that it is possible to use TLS without the insecure flag when the server uses a self-signed certificate
func WithHTTPClient ¶
WithHTTPClient sets the client to use. Default will be used if not provided. If set, other configuration options will be ignored, such as Timeout
func WithHeaders ¶
WithHeaders sets the headers to add to all requests.
func WithInsecureTLS ¶ added in v1.2.1
Insecure activates TLS but does not verify any certificate
func WithNamespace ¶
WithNamespace sets the default namespace to use for all requests.
func WithTimeout ¶
WithTimeout sets the timeout for requests.
func WithWebsocketChannelBuffer ¶ added in v1.2.2
WithWebsocketChannelBuffer sets the size of the channel buffer for websocket messages
type UnexpectedResponseError ¶
type UnexpectedResponseError struct {
// contains filtered or unexported fields
}
UnexpectedResponseError tracks the components for API errors encountered when requireOK and requireStatusIn's conditions are not met.
func (UnexpectedResponseError) Additional ¶
func (e UnexpectedResponseError) Additional() error
func (UnexpectedResponseError) Body ¶
func (e UnexpectedResponseError) Body() string
func (UnexpectedResponseError) Error ¶
func (e UnexpectedResponseError) Error() string
func (UnexpectedResponseError) ExpectedStatuses ¶
func (e UnexpectedResponseError) ExpectedStatuses() []int
func (UnexpectedResponseError) HasAdditional ¶
func (e UnexpectedResponseError) HasAdditional() bool
func (UnexpectedResponseError) HasBody ¶
func (e UnexpectedResponseError) HasBody() bool
func (UnexpectedResponseError) HasError ¶
func (e UnexpectedResponseError) HasError() bool
func (UnexpectedResponseError) HasStatusCode ¶
func (e UnexpectedResponseError) HasStatusCode() bool
func (UnexpectedResponseError) HasStatusText ¶
func (e UnexpectedResponseError) HasStatusText() bool
func (UnexpectedResponseError) StatusCode ¶
func (e UnexpectedResponseError) StatusCode() int
func (UnexpectedResponseError) StatusText ¶
func (e UnexpectedResponseError) StatusText() string
func (UnexpectedResponseError) Unwrap ¶
func (e UnexpectedResponseError) Unwrap() error