client

package
v1.2.2-rc1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2024 License: Apache-2.0 Imports: 23 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(ctx context.Context) (*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(ctx context.Context) (*apimodels.GetVersionResponse, error)

Version is used to get the agent version.

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

type Client

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

func New

func New(address string, 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) Auth added in v1.2.1

func (c *Client) Auth() *Auth

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

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

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

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) Logs added in v1.2.2

Logs returns a stream of logs for a given job/execution.

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(*Config)

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

func WithAppID

func WithAppID(appID string) OptionFn

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

func WithCACertificate added in v1.2.1

func WithCACertificate(cacert string) OptionFn

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 WithHTTPAuth

func WithHTTPAuth(credential *apimodels.HTTPCredential) 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 WithInsecureTLS added in v1.2.1

func WithInsecureTLS(insecure bool) OptionFn

Insecure activates TLS but does not verify any certificate

func WithNamespace

func WithNamespace(namespace string) OptionFn

WithNamespace sets the default namespace to use for all requests.

func WithTLS added in v1.2.1

func WithTLS(active bool) OptionFn

UseTLS denotes whether to use TLS or not

func WithTimeout

func WithTimeout(timeout time.Duration) OptionFn

WithTimeout sets the timeout for requests.

func WithWebsocketChannelBuffer added in v1.2.2

func WithWebsocketChannelBuffer(buffer int) OptionFn

WithWebsocketChannelBuffer sets the size of the channel buffer for websocket messages

type TLSConfig added in v1.2.1

type TLSConfig struct {
	// UseTLS denotes whether to use TLS or not
	UseTLS bool
	// Insecure activates TLS but does not verify any certificate
	Insecure bool
	// CACert specifies the location of a self-signed CA certificate
	// file
	CACert string
}

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