client

package
v0.11.1-rc.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 24 Imported by: 1

Documentation

Index

Constants

View Source
const ArtifactTarballFileName = "artifact.tgz"

ArtifactTarballFileName defines name for the generated artifact tarball file

Variables

View Source
var (
	// CanonicalConfigMediaType is the OCI media type for the config layer.
	CanonicalConfigMediaType types.MediaType = "application/vnd.io.kusion.config.v1+json"

	// CanonicalMediaTypePrefix is the suffix for OCI media type for the content layer.
	CanonicalMediaTypePrefix types.MediaType = "application/vnd.io.kusion.content.v1"

	// CanonicalContentMediaType is the OCI media type for the content layer.
	CanonicalContentMediaType = types.MediaType(fmt.Sprintf("%s.tar+gzip", CanonicalMediaTypePrefix))
)

Functions

This section is empty.

Types

type Client

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

Client provides methods to interact with OCI registry.

func NewClient

func NewClient(options ...ClientOption) *Client

NewClient returns a client instance for use communicating with OCI registry.

func (*Client) Build

func (c *Client) Build(artifactPath, sourceDir string, ignorePaths []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. Original copy from https://github.com/fluxcd/pkg/blob/main/oci/client/build.go

func (*Client) Push

func (c *Client) Push(
	ctx context.Context,
	ociURL, version, sourceDir string,
	metadata meta.Metadata,
	ignorePaths []string,
) (string, string, error)

Push takes care of the actual artifact push behavior. It performs following operations: - builds tarball from given directory also corresponding layer - adds this layer to an empty OpenContainers artifact - annotates the artifact with the given annotations - check if the target reference exists and if it is an image index. Creates a new image index if it does not exist - uploads the final artifact to the OCI registry and appends the artifact to the index, - returns the digest URL of the upstream artifact

func (*Client) Tag

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

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

type ClientOption

type ClientOption func(o *ClientOptions)

ClientOption is a function for configuring ClientOptions.

func WithCredentials

func WithCredentials(credentials string) ClientOption

WithCredentials sets authenticator for remote operations.

func WithInsecure

func WithInsecure(insecure bool) ClientOption

WithInsecure returns a ClientOption which allows image references to be fetched without TLS.

func WithPlatform added in v0.11.1

func WithPlatform(platform *v1.Platform) ClientOption

WithPlatform sets a platform for the client.

func WithUserAgent

func WithUserAgent(userAgent string) ClientOption

WithUserAgent sets User-Agent header for any HTTP requests.

type ClientOptions

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

ClientOptions are options for configuring the client behavior.

Jump to

Keyboard shortcuts

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