ociinstaller

package
v1.6.3-rc.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2024 License: AGPL-3.0 Imports: 33 Imported by: 6

Documentation

Index

Constants

View Source
const (
	DefaultImageTag  = "latest"
	DefaultImageOrg  = "turbot"
	DefaultImageType = "plugins"
)
View Source
const DefaultConfigSchema string = "2020-11-18"

Variables

This section is empty.

Functions

func FileExists added in v1.6.0

func FileExists(filePath string) bool

func FindLayersForMediaType added in v1.6.0

func FindLayersForMediaType(layers []ocispec.Descriptor, mediaType string) []ocispec.Descriptor

func MediaTypeConfig

func MediaTypeConfig() string

func MediaTypePluginConfig

func MediaTypePluginConfig() string

deprecate this....

func MediaTypePluginDocsLayer

func MediaTypePluginDocsLayer() string

func MediaTypePluginLicenseLayer

func MediaTypePluginLicenseLayer() string

func MediaTypePluginSpcLayer

func MediaTypePluginSpcLayer() string

func MoveFileWithinPartition

func MoveFileWithinPartition(sourcePath, destPath string) error

MoveFileWithinPartition moves a file within an fs partition. panics if movement is attempted between partitions this is done separately to achieve performance benefits of os.Rename over reading and writing content

func MoveFolderWithinPartition

func MoveFolderWithinPartition(sourcePath, destPath string) error

MoveFolderWithinPartition moves a folder within an fs partition. panics if movement is attempted between partitions this is done separately to achieve performance benefits of os.Rename over reading and writing content

func NewTempDir

func NewTempDir(parent string) *tempDir

NewTempDir creates a directory under the given parent directory.

func Ungzip

func Ungzip(sourceFile string, destDir string, opts ...UngzipOption) (string, error)

Types

type ImageProvider added in v1.6.0

type ImageProvider[I OciImageData, C OciImageConfig] interface {
	GetImageData(layers []ocispec.Descriptor) (I, error)
	EmptyConfig() C
}

type ImageRef added in v1.6.0

type ImageRef struct {
	RequestedRef string
}

ImageRef a struct encapsulating a ref to an OCI image

func NewImageRef added in v1.6.0

func NewImageRef(ref string) *ImageRef

NewImageRef creates and returns a New ImageRef

func (*ImageRef) ActualImageRef added in v1.6.0

func (r *ImageRef) ActualImageRef() string

ActualImageRef returns the actual, physical full image ref (ghcr.io/turbot/steampipe/plugins/turbot/aws:1.0.0)

func (*ImageRef) DisplayImageRef added in v1.6.0

func (r *ImageRef) DisplayImageRef() string

DisplayImageRef returns the "friendly" user-facing full image ref (hub.steampipe.io/plugins/turbot/aws@1.0.0)

func (*ImageRef) DisplayImageRefConstraintOverride added in v1.6.0

func (r *ImageRef) DisplayImageRefConstraintOverride(constraint string) string

DisplayImageRefConstraintOverride returns a "friendly" user-facing version of the image ref but with the version replaced by provided constraint (hub.steampipe.io/plugins/turbot/aws@^1.0)

func (*ImageRef) GetFriendlyName added in v1.6.0

func (r *ImageRef) GetFriendlyName() string

GetFriendlyName returns the minimum friendly name so that the original name can be rebuilt using preset defaults: hub.steampipe.io/plugins/turbot/aws@1.0.0 => aws@1.0.0 hub.steampipe.io/plugins/turbot/aws@latest => aws hub.steampipe.io/plugins/otherOrg/aws@latest => otherOrg/aws hub.steampipe.io/plugins/otherOrg/aws@1.0.0 => otherOrg/aws@1.0.0 differentRegistry.com/otherOrg/aws@latest => differentRegistry.com/otherOrg/aws@latest differentRegistry.com/otherOrg/aws@1.0.0 => differentRegistry.com/otherOrg/aws@1.0.0

func (*ImageRef) GetOrgNameAndStream added in v1.6.0

func (r *ImageRef) GetOrgNameAndStream() (org, name, stream string)

GetOrgNameAndStream splits the full image reference into (org, name, constraint) Constraint will be either a SemVer version (1.2.3) or a SemVer constraint (^0.4)

func (*ImageRef) IsFromTurbotHub added in v1.6.0

func (r *ImageRef) IsFromTurbotHub() bool

type ImageType

type ImageType string
const (
	ImageTypePlugin ImageType = "plugin"
)

