Documentation
¶
Index ¶
- Constants
- type ActionDesc
- type ActionRequest
- type Descriptor
- type LogChunk
- type Loggable
- type Module
- type Registry
- func (mr *Registry) Log(ctx context.Context, spec Spec, filter map[string]string) (<-chan LogChunk, error)
- func (mr *Registry) Plan(ctx context.Context, spec Spec, act ActionRequest) (*resource.Resource, error)
- func (mr *Registry) Register(desc Descriptor) error
- func (mr *Registry) Sync(ctx context.Context, spec Spec) (*resource.State, error)
- type ResolvedDependency
- type Spec
Constants ¶
View Source
const ( CreateAction = "create" UpdateAction = "update" DeleteAction = "delete" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ActionDesc ¶
type ActionDesc struct {
Name string `json:"name"`
Description string `json:"description"`
ParamSchema string `json:"param_schema"`
// contains filtered or unexported fields
}
ActionDesc is a descriptor for an action supported by a module.
type ActionRequest ¶
type ActionRequest struct {
Name string `json:"name"`
Params json.RawMessage `json:"params"`
}
ActionRequest describes an invocation of action on module.
type Descriptor ¶
type Descriptor struct {
Kind string `json:"kind"`
Actions []ActionDesc `json:"actions"`
Dependencies map[string]string `json:"dependencies"`
Module Module `json:"-"`
}
Descriptor is a module descriptor that represents supported actions, resource-kind the module can operate on, etc.
type Loggable ¶
type Loggable interface {
Module
Log(ctx context.Context, spec Spec, filter map[string]string) (<-chan LogChunk, error)
}
Loggable extension of module allows streaming log data for a resource.
type Module ¶
type Module interface {
// Plan SHOULD validate the action on the current version of the resource,
// return the resource with config/status/state changes (if any) applied.
// Plan SHOULD NOT have side effects on anything other than the resource.
Plan(ctx context.Context, spec Spec, act ActionRequest) (*resource.Resource, error)
// Sync is called repeatedly by Entropy core until the returned state is
// a terminal status. Module implementation is free to execute an action
// in a single Sync() call or split into steps for better feedback to the
// end-user about the progress.
// Sync can return state in resource.StatusDeleted to indicate resource
// should be removed from the Entropy storage.
Sync(ctx context.Context, spec Spec) (*resource.State, error)
}
Module is responsible for achieving desired external system states based on a resource in Entropy.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry maintains a list of supported/enabled modules.
func NewRegistry ¶
func NewRegistry() *Registry
func (*Registry) Register ¶
func (mr *Registry) Register(desc Descriptor) error
Register adds a module to the registry.
type ResolvedDependency ¶
type ResolvedDependency struct {
Kind string `json:"kind"`
Output json.RawMessage `json:"output"`
}
Click to show internal directories.
Click to hide internal directories.