client

package
v0.0.0-...-43a96cf Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 13 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDefaultClient

func NewDefaultClient(manifestPath string) manifest.ReleaseManifestProvider

NewDefaultClient is a convenience constructor that returns a ReleaseManifestProvider.

Types

type HTTP

type HTTP struct {
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

A HTTP client makes HTTP requests to retrieve and parse a Manifest. The default manifests are stored on S3, but the manifestURLFmt can be overridden for testing.

func NewHTTPClient

func NewHTTPClient(options ...Opt) *HTTP

NewHTTPClient returns a client with the given options applied.

func (*HTTP) GetCurrentManifest

func (c *HTTP) GetCurrentManifest(ctx context.Context, channel string) (*manifest.A2, error)

GetCurrentManifest retrieves the current manifest for the given channel.

func (*HTTP) GetManifest

func (c *HTTP) GetManifest(ctx context.Context, release string) (*manifest.A2, error)

GetCurrentManifest retrieves the current manifest for the given channel.

type InMemory

type InMemory struct {
	// contains filtered or unexported fields
}

InMemory manifest client reads the manifest from bytes in memory

func NewInMemoryClient

func NewInMemoryClient(data []byte) *InMemory

NewInMemoryClient returns a InMemory manifest client

func (*InMemory) GetCurrentManifest

func (d *InMemory) GetCurrentManifest(_ context.Context, _ string) (*manifest.A2, error)

GetCurrentManifest parses the manifest in memory

func (*InMemory) GetManifest

func (d *InMemory) GetManifest(_ context.Context, release string) (*manifest.A2, error)

GetManifest parses the manifest in memory

type Opt

type Opt func(c *HTTP)

An Opt represent an option that can be passed to NewClient

func LatestSemanticURLFormat

func LatestSemanticURLFormat(urlFormat string) Opt

func LatestURLFormat

func LatestURLFormat(urlFormat string) Opt

CurrentURLFormat returns an Opt that can be passed to NewClient which sets the latestManifestURLFmt to the given string. Used in testing.

func NoVerify

func NoVerify(noVerify bool) Opt

NoVerify disables signature verification of the manifest

func URLFormat

func URLFormat(urlFormat string) Opt

URLFormat returns an Opt that can be passed to NewClient which sets the manifestURLFmt to the given string. Used in testing.

type Path

type Path struct {
	// contains filtered or unexported fields
}

A Path client retrieves and parses a Manifest from files in a directory or a file

func NewPathClient

func NewPathClient(path string) *Path

NewPathClient returns a Directory client

func (*Path) GetCurrentManifest

func (d *Path) GetCurrentManifest(_ context.Context, channel string) (*manifest.A2, error)

GetCurrentManifest returns an A2 manifest.

func (*Path) GetManifest

func (d *Path) GetManifest(_ context.Context, release string) (*manifest.A2, error)

GetCurrentManifest returns an A2 manifest.

Jump to

Keyboard shortcuts

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