type MediaTypeProvider added in v1.6.0

type MediaTypeProvider interface {
	MediaTypeForPlatform(imageType ImageType) ([]string, error)
	SharedMediaTypes(imageType ImageType) []string
	ConfigMediaTypes() []string
}

type OciConfigBase added in v1.6.0

type OciConfigBase struct {
	SchemaVersion string `json:"schemaVersion"`
}

func (*OciConfigBase) GetSchemaVersion added in v1.6.0

func (c *OciConfigBase) GetSchemaVersion() string

func (*OciConfigBase) SetSchemaVersion added in v1.6.0

func (c *OciConfigBase) SetSchemaVersion(version string)

type OciDownloader added in v1.6.0

type OciDownloader[I OciImageData, C OciImageConfig] struct {
	Images []*OciImage[I, C]

	MediaTypesProvider MediaTypeProvider
	ImageProvider      ImageProvider[I, C]
	// contains filtered or unexported fields
}

func NewOciDownloader

func NewOciDownloader[I OciImageData, C OciImageConfig](baseImageRef string, mediaTypesProvider MediaTypeProvider, imageProvider ImageProvider[I, C]) *OciDownloader[I, C]

NewOciDownloader creates and returns a OciDownloader instance

func (*OciDownloader[I, C]) Download added in v1.6.0

func (o *OciDownloader[I, C]) Download(ctx context.Context, ref *ImageRef, imageType ImageType, destDir string) (*OciImage[I, C], error)

func (*OciDownloader[I, C]) Pull added in v1.6.0

func (o *OciDownloader[I, C]) Pull(ctx context.Context, ref string, mediaTypes []string, destDir string) (*ocispec.Descriptor, *ocispec.Descriptor, []byte, []ocispec.Descriptor, error)

Pull downloads the image from the given `ref` to the supplied `destDir`

Returns

imageDescription, configDescription, config, imageLayers, error

type OciImage added in v1.6.0

type OciImage[I OciImageData, C OciImageConfig] struct {
	OCIDescriptor *ocispec.Descriptor
	ImageRef      *ImageRef
	Config        C
	Data          I
	// contains filtered or unexported fields
}

func InstallPlugin added in v1.6.0

func InstallPlugin(ctx context.Context, imageRef string, constraint string, sub chan struct{}, baseImageRef string, mediaTypesProvider MediaTypeProvider, opts ...PluginInstallOption) (*OciImage[*PluginImage, *PluginImageConfig], error)

InstallPlugin installs a plugin from an OCI Image

type OciImageConfig added in v1.6.0

type OciImageConfig interface {
	GetSchemaVersion() string
	SetSchemaVersion(string)
}

type OciImageData added in v1.6.0

type OciImageData interface {
	Type() ImageType
}

type PluginImage

type PluginImage struct {
	BinaryFile         string
	BinaryDigest       string
	BinaryArchitecture string
	DocsDir            string
	ConfigFileDir      string
	LicenseFile        string
}

func (*PluginImage) Type added in v1.6.0

func (s *PluginImage) Type() ImageType

type PluginImageConfig added in v1.6.0

type PluginImageConfig struct {
	OciConfigBase
	Plugin struct {
		Name         string `json:"name,omitempty"`
		Organization string `json:"organization,omitempty"`
		Version      string `json:"version"`
	}
}

type PluginInstallOption added in v1.6.0

type PluginInstallOption = func(config *pluginInstallConfig)

func WithSkipConfig added in v1.6.0

func WithSkipConfig(skipConfigFile bool) PluginInstallOption

type PluginOciDownloader added in v1.6.0

type PluginOciDownloader struct {
	OciDownloader[*PluginImage, *PluginImageConfig]
}

func NewPluginOciDownloader added in v1.6.0

func NewPluginOciDownloader(baseImageRef string, mediaTypesProvider MediaTypeProvider) *PluginOciDownloader

func (*PluginOciDownloader) EmptyConfig added in v1.6.0

func (p *PluginOciDownloader) EmptyConfig() *PluginImageConfig

func (*PluginOciDownloader) GetImageData added in v1.6.0

func (p *PluginOciDownloader) GetImageData(layers []ocispec.Descriptor) (*PluginImage, error)

type UngzipOption added in v1.6.0

type UngzipOption func(*gzipConfig)

func WithMaxDecompressedSize added in v1.6.0

func WithMaxDecompressedSize(size int64) UngzipOption

Jump to

Keyboard shortcuts

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