Documentation ¶
Index ¶
- Variables
- func CheckResponseCode(inError error) (int, error)
- func JoinURL(elements ...string) string
- func NewConnection(ctx context.Context, uri string) (context.Context, error)
- func NewConnectionWithIdentity(ctx context.Context, uri string, identity string, machine bool) (context.Context, error)
- func ServiceVersion(ctx context.Context) *semver.Version
- type APIResponse
- func (h *APIResponse) IsClientError() bool
- func (h *APIResponse) IsConflictError() bool
- func (h *APIResponse) IsInformational() bool
- func (h *APIResponse) IsRedirection() bool
- func (h *APIResponse) IsServerError() bool
- func (h *APIResponse) IsSuccess() bool
- func (h APIResponse) Process(unmarshalInto interface{}) error
- func (h APIResponse) ProcessWithError(unmarshalInto interface{}, unmarshalErrorInto interface{}) error
- type APIVersionError
- type ConnectError
- type Connection
Constants ¶
This section is empty.
Variables ¶
var (
ErrNotImplemented = errors.New("function not implemented")
)
Functions ¶
func CheckResponseCode ¶
func NewConnection ¶
NewConnection creates a new service connection without an identity
func NewConnectionWithIdentity ¶
func NewConnectionWithIdentity(ctx context.Context, uri string, identity string, machine bool) (context.Context, error)
NewConnectionWithIdentity takes a URI as a string and returns a context with the Connection embedded as a value. This context needs to be passed to each endpoint to work correctly.
A valid URI connection should be scheme:// For example tcp://localhost:<port> or unix:///run/podman/podman.sock or ssh://<user>@<host>[:port]/run/podman/podman.sock?secure=True
func ServiceVersion ¶
ServiceVersion from context build by NewConnection()
Types ¶
type APIResponse ¶
func (*APIResponse) IsClientError ¶
func (h *APIResponse) IsClientError() bool
IsClientError returns true if the response code is 4xx
func (*APIResponse) IsConflictError ¶
func (h *APIResponse) IsConflictError() bool
IsConflictError returns true if the response code is 409
func (*APIResponse) IsInformational ¶
func (h *APIResponse) IsInformational() bool
IsInformational returns true if the response code is 1xx
func (*APIResponse) IsRedirection ¶
func (h *APIResponse) IsRedirection() bool
IsRedirection returns true if the response code is 3xx
func (*APIResponse) IsServerError ¶
func (h *APIResponse) IsServerError() bool
IsServerError returns true if the response code is 5xx
func (*APIResponse) IsSuccess ¶
func (h *APIResponse) IsSuccess() bool
IsSuccess returns true if the response code is 2xx
func (APIResponse) Process ¶
func (h APIResponse) Process(unmarshalInto interface{}) error
Process drains the response body, and processes the HTTP status code Note: Closing the response.Body is left to the caller
func (APIResponse) ProcessWithError ¶
func (h APIResponse) ProcessWithError(unmarshalInto interface{}, unmarshalErrorInto interface{}) error
ProcessWithError drains the response body, and processes the HTTP status code Note: Closing the response.Body is left to the caller
type APIVersionError ¶ added in v4.8.1
type APIVersionError struct {
// contains filtered or unexported fields
}
func NewAPIVersionError ¶ added in v4.8.1
func NewAPIVersionError(endpoint string, version *semver.Version, requiredVersion string) *APIVersionError
NewAPIVersionError create bindings error when the endpoint on the server is not supported because the version is to old.
- endpoint is the name fo the endpoint (e.g. /containers/json)
- version is the server API version
- requiredVersion is the server version need to use said endpoint
func (*APIVersionError) Error ¶ added in v4.8.1
func (e *APIVersionError) Error() string
type ConnectError ¶ added in v4.6.0
type ConnectError struct {
Err error
}
func (ConnectError) Error ¶ added in v4.6.0
func (c ConnectError) Error() string
func (ConnectError) Unwrap ¶ added in v4.6.0
func (c ConnectError) Unwrap() error
type Connection ¶
func GetClient ¶
func GetClient(ctx context.Context) (*Connection, error)
GetClient from context build by NewConnection()
func (*Connection) DoRequest ¶
func (c *Connection) DoRequest(ctx context.Context, httpBody io.Reader, httpMethod, endpoint string, queryParams url.Values, headers http.Header, pathValues ...string) (*APIResponse, error)
DoRequest assembles the http request and returns the response. The caller must close the response body.
Directories ¶
Path | Synopsis |
---|---|
Code generated by go generate; DO NOT EDIT.
|
Code generated by go generate; DO NOT EDIT. |
Code generated by go generate; DO NOT EDIT.
|
Code generated by go generate; DO NOT EDIT. |
Code generated by go generate; DO NOT EDIT.
|
Code generated by go generate; DO NOT EDIT. |
internal
|
|
Code generated by go generate; DO NOT EDIT.
|
Code generated by go generate; DO NOT EDIT. |
Code generated by go generate; DO NOT EDIT.
|
Code generated by go generate; DO NOT EDIT. |
Code generated by go generate; DO NOT EDIT.
|
Code generated by go generate; DO NOT EDIT. |
Code generated by go generate; DO NOT EDIT.
|
Code generated by go generate; DO NOT EDIT. |
Code generated by go generate; DO NOT EDIT.
|
Code generated by go generate; DO NOT EDIT. |
Code generated by go generate; DO NOT EDIT.
|
Code generated by go generate; DO NOT EDIT. |
Code generated by go generate; DO NOT EDIT.
|
Code generated by go generate; DO NOT EDIT. |