Documentation ¶
Overview ¶
Package fetcher implements a client for the Constellation Resource API.
The fetcher is used to get information from the versions API without having to authenticate with AWS, where the API is currently hosted. This package should be used in user-facing application code most of the time, like the CLI.
Each sub-API included in the Constellation Resource API should define it's resources by implementing types that implement apiObject. The new package can then call this package's Fetch function to get the resource from the API. To modify resources, pkg internal/api/client should be used in a similar fashion.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Fetch ¶
func Fetch[T apiObject](ctx context.Context, c HTTPClient, cdnURL string, obj T) (T, error)
Fetch fetches the given apiObject from the public Constellation CDN. Fetch does not require authentication.
func FetchAndVerify ¶
func FetchAndVerify[T apiObject](ctx context.Context, c HTTPClient, cdnURL string, obj T, cosignVerifier sigstore.Verifier) (T, error)
FetchAndVerify fetches the given apiObject, checks if it can fetch an accompanying signature and verifies if the signature matches the found object. The public key used to verify the signature is embedded in the verifier argument. FetchAndVerify uses a generic to return a new object of type T. Otherwise the caller would have to cast the interface type to a concrete object, which could fail.
Types ¶
type HTTPClient ¶
HTTPClient is an interface for http clients.
type NotFoundError ¶
type NotFoundError struct {
// contains filtered or unexported fields
}
NotFoundError is an error that is returned when a resource is not found.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
func (*NotFoundError) Unwrap ¶
func (e *NotFoundError) Unwrap() error