Documentation ¶
Index ¶
- Constants
- Variables
- func ApplyFlags(optsPtr interface{}, target *pflag.FlagSet)
- func CheckStdinConflict(flags *pflag.FlagSet) error
- func Parse(cmd *cobra.Command, optsPtr interface{}) error
- type BinaryTarget
- func (opts *BinaryTarget) ApplyFlags(fs *pflag.FlagSet)
- func (opts *BinaryTarget) EnableDistributionSpecFlag()
- func (opts *BinaryTarget) EnsureSourceTargetReferenceNotEmpty(cmd *cobra.Command) error
- func (opts *BinaryTarget) Modify(cmd *cobra.Command, err error) (error, bool)
- func (opts *BinaryTarget) Parse(cmd *cobra.Command) error
- type Cache
- type Common
- type Confirmation
- type Descriptor
- type DistributionSpec
- type FlagApplier
- type FlagParser
- type Format
- type FormatType
- type ImageSpec
- type Packer
- func (opts *Packer) ApplyFlags(fs *pflag.FlagSet)
- func (opts *Packer) ExportManifest(ctx context.Context, fetcher content.Fetcher, desc ocispec.Descriptor) error
- func (opts *Packer) LoadManifestAnnotations() (annotations map[string]map[string]string, err error)
- func (opts *Packer) Parse(*cobra.Command) error
- type Platform
- type Pretty
- type ReadOnlyGraphTagFinderTarget
- type Remote
- func (opts *Remote) ApplyFlags(fs *pflag.FlagSet)
- func (opts *Remote) ApplyFlagsWithPrefix(fs *pflag.FlagSet, prefix, description string)
- func (opts *Remote) ConfigPath() (string, error)
- func (opts *Remote) Credential() auth.Credential
- func (opts *Remote) DecorateCredentialError(err error) *oerrors.Error
- func (opts *Remote) EnableDistributionSpecFlag()
- func (opts *Remote) Modify(cmd *cobra.Command, err error) (error, bool)
- func (opts *Remote) NewRegistry(registry string, common Common, logger logrus.FieldLogger) (reg *remote.Registry, err error)
- func (opts *Remote) NewRepository(reference string, common Common, logger logrus.FieldLogger) (repo *remote.Repository, err error)
- func (opts *Remote) Parse(cmd *cobra.Command) error
- type ResolvableDeleter
- type Target
- func (opts *Target) AnnotatedReference() string
- func (opts *Target) ApplyFlags(fs *pflag.FlagSet)
- func (opts *Target) ApplyFlagsWithPrefix(fs *pflag.FlagSet, prefix, description string)
- func (opts *Target) EnsureReferenceNotEmpty(cmd *cobra.Command, needsTag bool) error
- func (opts *Target) Modify(cmd *cobra.Command, err error) (error, bool)
- func (opts *Target) NewBlobDeleter(common Common, logger logrus.FieldLogger) (ResolvableDeleter, error)
- func (opts *Target) NewManifestDeleter(common Common, logger logrus.FieldLogger) (ResolvableDeleter, error)
- func (opts *Target) NewReadonlyTarget(ctx context.Context, common Common, logger logrus.FieldLogger) (ReadOnlyGraphTagFinderTarget, error)
- func (opts *Target) NewTarget(common Common, logger logrus.FieldLogger) (oras.GraphTarget, error)
- func (opts *Target) Parse(cmd *cobra.Command) error
Constants ¶
const ( AnnotationManifest = "$manifest" AnnotationConfig = "$config" )
Pre-defined annotation keys for annotation file
const ( ImageSpecV1_1 = "v1.1" ImageSpecV1_0 = "v1.0" )
const ( DistributionSpecReferrersTagV1_1 = "v1.1-referrers-tag" DistributionSpecReferrersAPIV1_1 = "v1.1-referrers-api" )
const ( TargetTypeRemote = "registry" TargetTypeOCILayout = "oci-layout" )
const NoTTYFlag = "no-tty"
Variables ¶
var ( FormatTypeJSON = &FormatType{ Name: "json", Usage: "Print in JSON format", } FormatTypeGoTemplate = &FormatType{ Name: "go-template", Usage: "Print output using the given Go template", HasParams: true, } FormatTypeTable = &FormatType{ Name: "table", Usage: "Get direct referrers and output in table format", } FormatTypeTree = &FormatType{ Name: "tree", Usage: "Get referrers recursively and print in tree format", } )
format types
Functions ¶
func ApplyFlags ¶
ApplyFlags applies applicable fields of the passed-in option pointer to the target flag set. NOTE: The option argument need to be a pointer to the options, so its value becomes addressable.
func CheckStdinConflict ¶ added in v1.2.0
CheckStdinConflict checks if PasswordFromStdin or IdentityTokenFromStdin of a *pflag.FlagSet conflicts with read file from input.
Types ¶
type BinaryTarget ¶ added in v1.0.0
BinaryTarget struct contains flags and arguments specifying two registries or image layouts. BinaryTarget implements errors.Handler interface.
func (*BinaryTarget) ApplyFlags ¶ added in v1.0.0
func (opts *BinaryTarget) ApplyFlags(fs *pflag.FlagSet)
ApplyFlags applies flags to a command flag set fs.
func (*BinaryTarget) EnableDistributionSpecFlag ¶ added in v1.0.0
func (opts *BinaryTarget) EnableDistributionSpecFlag()
EnableDistributionSpecFlag set distribution specification flag as applicable.
func (*BinaryTarget) EnsureSourceTargetReferenceNotEmpty ¶ added in v1.2.0
func (opts *BinaryTarget) EnsureSourceTargetReferenceNotEmpty(cmd *cobra.Command) error
EnsureSourceTargetReferenceNotEmpty ensures that the from target reference is not empty.
type Cache ¶ added in v0.15.0
type Cache struct {
Root string
}
func (*Cache) CachedTarget ¶ added in v0.15.0
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) ApplyFlags ¶
ApplyFlags applies flags to a command flag set.
type Confirmation ¶ added in v0.15.0
type Confirmation struct {
Force bool
}
Confirmation option struct.
func (*Confirmation) ApplyFlags ¶ added in v0.15.0
func (opts *Confirmation) ApplyFlags(fs *pflag.FlagSet)
ApplyFlags applies flags to a command flag set.
func (*Confirmation) AskForConfirmation ¶ added in v0.15.0
AskForConfirmation prints a propmt to ask for confirmation before doing an action and takes user input as response.
type Descriptor ¶ added in v0.15.0
type Descriptor struct {
OutputDescriptor bool
}
Descriptor option struct.
func (*Descriptor) ApplyFlags ¶ added in v0.15.0
func (opts *Descriptor) ApplyFlags(fs *pflag.FlagSet)
ApplyFlags applies flags to a command flag set.
func (*Descriptor) Marshal ¶ added in v0.15.0
func (opts *Descriptor) Marshal(desc ocispec.Descriptor) ([]byte, error)
Marshal returns the JSON encoding of descriptor.
type DistributionSpec ¶ added in v1.2.0
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 which implements pflag.Value interface.
func (*DistributionSpec) ApplyFlagsWithPrefix ¶ added in v1.2.0
func (ds *DistributionSpec) ApplyFlagsWithPrefix(fs *pflag.FlagSet, prefix, description string)
ApplyFlagsWithPrefix applies flags to a command flag set with a prefix string.
func (*DistributionSpec) Options ¶ added in v1.2.0
func (ds *DistributionSpec) Options() string
Options returns the string of usable options for the flag.
func (*DistributionSpec) Set ¶ added in v1.2.0
func (ds *DistributionSpec) Set(value string) error
Set validates and sets the flag value from a string argument.
func (*DistributionSpec) String ¶ added in v1.2.0
func (ds *DistributionSpec) String() string
String returns the string representation of the flag.
func (*DistributionSpec) Type ¶ added in v1.2.0
func (ds *DistributionSpec) Type() string
Type returns the string value of the inner flag.
type FlagApplier ¶
FlagApplier applies flags to a command flag set.
type FlagParser ¶ added in v1.0.0
FlagParser parses flags in an option.
type Format ¶ added in v1.2.0
type Format struct { FormatFlag string Type string Template string AllowedTypes []*FormatType }
Format contains input and parsed options for formatted output flags.
func (*Format) ApplyFlags ¶ added in v1.2.0
ApplyFlag implements FlagProvider.ApplyFlag.
type FormatType ¶ added in v1.2.0
type FormatType struct { // Name is the format type name. Name string // Usage is the usage string in help doc. Usage string // HasParams indicates whether the format type has parameters. HasParams bool }
FormatType represents a format type.
func (*FormatType) WithUsage ¶ added in v1.2.0
func (ft *FormatType) WithUsage(usage string) *FormatType
WithUsage returns a new format type with provided usage string.
type ImageSpec ¶ added in v1.0.0
type ImageSpec struct { Flag string PackVersion oras.PackManifestVersion }
ImageSpec option struct which implements pflag.Value interface.
func (*ImageSpec) ApplyFlags ¶ added in v1.0.0
ApplyFlags applies flags to a command flag set.
func (*ImageSpec) Options ¶ added in v1.2.0
Options returns the string of usable options for the flag.
func (*ImageSpec) Set ¶ added in v1.2.0
Set validates and sets the flag value from a string argument.
type Packer ¶ added in v0.14.0
type Packer struct { ManifestExportPath string PathValidationDisabled bool AnnotationFilePath string ManifestAnnotations []string FileRefs []string }
Packer option struct.
func (*Packer) ApplyFlags ¶ added in v0.14.0
ApplyFlags applies flags to a command flag set.
func (*Packer) ExportManifest ¶ added in v0.14.0
func (opts *Packer) ExportManifest(ctx context.Context, fetcher content.Fetcher, desc ocispec.Descriptor) error
ExportManifest saves the pushed manifest to a local file.
func (*Packer) LoadManifestAnnotations ¶ added in v0.14.0
LoadManifestAnnotations loads the manifest annotation map.
type Platform ¶ added in v0.14.0
type Platform struct { Platform *ocispec.Platform FlagDescription string // contains filtered or unexported fields }
Platform option struct.
func (*Platform) ApplyFlags ¶ added in v0.14.0
ApplyFlags applies flags to a command flag set.
type Pretty ¶ added in v0.15.0
type Pretty struct {
Pretty bool
}
Pretty option struct.
func (*Pretty) ApplyFlags ¶ added in v0.15.0
ApplyFlags applies flags to a command flag set.
type ReadOnlyGraphTagFinderTarget ¶ added in v1.0.0
ReadOnlyGraphTagFinderTarget represents a read-only graph target with tag finder capability.
type Remote ¶
type Remote struct { DistributionSpec CACertFilePath string CertFilePath string KeyFilePath string Insecure bool Configs []string Username string Secret string // contains filtered or unexported fields }
Remote options struct contains flags and arguments specifying one registry. Remote implements oerrors.Handler and interface.
func (*Remote) ApplyFlags ¶
ApplyFlags applies flags to a command flag set.
func (*Remote) ApplyFlagsWithPrefix ¶ added in v0.14.0
ApplyFlagsWithPrefix applies flags to a command flag set with a prefix string. Commonly used for non-unary remote targets.
func (*Remote) ConfigPath ¶ added in v1.2.0
ConfigPath returns the config path of the credential store.
func (*Remote) Credential ¶
func (opts *Remote) Credential() auth.Credential
Credential returns a credential based on the remote options.
func (*Remote) DecorateCredentialError ¶ added in v1.2.0
DecorateCredentialError decorate error with recommendation.
func (*Remote) EnableDistributionSpecFlag ¶ added in v1.0.0
func (opts *Remote) EnableDistributionSpecFlag()
EnableDistributionSpecFlag set distribution specification flag as applicable.
func (*Remote) NewRegistry ¶
func (opts *Remote) NewRegistry(registry string, common Common, logger logrus.FieldLogger) (reg *remote.Registry, err error)
NewRegistry assembles a oras remote registry.
func (*Remote) NewRepository ¶
func (opts *Remote) NewRepository(reference string, common Common, logger logrus.FieldLogger) (repo *remote.Repository, err error)
NewRepository assembles a oras remote repository.
type ResolvableDeleter ¶ added in v1.2.0
type Target ¶ added in v1.0.0
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 IsOCILayout bool }
Target struct contains flags and arguments specifying one registry or image layout. Target implements oerrors.Handler interface.
func (*Target) AnnotatedReference ¶ added in v1.0.0
AnnotatedReference returns full printable reference.
func (*Target) ApplyFlags ¶ added in v1.0.0
ApplyFlags applies flags to a command flag set for unary target
func (*Target) ApplyFlagsWithPrefix ¶ added in v1.0.0
ApplyFlagsWithPrefix applies flags to a command flag set with a prefix string. Commonly used for non-unary remote targets.
func (*Target) EnsureReferenceNotEmpty ¶ added in v1.0.0
EnsureReferenceNotEmpty returns formalized error when the reference is empty.
func (*Target) NewBlobDeleter ¶ added in v1.2.0
func (opts *Target) NewBlobDeleter(common Common, logger logrus.FieldLogger) (ResolvableDeleter, error)
NewBlobDeleter generates a new blob deleter based on opts.
func (*Target) NewManifestDeleter ¶ added in v1.2.0
func (opts *Target) NewManifestDeleter(common Common, logger logrus.FieldLogger) (ResolvableDeleter, error)
NewManifestDeleter generates a new blob deleter based on opts.
func (*Target) NewReadonlyTarget ¶ added in v1.0.0
func (opts *Target) NewReadonlyTarget(ctx context.Context, common Common, logger logrus.FieldLogger) (ReadOnlyGraphTagFinderTarget, error)
NewReadonlyTargets generates a new read only target based on opts.