Documentation
¶
Index ¶
- Constants
- Variables
- func Build(*BuildOptions) error
- func GetClassTree() map[ResourceClass][]ResourceSubClass
- func WithBearer(fn func() (string, error)) func(*http.Request) error
- type AddOptions
- type Backend
- type BuildOptions
- type Connector
- type ConnectorType
- type CreateOptions
- type DelOptions
- type FlatBackend
- type FlatBackendOptions
- type Integration
- type IntegrationIndex
- type IntegrationInstallation
- type IntegrationTypes
- type Manager
- func (p *Manager) Add(target string, opts *AddOptions) error
- func (p *Manager) Create(manifest *Manifest, opts *CreateOptions) error
- func (p *Manager) Del(target string, opts *DelOptions) error
- func (p *Manager) FetchRecipe(name string) (*Recipe, error)
- func (p *Manager) List() iter.Seq2[*Package, error]
- func (p *Manager) Query(opts *QueryOptions) (ret []*Integration, err error)
- type Manifest
- type ManifestConnector
- type Options
- type Package
- type Protocol
- type QueryOptions
- type Recipe
- type RequestHook
- type ResourceClass
- type ResourceSubClass
Constants ¶
View Source
const ( ResourceClassUndefined ResourceClass = "" ResourceClassUnknown ResourceClass = "unknown" ResourceClassAnalytics ResourceClass = "analytics" ResourceClassBlockStorage ResourceClass = "block-storage" ResourceClassCompute ResourceClass = "compute" ResourceClassDatabase ResourceClass = "database" ResourceClassFileStorage ResourceClass = "file-storage" ResourceClassHypervisor ResourceClass = "hypervisor" ResourceClassIdentity ResourceClass = "identity" ResourceClassMessaging ResourceClass = "messaging" ResourceClassNetwork ResourceClass = "network" ResourceClassObjectStorage ResourceClass = "object-storage" ResourceClassObservability ResourceClass = "observability" ResourceClassRegistry ResourceClass = "registry" ResourceClassSecurity ResourceClass = "security" ResourceClassService ResourceClass = "service" ResourceSubClassUndefined ResourceSubClass = "" ResourceSubClassUnknown ResourceSubClass = "unknown" ResourceSubClassAzBlob ResourceSubClass = "azblob" ResourceSubClassFTP ResourceSubClass = "ftp" ResourceSubClassGCS ResourceSubClass = "gcs" ResourceSubClassIMAP ResourceSubClass = "imap" ResourceSubClassMongoDB ResourceSubClass = "mongodb" ResourceSubClassMySQL ResourceSubClass = "mysql" ResourceSubClassPVC ResourceSubClass = "pvc" ResourceSubClassPostgreSQL ResourceSubClass = "postgresql" ResourceSubClassProxmox ResourceSubClass = "proxmox" ResourceSubClassRedis ResourceSubClass = "redis" ResourceSubClassS3 ResourceSubClass = "s3" ResourceSubClassSecretManager ResourceSubClass = "secret-manager" ResourceSubClassSFTP ResourceSubClass = "sftp" ConnectorTypeImporter ConnectorType = "importer" ConnectorTypeExporter ConnectorType = "exporter" ConnectorTypeStorage ConnectorType = "storage" ConnectorTypeSecretProvider ConnectorType = "secret_provider" ConnectorTypeInventory ConnectorType = "inventory" )
View Source
const PLUGIN_API_VERSION = "v1.1.0"
View Source
const PLUGIN_BUNDLE_VERSION = "v1.0.0"
Variables ¶
View Source
var ( ErrInvalidOptions = errors.New("invalid options") ErrAlreadyInstalled = errors.New("already installed") ErrBadOSArch = errors.New("OS or architecture don't match the current one") ErrAuthorizationRequired = errors.New("authorization required") )
View Source
var (
ErrBadPackageName = errors.New("invalid package name")
)
Functions ¶
func Build ¶
func Build(*BuildOptions) error
func GetClassTree ¶
func GetClassTree() map[ResourceClass][]ResourceSubClass
func WithBearer ¶
WithBearer adds an Authorization header with the Bearer token returned by the given callback. It's meant to be passed as Options.RequestHook. If it yields an empty token, the header will not be added.
Types ¶
type AddOptions ¶
type AddOptions struct {
// The version to install, if given. Otherwise, the latest
// version available will be used.
Version string
// If exists a older version of the plugin, remove it prior
// to install this version.
Upgrade bool
// If exists a newer version of the plugin, remove it prior
// to install this version.
Downgrade bool
// Remove other version of the plugin, even if it's the same,
// and install this version.
Replace bool
// Don't fail if other versions of the same plugin exist.
AllowMultipleVersions bool
// If target does not point at a .ptar file, attempt to fetch
// the pre-packaged plugin from the repository.
ImplicitFetch bool
// Install the package even if the OS and Architecture don't
// match.
AllowOSArchMismatch bool
}
type Backend ¶
type Backend interface {
// List returns an iterator of plugin names,
// e.g. s3_v1.0.0_openbsd_amd64.ptar, optionally filtered by
// the given name, or an error.
List(name string) iter.Seq2[*Package, error]
// Load a plugin' ptar from the given reader.
Load(*Package, io.Reader) error
// Unload a plugin
Unload(*Package) error
}
type BuildOptions ¶
type BuildOptions struct{}
type ConnectorType ¶
type ConnectorType string
func (ConnectorType) IsValid ¶
func (c ConnectorType) IsValid() bool
type CreateOptions ¶
type CreateOptions struct{}
type DelOptions ¶
type DelOptions struct {
// If target is the empty string, delete all the packages
// installed.
All bool
}
type FlatBackend ¶
type FlatBackend struct {
// contains filtered or unexported fields
}
A backend that stores integrations in a single, flat, directory.
func NewFlatBackend ¶
func NewFlatBackend(kctx *kcontext.KContext, pkgdir, cachedir string, opts *FlatBackendOptions) (*FlatBackend, error)
func (*FlatBackend) LoadAll ¶
func (f *FlatBackend) LoadAll() error
func (*FlatBackend) Unload ¶
func (f *FlatBackend) Unload(pkg *Package) error
type FlatBackendOptions ¶
type Integration ¶
type Integration struct {
Edition string `json:"edition"`
API string `json:"api"`
Tier string `json:"tier"`
Contact string `json:"contact"`
Name string `json:"name"`
DisplayName string `json:"display_name"`
Description string `json:"description"`
Homepage string `json:"homepage"`
Repository string `json:"repository"`
License string `json:"license"`
Tags []string `json:"tags"`
Version string `json:"version"` // integration version
Connectors []Connector `json:"connectors"`
Documentation string `json:"documentation"` // README.md
Icon string `json:"icon"` // assets/icon.{png,svg}
Featured string `json:"featured"` // assets/featured.{png,svg}
Id string `json:"id"`
Types IntegrationTypes `json:"types"`
Stage string `json:"stage"`
Installation IntegrationInstallation `json:"installation"`
LatestVersion string `json:"latest_version"`
}
func (*Integration) HasConnectorType ¶
func (int *Integration) HasConnectorType(ct string) bool
type IntegrationIndex ¶
type IntegrationIndex struct {
Version string `json:"version"`
Timestamp time.Time `json:"timestamp"`
Integrations []Integration `json:"integrations"`
}
type IntegrationInstallation ¶
type IntegrationTypes ¶
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
func (*Manager) Add ¶
func (p *Manager) Add(target string, opts *AddOptions) error
Add installs a package. By default, it will fail if another version of the same plugin is already present.
func (*Manager) Del ¶
func (p *Manager) Del(target string, opts *DelOptions) error
Del uninstalls all matching packages.
func (*Manager) Query ¶
func (p *Manager) Query(opts *QueryOptions) (ret []*Integration, err error)
type Manifest ¶
type Manifest struct {
Name string `yaml:"name"`
DisplayName string `yaml:"display_name"`
Description string `yaml:"description"`
Tier string `yaml:"tier"`
Contact string `yaml:"contact"`
Homepage string `yaml:"homepage"`
License string `yaml:"license"`
Tags []string `yaml:"tags"`
APIVersion string `yaml:"api_version"`
Connectors []ManifestConnector `yaml:"connectors"`
}
func NewManifestFromFile ¶
type ManifestConnector ¶
type ManifestConnector struct {
Type ConnectorType `yaml:"type"`
Class ResourceClass `yaml:"class"`
SubClass ResourceSubClass `yaml:"subclass"`
Validator string `yaml:"validator"`
Protocols []string `yaml:"protocols"`
LocationFlags []string `yaml:"location_flags"`
Executable string `yaml:"executable"`
Args []string `yaml:"args"`
ExtraFiles []string `yaml:"extra_files"`
}
type Options ¶
type Options struct {
InstallURL string
ApiURL string
BinaryNeedsAuth bool
RequestHook RequestHook
// User agent name for network requests on the repository at
// InstallURL. "(os/architecture)" will be appended
// implicitly.
UserAgent string
}
type QueryOptions ¶
type Recipe ¶
type Recipe struct {
Name string `yaml:"name"`
Version string `yaml:"version"`
Repository string `yaml:"repository"`
}
func NewRecipeFromFile ¶
type RequestHook ¶
type ResourceClass ¶
type ResourceClass string
func (ResourceClass) IsValid ¶
func (c ResourceClass) IsValid() bool
type ResourceSubClass ¶
type ResourceSubClass string
func (ResourceSubClass) IsSubClassOf ¶
func (c ResourceSubClass) IsSubClassOf(parent ResourceClass) bool
func (ResourceSubClass) IsValid ¶
func (c ResourceSubClass) IsValid() bool
Click to show internal directories.
Click to hide internal directories.