Documentation
¶
Overview ¶
Package client provides a rest client to talk to the Trusty API.
Index ¶
- Variables
- type Options
- type Trusty
- func (t *Trusty) GroupReport(_ context.Context, deps []*types.Dependency) ([]*types.Reply, error)
- func (t *Trusty) PackageEndpoint(dep *types.Dependency) (string, error)
- func (t *Trusty) PurlEndpoint(purl string) (string, error)
- func (t *Trusty) PurlToDependency(purlString string) (*types.Dependency, error)
- func (_ *Trusty) PurlToEcosystem(purl string) types.Ecosystem
- func (t *Trusty) Report(_ context.Context, dep *types.Dependency) (*types.Reply, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultOptions = Options{ Workers: 2, BaseURL: defaultEndpoint, WaitForIngestion: true, IngestionRetryWait: 5, }
DefaultOptions is the default Trusty client options set
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
HttpClient netClient
// Workers is the number of parallel request the client makes to the API
Workers int
// BaseURL of the Trusty API
BaseURL string
// WaitForIngestion causes the http client to wait and retry if Trusty
// responds with a successful request but with a "pending" or "scoring" status
WaitForIngestion bool
// ErrOnFailedIngestion makes the client return an error on a Report call
// when the ingestion failed internally withing trusty. If false, the
// report data willbe returned but the application needs to check the
// ingestion status and handle it.
ErrOnFailedIngestion bool
// IngestionRetryWait is the number of seconds that the client will wait for
// package ingestion before retrying.
IngestionRetryWait int
// IngestionMaxRetries is the maximum number of requests the client will
// send while waiting for ingestion to finish
IngestionMaxRetries int
}
Options configures the Trusty API client
type Trusty ¶
type Trusty struct {
Options Options
}
Trusty is the main trusty client
func NewWithOptions ¶
NewWithOptions returns a new client with the specified options set
func (*Trusty) GroupReport ¶
GroupReport queries the Trusty API in parallel for a group of dependencies.
func (*Trusty) PackageEndpoint ¶
func (t *Trusty) PackageEndpoint(dep *types.Dependency) (string, error)
PackageEndpoint takes a dependency and returns the Trusty endpoint to query data about it.
func (*Trusty) PurlEndpoint ¶
PurlEndpoint returns the API endpoint url to query for data about a purl
func (*Trusty) PurlToDependency ¶
func (t *Trusty) PurlToDependency(purlString string) (*types.Dependency, error)
PurlToDependency takes a string with a package url
func (*Trusty) PurlToEcosystem ¶
PurlToEcosystem returns a trusty ecosystem constant from a Package URL's type
Click to show internal directories.
Click to hide internal directories.