-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.go
37 lines (29 loc) · 878 Bytes
/
client.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package infoblox
import ibclient "github.com/infobloxopen/infoblox-go-client/v2"
func (p *Provider) getConnector() (*ibclient.Connector, error) {
hostConfig := ibclient.HostConfig{
Scheme: "https",
Host: p.Host,
Version: p.Version,
Port: "443",
}
authConfig := ibclient.AuthConfig{
Username: p.Username,
Password: p.Password,
}
transportConfig := ibclient.NewTransportConfig("false", 20, 10)
requestBuilder := &ibclient.WapiRequestBuilder{}
requestor := &ibclient.WapiHttpRequestor{}
conn, err := ibclient.NewConnector(hostConfig, authConfig, transportConfig, requestBuilder, requestor)
if err != nil {
return nil, err
}
return conn, nil
}
func (p *Provider) getObjectManager() (ibclient.IBObjectManager, error) {
conn, err := p.getConnector()
if err != nil {
return nil, err
}
return ibclient.NewObjectManager(conn, "", ""), nil
}