client

package
v1.1.4-rc1 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

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

func (*Agent) Alive

func (c *Agent) Alive() (*apimodels.IsAliveResponse, error)

Alive is used to check if the agent is alive.

func (*Agent) Node

Node is used to get the agent node info.

func (*Agent) Version

func (c *Agent) Version() (*apimodels.GetVersionResponse, error)

Version is used to get the agent version.

type Client

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

func New

func New(options Options, optFns ...OptionFn) *Client

New creates a new client.

func (*Client) Agent

func (c *Client) Agent() *Agent

Agent returns a handle on the agent endpoints.

func (*Client) Jobs

func (c *Client) Jobs() *Jobs

Jobs returns a handle on the jobs endpoints.

func (*Client) Nodes

func (c *Client) Nodes() *Nodes

Nodes returns a handle on the nodes endpoints.

type Jobs

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

func (*Jobs) Executions

Executions returns executions for a job.

func (*Jobs) Get

Get is used to get a job by ID.

func (*Jobs) History

History returns history events for a job.

func (*Jobs) List

List is used to list all jobs in the cluster.

func (*Jobs) Put

Put is used to submit a new job to the cluster, or update an existing job with matching ID.

func (*Jobs) Results

Results returns results for a job.

func (*Jobs) Stop

Stop is used to stop a job by ID.

type Nodes

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

func (*Nodes) Get

Get is used to get a node by ID.

func (*Nodes) List

List is used to list all nodes in the cluster.

type OptionFn

type OptionFn func(*Options)

OptionFn is a function that can be used to configure the client.

func WithAddress

func WithAddress(address string) OptionFn

WithAddress sets the address of the node's public REST API.

func WithAppID

func WithAppID(appID string) OptionFn

WithAppID sets the optional application specific identifier appended to the User-Agent header.

func WithContext

func WithContext(ctx context.Context) OptionFn

WithContext sets the default context to use for requests.

func WithHTTPAuth

func WithHTTPAuth(auth *apimodels.HTTPBasicAuth) OptionFn

WithHTTPAuth sets the auth info to use for http access.

func WithHTTPClient

func WithHTTPClient(client *http.Client) OptionFn

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

func WithHeaders(headers http.Header) OptionFn

WithHeaders sets the headers to add to all requests.

func WithNamespace

func WithNamespace(namespace string) OptionFn

WithNamespace sets the default namespace to use for all requests.

func WithTimeout

func WithTimeout(timeout time.Duration) OptionFn

WithTimeout sets the timeout for requests.

type Options

type Options struct {
	// Address is the address of the node's public REST API.
	Address string

	// 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

	// Context is the default context to use for requests.
	Context context.Context

	// 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

	// HTTPAuth is the auth info to use for http access.
	HTTPAuth *apimodels.HTTPBasicAuth

	// Timeout is the timeout for requests.
	Timeout time.Duration

	// Headers is a map of headers to add to all requests.
	Headers http.Header
}

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 (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

Jump to

Keyboard shortcuts

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