Documentation
¶
Index ¶
- func HostConfigBrokerIDFromContext(ctx context.Context) (uint32, bool)
- func WithHostConfigBrokerID(ctx context.Context, id uint32) context.Context
- func WithHostConfigPayload(ctx context.Context, cfg *Config) context.Context
- func WithHostConfigProvider(ctx context.Context, provider HostConfigProvider) context.Context
- type Artifact
- type AuthConfig
- type CacheConfig
- type Config
- type Credential
- type ExecutionResult
- type FinalizerRequest
- type HostConfigProvider
- type Layer
- type LoggingConfig
- type OCIPluginMetadata
- type Plugin
- type PluginArgs
- func (a PluginArgs) All(key string) []string
- func (a PluginArgs) Bool(key string) (bool, bool)
- func (a PluginArgs) BoolAny(keys ...string) (bool, bool)
- func (a PluginArgs) Count(key string) int
- func (a PluginArgs) First(key string) (string, bool)
- func (a PluginArgs) FirstAny(keys ...string) (string, bool)
- func (a PluginArgs) Has(key string) bool
- func (a PluginArgs) Keys() []string
- func (a PluginArgs) Positional(index int) (string, bool)
- func (a PluginArgs) Positionals() []string
- func (a PluginArgs) Raw() []string
- type PluginCommand
- type PluginInfo
- type PluginInfoProvider
- type PluginPlatform
- type PluginProtocol
- type PluginSchema
- type PluginSource
- type PluginsConfig
- type ProxyConfig
- type RegistryConfig
- type SchemaProperty
- type ServiceHealth
- type ServiceInfo
- type SignatureConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HostConfigBrokerIDFromContext ¶ added in v1.3.0
HostConfigBrokerIDFromContext extracts the broker id if present.
func WithHostConfigBrokerID ¶ added in v1.3.0
WithHostConfigBrokerID stores the broker identifier that plugins can dial for host services.
func WithHostConfigPayload ¶ added in v1.3.0
WithHostConfigPayload attaches the effective configuration payload so the host can serve it via broker.
func WithHostConfigProvider ¶ added in v1.3.0
func WithHostConfigProvider(ctx context.Context, provider HostConfigProvider) context.Context
WithHostConfigProvider stores the host config provider in the context for plugin consumption.
Types ¶
type Artifact ¶
type Artifact struct {
Reference string `json:"reference"`
Digest string `json:"digest"`
Size int64 `json:"size"`
MediaType string `json:"mediaType"`
Metadata map[string]string `json:"metadata,omitempty"`
Layers []Layer `json:"layers,omitempty"`
CreatedAt time.Time `json:"createdAt"`
}
Artifact represents an OCI artifact
type AuthConfig ¶
type AuthConfig struct {
DockerConfig string `mapstructure:"docker_config" yaml:"docker_config,omitempty"`
Credentials []Credential `mapstructure:"credentials" yaml:"credentials,omitempty"`
}
AuthConfig contains authentication settings
type CacheConfig ¶
type CacheConfig struct {
Dir string `mapstructure:"dir" yaml:"dir"`
MaxSize int64 `mapstructure:"max_size" yaml:"max_size"` // in bytes
TTL time.Duration `mapstructure:"ttl" yaml:"ttl"`
}
CacheConfig contains cache settings
type Config ¶
type Config struct {
Registry RegistryConfig `mapstructure:"registry" yaml:"registry"`
Auth AuthConfig `mapstructure:"auth" yaml:"auth"`
Cache CacheConfig `mapstructure:"cache" yaml:"cache"`
Logging LoggingConfig `mapstructure:"logging" yaml:"logging"`
Proxy ProxyConfig `mapstructure:"proxy" yaml:"proxy"`
Plugins PluginsConfig `mapstructure:"plugins" yaml:"plugins"`
}
Config represents the complete DS configuration
type Credential ¶
type Credential struct {
Registry string `mapstructure:"registry" yaml:"registry"`
Username string `mapstructure:"username" yaml:"username"`
Token string `mapstructure:"token" yaml:"token,omitempty"`
Password string `mapstructure:"password" yaml:"password,omitempty"`
}
Credential represents a single registry credential
type ExecutionResult ¶ added in v1.1.0
type ExecutionResult struct {
Stdout string `json:"stdout"`
Stderr string `json:"stderr"`
ExitCode int `json:"exit_code"`
Error string `json:"error,omitempty"`
Finalizers []FinalizerRequest `json:"finalizers,omitempty"`
}
ExecutionResult contains the result of a plugin execution
type FinalizerRequest ¶ added in v1.5.0
type FinalizerRequest struct {
Name string `json:"name"`
Operation string `json:"operation"`
Args []string `json:"args,omitempty"`
}
FinalizerRequest tells the DS host to invoke another plugin after a successful run.
type HostConfigProvider ¶ added in v1.3.0
HostConfigProvider exposes host configuration access to plugins.
func HostConfigFromContext ¶ added in v1.3.0
func HostConfigFromContext(ctx context.Context) (HostConfigProvider, bool)
HostConfigFromContext returns the host config provider if present.
type Layer ¶
type Layer struct {
Digest string `json:"digest"`
Size int64 `json:"size"`
MediaType string `json:"mediaType"`
Metadata map[string]string `json:"metadata,omitempty"`
}
Layer represents a layer in an artifact
type LoggingConfig ¶
type LoggingConfig struct {
Level string `mapstructure:"level" yaml:"level"`
Format string `mapstructure:"format" yaml:"format"`
Output string `mapstructure:"output" yaml:"output"`
}
LoggingConfig contains logging settings
type OCIPluginMetadata ¶ added in v1.1.0
type OCIPluginMetadata struct {
Name string `json:"name"`
Version string `json:"version"`
Description string `json:"description"`
Author string `json:"author,omitempty"`
Homepage string `json:"homepage,omitempty"`
Tags []string `json:"tags,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
OCIPluginMetadata represents metadata about a plugin
type Plugin ¶
type Plugin interface {
// Name returns the plugin name
Name() string
// Version returns the plugin version
Version() string
// Execute runs the plugin with given arguments
Execute(args []string) error
}
Plugin interface defines the contract for plugin management
type PluginArgs ¶ added in v1.6.0
type PluginArgs struct {
// contains filtered or unexported fields
}
PluginArgs represents a set of plugin arguments parsed into key/value pairs.
func NewPluginArgs ¶ added in v1.6.0
func NewPluginArgs(pairs []string) PluginArgs
NewPluginArgs constructs a PluginArgs helper from a key=value list.
func (PluginArgs) All ¶ added in v1.6.0
func (a PluginArgs) All(key string) []string
All returns all values associated with the key.
func (PluginArgs) Bool ¶ added in v1.6.0
func (a PluginArgs) Bool(key string) (bool, bool)
Bool interprets the first value for the key as a boolean.
func (PluginArgs) BoolAny ¶ added in v1.6.0
func (a PluginArgs) BoolAny(keys ...string) (bool, bool)
BoolAny returns the first boolean value for any of the provided keys.
func (PluginArgs) Count ¶ added in v1.6.0
func (a PluginArgs) Count(key string) int
Count returns the number of values tracked for the key.
func (PluginArgs) First ¶ added in v1.6.0
func (a PluginArgs) First(key string) (string, bool)
First returns the first value associated with the key.
func (PluginArgs) FirstAny ¶ added in v1.6.0
func (a PluginArgs) FirstAny(keys ...string) (string, bool)
FirstAny returns the first value for the first key in the list that exists.
func (PluginArgs) Has ¶ added in v1.6.0
func (a PluginArgs) Has(key string) bool
Has reports whether the given key exists.
func (PluginArgs) Keys ¶ added in v1.6.0
func (a PluginArgs) Keys() []string
Keys returns the set of keys present in the argument list.
func (PluginArgs) Positional ¶ added in v1.6.0
func (a PluginArgs) Positional(index int) (string, bool)
Positional returns the positional argument at the provided index.
func (PluginArgs) Positionals ¶ added in v1.6.0
func (a PluginArgs) Positionals() []string
Positionals returns a copy of all positional arguments.
func (PluginArgs) Raw ¶ added in v1.6.0
func (a PluginArgs) Raw() []string
Raw returns a copy of the underlying key=value list.
type PluginCommand ¶
type PluginCommand struct {
Name string `mapstructure:"name" yaml:"name"`
Description string `mapstructure:"description" yaml:"description"`
}
PluginCommand represents a command provided by the plugin
type PluginInfo ¶
type PluginInfo struct {
Name string `json:"name" yaml:"name"`
Version string `json:"version" yaml:"version"`
Description string `json:"description" yaml:"description"`
Path string `json:"path,omitempty" yaml:"path,omitempty"`
Commands []PluginCommand `json:"commands,omitempty" yaml:"commands,omitempty"`
Platform PluginPlatform `json:"platform,omitempty" yaml:"platform,omitempty"`
}
PluginInfo describes an installed plugin along with the metadata it exposes.
type PluginInfoProvider ¶ added in v1.6.0
type PluginInfoProvider interface {
GetManifest(ctx context.Context) (*PluginInfo, error)
}
PluginInfoProvider can be implemented by plugins that expose metadata over RPC.
type PluginPlatform ¶
type PluginPlatform struct {
OS []string `mapstructure:"os" yaml:"os,omitempty"`
Arch []string `mapstructure:"arch" yaml:"arch,omitempty"`
}
PluginPlatform specifies platform compatibility
type PluginProtocol ¶ added in v1.1.0
type PluginProtocol interface {
// Execute runs a plugin operation with given arguments
// Returns output (stdout), error output (stderr), and exit code
Execute(ctx context.Context, operation string, args []string) (*ExecutionResult, error)
// ValidateConfig validates plugin configuration
ValidateConfig(ctx context.Context, config map[string]interface{}) error
// GetSchema returns the configuration schema for this plugin
GetSchema(ctx context.Context) (*PluginSchema, error)
}
PluginProtocol defines the RPC interface for DS plugins This interface will be implemented by all plugins and exposed via go-plugin
type PluginSchema ¶ added in v1.1.0
type PluginSchema struct {
Version string `json:"version"`
Properties map[string]SchemaProperty `json:"properties"`
}
PluginSchema describes the configuration schema
type PluginSource ¶
type PluginSource struct {
Registry string `mapstructure:"registry" yaml:"registry"`
VersionConstraint string `mapstructure:"version_constraint" yaml:"version_constraint,omitempty"`
}
PluginSource represents a plugin registry source
type PluginsConfig ¶
type PluginsConfig struct {
Dir string `mapstructure:"dir" yaml:"dir"`
AutoInstall bool `mapstructure:"auto_install" yaml:"auto_install"`
Sources []PluginSource `mapstructure:"sources" yaml:"sources,omitempty"`
Signature SignatureConfig `mapstructure:"signature" yaml:"signature,omitempty"`
Settings map[string]map[string]interface{} `mapstructure:"settings" yaml:"settings,omitempty"`
}
PluginsConfig contains plugin management settings
type ProxyConfig ¶
type ProxyConfig struct {
HTTPProxy string `mapstructure:"http_proxy" yaml:"http_proxy,omitempty"`
HTTPSProxy string `mapstructure:"https_proxy" yaml:"https_proxy,omitempty"`
NoProxy string `mapstructure:"no_proxy" yaml:"no_proxy,omitempty"`
}
ProxyConfig contains proxy settings
type RegistryConfig ¶
type RegistryConfig struct {
Default string `mapstructure:"default" yaml:"default"`
Mirrors []string `mapstructure:"mirrors" yaml:"mirrors,omitempty"`
InsecureRegistries []string `mapstructure:"insecure_registries" yaml:"insecure_registries,omitempty"`
}
RegistryConfig contains OCI registry settings
type SchemaProperty ¶ added in v1.1.0
type SchemaProperty struct {
Type string `json:"type"`
Description string `json:"description"`
Required bool `json:"required"`
Default string `json:"default,omitempty"`
}
SchemaProperty describes a configuration property
type ServiceHealth ¶
type ServiceHealth struct {
Status string `json:"status"`
Message string `json:"message,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
ServiceHealth represents the health status of a service
type ServiceInfo ¶
type ServiceInfo struct {
Name string `json:"name"`
Address string `json:"address"`
Protocol string `json:"protocol,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
Health ServiceHealth `json:"health,omitempty"`
}
ServiceInfo represents information about a registered service
type SignatureConfig ¶
type SignatureConfig struct {
// Mode: "strict" (only valid signatures) or "permissive" (warn on unsigned)
Mode string `mapstructure:"mode" yaml:"mode"`
// PublicKeys contains paths to trusted public key files
PublicKeys []string `mapstructure:"public_keys" yaml:"public_keys,omitempty"`
// TrustStore is a directory containing trusted public keys
TrustStore string `mapstructure:"trust_store" yaml:"trust_store,omitempty"`
// AllowUnsigned allows unsigned plugins in permissive mode
AllowUnsigned bool `mapstructure:"allow_unsigned" yaml:"allow_unsigned"`
}
SignatureConfig contains digital signature verification settings