settings

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldString  = "string"
	FieldBoolean = "boolean"
	FieldNumber  = "number"
	FieldInteger = "integer"
	FieldEnum    = "enum"
	FieldSelect  = "select"
	FieldSecret  = "secret"
)

Variables

View Source
var (
	ErrNotDeclared     = errors.New("plugin settings are not declared")
	ErrInvalidSetting  = errors.New("plugin setting is invalid")
	ErrArchiveNotFound = errors.New("plugin settings archive not found")
	ErrNotRetained     = errors.New("plugin settings are not retained")
	ErrAlreadyExists   = errors.New("plugin settings already exist")
)

Functions

This section is empty.

Types

type ArchiveRecord

type ArchiveRecord struct {
	ArchiveRef             string                      `json:"archive_ref"`
	SourcePluginInstanceID string                      `json:"source_plugin_instance_id"`
	IncludeSecrets         bool                        `json:"include_secrets"`
	SchemaVersion          int                         `json:"schema_version"`
	Fields                 []manifest.SettingFieldSpec `json:"fields"`
	Values                 map[string]any              `json:"values"`
	Secrets                map[string]SecretState      `json:"secrets"`
	SettingsRevision       uint64                      `json:"settings_revision"`
	UpdatedAt              time.Time                   `json:"updated_at"`
	CreatedAt              time.Time                   `json:"created_at"`
}

type BindRetainedRequest

type BindRetainedRequest struct {
	SourcePluginInstanceID string
	TargetPluginInstanceID string
	Spec                   *manifest.SettingsSpec
	DryRun                 bool
	Now                    time.Time
}

type DeleteRequest

type DeleteRequest struct {
	PluginInstanceID string
	DeleteData       bool
	RequireRetained  bool
	Now              time.Time
}

type EnsureRequest

type EnsureRequest struct {
	PluginInstanceID string
	Spec             *manifest.SettingsSpec
	Now              time.Time
}

type ExportRequest

type ExportRequest struct {
	PluginInstanceID string
	IncludeSecrets   bool
	Now              time.Time
}

type GetRequest

type GetRequest struct {
	PluginInstanceID string
}

type ImportRequest

type ImportRequest struct {
	PluginInstanceID string
	ArchiveRef       string
	DeleteExisting   bool
	Spec             *manifest.SettingsSpec
	Now              time.Time
}

type MarkSecretRequest

type MarkSecretRequest struct {
	PluginInstanceID string
	SecretRef        string
	Set              bool
	LastTestStatus   string
	Now              time.Time
}

type MemoryState

type MemoryState struct {
	NextExport int                      `json:"next_export,omitempty"`
	Records    map[string]Record        `json:"records,omitempty"`
	Archives   map[string]ArchiveRecord `json:"archives,omitempty"`
}

type MemoryStore

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

func NewMemoryStore

func NewMemoryStore() *MemoryStore

func NewMemoryStoreFromState

func NewMemoryStoreFromState(state MemoryState) *MemoryStore

func (*MemoryStore) BindRetained

func (s *MemoryStore) BindRetained(_ context.Context, req BindRetainedRequest) (Snapshot, error)

func (*MemoryStore) Delete

func (s *MemoryStore) Delete(_ context.Context, req DeleteRequest) error

func (*MemoryStore) Ensure

func (s *MemoryStore) Ensure(_ context.Context, req EnsureRequest) (Snapshot, error)

func (*MemoryStore) Export

func (s *MemoryStore) Export(_ context.Context, req ExportRequest) (string, error)

func (*MemoryStore) Get

func (s *MemoryStore) Get(_ context.Context, req GetRequest) (Snapshot, error)

func (*MemoryStore) Import

func (s *MemoryStore) Import(_ context.Context, req ImportRequest) (Snapshot, error)

func (*MemoryStore) MarkSecret

func (s *MemoryStore) MarkSecret(_ context.Context, req MarkSecretRequest) (Snapshot, error)

