fix: infoblox provider has switched to string pointer

This commit is contained in:
Michel Loiseleur 2023-12-02 21:59:39 +01:00
parent 93e23d8e87
commit 5f6df47056
2 changed files with 98 additions and 97 deletions

View File

@ -215,28 +215,28 @@ func (p *ProviderConfig) Records(ctx context.Context) (endpoints []*endpoint.End
// Check if endpoint already exists and add to existing endpoint if it does
foundExisting := false
for _, ep := range endpoints {
if ep.DNSName == res.Name && ep.RecordType == endpoint.RecordTypeA {
if ep.DNSName == *res.Name && ep.RecordType == endpoint.RecordTypeA {
foundExisting = true
duplicateTarget := false
for _, t := range ep.Targets {
if t == res.Ipv4Addr {
if t == *res.Ipv4Addr {
duplicateTarget = true
break
}
}
if duplicateTarget {
logrus.Debugf("A duplicate target '%s' found for existing A record '%s'", res.Ipv4Addr, ep.DNSName)
logrus.Debugf("A duplicate target '%s' found for existing A record '%s'", *res.Ipv4Addr, ep.DNSName)
} else {
logrus.Debugf("Adding target '%s' to existing A record '%s'", res.Ipv4Addr, res.Name)
ep.Targets = append(ep.Targets, res.Ipv4Addr)
logrus.Debugf("Adding target '%s' to existing A record '%s'", *res.Ipv4Addr, *res.Name)
ep.Targets = append(ep.Targets, *res.Ipv4Addr)
}
break
}
}
if !foundExisting {
newEndpoint := endpoint.NewEndpoint(res.Name, endpoint.RecordTypeA, res.Ipv4Addr)
newEndpoint := endpoint.NewEndpoint(*res.Name, endpoint.RecordTypeA, *res.Ipv4Addr)
if p.createPTR {
newEndpoint.WithProviderSpecific(providerSpecificInfobloxPtrRecord, "true")
}
@ -257,11 +257,11 @@ func (p *ProviderConfig) Records(ctx context.Context) (endpoints []*endpoint.End
}
for _, res := range resH {
for _, ip := range res.Ipv4Addrs {
logrus.Debugf("Record='%s' A(H):'%s'", res.Name, ip.Ipv4Addr)
logrus.Debugf("Record='%s' A(H):'%s'", *res.Name, *ip.Ipv4Addr)
// host record is an abstraction in infoblox that combines A and PTR records
// for any host record we already should have a PTR record in infoblox, so mark it as created
newEndpoint := endpoint.NewEndpoint(res.Name, endpoint.RecordTypeA, ip.Ipv4Addr)
newEndpoint := endpoint.NewEndpoint(*res.Name, endpoint.RecordTypeA, *ip.Ipv4Addr)
if p.createPTR {
newEndpoint.WithProviderSpecific(providerSpecificInfobloxPtrRecord, "true")
}
@ -276,8 +276,8 @@ func (p *ProviderConfig) Records(ctx context.Context) (endpoints []*endpoint.End
return nil, fmt.Errorf("could not fetch CNAME records from zone '%s': %w", zone.Fqdn, err)
}
for _, res := range resC {
logrus.Debugf("Record='%s' CNAME:'%s'", res.Name, res.Canonical)
endpoints = append(endpoints, endpoint.NewEndpoint(res.Name, endpoint.RecordTypeCNAME, res.Canonical))
logrus.Debugf("Record='%s' CNAME:'%s'", *res.Name, *res.Canonical)
endpoints = append(endpoints, endpoint.NewEndpoint(*res.Name, endpoint.RecordTypeCNAME, *res.Canonical))
}
if p.createPTR {
@ -293,7 +293,7 @@ func (p *ProviderConfig) Records(ctx context.Context) (endpoints []*endpoint.End
return nil, fmt.Errorf("could not fetch PTR records from zone '%s': %w", zone.Fqdn, err)
}
for _, res := range resP {
endpoints = append(endpoints, endpoint.NewEndpoint(res.PtrdName, endpoint.RecordTypePTR, res.Ipv4Addr))
endpoints = append(endpoints, endpoint.NewEndpoint(*res.PtrdName, endpoint.RecordTypePTR, *res.Ipv4Addr))
}
}
}
@ -307,36 +307,37 @@ func (p *ProviderConfig) Records(ctx context.Context) (endpoints []*endpoint.End
for _, res := range resT {
// The Infoblox API strips enclosing double quotes from TXT records lacking whitespace.
// Unhandled, the missing double quotes would break the extractOwnerID method of the registry package.
if _, err := strconv.Unquote(res.Text); err != nil {
res.Text = strconv.Quote(res.Text)
if _, err := strconv.Unquote(*res.Text); err != nil {
quoted := strconv.Quote(*res.Text)
res.Text = &quoted
}
foundExisting := false
for _, ep := range endpoints {
if ep.DNSName == res.Name && ep.RecordType == endpoint.RecordTypeTXT {
if ep.DNSName == *res.Name && ep.RecordType == endpoint.RecordTypeTXT {
foundExisting = true
duplicateTarget := false
for _, t := range ep.Targets {
if t == res.Text {
if t == *res.Text {
duplicateTarget = true
break
}
}
if duplicateTarget {
logrus.Debugf("A duplicate target '%s' found for existing TXT record '%s'", res.Text, ep.DNSName)
logrus.Debugf("A duplicate target '%s' found for existing TXT record '%s'", *res.Text, ep.DNSName)
} else {
logrus.Debugf("Adding target '%s' to existing TXT record '%s'", res.Text, res.Name)
ep.Targets = append(ep.Targets, res.Text)
logrus.Debugf("Adding target '%s' to existing TXT record '%s'", *res.Text, *res.Name)
ep.Targets = append(ep.Targets, *res.Text)
}
break
}
}
if !foundExisting {
logrus.Debugf("Record='%s' TXT:'%s'", res.Name, res.Text)
newEndpoint := endpoint.NewEndpoint(res.Name, endpoint.RecordTypeTXT, res.Text)
logrus.Debugf("Record='%s' TXT:'%s'", *res.Name, *res.Text)
newEndpoint := endpoint.NewEndpoint(*res.Name, endpoint.RecordTypeTXT, *res.Text)
endpoints = append(endpoints, newEndpoint)
}
}
@ -532,11 +533,11 @@ func (p *ProviderConfig) recordSet(ep *endpoint.Endpoint, getObject bool, target
case endpoint.RecordTypeA:
var res []ibclient.RecordA
obj := ibclient.NewEmptyRecordA()
obj.Name = ep.DNSName
obj.Ipv4Addr = ep.Targets[targetIndex]
obj.Name = &ep.DNSName
obj.Ipv4Addr = &ep.Targets[targetIndex]
obj.View = p.view
if getObject {
queryParams := ibclient.NewQueryParams(false, map[string]string{"name": obj.Name})
queryParams := ibclient.NewQueryParams(false, map[string]string{"name": *obj.Name})
err = p.client.GetObject(obj, "", queryParams, &res)
if err != nil && !isNotFoundError(err) {
return
@ -549,11 +550,11 @@ func (p *ProviderConfig) recordSet(ep *endpoint.Endpoint, getObject bool, target
case endpoint.RecordTypePTR:
var res []ibclient.RecordPTR
obj := ibclient.NewEmptyRecordPTR()
obj.PtrdName = ep.DNSName
obj.Ipv4Addr = ep.Targets[targetIndex]
obj.PtrdName = &ep.DNSName
obj.Ipv4Addr = &ep.Targets[targetIndex]
obj.View = p.view
if getObject {
queryParams := ibclient.NewQueryParams(false, map[string]string{"name": obj.PtrdName})
queryParams := ibclient.NewQueryParams(false, map[string]string{"name": *obj.PtrdName})
err = p.client.GetObject(obj, "", queryParams, &res)
if err != nil && !isNotFoundError(err) {
return
@ -566,11 +567,11 @@ func (p *ProviderConfig) recordSet(ep *endpoint.Endpoint, getObject bool, target
case endpoint.RecordTypeCNAME:
var res []ibclient.RecordCNAME
obj := ibclient.NewEmptyRecordCNAME()
obj.Name = ep.DNSName
obj.Canonical = ep.Targets[0]
obj.View = p.view
obj.Name = &ep.DNSName
obj.Canonical = &ep.Targets[0]
obj.View = &p.view
if getObject {
queryParams := ibclient.NewQueryParams(false, map[string]string{"name": obj.Name})
queryParams := ibclient.NewQueryParams(false, map[string]string{"name": *obj.Name})
err = p.client.GetObject(obj, "", queryParams, &res)
if err != nil && !isNotFoundError(err) {
return
@ -588,11 +589,11 @@ func (p *ProviderConfig) recordSet(ep *endpoint.Endpoint, getObject bool, target
ep.Targets = endpoint.Targets{target}
}
obj := ibclient.NewEmptyRecordTXT()
obj.Name = ep.DNSName
obj.Text = ep.Targets[0]
obj.View = p.view
obj.Name = &ep.DNSName
obj.Text = &ep.Targets[0]
obj.View = &p.view
if getObject {
queryParams := ibclient.NewQueryParams(false, map[string]string{"name": obj.Name})
queryParams := ibclient.NewQueryParams(false, map[string]string{"name": *obj.Name})
err = p.client.GetObject(obj, "", queryParams, &res)
if err != nil && !isNotFoundError(err) {
return
@ -679,36 +680,36 @@ func (p *ProviderConfig) deleteRecords(deleted infobloxChangeMap) {
case endpoint.RecordTypeA:
for _, record := range *recordSet.res.(*[]ibclient.RecordA) {
if p.dryRun {
logrus.Infof("Would delete %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "A", record.Name, record.Ipv4Addr, record.Zone)
logrus.Infof("Would delete %s record named '%p' to '%p' for Infoblox DNS zone '%s'.", "A", record.Name, record.Ipv4Addr, record.Zone)
} else {
logrus.Infof("Deleting %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "A", record.Name, record.Ipv4Addr, record.Zone)
logrus.Infof("Deleting %s record named '%p' to '%p' for Infoblox DNS zone '%s'.", "A", record.Name, record.Ipv4Addr, record.Zone)
_, err = p.client.DeleteObject(record.Ref)
}
}
case endpoint.RecordTypePTR:
for _, record := range *recordSet.res.(*[]ibclient.RecordPTR) {
if p.dryRun {
logrus.Infof("Would delete %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "PTR", record.PtrdName, record.Ipv4Addr, record.Zone)
logrus.Infof("Would delete %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "PTR", *record.PtrdName, *record.Ipv4Addr, record.Zone)
} else {
logrus.Infof("Deleting %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "PTR", record.PtrdName, record.Ipv4Addr, record.Zone)
logrus.Infof("Deleting %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "PTR", *record.PtrdName, *record.Ipv4Addr, record.Zone)
_, err = p.client.DeleteObject(record.Ref)
}
}
case endpoint.RecordTypeCNAME:
for _, record := range *recordSet.res.(*[]ibclient.RecordCNAME) {
if p.dryRun {
logrus.Infof("Would delete %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "CNAME", record.Name, record.Canonical, record.Zone)
logrus.Infof("Would delete %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "CNAME", *record.Name, *record.Canonical, record.Zone)
} else {
logrus.Infof("Deleting %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "CNAME", record.Name, record.Canonical, record.Zone)
logrus.Infof("Deleting %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "CNAME", *record.Name, *record.Canonical, record.Zone)
_, err = p.client.DeleteObject(record.Ref)
}
}
case endpoint.RecordTypeTXT:
for _, record := range *recordSet.res.(*[]ibclient.RecordTXT) {
if p.dryRun {
logrus.Infof("Would delete %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "TXT", record.Name, record.Text, record.Zone)
logrus.Infof("Would delete %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "TXT", *record.Name, *record.Text, record.Zone)
} else {
logrus.Infof("Deleting %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "TXT", record.Name, record.Text, record.Zone)
logrus.Infof("Deleting %s record named '%s' to '%s' for Infoblox DNS zone '%s'.", "TXT", *record.Name, *record.Text, record.Zone)
_, err = p.client.DeleteObject(record.Ref)
}
}

View File

@ -113,63 +113,63 @@ func (client *mockIBConnector) CreateObject(obj ibclient.IBObject) (ref string,
client.createdEndpoints = append(
client.createdEndpoints,
endpoint.NewEndpoint(
obj.(*ibclient.RecordA).Name,
*obj.(*ibclient.RecordA).Name,
endpoint.RecordTypeA,
obj.(*ibclient.RecordA).Ipv4Addr,
*obj.(*ibclient.RecordA).Ipv4Addr,
),
)
ref = fmt.Sprintf("%s/%s:%s/default", obj.ObjectType(), base64.StdEncoding.EncodeToString([]byte(obj.(*ibclient.RecordA).Name)), obj.(*ibclient.RecordA).Name)
ref = fmt.Sprintf("%s/%s:%s/default", obj.ObjectType(), base64.StdEncoding.EncodeToString([]byte(*obj.(*ibclient.RecordA).Name)), *obj.(*ibclient.RecordA).Name)
obj.(*ibclient.RecordA).Ref = ref
case "record:cname":
client.createdEndpoints = append(
client.createdEndpoints,
endpoint.NewEndpoint(
obj.(*ibclient.RecordCNAME).Name,
*obj.(*ibclient.RecordCNAME).Name,
endpoint.RecordTypeCNAME,
obj.(*ibclient.RecordCNAME).Canonical,
*obj.(*ibclient.RecordCNAME).Canonical,
),
)
ref = fmt.Sprintf("%s/%s:%s/default", obj.ObjectType(), base64.StdEncoding.EncodeToString([]byte(obj.(*ibclient.RecordCNAME).Name)), obj.(*ibclient.RecordCNAME).Name)
ref = fmt.Sprintf("%s/%s:%s/default", obj.ObjectType(), base64.StdEncoding.EncodeToString([]byte(*obj.(*ibclient.RecordCNAME).Name)), *obj.(*ibclient.RecordCNAME).Name)
obj.(*ibclient.RecordCNAME).Ref = ref
case "record:host":
for _, i := range obj.(*ibclient.HostRecord).Ipv4Addrs {
client.createdEndpoints = append(
client.createdEndpoints,
endpoint.NewEndpoint(
obj.(*ibclient.HostRecord).Name,
*obj.(*ibclient.HostRecord).Name,
endpoint.RecordTypeA,
i.Ipv4Addr,
*i.Ipv4Addr,
),
)
}
ref = fmt.Sprintf("%s/%s:%s/default", obj.ObjectType(), base64.StdEncoding.EncodeToString([]byte(obj.(*ibclient.HostRecord).Name)), obj.(*ibclient.HostRecord).Name)
ref = fmt.Sprintf("%s/%s:%s/default", obj.ObjectType(), base64.StdEncoding.EncodeToString([]byte(*obj.(*ibclient.HostRecord).Name)), *obj.(*ibclient.HostRecord).Name)
obj.(*ibclient.HostRecord).Ref = ref
case "record:txt":
client.createdEndpoints = append(
client.createdEndpoints,
endpoint.NewEndpoint(
obj.(*ibclient.RecordTXT).Name,
*obj.(*ibclient.RecordTXT).Name,
endpoint.RecordTypeTXT,
obj.(*ibclient.RecordTXT).Text,
*obj.(*ibclient.RecordTXT).Text,
),
)
obj.(*ibclient.RecordTXT).Ref = ref
ref = fmt.Sprintf("%s/%s:%s/default", obj.ObjectType(), base64.StdEncoding.EncodeToString([]byte(obj.(*ibclient.RecordTXT).Name)), obj.(*ibclient.RecordTXT).Name)
ref = fmt.Sprintf("%s/%s:%s/default", obj.ObjectType(), base64.StdEncoding.EncodeToString([]byte(*obj.(*ibclient.RecordTXT).Name)), *obj.(*ibclient.RecordTXT).Name)
case "record:ptr":
client.createdEndpoints = append(
client.createdEndpoints,
endpoint.NewEndpoint(
obj.(*ibclient.RecordPTR).PtrdName,
*obj.(*ibclient.RecordPTR).PtrdName,
endpoint.RecordTypePTR,
obj.(*ibclient.RecordPTR).Ipv4Addr,
*obj.(*ibclient.RecordPTR).Ipv4Addr,
),
)
obj.(*ibclient.RecordPTR).Ref = ref
reverseAddr, err := dns.ReverseAddr(obj.(*ibclient.RecordPTR).Ipv4Addr)
reverseAddr, err := dns.ReverseAddr(*obj.(*ibclient.RecordPTR).Ipv4Addr)
if err != nil {
return ref, fmt.Errorf("unable to create reverse addr from %s", obj.(*ibclient.RecordPTR).Ipv4Addr)
return ref, fmt.Errorf("unable to create reverse addr from %s", *obj.(*ibclient.RecordPTR).Ipv4Addr)
}
ref = fmt.Sprintf("%s/%s:%s/default", obj.ObjectType(), base64.StdEncoding.EncodeToString([]byte(obj.(*ibclient.RecordPTR).PtrdName)), reverseAddr)
ref = fmt.Sprintf("%s/%s:%s/default", obj.ObjectType(), base64.StdEncoding.EncodeToString([]byte(*obj.(*ibclient.RecordPTR).PtrdName)), reverseAddr)
}
*client.mockInfobloxObjects = append(
*client.mockInfobloxObjects,
@ -200,8 +200,8 @@ func (client *mockIBConnector) GetObject(obj ibclient.IBObject, ref string, quer
ref != object.(*ibclient.RecordA).Ref {
continue
}
if obj.(*ibclient.RecordA).Name != "" &&
obj.(*ibclient.RecordA).Name != object.(*ibclient.RecordA).Name {
if obj.(*ibclient.RecordA).Name != nil &&
*obj.(*ibclient.RecordA).Name != *object.(*ibclient.RecordA).Name {
continue
}
result = append(result, *object.(*ibclient.RecordA))
@ -216,8 +216,8 @@ func (client *mockIBConnector) GetObject(obj ibclient.IBObject, ref string, quer
ref != object.(*ibclient.RecordCNAME).Ref {
continue
}
if obj.(*ibclient.RecordCNAME).Name != "" &&
obj.(*ibclient.RecordCNAME).Name != object.(*ibclient.RecordCNAME).Name {
if obj.(*ibclient.RecordCNAME).Name != nil &&
*obj.(*ibclient.RecordCNAME).Name != *object.(*ibclient.RecordCNAME).Name {
continue
}
result = append(result, *object.(*ibclient.RecordCNAME))
@ -232,8 +232,8 @@ func (client *mockIBConnector) GetObject(obj ibclient.IBObject, ref string, quer
ref != object.(*ibclient.HostRecord).Ref {
continue
}
if obj.(*ibclient.HostRecord).Name != "" &&
obj.(*ibclient.HostRecord).Name != object.(*ibclient.HostRecord).Name {
if obj.(*ibclient.HostRecord).Name != nil &&
*obj.(*ibclient.HostRecord).Name != *object.(*ibclient.HostRecord).Name {
continue
}
result = append(result, *object.(*ibclient.HostRecord))
@ -248,8 +248,8 @@ func (client *mockIBConnector) GetObject(obj ibclient.IBObject, ref string, quer
ref != object.(*ibclient.RecordTXT).Ref {
continue
}
if obj.(*ibclient.RecordTXT).Name != "" &&
obj.(*ibclient.RecordTXT).Name != object.(*ibclient.RecordTXT).Name {
if obj.(*ibclient.RecordTXT).Name != nil &&
*obj.(*ibclient.RecordTXT).Name != *object.(*ibclient.RecordTXT).Name {
continue
}
result = append(result, *object.(*ibclient.RecordTXT))
@ -264,8 +264,8 @@ func (client *mockIBConnector) GetObject(obj ibclient.IBObject, ref string, quer
ref != object.(*ibclient.RecordPTR).Ref {
continue
}
if obj.(*ibclient.RecordPTR).PtrdName != "" &&
obj.(*ibclient.RecordPTR).PtrdName != object.(*ibclient.RecordPTR).PtrdName {
if obj.(*ibclient.RecordPTR).PtrdName != nil &&
*obj.(*ibclient.RecordPTR).PtrdName != *object.(*ibclient.RecordPTR).PtrdName {
continue
}
result = append(result, *object.(*ibclient.RecordPTR))
@ -286,13 +286,13 @@ func (client *mockIBConnector) DeleteObject(ref string) (refRes string, err erro
case "record:a":
var records []ibclient.RecordA
obj := ibclient.NewEmptyRecordA()
obj.Name = result[2]
obj.Name = &result[2]
client.GetObject(obj, ref, nil, &records)
for _, record := range records {
client.deletedEndpoints = append(
client.deletedEndpoints,
endpoint.NewEndpoint(
record.Name,
*record.Name,
endpoint.RecordTypeA,
"",
),
@ -301,13 +301,13 @@ func (client *mockIBConnector) DeleteObject(ref string) (refRes string, err erro
case "record:cname":
var records []ibclient.RecordCNAME
obj := ibclient.NewEmptyRecordCNAME()
obj.Name = result[2]
obj.Name = &result[2]
client.GetObject(obj, ref, nil, &records)
for _, record := range records {
client.deletedEndpoints = append(
client.deletedEndpoints,
endpoint.NewEndpoint(
record.Name,
*record.Name,
endpoint.RecordTypeCNAME,
"",
),
@ -316,13 +316,13 @@ func (client *mockIBConnector) DeleteObject(ref string) (refRes string, err erro
case "record:host":
var records []ibclient.HostRecord
obj := ibclient.NewEmptyHostRecord()
obj.Name = result[2]
obj.Name = &result[2]
client.GetObject(obj, ref, nil, &records)
for _, record := range records {
client.deletedEndpoints = append(
client.deletedEndpoints,
endpoint.NewEndpoint(
record.Name,
*record.Name,
endpoint.RecordTypeA,
"",
),
@ -331,13 +331,13 @@ func (client *mockIBConnector) DeleteObject(ref string) (refRes string, err erro
case "record:txt":
var records []ibclient.RecordTXT
obj := ibclient.NewEmptyRecordTXT()
obj.Name = result[2]
obj.Name = &result[2]
client.GetObject(obj, ref, nil, &records)
for _, record := range records {
client.deletedEndpoints = append(
client.deletedEndpoints,
endpoint.NewEndpoint(
record.Name,
*record.Name,
endpoint.RecordTypeTXT,
"",
),
@ -346,13 +346,13 @@ func (client *mockIBConnector) DeleteObject(ref string) (refRes string, err erro
case "record:ptr":
var records []ibclient.RecordPTR
obj := ibclient.NewEmptyRecordPTR()
obj.Name = result[2]
obj.Name = &result[2]
client.GetObject(obj, ref, nil, &records)
for _, record := range records {
client.deletedEndpoints = append(
client.deletedEndpoints,
endpoint.NewEndpoint(
record.PtrdName,
*record.PtrdName,
endpoint.RecordTypePTR,
"",
),
@ -368,8 +368,8 @@ func (client *mockIBConnector) UpdateObject(obj ibclient.IBObject, ref string) (
client.updatedEndpoints = append(
client.updatedEndpoints,
endpoint.NewEndpoint(
obj.(*ibclient.RecordA).Name,
obj.(*ibclient.RecordA).Ipv4Addr,
*obj.(*ibclient.RecordA).Name,
*obj.(*ibclient.RecordA).Ipv4Addr,
endpoint.RecordTypeA,
),
)
@ -377,8 +377,8 @@ func (client *mockIBConnector) UpdateObject(obj ibclient.IBObject, ref string) (
client.updatedEndpoints = append(
client.updatedEndpoints,
endpoint.NewEndpoint(
obj.(*ibclient.RecordCNAME).Name,
obj.(*ibclient.RecordCNAME).Canonical,
*obj.(*ibclient.RecordCNAME).Name,
*obj.(*ibclient.RecordCNAME).Canonical,
endpoint.RecordTypeCNAME,
),
)
@ -387,8 +387,8 @@ func (client *mockIBConnector) UpdateObject(obj ibclient.IBObject, ref string) (
client.updatedEndpoints = append(
client.updatedEndpoints,
endpoint.NewEndpoint(
obj.(*ibclient.HostRecord).Name,
i.Ipv4Addr,
*obj.(*ibclient.HostRecord).Name,
*i.Ipv4Addr,
endpoint.RecordTypeA,
),
)
@ -397,8 +397,8 @@ func (client *mockIBConnector) UpdateObject(obj ibclient.IBObject, ref string) (
client.updatedEndpoints = append(
client.updatedEndpoints,
endpoint.NewEndpoint(
obj.(*ibclient.RecordTXT).Name,
obj.(*ibclient.RecordTXT).Text,
*obj.(*ibclient.RecordTXT).Name,
*obj.(*ibclient.RecordTXT).Text,
endpoint.RecordTypeTXT,
),
)
@ -417,37 +417,37 @@ func createMockInfobloxObject(name, recordType, value string) ibclient.IBObject
switch recordType {
case endpoint.RecordTypeA:
obj := ibclient.NewEmptyRecordA()
obj.Name = name
obj.Name = &name
obj.Ref = ref
obj.Ipv4Addr = value
obj.Ipv4Addr = &value
return obj
case endpoint.RecordTypeCNAME:
obj := ibclient.NewEmptyRecordCNAME()
obj.Name = name
obj.Name = &name
obj.Ref = ref
obj.Canonical = value
obj.Canonical = &value
return obj
case endpoint.RecordTypeTXT:
obj := ibclient.NewEmptyRecordTXT()
obj.Name = name
obj.Name = &name
obj.Ref = ref
obj.Text = value
obj.Text = &value
return obj
case "HOST":
obj := ibclient.NewEmptyHostRecord()
obj.Name = name
obj.Name = &name
obj.Ref = ref
obj.Ipv4Addrs = []ibclient.HostRecordIpv4Addr{
{
Ipv4Addr: value,
Ipv4Addr: &value,
},
}
return obj
case endpoint.RecordTypePTR:
obj := ibclient.NewEmptyRecordPTR()
obj.PtrdName = name
obj.PtrdName = &name
obj.Ref = ref
obj.Ipv4Addr = value
obj.Ipv4Addr = &value
return obj
}