Skip to content

Commit

Permalink
[IMP] Updated forwardZone to manage the forwarding server details alo…
Browse files Browse the repository at this point in the history
…ng with ns_group
  • Loading branch information
JkhatriInfobox committed Jun 19, 2024
1 parent cc74518 commit 654f878
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion object_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type IBObjectManager interface {
CreateZoneAuth(fqdn string, ea EA) (*ZoneAuth, error)
CreateCNAMERecord(dnsview string, canonical string, recordname string, useTtl bool, ttl uint32, comment string, eas EA) (*RecordCNAME, error)
CreateDefaultNetviews(globalNetview string, localNetview string) (globalNetviewRef string, localNetviewRef string, err error)
CreateZoneForward(comment string, disable bool, eas EA, forwardTo NullForwardTo, forwardersOnly bool, forwardingServers []*Forwardingmemberserver, fqdn string, nsGroup string, view string, zoneFormat string, externalNsGroup string) (*ZoneForward, error)
CreateZoneForward(comment string, disable bool, eas EA, forwardTo NullForwardTo, forwardersOnly bool, forwardingServers *NullableForwardingServers, fqdn string, nsGroup string, view string, zoneFormat string, externalNsGroup string) (*ZoneForward, error)
CreateEADefinition(eadef EADefinition) (*EADefinition, error)
CreateHostRecord(enabledns bool, enabledhcp bool, recordName string, netview string, dnsview string, ipv4cidr string, ipv6cidr string, ipv4Addr string, ipv6Addr string, macAddr string, duid string, useTtl bool, ttl uint32, comment string, eas EA, aliases []string) (*HostRecord, error)
CreateMXRecord(dnsView string, fqdn string, mx string, preference uint32, ttl uint32, useTtl bool, comment string, eas EA) (*RecordMX, error)
Expand Down
14 changes: 8 additions & 6 deletions object_manager_forward_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (objMgr *ObjectManager) CreateZoneForward(
eas EA,
forwardTo NullForwardTo,
forwardersOnly bool,
forwardingServers []*Forwardingmemberserver,
forwardingServers *NullableForwardingServers,
fqdn string,
nsGroup string,
view string,
Expand All @@ -71,7 +71,11 @@ func (objMgr *ObjectManager) CreateZoneForward(
if fqdn == "" {
return nil, fmt.Errorf("FQDN is required to create a forward zone")
}

if forwardingServers != nil && forwardingServers.Servers != nil {
forwardingServers = &NullableForwardingServers{Servers: forwardingServers.Servers}
} else {
forwardingServers = nil
}
zoneForward := NewZoneForward(comment, disable, eas, forwardTo, forwardersOnly, forwardingServers, fqdn, nsGroup, view, zoneFormat, "", externalNsGroup)
ref, err := objMgr.connector.CreateObject(zoneForward)
if err != nil {
Expand Down Expand Up @@ -163,7 +167,7 @@ func NewZoneForward(comment string,
eas EA,
forwardTo NullForwardTo,
forwardersOnly bool,
forwardingServers []*Forwardingmemberserver,
forwardingServers *NullableForwardingServers,
fqdn string,
nsGroup string,
view string,
Expand All @@ -178,9 +182,7 @@ func NewZoneForward(comment string,
zoneForward.Ea = eas
zoneForward.ForwardTo = forwardTo
zoneForward.ForwardersOnly = &forwardersOnly
if forwardingServers != nil {
zoneForward.ForwardingServers = &NullableForwardingServers{Servers: forwardingServers}
}
zoneForward.ForwardingServers = forwardingServers

zoneForward.Fqdn = fqdn
if nsGroup == "" {
Expand Down

0 comments on commit 654f878

Please sign in to comment.