Documentation ¶
Overview ¶
Package artifact implements interface to fetch the binary artifacts from different sources
Index ¶
Constants ¶
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 ¶
NewHTTPArtifact creates HTTP Artifact object
func NewLocalArtifact ¶
NewLocalArtifact creates Local Artifact object If path is not an absolute path search under `xdg.ConfigHome/tanzu-plugin/distribution` directory
func NewOCIArtifact ¶
NewOCIArtifact creates OCI Artifact object
func NewURIArtifact ¶
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) 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) FetchTest ¶
func (g *OCIArtifact) FetchTest() ([]byte, error)
FetchTest returns test artifact