plugin

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2024 License: AGPL-3.0 Imports: 22 Imported by: 8

Documentation

Index

Constants

View Source
const (
	LimiterSourceConfig     = "config"
	LimiterSourcePlugin     = "plugin"
	LimiterStatusActive     = "active"
	LimiterStatusOverridden = "overridden"
)
View Source
const (
	VersionCheckerSchema   = "https"
	VersionCheckerHost     = "hub.steampipe.io"
	VersionCheckerEndpoint = "api/plugin/version"
)

Variables

This section is empty.

Functions

func CleanupOldTmpDirs

func CleanupOldTmpDirs(ctx context.Context)

func Exists

func Exists(ctx context.Context, plugin string) (bool, error)

Exists looks up the version file and reports whether a plugin is already installed

func GetAllUpdateReport

func GetAllUpdateReport(ctx context.Context, installationID string, pluginVersions map[string]*versionfile.InstalledVersion) map[string]PluginVersionCheckReport

GetAllUpdateReport looks up and reports the updated version of all turbot plugins which are listed in versions.json

func GetUpdateReport

func GetUpdateReport(ctx context.Context, installationID string, check []*versionfile.InstalledVersion) map[string]PluginVersionCheckReport

GetUpdateReport looks up and reports the updated version of selective turbot plugins which are listed in versions.json

func PrintInstallReports

func PrintInstallReports(reports PluginInstallReports, isUpdateReport bool)

PrintInstallReports Prints out the installation reports onto the console

func ResolvePluginImageRef

func ResolvePluginImageRef(pluginAlias string) string

ResolvePluginImageRef resolves the plugin image ref from the plugin alias (this handles the special case of locally developed plugins in the plugins/local folder)

func UpdateRequired

func UpdateRequired(report PluginVersionCheckReport) bool

UpdateRequired determines if the latest version in a "stream" requires the plugin to update.

Types

type Plugin

type Plugin struct {
	Instance        string         `hcl:"name,label" db:"plugin_instance"`
	Alias           string         `hcl:"source,optional"`
	MemoryMaxMb     *int           `hcl:"memory_max_mb,optional" db:"memory_max_mb"`
	StartTimeout    *int           `hcl:"start_timeout,optional"`
	Limiters        []*RateLimiter `hcl:"limiter,block" db:"limiters"`
	FileName        *string        `db:"file_name"`
	StartLineNumber *int           `db:"start_line_number"`
	EndLineNumber   *int           `db:"end_line_number"`
	// the image ref as a string
	Plugin string `db:"plugin"`
	// the actual plugin version, as a string
	Version string `db:"version"`
}

func NewImplicitPlugin

func NewImplicitPlugin(alias string, imageRef string) *Plugin

NewImplicitPlugin creates a default plugin config struct for a connection this is called when there is no explicit plugin config defined for a plugin which is used by a connection

func (*Plugin) Equals

func (l *Plugin) Equals(other *Plugin) bool

func (*Plugin) FriendlyName

func (l *Plugin) FriendlyName() string

func (*Plugin) GetLimiterMap

func (l *Plugin) GetLimiterMap() map[string]*RateLimiter

func (*Plugin) GetMaxMemoryBytes

func (l *Plugin) GetMaxMemoryBytes() int64

func (*Plugin) GetStartTimeout

func (l *Plugin) GetStartTimeout() int64

func (*Plugin) IsDefault

func (l *Plugin) IsDefault() bool

IsDefault returns whether this config was created as a default i.e. a connection reference this plugin but there was no plugin config in this case the Instance will be the imageRef

func (*Plugin) OnDecoded

func (l *Plugin) OnDecoded(block *hcl.Block)

type PluginInstallReport

type PluginInstallReport struct {
	Skipped        bool
	Plugin         string
	SkipReason     string
	DocURL         string
	Version        string
	IsUpdateReport bool
}

func (*PluginInstallReport) String

func (i *PluginInstallReport) String() string

type PluginInstallReports

type PluginInstallReports []*PluginInstallReport

func (PluginInstallReports) Len

func (i PluginInstallReports) Len() int

making the type compatible with sort.Interface so that we can use the sort package utilities

func (PluginInstallReports) Less

func (i PluginInstallReports) Less(lIdx, rIdx int) bool

func (PluginInstallReports) Swap

func (i PluginInstallReports) Swap(lIdx, rIdx int)

type PluginVersion

