client

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2022 License: Apache-2.0 Imports: 18 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseArtifactURL

func ParseArtifactURL(ociURL string) (string, error)

ParseArtifactURL validates the OCI URL and returns the address of the artifact.

func ParseRepositoryURL

func ParseRepositoryURL(ociURL string) (string, error)

ParseRepositoryURL validates the OCI URL and returns the address of the artifact repository.

Types

type Client

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

Client holds the options for accessing remote OCI registries.

func NewClient

func NewClient(opts []crane.Option) *Client

NewClient returns an OCI client configured with the given crane options.

func NewLocalClient

func NewLocalClient() *Client

NewLocalClient returns an OCI client configured with the Docker keychain helpers.

func (*Client) Build

func (c *Client) Build(artifactPath, sourceDir string) (err error)

Build archives the given directory as a tarball to the given local path. While archiving, any environment specific data (for example, the user and group name) is stripped from file headers.

func (*Client) List

func (c *Client) List(ctx context.Context, url string) ([]Metadata, error)

List fetches the tags and their manifests for a given OCI repository.

func (*Client) Pull

func (c *Client) Pull(ctx context.Context, url, outDir string) (*Metadata, error)

Pull downloads an artifact from an OCI repository and extracts the content to the given directory.

func (*Client) Push

func (c *Client) Push(ctx context.Context, url, sourceDir string, meta Metadata) (string, error)

Push creates an artifact from the given directory, uploads the artifact to the given OCI repository and returns the digest.

func (*Client) Tag

func (c *Client) Tag(ctx context.Context, url, tag string) (string, error)

Tag creates a new tag for the given artifact using the same OCI repository as the origin.

type Metadata

type Metadata struct {
	Source   string `json:"source_url"`
	Revision string `json:"source_revision"`
	Digest   string `json:"digest"`
	URL      string `json:"url"`
}

Metadata holds the upstream information about on artifact's source.

func MetadataFromAnnotations

func MetadataFromAnnotations(annotations map[string]string) (*Metadata, error)

MetadataFromAnnotations parses the OpenContainers annotations and returns a Metadata object.

func (*Metadata) ToAnnotations

func (m *Metadata) ToAnnotations() map[string]string

ToAnnotations returns the OpenContainers source and revision map.

Jump to

Keyboard shortcuts

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