Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds search for a records by zone name #201

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions object_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type IBObjectManager interface {
DeleteZoneDelegated(ref string) (string, error)
GetARecordByRef(ref string) (*RecordA, error)
GetARecord(dnsview string, recordName string, ipAddr string) (*RecordA, error)
GetARecordByZone(zone_name string, dnsview string) (*[]RecordA, error)
GetAAAARecord(dnsview string, recordName string, ipAddr string) (*RecordAAAA, error)
GetAAAARecordByRef(ref string) (*RecordAAAA, error)
GetCNAMERecord(dnsview string, canonical string, recordName string) (*RecordCNAME, error)
Expand Down
26 changes: 26 additions & 0 deletions object_manager_a-record.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,32 @@ func (objMgr *ObjectManager) GetARecordByRef(ref string) (*RecordA, error) {
return recordA, err
}

func (objMgr *ObjectManager) GetARecordByZone(zone_name string, dnsview string) (*[]RecordA, error) {
var res []RecordA
recordA := NewEmptyRecordA()

if dnsview == "" {
dnsview = "default"
}

if zone_name == "" {
return nil, fmt.Errorf("zone_name must not be empty")
}

sf := map[string]string{
"zone": zone_name,
"view": dnsview,
}
queryParams := NewQueryParams(false, sf)
err := objMgr.connector.GetObject(recordA, "", queryParams, &res)

if err != nil {
return nil, err
}

return &res, nil
}

func (objMgr *ObjectManager) DeleteARecord(ref string) (string, error) {
return objMgr.connector.DeleteObject(ref)
}