forked from infobloxopen/infoblox-go-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adding DNS view object (read-only so far)
- Loading branch information
1 parent
9289399
commit e9b608a
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
} |