Documentation
¶
Overview ¶
Package framework provides resource lifecycle management.
Index ¶
- Constants
- func RunWithDryRunGuard[T any](config *Config, cb func() (T, error), defaultValue T) (T, error)
- type Config
- type Resource
- type ResourceHandler
- type ResourceLock
- func (rl *ResourceLock) Add(resource Resource) error
- func (rl *ResourceLock) DiffResources(desiredResources []Resource) (removed, added []Resource)
- func (rl *ResourceLock) Has(resource Resource) bool
- func (rl *ResourceLock) Remove(resource Resource) error
- func (rl *ResourceLock) Save() error
- func (rl *ResourceLock) SyncResource(ctx context.Context, handler ResourceHandler, resource Resource) error
- type ResourceManager
Constants ¶
View Source
const (
ResourceLockFile = "moley.lock"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
DryRun bool
}
Config holds configuration for framework operations.
type Resource ¶
func NewResource ¶
type ResourceHandler ¶
type ResourceLock ¶
func LoadResourceLock ¶
func LoadResourceLock() (*ResourceLock, error)
func (*ResourceLock) Add ¶
func (rl *ResourceLock) Add(resource Resource) error
func (*ResourceLock) DiffResources ¶
func (rl *ResourceLock) DiffResources(desiredResources []Resource) (removed, added []Resource)
DiffResources compares desired vs actual resources and returns what to remove/add.
func (*ResourceLock) Has ¶
func (rl *ResourceLock) Has(resource Resource) bool
func (*ResourceLock) Remove ¶
func (rl *ResourceLock) Remove(resource Resource) error
func (*ResourceLock) Save ¶
func (rl *ResourceLock) Save() error
func (*ResourceLock) SyncResource ¶
func (rl *ResourceLock) SyncResource(ctx context.Context, handler ResourceHandler, resource Resource) error
SyncResource syncs a single resource's state with the lockfile.
type ResourceManager ¶
type ResourceManager struct {
// contains filtered or unexported fields
}
ResourceManager manages the lifecycle of multiple resources.
func NewResourceManager ¶
func NewResourceManager(handlers map[string]ResourceHandler, resources []Resource) (*ResourceManager, error)
NewResourceManager creates a new resource manager.
Click to show internal directories.
Click to hide internal directories.