ociclient

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: Apache-2.0 Imports: 19 Imported by: 1

Documentation

Overview

Package ociclient contains the OCI client interface and implementation.

Index

Constants

View Source
const (
	// Scheme is the URI scheme for an OCI registry.
	Scheme = "oci://"

	// VerificationTimeout is the timeout for verifying the authenticity of an image.
	VerificationTimeout = 60 * time.Second
)

Variables

View Source
var (
	// ErrNoPublicKeys is the error message for when no public keys are provided for signature verification.
	ErrNoPublicKeys = errors.New("no public keys provided for signature verification")
)

Functions

This section is empty.

Types

type Client

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

Client is an interface for interacting with an OCI registry.

func NewOCIClient

func NewOCIClient(opts ...Option) (*Client, error)

NewOCIClient creates a new OCI client with the given options.

func (*Client) Catalog

func (c *Client) Catalog(ctx context.Context, reg name.Registry) ([]string, error)

Catalog returns the list of repositories in the registry.

func (*Client) Head

func (c *Client) Head(ref name.Reference) (*v1.Descriptor, error)

Head checks if the given artifact exists in the registry.

func (*Client) List

func (c *Client) List(ref name.Repository) ([]string, error)

List returns a list of tags for the given repository.

func (*Client) PullChart

func (c *Client) PullChart(opts ImageOptions) error

PullChart pulls a Helm chart from the given ImageOptions.

func (*Client) PullImage

func (c *Client) PullImage(ref name.Reference) (v1.Image, error)

PullImage pulls an image from the given name.Reference.

func (*Client) ValidateImage

func (c *Client) ValidateImage(image v1.Image, vType v1alpha1.ValidationType) error

ValidateImage validates the given image.

func (*Client) VerifySignature

func (c *Client) VerifySignature(ctx context.Context, ref name.Reference) ([]string, []error)

VerifySignature verifies the authenticity of the given image reference URL using the provided public keys.

func (*Client) WriteLayer

func (c *Client) WriteLayer(layer v1.Layer, path string, opts ImageOptions) error

WriteLayer writes a layer to the filesystem.

type ImageOptions

type ImageOptions struct {
	Ref     string
	OutDir  string
	OutFile string
}

ImageOptions defines the options for pulling an image.

type Option

type Option func(*Client)

Option is a functional option for configuring the OCI client.

func WithAnonymousAuth

func WithAnonymousAuth() Option

WithAnonymousAuth configures the OCI client with anonymous authentication.

func WithBasicAuth

func WithBasicAuth(username, password string) Option

WithBasicAuth configures the OCI client with basic authentication.

func WithMultiAuth

func WithMultiAuth(keychain []authn.Keychain) Option

WithMultiAuth configures the OCI client with multiple authentication keychains.

func WithTLSConfig

func WithTLSConfig(insecureSkipTLSVerify bool, caCert, caFile string) Option

WithTLSConfig configures the OCI client with the given TLS options.

func WithVerificationPublicKeys

func WithVerificationPublicKeys(publicKeys [][]byte) Option

WithVerificationPublicKeys configures the OCI client with the given public keys for signature verification.

func WithVerificationTimeout

func WithVerificationTimeout(timeout time.Duration) Option

WithVerificationTimeout configures the OCI client with the given verification timeout.

Directories

Path Synopsis
Package verifier contains the verifier interface and the cosign verifier implementation.
Package verifier contains the verifier interface and the cosign verifier implementation.

Jump to

Keyboard shortcuts

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