oci

package
v0.7.0-beta3 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: Apache-2.0 Imports: 12 Imported by: 9

Documentation

Overview

Package oci implements all the interactions with remote registry.

Index

Constants

View Source
const (

	// FalcoRulesfileConfigMediaType is the MediaType for rule's config layer.
	FalcoRulesfileConfigMediaType = "application/vnd.cncf.falco.rulesfile.config.v1+json"

	// FalcoRulesfileLayerMediaType is the MediaType for rules.
	FalcoRulesfileLayerMediaType = "application/vnd.cncf.falco.rulesfile.layer.v1+tar.gz"

	// FalcoPluginConfigMediaType is the MediaType for plugin's config layer.
	FalcoPluginConfigMediaType = "application/vnd.cncf.falco.plugin.config.v1+json"

	// FalcoPluginLayerMediaType is the MediaType for plugins.
	FalcoPluginLayerMediaType = "application/vnd.cncf.falco.plugin.layer.v1+tar.gz"

	// DefaultTag is the default tag reference to be used when none is provided.
	DefaultTag = "latest"
)

Variables

This section is empty.

Functions

func HumanReadableMediaType added in v0.5.0

func HumanReadableMediaType(s string) string

HumanReadableMediaType converts MediaType to its corresponding type in a human readable format.

func Platforms

func Platforms(ctx context.Context, ref string, client remote.Client) (map[string]struct{}, error)

Platforms returns a list of all available platforms for a given ref.

Types

type ArtifactConfig

type ArtifactConfig struct {
	// It's the unique name used by the index
	Name         string                `json:"name,omitempty"`
	Version      string                `json:"version,omitempty"`
	Dependencies []ArtifactDependency  `json:"dependencies,omitempty"`
	Requirements []ArtifactRequirement `json:"requirements,omitempty"`
}

ArtifactConfig is the struct stored in the config layer of rulesfile and plugin artifacts. Each type fills only the fields of interest.

func (*ArtifactConfig) ParseDependencies

func (rc *ArtifactConfig) ParseDependencies(dependencies ...string) error

ParseDependencies parses artifact dependencies in the format "name:version|alt1:version1|..." and set them in the config.

func (*ArtifactConfig) ParseRequirements

func (rc *ArtifactConfig) ParseRequirements(requirements ...string) error

ParseRequirements parses artifact requirements in the format "name:version" and set them in the config.

func (*ArtifactConfig) SetDependency

func (rc *ArtifactConfig) SetDependency(name, version string, alternatives []Dependency) int

SetDependency stores an artifact dependency in the config.

Return the insertion position.

func (*ArtifactConfig) SetRequirement

func (rc *ArtifactConfig) SetRequirement(name, version string) int

SetRequirement stores an artifact dependency in the config.

Return the insertion position.

type ArtifactDependency

type ArtifactDependency struct {
	Name         string       `json:"name"`
	Version      string       `json:"version"`
	Alternatives []Dependency `json:"alternatives,omitempty"`
}

ArtifactDependency represents the artifact's depedendency to be stored in the config.

func (*ArtifactDependency) SetAlternative

func (a *ArtifactDependency) SetAlternative(name, version string)

SetAlternative sets an alternative dependency for an artifact dependency.

type ArtifactRequirement

type ArtifactRequirement struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

ArtifactRequirement represents the artifact's requirement to be stored in the config.

type ArtifactType

type ArtifactType string

ArtifactType represents a rules file or a plugin. Used to select the right mediaType when interacting with the registry.

const (
	// Rulesfile represents a rules file artifact.
	Rulesfile ArtifactType = "rulesfile"
	// Plugin represents a plugin artifact.
	Plugin ArtifactType = "plugin"
)

func (*ArtifactType) Set

func (e *ArtifactType) Set(v string) error

Set an ArtifactType.

func (ArtifactType) String

func (e ArtifactType) String() string

String returns a string representation of ArtifactType.

func (*ArtifactType) ToMediaType added in v0.4.0

func (e *ArtifactType) ToMediaType() string

ToMediaType converts type to its corresponding media type. Ensure this is called after a Set().

func (*ArtifactType) Type

func (e *ArtifactType) Type() string

Type returns a string representing this type.

type ArtifactTypeSlice added in v0.4.0

type ArtifactTypeSlice struct {
	Types                []ArtifactType
	CommaSeparatedString string
}

ArtifactTypeSlice is a slice of ArtifactType, can be passed as comma separated values.

func (*ArtifactTypeSlice) Set added in v0.4.0

func (e *ArtifactTypeSlice) Set(v string) error

Set an ArtifactType. Given that we are appending values, the flag can be repeated multiple times.

func (ArtifactTypeSlice) String added in v0.4.0

func (e ArtifactTypeSlice) String() string

String returns a string representation of ArtifactTypeSlice.

func (*ArtifactTypeSlice) Type added in v0.4.0

func (e *ArtifactTypeSlice) Type() string

Type returns a string representing this type.

type Dependency

type Dependency struct {
	Name    string `json:"name"`
	Version string `json:"version"`
}

Dependency represent a dependency with its own name and version.

type RegistryResult

type RegistryResult struct {
	RootDigest string
	Digest     string
	Config     ArtifactConfig
	Type       ArtifactType
	Filename   string
}

RegistryResult represents a generic result that is generated when interacting with a remote OCI registry.

Directories

Path Synopsis
Package authn implements the logic for authentication with OCI registries.
Package authn implements the logic for authentication with OCI registries.
Package puller implements the logic for pull operations.
Package puller implements the logic for pull operations.
Package pusher implements the logic for push operations.
Package pusher implements the logic for push operations.
Package registry implements the logic for interacting with a remote registry.
Package registry implements the logic for interacting with a remote registry.
Package repository implements the logic for interacting with a remote repository.
Package repository implements the logic for interacting with a remote repository.
Package utils implements common OCI utility functions.
Package utils implements common OCI utility functions.

Jump to

Keyboard shortcuts

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