client

package
v4.0.0-rc.5 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2020 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAddr = `http://clair:6060/`

DefaultAddr is used if the WithAddr Option isn't provided to New.

This uses the default service port, and should just work if a containerized deployment has a service configured that hairpins and routes correctly.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTP

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

HTTP implements access to clair interfaces over HTTP

func NewHTTP

func NewHTTP(ctx context.Context, opt ...Option) (*HTTP, error)

NewHTTP is a constructor for an HTTP client.

func (*HTTP) AffectedManifests

func (s *HTTP) AffectedManifests(ctx context.Context, v []claircore.Vulnerability) (claircore.AffectedManifests, error)

func (*HTTP) DeleteUpdateOperations

func (c *HTTP) DeleteUpdateOperations(ctx context.Context, ref ...uuid.UUID) error

DeleteUpdateOperations attempts to delete the referenced update operations.

func (*HTTP) Index

func (s *HTTP) Index(ctx context.Context, manifest *claircore.Manifest) (*claircore.IndexReport, error)

Index receives a Manifest and returns a IndexReport providing the indexed items in the resulting image.

Index blocks until completion. An error is returned if the index operation could not start. If an error occurs during the index operation the error will be preset on the IndexReport.Err field of the returned IndexReport.

func (*HTTP) IndexReport

func (s *HTTP) IndexReport(ctx context.Context, manifest claircore.Digest) (*claircore.IndexReport, bool, error)

IndexReport retrieves a IndexReport given a manifest hash string

func (*HTTP) LatestUpdateOperation

func (c *HTTP) LatestUpdateOperation(_ context.Context) (uuid.UUID, error)

LatestUpdateOperation shouldn't be used by client code and is implemented only to satisfy the matcher.Differ interface.

func (*HTTP) LatestUpdateOperations

func (c *HTTP) LatestUpdateOperations(ctx context.Context) (map[string][]driver.UpdateOperation, error)

LatestUpdateOperations returns the most recent UpdateOperation per updater.

func (*HTTP) Scan

func (*HTTP) State

func (s *HTTP) State(ctx context.Context) (string, error)

func (*HTTP) UpdateDiff

func (c *HTTP) UpdateDiff(ctx context.Context, prev, cur uuid.UUID) (*driver.UpdateDiff, error)

UpdateDiff reports the diff of two update operations, identified by the provided refs.

"Prev" may be passed uuid.Nil if the client's last known state has been forgotten by the server.

func (*HTTP) UpdateOperations

func (c *HTTP) UpdateOperations(ctx context.Context, updaters ...string) (map[string][]driver.UpdateOperation, error)

UpdateOperations returns all the known UpdateOperations per updater.

type Option

type Option func(*HTTP) error

Option sets an option on an HTTP.

func WithAddr

func WithAddr(root string) Option

WithAddr sets the address to talk to.

The client doesn't support providing multiple addresses, so the provided address should most likely have some form of load balancing or routing.

The provided URL should not include the `/api/v1` prefix.

func WithClient

func WithClient(c *http.Client) Option

WithClient sets the http.Client used for requests.

If WithClient is not supplied to NewHTTP, http.DefaultClient is used.

Jump to

Keyboard shortcuts

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