Skip to content

Commit

Permalink
adding 'zone' field to MX and SRV record types
Browse files Browse the repository at this point in the history
  • Loading branch information
skudriavtsev committed Mar 27, 2023
1 parent b0c55f5 commit 8624a4a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
14 changes: 10 additions & 4 deletions objects.go
Original file line number Diff line number Diff line change
Expand Up @@ -803,24 +803,27 @@ type RecordMX struct {
Fqdn string `json:"name,omitempty"`
MX string `json:"mail_exchanger,omitempty"`
Preference uint32 `json:"preference"`
Zone string `json:"zone,omitempty"`
Ttl uint32 `json:"ttl"`
UseTtl bool `json:"use_ttl"`
Comment string `json:"comment"`
Ea EA `json:"extattrs"`
}

var mxRecordReturnFieldsList = []string{"mail_exchanger", "view", "name", "preference", "ttl", "use_ttl", "comment", "extattrs", "zone"}

func NewEmptyRecordMX() *RecordMX {
res := &RecordMX{}
res.objectType = "record:mx"
res.returnFields = []string{"mail_exchanger", "view", "name", "preference", "ttl", "use_ttl", "comment", "extattrs"}
res.returnFields = mxRecordReturnFieldsList

return res
}

func NewRecordMX(rm RecordMX) *RecordMX {
res := rm
res.objectType = "record:mx"
res.returnFields = []string{"mail_exchanger", "view", "name", "preference", "ttl", "use_ttl", "comment", "extattrs"}
res.returnFields = mxRecordReturnFieldsList

return &res
}
Expand All @@ -834,24 +837,27 @@ type RecordSRV struct {
Weight uint32 `json:"weight"`
Port uint32 `json:"port"`
Target string `json:"target,omitempty"`
Zone string `json:"zone,omitempty"`
Ttl uint32 `json:"ttl"`
UseTtl bool `json:"use_ttl"`
Comment string `json:"comment"`
Ea EA `json:"extattrs"`
}

var srvRecordReturnFieldsList = []string{"name", "view", "priority", "weight", "port", "target", "ttl", "use_ttl", "comment", "extattrs", "zone"}

func NewEmptyRecordSRV() *RecordSRV {
res := RecordSRV{}
res.objectType = "record:srv"
res.returnFields = []string{"name", "view", "priority", "weight", "port", "target", "ttl", "use_ttl", "comment", "extattrs"}
res.returnFields = srvRecordReturnFieldsList

return &res
}

func NewRecordSRV(rv RecordSRV) *RecordSRV {
res := rv
res.objectType = "record:srv"
res.returnFields = []string{"name", "view", "priority", "weight", "port", "target", "ttl", "use_ttl", "comment", "extattrs"}
res.returnFields = srvRecordReturnFieldsList

return &res
}
Expand Down
4 changes: 2 additions & 2 deletions objects_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -638,7 +638,7 @@ var _ = Describe("Objects", func() {

It("should set base fields correctly", func() {
Expect(rm.ObjectType()).To(Equal("record:mx"))
Expect(rm.ReturnFields()).To(ConsistOf("mail_exchanger", "view", "name", "preference", "ttl", "use_ttl", "comment", "extattrs"))
Expect(rm.ReturnFields()).To(ConsistOf("mail_exchanger", "view", "name", "preference", "ttl", "use_ttl", "comment", "extattrs", "zone"))
})
})

Expand Down Expand Up @@ -681,7 +681,7 @@ var _ = Describe("Objects", func() {
})
It("should set base fields correctly", func() {
Expect(rv.ObjectType()).To(Equal("record:srv"))
Expect(rv.ReturnFields()).To(ConsistOf("name", "view", "priority", "weight", "port", "target", "ttl", "use_ttl", "comment", "extattrs"))
Expect(rv.ReturnFields()).To(ConsistOf("name", "view", "priority", "weight", "port", "target", "ttl", "use_ttl", "comment", "extattrs", "zone"))
})

})
Expand Down

0 comments on commit 8624a4a

Please sign in to comment.