package client

import "github.com/rootless-containers/rootlesskit/pkg/api/client"

Index

Constants

const HTTPStatusErrorBodyMaxLength = 64 * 1024

HTTPStatusErrorBodyMaxLength specifies the maximum length of HTTPStatusError.Body

Types

type Client

type Client interface {
	HTTPClient() *http.Client
	PortManager() port.Manager
	Info(context.Context) (*api.Info, error)
}

func New

func New(socketPath string) (Client, error)

New creates a client. socketPath is a path to the UNIX socket, without unix:// prefix.

func NewWithHTTPClient

func NewWithHTTPClient(hc *http.Client) Client

type HTTPStatusError

type HTTPStatusError struct {
	// StatusCode is non-2XX status code
	StatusCode int
	// Body is at most HTTPStatusErrorBodyMaxLength
	Body string
}

HTTPStatusError is created from non-2XX HTTP response

func (*HTTPStatusError) Error

func (e *HTTPStatusError) Error() string

Error implements error. If e.Body is a marshalled string of api.ErrorJSON, Error returns ErrorJSON.Message . Otherwise Error returns a human-readable string that contains e.StatusCode and e.Body.

Source Files

client.go

Version
v1.1.1 (latest)
Published
May 30, 2023
Platform
js/wasm
Imports
11 packages
Last checked
2 weeks ago

Tools for package owners.