diff --git a/object_manager_dnsview.go b/object_manager_dnsview.go new file mode 100644 index 00000000..b50611ae --- /dev/null +++ b/object_manager_dnsview.go @@ -0,0 +1,20 @@ +package ibclient + +import "fmt" + +func (objMgr *ObjectManager) GetDNSView(name string) (*DNSView, error) { + var res []DNSView + if name == "" { + return nil, fmt.Errorf( + "DNS view's name is required to retreive DNS view object") + } + queryParams := NewQueryParams(false, map[string]string{"name": name}) + err := objMgr.connector.GetObject(NewEmptyDNSView(), "", queryParams, &res) + if err != nil { + return nil, err + } else if res == nil || len(res) == 0 { + return nil, NewNotFoundError(fmt.Sprintf("DNS view with name '%s' not found", name)) + } + + return &res[0], nil +}