Documentation
¶
Index ¶
- Variables
- func ByZone(existing models.Records, dc *models.DomainConfig, compFunc ComparableFunc) ([]string, bool, error)
- type Change
- type ChangeList
- func ByLabel(existing models.Records, dc *models.DomainConfig, compFunc ComparableFunc) (ChangeList, error)
- func ByRecord(existing models.Records, dc *models.DomainConfig, compFunc ComparableFunc) (ChangeList, error)
- func ByRecordSet(existing models.Records, dc *models.DomainConfig, compFunc ComparableFunc) (ChangeList, error)
- type ComparableFunc
- type CompareConfig
- type Verb
Constants ¶
This section is empty.
Variables ¶
var EnableDiff2 bool
EnableDiff2 is true to activate the experimental diff2 algorithm.
Functions ¶
func ByZone ¶
func ByZone(existing models.Records, dc *models.DomainConfig, compFunc ComparableFunc) ([]string, bool, error)
ByZone takes two lists of records (existing and desired) and returns text one would output to users describing the change.
Use this with DNS providers whose API updates the entire zone at a time. That is, to make any change (1 record or many) the entire DNS zone is uploaded.
The user should see a list of changes as if individual records were updated.
The caller of this function should:
changed, msgs := diff2.ByZone(existing, desired, origin, nil
fmt.Sprintf("CREATING ZONEFILE FOR THE FIRST TIME: dir/example.com.zone"))
if changed {
// output msgs
// generate the zone using the "desired" records
}
Example providers include: BIND
Types ¶
type Change ¶
type Change struct {
Type Verb // Add, Change, Delete
Key models.RecordKey // .Key.Type is "" unless using ByRecordSet
Old models.Records
New models.Records // any changed or added records at Key.
Msgs []string // Human-friendly explanation of what changed
MsgsJoined string // strings.Join(Msgs, "\n")
MsgsByKey map[models.RecordKey][]string // Messages for a given key
}
type ChangeList ¶
type ChangeList []Change
func ByLabel ¶
func ByLabel(existing models.Records, dc *models.DomainConfig, compFunc ComparableFunc) (ChangeList, error)
ByLabel takes two lists of records (existing and desired) and returns instructions for turning existing into desired.
Use this with DNS providers whose API updates one label at a time. That is, updates are done by sending a list of DNS records to be served at a particular label, or the label itself is deleted.
Examples include:
func ByRecord ¶
func ByRecord(existing models.Records, dc *models.DomainConfig, compFunc ComparableFunc) (ChangeList, error)
ByRecord takes two lists of records (existing and desired) and returns instructions for turning existing into desired.
Use this with DNS providers whose API updates one record at a time.
Note: The .Old and .New field are lists ([]models.RecordConfig) but when using ByRecord() they will never have more than one entry. A create always has exactly 1 new: .New[0] A change always has exactly 1 old and 1 new: .Old[0] and .New[0] A delete always has exactly 1 old: .Old[0]
Examples include: INWX
func ByRecordSet ¶
func ByRecordSet(existing models.Records, dc *models.DomainConfig, compFunc ComparableFunc) (ChangeList, error)
ByRecordSet takes two lists of records (existing and desired) and returns instructions for turning existing into desired.
Use this with DNS providers whose API updates one recordset at a time. A recordset is all the records of a particular type at a label. For example, if www.example.com has 3 A records and a TXT record, if A records are added, changed, or removed, the API takes www.example.com, A, and a list of all the desired IP addresses.
Examples include:
func (ChangeList) String ¶
func (cl ChangeList) String() string
type ComparableFunc ¶
type ComparableFunc func(*models.RecordConfig) string
type CompareConfig ¶
type CompareConfig struct {
// contains filtered or unexported fields
}
func NewCompareConfig ¶
func NewCompareConfig(origin string, existing, desired models.Records, compFn ComparableFunc) *CompareConfig
func (*CompareConfig) String ¶
func (cc *CompareConfig) String() string
String returns cc represented as a string. This is used for debugging and unit tests, as the structure may otherwise be difficult to compare.
func (*CompareConfig) VerifyCNAMEAssertions ¶
func (cc *CompareConfig) VerifyCNAMEAssertions()