Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
Golang Infoblox API
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2019 09:46 AM
2958     0
Hi,
I'm a newbie to infoblox and trying to use the official (?!) go library "github.com/infobloxopen/infoblox-go-client"
to interact with infoblox WAPI.
Are there any examples of creating/fetching Infoblox objects (eg. record host etc).
I am trying things like below:
transportConfig := ibclient.NewTransportConfig("false", 20, 10) requestBuilder := &ibclient.WapiRequestBuilder{} requestor := &ibclient.WapiHttpRequestor{} conn, err := ibclient.NewConnector(hostConfig, transportConfig, requestBuilder, requestor) if err != nil { fmt.Printf("ibclient.NewConnector(): %s", err) } defer conn.Logout() objMgr := ibclient.NewObjectManager(conn, "myclient", "") ibNtw, err := objMgr.CreateNetwork("", "10.10.0.0/16", "") if err != nil { fmt.Println(err) } fmt.Println(ibNtw.Ref)
And I get error like so:
2019/06/19 17:38:08 WAPI request error: 400('400 Bad Request') Contents: { "Error": "AdmConProtoError: Unknown extensible attribute: Cloud API Owned", "code": "Client.Ibap.Proto", "text": "Unknown extensible attribute: Cloud API Owned" }
OR even trying to get a host record:
transportConfig := ibclient.NewTransportConfig("false", 20, 10) requestBuilder := &ibclient.WapiRequestBuilder{} requestor := &ibclient.WapiHttpRequestor{} conn, err := ibclient.NewConnector(hostConfig, transportConfig, requestBuilder, requestor) if err != nil { fmt.Printf("ibclient.NewConnector(): %s", err) } defer conn.Logout() objMgr := ibclient.NewObjectManager(conn, "myclient", "") hostRec, err := objMgr.GetHostRecord("record:host/ZG5zLmhvc3QkLl9kZWZhdWx0LmNvbS56b25lLmhvc3Q:host.zone.com/default") if err != nil { fmt.Printf("objMgr.GetHostRecord(): %s", err) } fmt.Printf("Record Name: %s", hostRec.Name)
I get the following error:
2019/06/19 17:44:37 Cannot unmarshall to check empty value '{ "_ref": "record:host/ZG5zLmhvc3QkLl9kZWZhdWx0LmNvbS56b25lLmhvc3Q:host.zone.com/default", "extattrs": {}, "ipv4addrs": [ { "_ref": "record:host_ipv4addr/ZG5zLmhvc3RfYWRkcmVzcyQuX2RlZmF1bHQuY29tLnpvbmUuaG9zdC4xMC4yMjIuMC4xMi4:10.222.0.12/host.zone.com/default", "configure_for_dhcp": false, "host": "host.zone.com", "ipv4addr": "10.222.0.12" } ], "name": "host.zone.com", "view": "default", "zone": "zone.com" }', err: 'json: cannot unmarshal object into Go value of type []map[string]interface {}' Record Name: host.zone.com%