Skip to content

Commit

Permalink
DNS Support for go-client (#74)
Browse files Browse the repository at this point in the history
* Added support for CNAME,A and PTR Records.Enabled to crete Host Record
with DNS.Added UT's
Running Suite: InfobloxGoClient Suite
=====================================
Random Seed: 1546495859
Will run 130 of 130 specs

••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
Ran 130 of 130 Specs in 0.003 seconds
SUCCESS! -- 130 Passed | 0 Failed | 0 Pending | 0 Skipped
PASS
ok      github.com/infobloxopen/infoblox-go-client      0.024s

* Fixed the review comments

* adding vendor and changing travis.yaml
  • Loading branch information
saiprasannasastry authored and yuewko committed Jan 29, 2019
1 parent 61dc5f9 commit 7247dee
Show file tree
Hide file tree
Showing 685 changed files with 563,699 additions and 28 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
vendor
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,10 @@ go:
- 1.7.x
- 1.8
- 1.9

env:
- GO111MODULE=on

install: true

script: go test -v ./...
183 changes: 183 additions & 0 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 19 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
[[constraint]]
name = "github.com/onsi/ginkgo"
version = "1.7.0"

[[constraint]]
name = "github.com/onsi/gomega"
version = "1.4.3"

[[constraint]]
name = "github.com/sirupsen/logrus"
version = "1.3.0"

[[constraint]]
branch = "master"
name = "golang.org/x/net"

[prune]
go-tests = true
unused-packages = true
9 changes: 5 additions & 4 deletions connector.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"net/http/cookiejar"
"net/url"
"strings"
"reflect"
"time"

"golang.org/x/net/publicsuffix"
)

Expand Down Expand Up @@ -283,12 +283,14 @@ func (c *Connector) GetObject(obj IBObject, ref string, res interface{}) (err er
queryParams := QueryParams{forceProxy: false}
resp, err := c.makeRequest(GET, obj, ref, queryParams)
//to check empty underlying value of interface
var result []map[string]interface{}
var result interface{}
err = json.Unmarshal(resp, &result)
if err != nil {
log.Printf("Cannot unmarshall to check empty value '%s', err: '%s'\n", string(resp), err)
}
if resp == nil || len(result) == 0 {

var data []interface{}
if resp == nil || (reflect.TypeOf(result) == reflect.TypeOf(data) && len(result.([]interface{})) == 0) {
queryParams.forceProxy = true
resp, err = c.makeRequest(GET, obj, ref, queryParams)
}
Expand All @@ -299,7 +301,6 @@ func (c *Connector) GetObject(obj IBObject, ref string, res interface{}) (err er
return
}
err = json.Unmarshal(resp, res)

if err != nil {
log.Printf("Cannot unmarshall '%s', err: '%s'\n", string(resp), err)
return
Expand Down
Loading

0 comments on commit 7247dee

Please sign in to comment.