Documentation ¶
Index ¶
- Variables
- func Concat(s string, next Mapper) (value string, ok bool)
- func Hasher(s string, next Mapper) (value string, ok bool)
- func Literal(s string, next Mapper) (value string, ok bool)
- func Lower(s string, next Mapper) (value string, ok bool)
- func ParseFunction(name, s string) (params string, ok bool)
- func Upper(s string, next Mapper) (value string, ok bool)
- type Action
- type ActionBuilder
- type ActionSpec
- type ArgMap
- type Config
- type DNS
- type DomainRecord
- type DomainRecordAction
- type DomainRecordTemplate
- type Environment
- type Filter
- type FilterBuilder
- type FilterSpec
- type Mapper
- type MapperSet
- type Providers
- type Rule
- type RuleSpec
- type SimpleMapper
Constants ¶
This section is empty.
Variables ¶
var DefaultConfig = Config{}
DefaultConfig holds the default configuration values.
Functions ¶
func ParseFunction ¶
ParseFunction attemps to parse s as a function. If successful it returns the function's parameters and true.
Types ¶
type Action ¶
type Action func(context.Context, Environment, Providers) error
Action performs some action based on the environment and providers.
func BuildAction ¶
func BuildAction(spec ActionSpec, builders ...ActionBuilder) (Action, error)
BuildAction uses builders to construct an action from the specification.
func BuildActions ¶
func BuildActions(specs []ActionSpec, builders ...ActionBuilder) ([]Action, error)
BuildActions converts the given specifications into an action list.
func DomainRecordActionBuilder ¶
func DomainRecordActionBuilder(spec ActionSpec) (Action, error)
DomainRecordActionBuilder constructs DNS actions from action specifications in the following forms:
dns.a name zone ip [ttl] dns.cname name zone alias
type ActionBuilder ¶
type ActionBuilder func(ActionSpec) (Action, error)
ActionBuilder builds actions from specifications.
type ActionSpec ¶
ActionSpec is a parsed action specification.
func ParseAction ¶
func ParseAction(v string) (ActionSpec, error)
ParseAction parses v as a string representation of an action.
func ParseActions ¶
func ParseActions(v string) ([]ActionSpec, error)
ParseActions parses v as a string representation of an action list.
func (ActionSpec) Arg ¶
func (spec ActionSpec) Arg(n int) string
Arg returns the argument with the nth index.
An empty string is returned if the argument doesn't exist.
type ArgMap ¶
ArgMap maps variable names to argument indices.
type Config ¶
type Config struct { Params ArgMap Rules []RuleSpec Timeout time.Duration GoogleProject string DigitalOceanToken string Concurrent bool }
Config holds configuration values.
type DNS ¶
type DNS interface {
Register(ctx context.Context, domain string, record DomainRecord) error
}
DNS is a DNS provider interface.
func NewDigitalOceanDNS ¶
NewDigitalOceanDNS returns a DigitalOcean DNS provider.
func NewGoogleDNS ¶
NewGoogleDNS returns a Google DNS provider.
type DomainRecord ¶
type DomainRecord struct { Type string Name string Data string TTL int Priority int Port int Weight int }
DomainRecord is a domain record used by DNS providers.
type DomainRecordAction ¶
type DomainRecordAction struct { Domain string Template DomainRecordTemplate }
DomainRecordAction performs an action on a DNS record.
func (DomainRecordAction) Apply ¶
func (action DomainRecordAction) Apply(ctx context.Context, env Environment, prov Providers) error
Apply runs the domain record action.
type DomainRecordTemplate ¶
type DomainRecordTemplate struct { Type string Name string Data string TTL string Priority string Port string Weight string }
DomainRecordTemplate is a template used by DNS actions. Its fields may contain environment variable expressions.
type Environment ¶
type Environment interface { // Expand replaces ${var} or $var in the string according to the // state of the current environment. Expand(s string) string }
Environment provides the ability to expand environment variables.
type Filter ¶
type Filter func(Environment) bool
A Filter matches some particular condition of its environment.
func BuildFilter ¶
func BuildFilter(spec FilterSpec, builders ...FilterBuilder) (Filter, error)
BuildFilter uses builders to construct a filter from the specification.
func BuildFilters ¶
func BuildFilters(specs []FilterSpec, builders ...FilterBuilder) ([]Filter, error)
BuildFilters converts the given specifications into a filter list.
func PatternBuilder ¶
func PatternBuilder(spec FilterSpec) (Filter, error)
PatternBuilder constructs pattern filters from filter specifications.
func RegexpBuilder ¶
func RegexpBuilder(spec FilterSpec) (Filter, error)
RegexpBuilder constructs regular expression filters from filter specifications.
type FilterBuilder ¶
type FilterBuilder func(FilterSpec) (Filter, error)
FilterBuilder builds filters from specifications.
type FilterSpec ¶
FilterSpec is a parsed filter specification.
func ParseFilter ¶
func ParseFilter(v string) (FilterSpec, error)
ParseFilter parses v as a string representation of a filter.
func ParseFilters ¶
func ParseFilters(v string) ([]FilterSpec, error)
ParseFilters parses v as a string representation of a filter list.
func (FilterSpec) Arg ¶
func (spec FilterSpec) Arg(n int) string
Arg returns the argument with the nth index.
An empty string is returned if the argument doesn't exist.
type MapperSet ¶
type MapperSet []Mapper
MapperSet maps variables to values by iterating through a set of mappers.
type Rule ¶
A Rule defines zero or more triggers and one or more actions.
func BuildRule ¶
func BuildRule(spec RuleSpec, fb []FilterBuilder, ab []ActionBuilder) (Rule, error)
BuildRule uses fb and ab to construct a rule from the specification.
func BuildRules ¶
func BuildRules(specs []RuleSpec, fb []FilterBuilder, ab []ActionBuilder) ([]Rule, error)
BuildRules converts the given specifications into a rule list.
func (Rule) Match ¶
func (r Rule) Match(env Environment) bool
Match returns true if the rule's filters match the environment.
type RuleSpec ¶
type RuleSpec struct { Filters []FilterSpec Actions []ActionSpec }
RuleSpec is a parsed rule specification.
func ParseRules ¶
ParseRules parses v as a string representation of a rule list.
Source Files ¶
- action.go
- actionbuilder.go
- actionspec.go
- argmap.go
- concat.go
- config.go
- digitaloceandns.go
- digitaloceantokensource.go
- dns.go
- domainrecord.go
- domainrecordtemplate.go
- domanrecordaction.go
- environment.go
- filter.go
- filterbuilder.go
- filterspec.go
- func.go
- googledns.go
- hasher.go
- literal.go
- lower.go
- mapper.go
- mapperset.go
- patternfilter.go
- providers.go
- regexpfilter.go
- rule.go
- rulespec.go
- simplemapper.go
- upper.go