Skip to content

Commit

Permalink
Change return value and type for UpdateTXTRecord. Fixes infobloxopen#113
Browse files Browse the repository at this point in the history
  • Loading branch information
Guy Newbury committed Feb 10, 2021
1 parent f5f0084 commit 00d1758
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions object_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type IBObjectManager interface {
CreateNetworkView(name string) (*NetworkView, error)
CreatePTRRecord(netview string, dnsview string, recordname string, cidr string, ipAddr string, ea EA) (*RecordPTR, error)
DeleteARecord(ref string) (string, error)
DeleteZoneAuth(ref string) (string, error)
DeleteZoneAuth(ref string) (string, error)
DeleteCNAMERecord(ref string) (string, error)
DeleteFixedAddress(ref string) (string, error)
DeleteHostRecord(ref string) (string, error)
Expand Down Expand Up @@ -615,28 +615,28 @@ func (objMgr *ObjectManager) GetTXTRecord(name string) (*RecordTXT, error) {
return &res[0], nil
}

func (objMgr *ObjectManager) UpdateTXTRecord(recordname string, text string) (*RecordTXT, error) {
func (objMgr *ObjectManager) UpdateTXTRecord(recordname string, text string) (string, error) {
var res []RecordTXT

recordTXT := NewRecordTXT(RecordTXT{Name: recordname})

err := objMgr.connector.GetObject(recordTXT, "", &res)

if len(res) == 0 {
return nil, nil
return "", nil
}

res[0].Text = text

res[0].Zone = "" // set the Zone value to "" as its a non writable field

_, err = objMgr.connector.UpdateObject(&res[0], res[0].Ref)
ref, err := objMgr.connector.UpdateObject(&res[0], res[0].Ref)

if err != nil || res == nil || len(res) == 0 {
return nil, err
return "", err
}

return &res[0], nil
return ref, nil
}

func (objMgr *ObjectManager) DeleteTXTRecord(ref string) (string, error) {
Expand Down Expand Up @@ -761,16 +761,15 @@ func (objMgr *ObjectManager) CreateZoneAuth(fqdn string, ea EA) (*ZoneAuth, erro
eas := objMgr.extendEA(ea)

zoneAuth := NewZoneAuth(ZoneAuth{
Fqdn: fqdn,
Ea: eas})

Fqdn: fqdn,
Ea: eas})

ref, err := objMgr.connector.CreateObject(zoneAuth)
zoneAuth.Ref = ref
return zoneAuth, err
}

// Retreive a authortative zone by ref
// Retreive a authortative zone by ref
func (objMgr *ObjectManager) GetZoneAuthByRef(ref string) (ZoneAuth, error) {
var res ZoneAuth

Expand Down

0 comments on commit 00d1758

Please sign in to comment.