client

package
v4.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: Apache-2.0 Imports: 19 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) DeleteManifests added in v4.4.0

func (s *HTTP) DeleteManifests(ctx context.Context, d ...claircore.Digest) ([]claircore.Digest, error)

DeleteManifests deletes the specified manifests.

Passing a digest of an unknown manifest is not an error.

func (*HTTP) DeleteUpdateOperations

func (c *HTTP) DeleteUpdateOperations(ctx context.Context, ref ...uuid.UUID) (int64, 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) Initialized added in v4.1.0

func (c *HTTP) Initialized(_ context.Context) (bool, error)

Initialized is present to fulfill the interface, but isn't exposed as part of the HTTP API. This method is stubbed out.

func (*HTTP) LatestUpdateOperation

func (c *HTTP) LatestUpdateOperation(_ context.Context, _ driver.UpdateKind) (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, k driver.UpdateKind) (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, k driver.UpdateKind, 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.

func WithSigner added in v4.6.0

func WithSigner(v Signer) Option

type Signer added in v4.6.0

type Signer interface {
	Sign(context.Context, *http.Request) error
}

Jump to

Keyboard shortcuts

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