fetcher

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fetcher

type Fetcher interface {
	Fetch() (*apiv1.ModuleReference, error)
	GetModuleRoot() string
}

func New

func New(ctx context.Context, opts Options) (Fetcher, error)

New is a factory function that creates a new Fetcher based on the provided options. If you know the type of fetcher you want to create, prefer using the specific factory function.

type Local

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

func NewLocal

func NewLocal(src, dst string) *Local

NewLocal creates a local Fetcher for the given module.

func (*Local) Fetch

func (f *Local) Fetch() (*apiv1.ModuleReference, error)

func (*Local) GetModuleRoot

func (f *Local) GetModuleRoot() string

type OCI

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

func NewOCI

func NewOCI(ctx context.Context, src, version, dst, cacheDir, creds string, insecure bool) *OCI

NewOCI creates an oci Fetcher for the given module.

func (*OCI) Fetch

func (f *OCI) Fetch() (*apiv1.ModuleReference, error)

Fetch copies the module contents to the destination directory. The artifact is pulled from the registry and its contents extracted to the destination dir.

func (*OCI) GetModuleRoot

func (f *OCI) GetModuleRoot() string

type Options

type Options struct {
	// Source is the location of the module to fetch.
	Source string
	// Version is the version of the module to fetch.
	Version string
	// Destination is the location to store the fetched module.
	Destination string
	// CacheDir is the location to store the fetched module.
	CacheDir string
	// Creds is the credentials to use when fetching the module.
	Creds string
	// Insecure is a flag that indicates if the fetcher should allow use of insecure connections.
	Insecure bool

	// DefaultLocal is a flag that indicates if the fetcher should default to a Local fetcher if no other can be applied.
	DefaultLocal bool
}

Jump to

Keyboard shortcuts

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