client

package
v0.0.0-...-52b58a3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: Apache-2.0, MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDefaultAuth = pkgerrors.New("default SSH agent authentication requires SDC_KEY_ID / TRITON_KEY_ID and SSH_AUTH_SOCK")
	ErrAccountName = pkgerrors.New("missing account name")
	ErrMissingURL  = pkgerrors.New("missing API URL")

	InvalidTritonURL   = "invalid format of Triton URL"
	InvalidMantaURL    = "invalid format of Manta URL"
	InvalidServicesURL = "invalid format of Triton Service Groups URL"
	InvalidDCInURL     = "invalid data center in URL"
)

Functions

This section is empty.

Types

type Client

type Client struct {
	HTTPClient    *http.Client
	RequestHeader *http.Header
	Authorizers   []authentication.Signer
	TritonURL     url.URL
	MantaURL      url.URL
	ServicesURL   url.URL
	AccountName   string
	Username      string
}

Client represents a connection to the Triton Compute or Object Storage APIs.

func New

func New(tritonURL string, mantaURL string, accountName string, signers ...authentication.Signer) (*Client, error)

New is used to construct a Client in order to make API requests to the Triton API.

At least one signer must be provided - example signers include authentication.PrivateKeySigner and authentication.SSHAgentSigner.

func (*Client) DecodeError

func (c *Client) DecodeError(resp *http.Response, requestMethod string, consumeBody bool) error

DecodeError decodes a backend Triton error into a more usable Go error type

func (*Client) DefaultAuth

func (c *Client) DefaultAuth() error

initDefaultAuth provides a default key signer for a client. This should only be used internally if the client has no other key signer for authenticating with Triton. We first look for both `SDC_KEY_ID` and `SSH_AUTH_SOCK` in the user's environ(7). If so we default to the SSH agent key signer.

func (*Client) ExecuteRequest

func (c *Client) ExecuteRequest(ctx context.Context, inputs RequestInput) (io.ReadCloser, error)

func (*Client) ExecuteRequestNoEncode

func (c *Client) ExecuteRequestNoEncode(ctx context.Context, inputs RequestNoEncodeInput) (io.ReadCloser, http.Header, error)

func (*Client) ExecuteRequestRaw

func (c *Client) ExecuteRequestRaw(ctx context.Context, inputs RequestInput) (*http.Response, error)

func (*Client) ExecuteRequestStorage

func (c *Client) ExecuteRequestStorage(ctx context.Context, inputs RequestInput) (io.ReadCloser, http.Header, error)

func (*Client) ExecuteRequestTSG

func (c *Client) ExecuteRequestTSG(ctx context.Context, inputs RequestInput) (io.ReadCloser, error)

func (*Client) ExecuteRequestURIParams

func (c *Client) ExecuteRequestURIParams(ctx context.Context, inputs RequestInput) (io.ReadCloser, error)

func (*Client) InsecureSkipTLSVerify

func (c *Client) InsecureSkipTLSVerify()

InsecureSkipTLSVerify turns off TLS verification for the client connection. This allows connection to an endpoint with a certificate which was signed by a non- trusted CA, such as self-signed certificates. This can be useful when connecting to temporary Triton installations such as Triton Cloud-On-A-Laptop.

type RequestInput

type RequestInput struct {
	Method  string
	Path    string
	Query   *url.Values
	Headers *http.Header
	Body    interface{}

	// If the response has the HTTP status code 410 (i.e., "Gone"), should we preserve the contents of the body for the caller?
	PreserveGone bool
}

type RequestNoEncodeInput

type RequestNoEncodeInput struct {
	Method  string
	Path    string
	Query   *url.Values
	Headers *http.Header
	Body    io.Reader
}

Jump to

Keyboard shortcuts

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