registry

package
v0.7.1-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2021 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const ArtifactTypeNotation = "application/vnd.cncf.notary.v2.signature"

ArtifactTypeNotation specifies the artifact type for a notation object.

View Source
const MediaTypeNotationSignature = "application/jose+json"

MediaTypeNotationSignature specifies the media type for the notation signature.

Variables

This section is empty.

Functions

func DescriptorFromBytes

func DescriptorFromBytes(data []byte) notation.Descriptor

DescriptorFromBytes computes the basic descriptor from the given bytes

func GetManifestDescriptor

func GetManifestDescriptor(ctx context.Context, tr http.RoundTripper, ref Reference, plainHTTP bool) (notation.Descriptor, error)

GetManifestDescriptor returns signature manifest information.

func NewAuthtransport

func NewAuthtransport(base http.RoundTripper, username, password string) http.RoundTripper

NewAuthtransport creates wraps a round tripper with auth strategies. It tries basic auth first and then falls back to token auth.

Types

type Reference

type Reference struct {
	// Registry is the name of the registry.
	// It is usually the domain name of the registry.
	Registry string

	// Repository is the name of the repository
	Repository string

	// Reference is the reference of the object in the repository.
	// A reference can be a tag and / or a digest.
	Reference string
}

Reference references to a descriptor in the registry

func ParseReference

func ParseReference(raw string) (Reference, error)

func (Reference) Digest

func (r Reference) Digest() (digest.Digest, error)

Digest returns the reference as a digest

func (Reference) Host

func (r Reference) Host() string

Host returns the host name of the registry

func (Reference) ReferenceOrDefault

func (r Reference) ReferenceOrDefault() string

ReferenceOrDefault returns the reference or the default reference if empty

func (Reference) String

func (r Reference) String() string

type RegistryClient

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

RegistryClient is a customized registry client.

func NewClient

func NewClient(tr http.RoundTripper, name string, plainHTTP bool) *RegistryClient

NewClient creates a new registry client.

func (*RegistryClient) Repository

func (r *RegistryClient) Repository(ctx context.Context, name string) *RepositoryClient

type RepositoryClient

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

func (*RepositoryClient) Get

func (r *RepositoryClient) Get(ctx context.Context, signatureDigest digest.Digest) ([]byte, error)

func (*RepositoryClient) GetManifestDescriptor

func (r *RepositoryClient) GetManifestDescriptor(ctx context.Context, ref string) (notation.Descriptor, error)

GetManifestDescriptor returns signature manifest information by tag or digest.

func (r *RepositoryClient) Link(ctx context.Context, manifest, signature notation.Descriptor) (notation.Descriptor, error)

func (*RepositoryClient) Lookup

func (r *RepositoryClient) Lookup(ctx context.Context, manifestDigest digest.Digest) ([]digest.Digest, error)

func (*RepositoryClient) Put

func (r *RepositoryClient) Put(ctx context.Context, signature []byte) (notation.Descriptor, error)

type SignatureRegistry

type SignatureRegistry interface {
	Repository(ctx context.Context, name string) SignatureRepository
}

SignatureRegistry provides signature repositories

type SignatureRepository

type SignatureRepository interface {
	// Lookup finds all signatures for the specified manifest
	Lookup(ctx context.Context, manifestDigest digest.Digest) ([]digest.Digest, error)

	// Get downloads the signature by the specified digest
	Get(ctx context.Context, signatureDigest digest.Digest) ([]byte, error)

	// Put uploads the signature to the registry
	Put(ctx context.Context, signature []byte) (notation.Descriptor, error)

	// Link creates an signature artifact linking the manifest and the signature
	Link(ctx context.Context, manifest, signature notation.Descriptor) (notation.Descriptor, error)
}

SignatureRepository provides a storage for signatures

Jump to

Keyboard shortcuts

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