Documentation ¶
Index ¶
- Constants
- Variables
- func CopyDir(src string, dst string) (err error)
- func CopyFile(src, dst string) (err error)
- func CurrentDir(L *lua.LState) string
- func DefaultShowDifferences(r *Resource) error
- func GenLogIndent(level int) string
- func SetNoColor(b bool)
- type App
- func (app *App) Close()
- func (app *App) DequeueDelayedNotification() *Notification
- func (app *App) EnqueueDelayedNotification(n *Notification)
- func (app *App) FindOneResource(desc string) *Resource
- func (app *App) Init() error
- func (app *App) IsRootApp() bool
- func (app *App) LoadDefinition(definition *Definition)
- func (app *App) LoadRecipe(recipeContent string) error
- func (app *App) LoadRecipeFile(recipeFile string) error
- func (app *App) LoadUserResources() error
- func (app *App) LoadVariableFromJSON(v string) error
- func (app *App) LoadVariableFromJSONFile(jsonFile string) error
- func (app *App) LoadVariableFromMap(m map[string]interface{}) error
- func (app *App) RegisterResource(r *Resource)
- func (app *App) RemoveDuplicateDelayedNotification()
- func (app *App) Run(dryRun bool) (err error)
- func (app *App) SendContentToTempfile(content []byte) (string, error)
- func (app *App) SendDirectoryToTempDirectory(src string) (string, error)
- func (app *App) SendFileToTempfile(file string) (string, error)
- type Attribute
- type BoolAttribute
- type ComparableValue
- type Definition
- type Integer
- type IntegerAttribute
- type LFunctionAttribute
- type Logger
- type MapAttribute
- type Notification
- type NotifiesAttribute
- type Resource
- func (r *Resource) CheckCommand(command string) bool
- func (r *Resource) Desc() string
- func (r *Resource) GetBoolAttribute(key string) bool
- func (r *Resource) GetBoolCurrentAttribute(key string) bool
- func (r *Resource) GetIntegerAttribute(key string) *Integer
- func (r *Resource) GetIntegerCurrentAttribute(key string) *Integer
- func (r *Resource) GetLFunctionAttribute(key string) *lua.LFunction
- func (r *Resource) GetLFunctionCurrentAttribute(key string) *lua.LFunction
- func (r *Resource) GetMapAttribute(key string) map[string]interface{}
- func (r *Resource) GetMapCurrentAttribute(key string) map[string]interface{}
- func (r *Resource) GetRawAttribute(key string) interface{}
- func (r *Resource) GetRawCurrentAttribute(key string) interface{}
- func (r *Resource) GetStringAttribute(key string) string
- func (r *Resource) GetStringCurrentAttribute(key string) string
- func (r *Resource) GetStringSliceAttribute(key string) []string
- func (r *Resource) GetStringSliceCurrentAttribute(key string) []string
- func (r *Resource) Infra() *infra.Infra
- func (r *Resource) IsDifferentFiles(from, to string) bool
- func (r *Resource) IsDifferentFilesRecursively(from, to string) bool
- func (r Resource) IsUpdated() bool
- func (r *Resource) MustRunCommand(command string) *backend.CommandResult
- func (r *Resource) Run(specificAction string) error
- func (r *Resource) RunCommand(command string) *backend.CommandResult
- func (r *Resource) SendContentToTempfile(content []byte) (string, error)
- func (r *Resource) SendDirectoryToTempDirectory(src string) (string, error)
- func (r *Resource) SendFileToTempfile(file string) (string, error)
- func (r *Resource) ShowContentDiff(from, to string)
- func (r *Resource) ShowContentDiffRecursively(from, to string)
- func (r *Resource) Update()
- type ResourceAction
- type ResourceType
- type StringAttribute
- func (attr *StringAttribute) GetDefault() interface{}
- func (attr *StringAttribute) GetName() string
- func (attr *StringAttribute) HasDefault() bool
- func (attr *StringAttribute) IsDefaultName() bool
- func (attr *StringAttribute) IsRequired() bool
- func (attr *StringAttribute) ToGoValue(lv lua.LValue) interface{}
- type StringSliceAttribute
- func (attr *StringSliceAttribute) GetDefault() interface{}
- func (attr *StringSliceAttribute) GetName() string
- func (attr *StringSliceAttribute) HasDefault() bool
- func (attr *StringSliceAttribute) IsDefaultName() bool
- func (attr *StringSliceAttribute) IsRequired() bool
- func (attr *StringSliceAttribute) ToGoValue(v lua.LValue) interface{}
Constants ¶
View Source
const LUA_APP_KEY = "*__COFU_APP__"
Variables ¶
View Source
var ( Name = "cofu" Version = "unknown" CommitHash = "unknown" Usage = "Minimum configuration management tool." )
View Source
var BinPath string
View Source
var CommonAttributes = []Attribute{ &StringAttribute{ Name: "only_if", }, &StringAttribute{ Name: "not_if", }, &StringAttribute{ Name: "user", }, &StringAttribute{ Name: "cwd", }, &NotifiesAttribute{ Name: "notifies", Default: nil, }, &StringSliceAttribute{ Name: "verify", Default: nil, }, &StringAttribute{ Name: "description", }, }
Functions ¶
func CurrentDir ¶ added in v0.9.0
func CurrentDir(L *lua.LState) string
CurrentDir returns a directory path that includes lua source file which is executed now.
func DefaultShowDifferences ¶
func GenLogIndent ¶ added in v0.10.0
func SetNoColor ¶ added in v0.12.0
func SetNoColor(b bool)
Types ¶
type App ¶
type App struct { LState *lua.LState Logger Logger ResourceTypes []*ResourceType ResourceTypesMap map[string]*ResourceType Resources []*Resource DelayedNotifications []*Notification Infra *infra.Infra DryRun bool Tmpdir string Tmpfiles []string Parent *App Level int LogHeader string BuiltinRecipes map[string]string Basepath string // contains filtered or unexported fields }
func (*App) DequeueDelayedNotification ¶ added in v0.9.0
func (app *App) DequeueDelayedNotification() *Notification
func (*App) EnqueueDelayedNotification ¶ added in v0.9.0
func (app *App) EnqueueDelayedNotification(n *Notification)
func (*App) FindOneResource ¶
func (*App) LoadDefinition ¶
func (app *App) LoadDefinition(definition *Definition)
func (*App) LoadRecipe ¶
func (*App) LoadRecipeFile ¶
func (*App) LoadUserResources ¶ added in v0.13.0
func (*App) LoadVariableFromJSON ¶
func (*App) LoadVariableFromJSONFile ¶
func (*App) LoadVariableFromMap ¶ added in v0.9.0
func (*App) RegisterResource ¶
func (*App) RemoveDuplicateDelayedNotification ¶ added in v0.9.0
func (app *App) RemoveDuplicateDelayedNotification()
func (*App) SendContentToTempfile ¶
func (*App) SendDirectoryToTempDirectory ¶ added in v0.4.0
type BoolAttribute ¶
BoolAttribute
func (*BoolAttribute) GetDefault ¶
func (attr *BoolAttribute) GetDefault() interface{}
func (*BoolAttribute) GetName ¶
func (attr *BoolAttribute) GetName() string
func (*BoolAttribute) HasDefault ¶
func (attr *BoolAttribute) HasDefault() bool
func (*BoolAttribute) IsRequired ¶
func (attr *BoolAttribute) IsRequired() bool
func (*BoolAttribute) ToGoValue ¶
func (attr *BoolAttribute) ToGoValue(v lua.LValue) interface{}
type ComparableValue ¶
type Definition ¶
type Definition struct { Name string DefaultParams *lua.LTable Func *lua.LFunction // contains filtered or unexported fields }
func (*Definition) LGFunction ¶
func (definition *Definition) LGFunction() func(L *lua.LState) int
type IntegerAttribute ¶
IntAttribute
func (*IntegerAttribute) GetDefault ¶
func (attr *IntegerAttribute) GetDefault() interface{}
func (*IntegerAttribute) GetName ¶
func (attr *IntegerAttribute) GetName() string
func (*IntegerAttribute) HasDefault ¶
func (attr *IntegerAttribute) HasDefault() bool
func (*IntegerAttribute) IsRequired ¶
func (attr *IntegerAttribute) IsRequired() bool
func (*IntegerAttribute) ToGoValue ¶
func (attr *IntegerAttribute) ToGoValue(lv lua.LValue) interface{}
type LFunctionAttribute ¶
LFunctionAttribute
func (*LFunctionAttribute) GetDefault ¶
func (attr *LFunctionAttribute) GetDefault() interface{}
func (*LFunctionAttribute) GetName ¶
func (attr *LFunctionAttribute) GetName() string
func (*LFunctionAttribute) HasDefault ¶
func (attr *LFunctionAttribute) HasDefault() bool
func (*LFunctionAttribute) IsRequired ¶
func (attr *LFunctionAttribute) IsRequired() bool
func (*LFunctionAttribute) ToGoValue ¶
func (attr *LFunctionAttribute) ToGoValue(lv lua.LValue) interface{}
type Logger ¶ added in v0.10.0
type Logger interface { Output() io.Writer SetOutput(w io.Writer) Prefix() string SetPrefix(p string) Level() log.Lvl SetLevel(v log.Lvl) SetHeader(h string) Print(i ...interface{}) Printf(format string, args ...interface{}) Printj(j log.JSON) Debug(i ...interface{}) Debugf(format string, args ...interface{}) Debugj(j log.JSON) Info(i ...interface{}) Infof(format string, args ...interface{}) Infoj(j log.JSON) Warn(i ...interface{}) Warnf(format string, args ...interface{}) Warnj(j log.JSON) Error(i ...interface{}) Errorf(format string, args ...interface{}) Errorj(j log.JSON) Fatal(i ...interface{}) Fatalj(j log.JSON) Fatalf(format string, args ...interface{}) Panic(i ...interface{}) Panicj(j log.JSON) Panicf(format string, args ...interface{}) }
type MapAttribute ¶
MapAttribute
func (*MapAttribute) GetDefault ¶
func (attr *MapAttribute) GetDefault() interface{}
func (*MapAttribute) GetName ¶
func (attr *MapAttribute) GetName() string
func (*MapAttribute) HasDefault ¶
func (attr *MapAttribute) HasDefault() bool
func (*MapAttribute) IsRequired ¶
func (attr *MapAttribute) IsRequired() bool
func (*MapAttribute) ToGoValue ¶
func (attr *MapAttribute) ToGoValue(v lua.LValue) interface{}
type Notification ¶
type Notification struct { DefinedInResource *Resource Action string TargetResourceDesc string Timing string }
func (*Notification) Delayed ¶
func (n *Notification) Delayed() bool
func (*Notification) Immediately ¶
func (n *Notification) Immediately() bool
func (*Notification) Run ¶
func (n *Notification) Run() error
func (*Notification) Validate ¶
func (n *Notification) Validate() error
type NotifiesAttribute ¶
type NotifiesAttribute struct { Name string Required bool Default []*Notification }
NotifiesAttribute
func (*NotifiesAttribute) GetDefault ¶
func (attr *NotifiesAttribute) GetDefault() interface{}
func (*NotifiesAttribute) GetName ¶
func (attr *NotifiesAttribute) GetName() string
func (*NotifiesAttribute) HasDefault ¶
func (attr *NotifiesAttribute) HasDefault() bool
func (*NotifiesAttribute) IsRequired ¶
func (attr *NotifiesAttribute) IsRequired() bool
func (*NotifiesAttribute) ToGoValue ¶
func (attr *NotifiesAttribute) ToGoValue(lv lua.LValue) interface{}
type Resource ¶
type Resource struct { Name string // Basepath is a directory path that includes recipe file defines this resource. Basepath string Attributes map[string]interface{} AttributesLValues map[string]lua.LValue CurrentAttributes map[string]interface{} FallbackAttributes map[string]interface{} Notifications []*Notification ResourceType *ResourceType App *App CurrentAction string Values map[string]interface{} // contains filtered or unexported fields }
func NewResource ¶
func NewResource(name string, resourceType *ResourceType, app *App) *Resource
func (*Resource) CheckCommand ¶
func (*Resource) GetBoolAttribute ¶
func (*Resource) GetBoolCurrentAttribute ¶
func (*Resource) GetIntegerAttribute ¶
func (*Resource) GetIntegerCurrentAttribute ¶
func (*Resource) GetLFunctionAttribute ¶
func (*Resource) GetLFunctionCurrentAttribute ¶
func (*Resource) GetMapAttribute ¶
func (*Resource) GetMapCurrentAttribute ¶
func (*Resource) GetRawAttribute ¶
func (*Resource) GetRawCurrentAttribute ¶
func (*Resource) GetStringAttribute ¶
func (*Resource) GetStringCurrentAttribute ¶
func (*Resource) GetStringSliceAttribute ¶
func (*Resource) GetStringSliceCurrentAttribute ¶
func (*Resource) IsDifferentFiles ¶
func (*Resource) IsDifferentFilesRecursively ¶ added in v0.4.0
func (*Resource) MustRunCommand ¶
func (r *Resource) MustRunCommand(command string) *backend.CommandResult
func (*Resource) RunCommand ¶
func (r *Resource) RunCommand(command string) *backend.CommandResult
func (*Resource) SendContentToTempfile ¶
func (*Resource) SendDirectoryToTempDirectory ¶ added in v0.4.0
func (*Resource) SendFileToTempfile ¶
func (*Resource) ShowContentDiff ¶
func (*Resource) ShowContentDiffRecursively ¶ added in v0.4.0
type ResourceAction ¶
type ResourceType ¶
type ResourceType struct { Name string Attributes []Attribute PreAction ResourceAction SetCurrentAttributesFunc ResourceAction Actions map[string]ResourceAction ShowDifferences ResourceAction UseFallbackAttributes bool // contains filtered or unexported fields }
func (*ResourceType) LGFunction ¶
func (resourceType *ResourceType) LGFunction() func(L *lua.LState) int
type StringAttribute ¶
type StringAttribute struct { Name string Required bool Default string // If DefaultName is true, it uses name as default value. DefaultName bool }
StringAttribute
func (*StringAttribute) GetDefault ¶
func (attr *StringAttribute) GetDefault() interface{}
func (*StringAttribute) GetName ¶
func (attr *StringAttribute) GetName() string
func (*StringAttribute) HasDefault ¶
func (attr *StringAttribute) HasDefault() bool
func (*StringAttribute) IsDefaultName ¶
func (attr *StringAttribute) IsDefaultName() bool
func (*StringAttribute) IsRequired ¶
func (attr *StringAttribute) IsRequired() bool
func (*StringAttribute) ToGoValue ¶
func (attr *StringAttribute) ToGoValue(lv lua.LValue) interface{}
type StringSliceAttribute ¶
type StringSliceAttribute struct { Name string Required bool Default []string // If DefaultName is true, it uses name as default value. DefaultName bool }
StringSliceAttribute
func (*StringSliceAttribute) GetDefault ¶
func (attr *StringSliceAttribute) GetDefault() interface{}
func (*StringSliceAttribute) GetName ¶
func (attr *StringSliceAttribute) GetName() string
func (*StringSliceAttribute) HasDefault ¶
func (attr *StringSliceAttribute) HasDefault() bool
func (*StringSliceAttribute) IsDefaultName ¶
func (attr *StringSliceAttribute) IsDefaultName() bool
func (*StringSliceAttribute) IsRequired ¶
func (attr *StringSliceAttribute) IsRequired() bool
func (*StringSliceAttribute) ToGoValue ¶
func (attr *StringSliceAttribute) ToGoValue(v lua.LValue) interface{}
Click to show internal directories.
Click to hide internal directories.