type PluginVersion struct {
	// the plugin name, as specified in the mod requires block. , e.g. turbot/mod1, aws
	RawName string `cty:"name" hcl:"name,label"`
	// the minumum version which satisfies the requirement
	MinVersionString string `cty:"min_version" hcl:"min_version,optional"`
	Constraint       *semver.Constraints
	// the org and name which are parsed from the raw name
	Org       string
	Name      string
	DeclRange hcl.Range
}

func (*PluginVersion) FullName

func (p *PluginVersion) FullName() string

func (*PluginVersion) Initialise

func (p *PluginVersion) Initialise(block *hcl.Block) hcl.Diagnostics

Initialise parses the version and name properties

func (*PluginVersion) ShortName

func (p *PluginVersion) ShortName() string

func (*PluginVersion) String

func (p *PluginVersion) String() string

type PluginVersionCheckReport

type PluginVersionCheckReport struct {
	Plugin        *versionfile.InstalledVersion
	CheckResponse versionCheckCorePayload
	CheckRequest  versionCheckCorePayload
}

PluginVersionCheckReport

func (*PluginVersionCheckReport) ShortName

func (vr *PluginVersionCheckReport) ShortName() string

func (*PluginVersionCheckReport) ShortNameWithConstraint

func (vr *PluginVersionCheckReport) ShortNameWithConstraint() string

type PluginVersionMap

type PluginVersionMap struct {
	Backend          string
	Database         string
	AvailablePlugins map[string]*PluginVersionString
}

func NewPluginVersionMap

func NewPluginVersionMap(backend, database string, availablePlugins map[string]*PluginVersionString) *PluginVersionMap

type PluginVersionString

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

func LocalPluginVersionString

func LocalPluginVersionString() *PluginVersionString

func NewPluginVersionString

func NewPluginVersionString(version string) (*PluginVersionString, error)

func (*PluginVersionString) IsLocal

func (p *PluginVersionString) IsLocal() bool

func (*PluginVersionString) IsSemver

func (p *PluginVersionString) IsSemver() bool

func (*PluginVersionString) Semver

func (p *PluginVersionString) Semver() *semver.Version

func (*PluginVersionString) String

func (p *PluginVersionString) String() string

type RateLimiter

type RateLimiter struct {
	Name            string                 `hcl:"name,label" db:"name"`
	BucketSize      *int64                 `hcl:"bucket_size,optional" db:"bucket_size"`
	FillRate        *float32               `hcl:"fill_rate,optional" db:"fill_rate"`
	MaxConcurrency  *int64                 `hcl:"max_concurrency,optional" db:"max_concurrency"`
	Scope           []string               `hcl:"scope,optional" db:"scope"`
	Where           *string                `hcl:"where,optional" db:"where"`
	Plugin          string                 `db:"plugin"`
	PluginInstance  string                 `db:"plugin_instance"`
	FileName        *string                `db:"file_name" json:"-"`
	StartLineNumber *int                   `db:"start_line_number"  json:"-"`
	EndLineNumber   *int                   `db:"end_line_number"  json:"-"`
	Status          string                 `db:"status"`
	Source          string                 `db:"source_type"`
	ImageRef        *ociinstaller.ImageRef `db:"-" json:"-"`
}

func (*RateLimiter) Equals

func (l *RateLimiter) Equals(other *RateLimiter) bool

func (*RateLimiter) OnDecoded

func (l *RateLimiter) OnDecoded(block *hcl.Block)

func (*RateLimiter) SetPlugin

func (l *RateLimiter) SetPlugin(plugin *Plugin)

func (*RateLimiter) SetPluginImageRef

func (l *RateLimiter) SetPluginImageRef(alias string)

type ResolvedPluginVersion

type ResolvedPluginVersion struct {
	PluginName string
	Version    string
	Constraint string
}

func GetLatestPluginVersionByConstraint

func GetLatestPluginVersionByConstraint(ctx context.Context, installationID string, org string, name string, constraint string) (*ResolvedPluginVersion, error)

func NewResolvedPluginVersion

func NewResolvedPluginVersion(pluginName string, version string, constraint string) ResolvedPluginVersion

func (ResolvedPluginVersion) GetVersionTag

func (r ResolvedPluginVersion) GetVersionTag() string

GetVersionTag returns the <PluginName>:<Version> (turbot/chaos:0.4.1)

type VersionChecker

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

VersionChecker :: wrapper struct over the plugin version check utilities

Jump to

Keyboard shortcuts

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