option

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TargetTypeRemote    = "registry"
	TargetTypeOCILayout = "oci-layout"
)

Variables

This section is empty.

Functions

func Parse

func Parse(optsPtr interface{}) error

Parse parses applicable fields of the passed-in option pointer and returns error during parsing.

Types

type BinaryTarget

type BinaryTarget struct {
	From Target
	To   Target
	// contains filtered or unexported fields
}

BinaryTarget struct contains flags and arguments specifying two registries or image layouts.

func (*BinaryTarget) EnableDistributionSpecFlag

func (opts *BinaryTarget) EnableDistributionSpecFlag()

EnableDistributionSpecFlag set distribution specification flag as applicable.

func (*BinaryTarget) Parse

func (opts *BinaryTarget) Parse() error

Parse parses user-provided flags and arguments into option struct.

type Cache

type Cache struct {
	Root string
}

func (*Cache) CachedTarget

func (opts *Cache) CachedTarget(src oras.ReadOnlyTarget) (oras.ReadOnlyTarget, error)

CachedTarget gets the target storage with caching if cache root is specified.

type Common

type Common struct {
	Debug   bool
	Verbose bool
	TTY     *os.File
	// contains filtered or unexported fields
}

Common option struct.

func (*Common) Parse

func (opts *Common) Parse() error

Parse gets target options from user input.

func (*Common) WithContext

func (opts *Common) WithContext(ctx context.Context) (context.Context, *slog.Logger)

WithContext returns a new FieldLogger and an associated Context derived from ctx.

type DistributionSpec

type DistributionSpec struct {
	// ReferrersAPI indicates the preference of the implementation of the Referrers API.
	// Set to true for referrers API, false for referrers tag scheme, and nil for auto fallback.
	ReferrersAPI *bool
	// contains filtered or unexported fields
}

DistributionSpec option struct.

func (*DistributionSpec) Parse

func (opts *DistributionSpec) Parse() error

Parse parses flags into the option.

type FlagParser

type FlagParser interface {
	Parse() error
}

FlagParser parses flags in an option.

type Platform

type Platform struct {
	Platform *ocispec.Platform
	// contains filtered or unexported fields
}

Platform option struct.

func (*Platform) Parse

func (opts *Platform) Parse() error

parse parses the input platform flag to an oci platform type.

type ReadOnlyGraphTagFinderTarget

type ReadOnlyGraphTagFinderTarget interface {
	oras.ReadOnlyGraphTarget
	registry.TagLister
}

ReadOnlyGraphTagFinderTarget represents a read-only graph target with tag finder capability.

type Remote

type Remote struct {
	DistributionSpec
	CACertFilePath    string
	Insecure          bool
	Configs           []string
	Username          string
	PasswordFromStdin bool
	Password          string
	// contains filtered or unexported fields
}

Remote options struct.

func NewRemote

func NewRemote(plainHTTP bool, username, password string) Remote

func (*Remote) Credential

func (opts *Remote) Credential() auth.Credential

Credential returns a credential based on the remote options.

func (*Remote) EnableDistributionSpecFlag

func (opts *Remote) EnableDistributionSpecFlag()

EnableDistributionSpecFlag set distribution specification flag as applicable.

func (*Remote) NewRegistry

func (opts *Remote) NewRegistry(
	registry string,
	common Common,
	logger *slog.Logger,
) (reg *remote.Registry, err error)

NewRegistry assembles a oras remote registry.

func (*Remote) NewRepository

func (opts *Remote) NewRepository(
	reference string,
	common Common,
	logger *slog.Logger,
) (repo *remote.Repository, err error)

NewRepository assembles a oras remote repository.

func (*Remote) Parse

func (opts *Remote) Parse() error

Parse tries to read password with optional cmd prompt.

type Target

type Target struct {
	Remote
	RawReference string
	Type         string
	Reference    string // contains tag or digest
	// Path contains
	//  - path to the OCI image layout target, or
	//  - registry and repository for the remote target
	Path string
	// contains filtered or unexported fields
}

Target struct contains flags and arguments specifying one registry or image layout.

func (*Target) AnnotatedReference

func (opts *Target) AnnotatedReference() string

AnnotatedReference returns full printable reference.

func (*Target) EnsureReferenceNotEmpty

func (opts *Target) EnsureReferenceNotEmpty() error

EnsureReferenceNotEmpty ensures whether the tag or digest is empty.

func (*Target) NewReadonlyTarget

func (opts *Target) NewReadonlyTarget(
	ctx context.Context,
	common Common,
	logger *slog.Logger,
) (ReadOnlyGraphTagFinderTarget, error)

NewReadonlyTargets generates a new read only target based on opts.

func (*Target) NewTarget

func (opts *Target) NewTarget(common Common, logger *slog.Logger) (oras.GraphTarget, error)

NewTarget generates a new target based on opts.

func (*Target) Parse

func (opts *Target) Parse() error

Parse gets target options from user input.

type Transport

type Transport struct {
	http.RoundTripper
}

Transport is an http.RoundTripper that keeps track of the in-flight request and add hooks to report HTTP tracing events.

func (*Transport) RoundTrip

func (t *Transport) RoundTrip(req *http.Request) (resp *http.Response, err error)

RoundTrip calls base roundtrip while keeping track of the current request.

Jump to

Keyboard shortcuts

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