func (*MemoryStore) Patch

func (s *MemoryStore) Patch(_ context.Context, req PatchRequest) (Snapshot, error)

func (*MemoryStore) State

func (s *MemoryStore) State() MemoryState

type PatchRequest

type PatchRequest struct {
	PluginInstanceID string
	Values           map[string]any
	Now              time.Time
}

type Record

type Record struct {
	PluginInstanceID string                      `json:"plugin_instance_id"`
	SchemaVersion    int                         `json:"schema_version"`
	SettingsRevision uint64                      `json:"settings_revision"`
	State            State                       `json:"state"`
	Fields           []manifest.SettingFieldSpec `json:"fields"`
	Values           map[string]any              `json:"values"`
	Secrets          map[string]SecretState      `json:"secrets"`
	UpdatedAt        time.Time                   `json:"updated_at"`
	RetainedAt       *time.Time                  `json:"retained_at,omitempty"`
}

type SQLiteStore

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

func NewSQLiteStore

func NewSQLiteStore(ctx context.Context, path string) (*SQLiteStore, error)

func (*SQLiteStore) BindRetained

func (s *SQLiteStore) BindRetained(ctx context.Context, req BindRetainedRequest) (Snapshot, error)

func (*SQLiteStore) Close

func (s *SQLiteStore) Close() error

func (*SQLiteStore) Delete

func (s *SQLiteStore) Delete(ctx context.Context, req DeleteRequest) error

func (*SQLiteStore) Ensure

func (s *SQLiteStore) Ensure(ctx context.Context, req EnsureRequest) (Snapshot, error)

func (*SQLiteStore) Export

func (s *SQLiteStore) Export(ctx context.Context, req ExportRequest) (string, error)

func (*SQLiteStore) Get

func (s *SQLiteStore) Get(ctx context.Context, req GetRequest) (Snapshot, error)

func (*SQLiteStore) Import

func (s *SQLiteStore) Import(ctx context.Context, req ImportRequest) (Snapshot, error)

func (*SQLiteStore) MarkSecret

func (s *SQLiteStore) MarkSecret(ctx context.Context, req MarkSecretRequest) (Snapshot, error)

func (*SQLiteStore) Patch

func (s *SQLiteStore) Patch(ctx context.Context, req PatchRequest) (Snapshot, error)

type SecretState

type SecretState struct {
	SecretRef      string     `json:"secret_ref"`
	Set            bool       `json:"set"`
	UpdatedAt      *time.Time `json:"updated_at,omitempty"`
	LastTestStatus string     `json:"last_test_status,omitempty"`
}

type SecretValue

type SecretValue struct {
	Set            bool       `json:"set"`
	UpdatedAt      *time.Time `json:"updated_at,omitempty"`
	LastTestStatus string     `json:"last_test_status,omitempty"`
}

type Snapshot

type Snapshot struct {
	PluginInstanceID string         `json:"plugin_instance_id"`
	SchemaVersion    int            `json:"schema_version"`
	SettingsRevision uint64         `json:"settings_revision"`
	Values           map[string]any `json:"values"`
	UpdatedAt        time.Time      `json:"updated_at"`
}

type State

type State string
const (
	StateActive   State = "active"
	StateRetained State = "retained"
)

type Store

type Store interface {
	Ensure(ctx context.Context, req EnsureRequest) (Snapshot, error)
	Get(ctx context.Context, req GetRequest) (Snapshot, error)
	Patch(ctx context.Context, req PatchRequest) (Snapshot, error)
	MarkSecret(ctx context.Context, req MarkSecretRequest) (Snapshot, error)
	Export(ctx context.Context, req ExportRequest) (string, error)
	Import(ctx context.Context, req ImportRequest) (Snapshot, error)
	Delete(ctx context.Context, req DeleteRequest) error
	BindRetained(ctx context.Context, req BindRetainedRequest) (Snapshot, error)
}

Jump to

Keyboard shortcuts

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