ppi

package
v0.1.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

ppi provides the plugin programming interface. It contains everything requirted to implement an OCM plugin

Index

Constants

View Source
const (
	KIND_PLUGIN       = internal.KIND_PLUGIN
	KIND_DOWNLOADER   = internal.KIND_DOWNLOADER
	KIND_UPLOADER     = internal.KIND_UPLOADER
	KIND_ACCESSMETHOD = internal.KIND_ACCESSMETHOD
)

Variables

Functions

This section is empty.

Types

type AccessMethod

type AccessMethod interface {
	runtime.TypedObjectDecoder

	Name() string
	Version() string

	// Options provides the list of CLI options supported to compose the access
	// specification.
	Options() []options.OptionType

	// Description provides a general description for the access mehod kind.
	Description() string
	// Format describes the attributes of the dedicated version.
	Format() string

	ValidateSpecification(p Plugin, spec AccessSpec) (info *AccessSpecInfo, err error)
	Reader(p Plugin, spec AccessSpec, creds credentials.Credentials) (io.ReadCloser, error)
	ComposeAccessSpecification(p Plugin, opts Config, config Config) error
}

type AccessMethodBase

type AccessMethodBase struct {
	// contains filtered or unexported fields
}

func MustNewAccessMethodBase

func MustNewAccessMethodBase(name, version string, proto AccessSpec, desc string, format string) AccessMethodBase

func (*AccessMethodBase) Description

func (b *AccessMethodBase) Description() string

func (*AccessMethodBase) Format

func (b *AccessMethodBase) Format() string

func (*AccessMethodBase) Name

func (b *AccessMethodBase) Name() string

func (*AccessMethodBase) Version

func (b *AccessMethodBase) Version() string

type AccessMethodDescriptor

type AccessMethodDescriptor = internal.AccessMethodDescriptor

type AccessSpec

type AccessSpec runtime.VersionedTypedObject

type AccessSpecInfo

type AccessSpecInfo = internal.AccessSpecInfo

type AccessSpecProvider

type AccessSpecProvider func() AccessSpec

type CLIOption

type CLIOption = internal.CLIOption

type Config

type Config map[string]interface{}

Config is a generic structured config stored in a string map.

func (Config) GetValue

func (c Config) GetValue(name string) (interface{}, bool)

type Descriptor

type Descriptor = internal.Descriptor

type DownloadResultProvider

type DownloadResultProvider func() (string, error)

type Downloader

type Downloader interface {
	Name() string
	Description() string

	Writer(p Plugin, arttype, mediatype string, filepath string) (io.WriteCloser, DownloadResultProvider, error)
}

type DownloaderDescriptor

type DownloaderDescriptor = internal.DownloaderDescriptor

type DownloaderKey

type DownloaderKey = internal.DownloaderKey

type Options

type Options struct {
	Config json.RawMessage
}

func (*Options) AddFlags

func (o *Options) AddFlags(fs *pflag.FlagSet)

type Plugin

type Plugin interface {
	Name() string
	Version() string
	Descriptor() internal.Descriptor

	SetShort(s string)
	SetLong(s string)
	SetConfigParser(config func(raw json.RawMessage) (interface{}, error))

	RegisterDownloader(arttype, mediatype string, u Downloader) error
	GetDownloader(name string) Downloader
	GetDownloaderFor(arttype, mediatype string) Downloader

	RegisterUploader(arttype, mediatype string, u Uploader) error
	GetUploader(name string) Uploader
	GetUploaderFor(arttype, mediatype string) Uploader
	DecodeUploadTargetSpecification(data []byte) (UploadTargetSpec, error)

	RegisterAccessMethod(m AccessMethod) error
	DecodeAccessSpecification(data []byte) (AccessSpec, error)
	GetAccessMethod(name string, version string) AccessMethod

	GetOptions() *Options
	GetConfig() (interface{}, error)
}

func NewPlugin

func NewPlugin(name string, version string) Plugin

type UploadTargetSpec

type UploadTargetSpec runtime.VersionedTypedObject

type UploadTargetSpecInfo

type UploadTargetSpecInfo = internal.UploadTargetSpecInfo

type Uploader

type Uploader interface {
	Decoders() map[string]runtime.TypedObjectDecoder

	Name() string
	Description() string

	ValidateSpecification(p Plugin, spec UploadTargetSpec) (info *UploadTargetSpecInfo, err error)
	Writer(p Plugin, arttype, mediatype string, hint string, spec UploadTargetSpec, creds credentials.Credentials) (io.WriteCloser, AccessSpecProvider, error)
}

type UploaderBase

type UploaderBase = nameDescription

func MustNewUploaderBase

func MustNewUploaderBase(name, desc string) UploaderBase

type UploaderDescriptor

type UploaderDescriptor = internal.UploaderDescriptor

type UploaderKey

type UploaderKey = internal.UploaderKey

Jump to

Keyboard shortcuts

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