Documentation ¶
Index ¶
- Constants
- func FileExists(filePath string) bool
- func FindLayersForMediaType(layers []ocispec.Descriptor, mediaType string) []ocispec.Descriptor
- func MediaTypeConfig() string
- func MediaTypePluginConfig() string
- func MediaTypePluginDocsLayer() string
- func MediaTypePluginLicenseLayer() string
- func MediaTypePluginSpcLayer() string
- func MoveFileWithinPartition(sourcePath, destPath string) error
- func MoveFolderWithinPartition(sourcePath, destPath string) error
- func NewTempDir(parent string) *tempDir
- func Ungzip(sourceFile string, destDir string, opts ...UngzipOption) (string, error)
- type ImageProvider
- type ImageRef
- func (r *ImageRef) ActualImageRef() string
- func (r *ImageRef) DisplayImageRef() string
- func (r *ImageRef) DisplayImageRefConstraintOverride(constraint string) string
- func (r *ImageRef) GetFriendlyName() string
- func (r *ImageRef) GetOrgNameAndStream() (org, name, stream string)
- func (r *ImageRef) IsFromTurbotHub() bool
- type ImageType
- type MediaTypeProvider
- type OciConfigBase
- type OciDownloader
- func (o *OciDownloader[I, C]) Download(ctx context.Context, ref *ImageRef, imageType ImageType, destDir string) (*OciImage[I, C], error)
- func (o *OciDownloader[I, C]) Pull(ctx context.Context, ref string, mediaTypes []string, destDir string) (*ocispec.Descriptor, *ocispec.Descriptor, []byte, []ocispec.Descriptor, error)
- type OciImage
- type OciImageConfig
- type OciImageData
- type PluginImage
- type PluginImageConfig
- type PluginInstallOption
- type PluginOciDownloader
- type UngzipOption
Constants ¶
const ( DefaultImageTag = "latest" DefaultImageOrg = "turbot" DefaultImageType = "plugins" )
const DefaultConfigSchema string = "2020-11-18"
Variables ¶
This section is empty.
Functions ¶
func FileExists ¶ added in v1.6.0
func FindLayersForMediaType ¶ added in v1.6.0
func FindLayersForMediaType(layers []ocispec.Descriptor, mediaType string) []ocispec.Descriptor
func MediaTypeConfig ¶
func MediaTypeConfig() string
func MediaTypePluginDocsLayer ¶
func MediaTypePluginDocsLayer() string
func MediaTypePluginLicenseLayer ¶
func MediaTypePluginLicenseLayer() string
func MediaTypePluginSpcLayer ¶
func MediaTypePluginSpcLayer() string
func MoveFileWithinPartition ¶
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 ¶
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.
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
NewImageRef creates and returns a New ImageRef
func (*ImageRef) ActualImageRef ¶ added in v1.6.0
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
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
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
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
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
type MediaTypeProvider ¶ added in v1.6.0
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]) 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 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