fetcher

package
v2.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

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, obj T) (T, error)

Fetch fetches the given apiObject from the public Constellation CDN. Fetch does not require authentication.

Types

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is an interface for http clients.

func NewHTTPClient

func NewHTTPClient() HTTPClient

NewHTTPClient returns a new http client.

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

Jump to

Keyboard shortcuts

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