Documentation
¶
Overview ¶
Package http resolves versions from an arbitrary HTTP endpoint, the escape hatch for any source clover has no bespoke provider for. It fetches a user-supplied url once, anonymously, and extracts one-or-many version strings from the response - a jq program over a JSON body, or a glob/regex over a text body - leaving the framework to own selection. The extraction expression is compiled at validation time, so clover lint catches a malformed jq or pattern offline before any fetch.
Index ¶
- type Option
- type Provider
- func (p *Provider) Describe(r provider.Resource) string
- func (p *Provider) Discover(ctx context.Context, r provider.Resource) ([]model.Candidate, error)
- func (p *Provider) Keys() []provider.Key
- func (p *Provider) Name() string
- func (p *Provider) Resource(d directive.Directive) (provider.Resource, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Provider)
Option configures a Provider.
func WithTransport ¶
func WithTransport(rt nethttp.RoundTripper) Option
WithTransport overrides the HTTP transport, for tests.
func WithVersion ¶
WithVersion sets the clover version woven into the default User-Agent. The composition root passes the running binary's version; an empty value keeps the bare product name.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider resolves versions from an arbitrary HTTP endpoint. It performs one anonymous GET of the configured url and extracts candidate version strings from the response, leaving selection to the framework; it lists candidates and nothing more, so it carries no per-version metadata.
func New ¶
New returns the http provider. The endpoint is fetched anonymously through the shared cache, with no ratelimit wrapper or credentials.
func (*Provider) Describe ¶
Describe returns a human-readable label for a resource: the endpoint's host.
func (*Provider) Discover ¶
Discover fetches the endpoint once and extracts candidate versions from the response. There is no pagination - a single response holds whatever the endpoint serves - so nothing is ever left unread.
func (*Provider) Keys ¶
Keys reports the directive keys http accepts, in canonical order. The two extraction keys are mutually exclusive; Resource enforces that exactly one is set, so neither carries the Required flag.