Skip to content

Commit

Permalink
adding DNS view object (read-only so far)
Browse files Browse the repository at this point in the history
  • Loading branch information
skudriavtsev committed Nov 9, 2022
1 parent 9289399 commit e9b608a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions object_manager_dnsview.go
Original file line number Diff line number Diff line change
@@ -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
}

0 comments on commit e9b608a

Please sign in to comment.