artifact

package
v1.2.0-alpha.0 Latest Latest
Warning

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

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

Documentation

Overview

Package artifact implements interface to fetch the binary artifacts from different sources

Index

Constants

View Source
const (
	ErrorMsgHTTPArtifactDownload = "error while downloading the artifact: %s; received status code: %d instead of 200"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Artifact

type Artifact interface {
	// Fetch the binary for a plugin version.
	Fetch() ([]byte, error)
	// FetchTest the test binary for a plugin version.
	FetchTest() ([]byte, error)
}

Artifact is an interface to download a single plugin binary.

func NewHTTPArtifact

func NewHTTPArtifact(url string) Artifact

NewHTTPArtifact creates HTTP Artifact object

func NewLocalArtifact

func NewLocalArtifact(path string) Artifact

NewLocalArtifact creates Local Artifact object If path is not an absolute path search under `xdg.ConfigHome/tanzu-plugin/distribution` directory

func NewOCIArtifact

func NewOCIArtifact(image string) Artifact

NewOCIArtifact creates OCI Artifact object

func NewURIArtifact

func NewURIArtifact(uri string) (Artifact, error)

NewURIArtifact creates new artifacts based on the URI

type HTTPArtifact

type HTTPArtifact struct {
	URL        string
	HTTPClient interfaces.HTTPClient
}

HTTPArtifact defines HTTP artifact location.

func (*HTTPArtifact) Fetch

func (g *HTTPArtifact) Fetch() ([]byte, error)

Fetch an artifact.

func (*HTTPArtifact) FetchTest

func (g *HTTPArtifact) FetchTest() ([]byte, error)

FetchTest returns test artifact

type LocalArtifact

type LocalArtifact struct {
	// Path is path to local binary artifact
	// if path is not an absolute path search under
	// `xdg.ConfigHome/tanzu-plugin/localPath` directory
	Path string
}

LocalArtifact defines local artifact path. Sample URI: file://home/user/workspace/tanzu-framework/artifacts/darwin/amd64/cli/login/v0.10.0-dev/tanzu-login-darwin_amd64

func (*LocalArtifact) Fetch

func (l *LocalArtifact) Fetch() ([]byte, error)

Fetch reads the local artifact from its path

func (*LocalArtifact) FetchTest

func (l *LocalArtifact) FetchTest() ([]byte, error)

FetchTest reads test plugin artifact based on the local plugin artifact path To fetch the test binary from the plugin we are using plugin binary path and creating test plugin path from it If the plugin binary path is `artifacts/darwin/amd64/cli/cluster/v0.27.0-dev/tanzu-cluster-darwin_amd64` then test plugin binary will be under `artifacts/darwin/amd64/cli/cluster/v0.27.0-dev/test/` directory

type OCIArtifact

type OCIArtifact struct {
	Image string
	// contains filtered or unexported fields
}

OCIArtifact defines OCI artifact image endpoint

func (*OCIArtifact) Fetch

func (g *OCIArtifact) Fetch() ([]byte, error)

Fetch an artifact.

func (*OCIArtifact) FetchTest

func (g *OCIArtifact) FetchTest() ([]byte, error)

FetchTest returns test artifact

Jump to

Keyboard shortcuts

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