Documentation
¶
Overview ¶
Package http implements an attestations collector that reads data from an https endpoint.
Index ¶
- Variables
- func New(funcs ...optFn) (attestation.Fetcher, error)
- func WithReadJSONL(doit bool) optFn
- func WithRetries(num uint) optFn
- func WithTemplatePredicateType(templ string) optFn
- func WithTemplateSubject(templ string) optFn
- func WithTemplateSubjectDigest(templ string) optFn
- func WithTemplateSubjectName(templ string) optFn
- func WithTemplateSubjectUri(templ string) optFn
- func WithURL(uriStrings ...string) optFn
- type Collector
- type CollectorPredicateType
- type CollectorPredicateTypeSubject
- type CollectorSubject
- type CollectorSubjectAndType
- func (c *CollectorSubjectAndType) Fetch(ctx context.Context, opts attestation.FetchOptions) ([]attestation.Envelope, error)
- func (c *CollectorSubjectAndType) FetchByPredicateType(ctx context.Context, fo attestation.FetchOptions, ...) ([]attestation.Envelope, error)
- func (c *CollectorSubjectAndType) FetchBySubject(ctx context.Context, fo attestation.FetchOptions, ...) ([]attestation.Envelope, error)
- type Options
Constants ¶
This section is empty.
Variables ¶
var ( TypeMoniker = "http" TypeMonikerHTTPS = "https" )
var BuildHTTP = func(uriString string) (attestation.Repository, error) { if strings.HasPrefix(uriString, "//") { uriString = "http:" + uriString } return New(WithURL(uriString)) }
Implement the factory function
var BuildHTTPs = func(uriString string) (attestation.Repository, error) { if strings.HasPrefix(uriString, "//") { uriString = "https:" + uriString } return New(WithURL(uriString)) }
Functions ¶
func New ¶
func New(funcs ...optFn) (attestation.Fetcher, error)
New creates a new collector. The type of collector returned varies according to the specified URL templates.
func WithReadJSONL ¶
func WithReadJSONL(doit bool) optFn
WithReadJSONL sets the options to assume the data read will be in linear json data.
func WithRetries ¶
func WithRetries(num uint) optFn
WithRetries fetches the number of retires to read
func WithTemplatePredicateType ¶
func WithTemplatePredicateType(templ string) optFn
func WithTemplateSubject ¶
func WithTemplateSubject(templ string) optFn
func WithTemplateSubjectDigest ¶
func WithTemplateSubjectDigest(templ string) optFn
func WithTemplateSubjectName ¶
func WithTemplateSubjectName(templ string) optFn
func WithTemplateSubjectUri ¶
func WithTemplateSubjectUri(templ string) optFn
Types ¶
type Collector ¶
type Collector struct {
Options Options
}
Collector is the general collector that supports fetching from a single URL
func (*Collector) Fetch ¶
func (c *Collector) Fetch(ctx context.Context, opts attestation.FetchOptions) ([]attestation.Envelope, error)
type CollectorPredicateType ¶
type CollectorPredicateType struct {
Options Options
}
CollectorPredicateType implements the attestation.FetcherByPredicateType interface
func (*CollectorPredicateType) Fetch ¶
func (c *CollectorPredicateType) Fetch(ctx context.Context, opts attestation.FetchOptions) ([]attestation.Envelope, error)
func (*CollectorPredicateType) FetchByPredicateType ¶
func (c *CollectorPredicateType) FetchByPredicateType(ctx context.Context, fo attestation.FetchOptions, types []attestation.PredicateType) ([]attestation.Envelope, error)
type CollectorPredicateTypeSubject ¶
type CollectorPredicateTypeSubject struct {
Options Options
}
func (*CollectorPredicateTypeSubject) Fetch ¶
func (c *CollectorPredicateTypeSubject) Fetch(ctx context.Context, opts attestation.FetchOptions) ([]attestation.Envelope, error)
type CollectorSubject ¶
type CollectorSubject struct {
Options Options
}
CollectorSubject implements the attestation.FetcherBySubject interface
func (*CollectorSubject) Fetch ¶
func (c *CollectorSubject) Fetch(ctx context.Context, opts attestation.FetchOptions) ([]attestation.Envelope, error)
func (*CollectorSubject) FetchBySubject ¶
func (c *CollectorSubject) FetchBySubject(ctx context.Context, fo attestation.FetchOptions, subjects []attestation.Subject) ([]attestation.Envelope, error)
type CollectorSubjectAndType ¶
type CollectorSubjectAndType struct {
Options Options
}
CollectorSubjectAndType implements the attestation.FetcherBySubject and attestation.FetcherByPredicateType interfaces it is not the same as the PredicateTypeSubject interface
func (*CollectorSubjectAndType) Fetch ¶
func (c *CollectorSubjectAndType) Fetch(ctx context.Context, opts attestation.FetchOptions) ([]attestation.Envelope, error)
func (*CollectorSubjectAndType) FetchByPredicateType ¶
func (c *CollectorSubjectAndType) FetchByPredicateType(ctx context.Context, fo attestation.FetchOptions, types []attestation.PredicateType) ([]attestation.Envelope, error)
func (*CollectorSubjectAndType) FetchBySubject ¶
func (c *CollectorSubjectAndType) FetchBySubject(ctx context.Context, fo attestation.FetchOptions, subjects []attestation.Subject) ([]attestation.Envelope, error)
type Options ¶
type Options struct {
URLs []string
TemplateSubject string
TemplateSubjectDigest string
TemplateSubjectName string
TemplateSubjectUri string
TemplatePredicateType string
TemplatePredicateTypeSubject string
Retries uint
ReadJSONL bool
}
Options captures the URLs and templates for the http collector variants. The options control the collector variant that gets returned by New()