Documentation
¶
Index ¶
- Constants
- Variables
- func ActivationResourceID(extensionName string, bundleName string, profileName string, scope Scope, ...) string
- func BundleResourceID(extensionName string, bundleName string) string
- func NewActivationResourceCodec() (resources.KindCodec[ActivationResourceSpec], error)
- func NewBundleResourceCodec() (resources.KindCodec[BundleResourceSpec], error)
- type ActivateRequest
- type Activation
- type ActivationPreview
- type ActivationResourceSpec
- type BundleActivationResourcePlan
- type BundleResourceSpec
- type CatalogEntry
- type DeclaredChannel
- type ExtensionInfoLister
- type ExtensionLoader
- type InventoryItem
- type NetworkSettings
- type Option
- type ResourceStore
- func (s *ResourceStore) ApplyBundleActivationResources(ctx context.Context, plan BundleActivationResourcePlan) error
- func (s *ResourceStore) CreateBundleActivation(ctx context.Context, activation Activation) error
- func (s *ResourceStore) DeleteBundleActivation(ctx context.Context, id string) error
- func (s *ResourceStore) GetBundleActivation(ctx context.Context, id string) (Activation, error)
- func (s *ResourceStore) ListAgentResources(ctx context.Context) ([]resources.Record[aghconfig.AgentDef], error)
- func (s *ResourceStore) ListBundleActivationInventory(ctx context.Context, activationID string) ([]InventoryItem, error)
- func (s *ResourceStore) ListBundleActivations(ctx context.Context) ([]Activation, error)
- func (s *ResourceStore) ListBundleResources(ctx context.Context) ([]resources.Record[BundleResourceSpec], error)
- func (s *ResourceStore) UpdateBundleActivation(ctx context.Context, activation Activation) error
- type ResourceStoreConfig
- type Scope
- type Service
- func (s *Service) Activate(ctx context.Context, req ActivateRequest) (ActivationPreview, error)
- func (s *Service) Apply(ctx context.Context, plan resources.ProjectionPlan) error
- func (s *Service) Build(ctx context.Context, ...) (resources.ProjectionPlan, error)
- func (s *Service) Catalog(ctx context.Context) ([]CatalogEntry, error)
- func (s *Service) Deactivate(ctx context.Context, id string) error
- func (s *Service) GetActivation(ctx context.Context, id string) (ActivationPreview, error)
- func (s *Service) ListActivations(ctx context.Context) ([]ActivationPreview, error)
- func (s *Service) NetworkSettings(ctx context.Context) (NetworkSettings, error)
- func (s *Service) PreviewActivation(ctx context.Context, req ActivateRequest) (ActivationPreview, error)
- func (s *Service) Reconcile(ctx context.Context) error
- func (s *Service) UpdateActivation(ctx context.Context, req UpdateActivationRequest) (ActivationPreview, error)
- type Store
- type UpdateActivationRequest
Constants ¶
const ( // BundleResourceKind is the canonical desired-state kind for extension bundles. BundleResourceKind resources.ResourceKind = "bundle" // BundleActivationResourceKind is the canonical desired-state kind for active bundle profiles. BundleActivationResourceKind resources.ResourceKind = "bundle.activation" BundleActivationOwnerKind resources.ResourceOwnerKind = "bundle.activation" )
const ( ScopeGlobal = modelpkg.ScopeGlobal ScopeWorkspace = modelpkg.ScopeWorkspace )
Variables ¶
var ( ErrActivationNotFound = modelpkg.ErrActivationNotFound ErrBundleNotFound = errors.New("bundles: bundle not found") ErrProfileNotFound = errors.New("bundles: profile not found") ErrDefaultChannelBusy = errors.New("bundles: effective default channel is already claimed") ErrWebhookUnsupported = errors.New("bundles: bundle webhook triggers are not supported") ErrAgentConflict = errors.New("bundles: bundle agent conflicts with an existing agent") ErrAgentReferenceNotFound = errors.New("bundles: bundle automation references an unavailable agent") )
Functions ¶
func ActivationResourceID ¶
func ActivationResourceID( extensionName string, bundleName string, profileName string, scope Scope, workspaceID string, ) string
ActivationResourceID returns the stable canonical resource ID for one bundle profile activation.
func BundleResourceID ¶
BundleResourceID returns the stable canonical resource ID for one extension bundle.
func NewActivationResourceCodec ¶
func NewActivationResourceCodec() (resources.KindCodec[ActivationResourceSpec], error)
NewActivationResourceCodec builds the typed codec for bundle.activation records.
func NewBundleResourceCodec ¶
func NewBundleResourceCodec() (resources.KindCodec[BundleResourceSpec], error)
NewBundleResourceCodec builds the typed codec for bundle records.
Types ¶
type ActivateRequest ¶
type Activation ¶
type Activation = modelpkg.Activation
type ActivationPreview ¶
type ActivationPreview struct {
Activation Activation
Bundle extensionpkg.BundleSpec
Profile extensionpkg.BundleProfile
Inventory []InventoryItem
}
type ActivationResourceSpec ¶
type ActivationResourceSpec struct {
ExtensionName string `json:"extension_name"`
BundleName string `json:"bundle_name"`
ProfileName string `json:"profile_name"`
SpecContentHash string `json:"spec_content_hash,omitempty"`
BindPrimaryChannelAsDefault bool `json:"bind_primary_channel_default"`
}
ActivationResourceSpec is the canonical desired-state payload for bundle activation records.
type BundleActivationResourcePlan ¶
type BundleActivationResourcePlan struct {
// contains filtered or unexported fields
}
BundleActivationResourcePlan is the owned-resource composition plan produced from bundle.activation records.
func (*BundleActivationResourcePlan) Kind ¶
func (p *BundleActivationResourcePlan) Kind() resources.ResourceKind
func (*BundleActivationResourcePlan) OperationCount ¶
func (p *BundleActivationResourcePlan) OperationCount() int
func (*BundleActivationResourcePlan) Revision ¶
func (p *BundleActivationResourcePlan) Revision() int64
type BundleResourceSpec ¶
type BundleResourceSpec struct {
ExtensionName string `json:"extension_name"`
Bundle extensionpkg.BundleSpec `json:"bundle"`
OwnerBridgePlatform string `json:"owner_bridge_platform,omitempty"`
OwnerProvidesBridgeAdapter bool `json:"owner_provides_bridge_adapter,omitempty"`
}
BundleResourceSpec is the canonical desired-state payload for bundle catalog records.
type CatalogEntry ¶
type CatalogEntry struct {
ExtensionName string
Bundle extensionpkg.BundleSpec
}
type DeclaredChannel ¶
type ExtensionInfoLister ¶
type ExtensionInfoLister interface {
List() ([]extensionpkg.ExtensionInfo, error)
}
type ExtensionLoader ¶
type InventoryItem ¶
type InventoryItem = modelpkg.InventoryItem
type NetworkSettings ¶
type NetworkSettings struct {
ConfiguredDefaultChannel string
EffectiveDefaultChannel string
EffectiveDefaultSource string
DeclaredChannels []DeclaredChannel
}
type Option ¶
type Option func(*Service)
func WithLogger ¶
func WithWorkspaceResolver ¶
func WithWorkspaceResolver(resolver workspacepkg.RuntimeResolver) Option
type ResourceStore ¶
type ResourceStore struct {
// contains filtered or unexported fields
}
ResourceStore persists bundles, activations, and owned activation fan-out through canonical resources.
func NewResourceStore ¶
func NewResourceStore(cfg ResourceStoreConfig) (*ResourceStore, error)
NewResourceStore constructs a resource-backed bundle store.
func (*ResourceStore) ApplyBundleActivationResources ¶
func (s *ResourceStore) ApplyBundleActivationResources( ctx context.Context, plan BundleActivationResourcePlan, ) error
func (*ResourceStore) CreateBundleActivation ¶
func (s *ResourceStore) CreateBundleActivation(ctx context.Context, activation Activation) error
func (*ResourceStore) DeleteBundleActivation ¶
func (s *ResourceStore) DeleteBundleActivation(ctx context.Context, id string) error
func (*ResourceStore) GetBundleActivation ¶
func (s *ResourceStore) GetBundleActivation(ctx context.Context, id string) (Activation, error)
func (*ResourceStore) ListAgentResources ¶
func (*ResourceStore) ListBundleActivationInventory ¶
func (s *ResourceStore) ListBundleActivationInventory( ctx context.Context, activationID string, ) ([]InventoryItem, error)
func (*ResourceStore) ListBundleActivations ¶
func (s *ResourceStore) ListBundleActivations(ctx context.Context) ([]Activation, error)
func (*ResourceStore) ListBundleResources ¶
func (s *ResourceStore) ListBundleResources( ctx context.Context, ) ([]resources.Record[BundleResourceSpec], error)
func (*ResourceStore) UpdateBundleActivation ¶
func (s *ResourceStore) UpdateBundleActivation(ctx context.Context, activation Activation) error
type ResourceStoreConfig ¶
type ResourceStoreConfig struct {
Bundles resources.Store[BundleResourceSpec]
BundleCodec resources.KindCodec[BundleResourceSpec]
Activations resources.Store[ActivationResourceSpec]
ActivationCodec resources.KindCodec[ActivationResourceSpec]
Agents resources.Store[aghconfig.AgentDef]
AgentCodec resources.KindCodec[aghconfig.AgentDef]
Souls resources.Store[soul.ResourceSpec]
SoulCodec resources.KindCodec[soul.ResourceSpec]
Heartbeats resources.Store[heartbeat.ResourceSpec]
HeartbeatCodec resources.KindCodec[heartbeat.ResourceSpec]
Jobs resources.Store[automationpkg.Job]
JobCodec resources.KindCodec[automationpkg.Job]
Triggers resources.Store[automationpkg.Trigger]
TriggerCodec resources.KindCodec[automationpkg.Trigger]
Bridges resources.Store[bridgepkg.BridgeInstanceSpec]
BridgeCodec resources.KindCodec[bridgepkg.BridgeInstanceSpec]
Actor resources.MutationActor
Trigger func(context.Context, resources.ResourceKind, resources.ReconcileReason) error
Now func() time.Time
}
ResourceStoreConfig groups the typed stores used by bundle resource projection.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(store Store, extensions ExtensionInfoLister, loadExtension ExtensionLoader, opts ...Option) *Service
func (*Service) Activate ¶
func (s *Service) Activate(ctx context.Context, req ActivateRequest) (ActivationPreview, error)
func (*Service) Apply ¶
Apply writes owned automation and bridge desired-state records through canonical stores.
func (*Service) Build ¶
func (s *Service) Build( ctx context.Context, activationRecords []resources.Record[ActivationResourceSpec], bundleRecords []resources.Record[BundleResourceSpec], ) (resources.ProjectionPlan, error)
Build composes active bundle activations with bundle catalog dependency records.
func (*Service) GetActivation ¶
func (*Service) ListActivations ¶
func (s *Service) ListActivations(ctx context.Context) ([]ActivationPreview, error)
func (*Service) NetworkSettings ¶
func (s *Service) NetworkSettings(ctx context.Context) (NetworkSettings, error)
func (*Service) PreviewActivation ¶
func (s *Service) PreviewActivation(ctx context.Context, req ActivateRequest) (ActivationPreview, error)
func (*Service) UpdateActivation ¶
func (s *Service) UpdateActivation(ctx context.Context, req UpdateActivationRequest) (ActivationPreview, error)
type Store ¶
type Store interface {
CreateBundleActivation(ctx context.Context, activation Activation) error
UpdateBundleActivation(ctx context.Context, activation Activation) error
DeleteBundleActivation(ctx context.Context, id string) error
GetBundleActivation(ctx context.Context, id string) (Activation, error)
ListBundleActivations(ctx context.Context) ([]Activation, error)
ListBundleActivationInventory(ctx context.Context, activationID string) ([]InventoryItem, error)
ListBundleResources(ctx context.Context) ([]resources.Record[BundleResourceSpec], error)
ListAgentResources(ctx context.Context) ([]resources.Record[aghconfig.AgentDef], error)
ApplyBundleActivationResources(ctx context.Context, plan BundleActivationResourcePlan) error
}