types

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HostConfigBrokerIDFromContext added in v1.3.0

func HostConfigBrokerIDFromContext(ctx context.Context) (uint32, bool)

HostConfigBrokerIDFromContext extracts the broker id if present.

func WithHostConfigBrokerID added in v1.3.0

func WithHostConfigBrokerID(ctx context.Context, id uint32) context.Context

WithHostConfigBrokerID stores the broker identifier that plugins can dial for host services.

func WithHostConfigPayload added in v1.3.0

func WithHostConfigPayload(ctx context.Context, cfg *Config) context.Context

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

func HostConfigPayloadFromContext added in v1.3.0

func HostConfigPayloadFromContext(ctx context.Context) (*Config, bool)

HostConfigPayloadFromContext extracts the configuration payload if available.

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"`
}

ExecutionResult contains the result of a plugin execution

type HostConfigProvider added in v1.3.0

type HostConfigProvider interface {
	GetEffectiveConfig(ctx context.Context) (*Config, error)
}

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 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" yaml:"path"`
	Manifest    *PluginManifest `json:"manifest,omitempty" yaml:"manifest,omitempty"`
}

PluginInfo contains information about an installed plugin

type PluginManifest

type PluginManifest struct {
	Name        string            `mapstructure:"name" yaml:"name"`
	Version     string            `mapstructure:"version" yaml:"version"`
	Description string            `mapstructure:"description" yaml:"description"`
	Checksum    string            `mapstructure:"checksum" yaml:"checksum,omitempty"`
	Commands    []PluginCommand   `mapstructure:"commands" yaml:"commands,omitempty"`
	Platform    PluginPlatform    `mapstructure:"platform" yaml:"platform,omitempty"`
	Annotations map[string]string `mapstructure:"annotations" yaml:"annotations,omitempty" json:"annotations,omitempty"`
}

PluginManifest represents the plugin.yaml manifest file

type PluginMetadata

type PluginMetadata struct {
	Name        string            `json:"name"`
	Version     string            `json:"version"`
	Description string            `json:"description"`
	Operations  []string          `json:"operations"`
	Platform    PluginPlatform    `json:"platform"`
	Config      map[string]string `json:"config,omitempty"`
}

PluginMetadata contains plugin information

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 {
	// GetMetadata returns plugin metadata (name, version, description, etc.)
	GetMetadata(ctx context.Context) (*PluginMetadata, error)

	// 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, env map[string]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

Jump to

Keyboard shortcuts

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