Comments (1)
Hi @gavmckee80,
As of now, we do not support update_if_exists flag during creation for any of the objects in Go-client. We will consider this as a feature enhancement and try to implement the same before our next release. Workaround for the same would be to Get an object and check if the returned value is nil. If the returned object is nil, then the code would proceed with creation else an update function can be called.
For example, to handle the creation or updation of a network 10.200.0.0/16,
package main
import (
"fmt"
ibclient "github.com/infobloxopen/infoblox-go-client"
)
func main() {
hostConfig := ibclient.HostConfig{
Host: "XXXXXXXX",
Version: "2.2",
Port: "443",
Username: "XXXXXX",
Password: "XXXXXXX",
}
transportConfig := ibclient.NewTransportConfig("false", 20, 10)
requestBuilder := &ibclient.WapiRequestBuilder{}
requestor := &ibclient.WapiHttpRequestor{}
conn, err := ibclient.NewConnector(hostConfig, transportConfig, requestBuilder, requestor)
if err != nil {
fmt.Println(err)
}
defer conn.Logout()
objMgr := ibclient.NewObjectManager(conn, "", "")
setEas := ibclient.EA{"Location" : "Test loc.", "Site" : "Test site"}
getNet, err := objMgr.GetNetwork("netViewName", "10.200.0.0/16", false, nil)
if getNet != nil {
updateNet, err := objMgr.UpdateNetwork(getNet.Ref, setEas, "updated comment")
if err != nil {
fmt.Println(err)
}
fmt.Println(updateNet)
} else {
createNet, err := objMgr.CreateNetwork("netViewName", "10.200.0.0/16", false, "comment", setEas)
if err != nil{
fmt.Println(err)
}
fmt.Println(createNet)
}
}
from infoblox-go-client.
Related Issues (20)
- Vlan support
- `develop` branch can be removed
- Use option structs instead of arguments HOT 1
- support grid api
- does this client support batch requests? HOT 1
- Add GitHub Action as a CI/CD tool for pull requests
- Kind request for a release HOT 4
- Make SearchHostRecordByAltId method more generic
- Fake client for unit testing or more exported fields HOT 1
- Search All capabilities? HOT 1
- v2 introduced long timeout when fetching A record HOT 1
- Add useful fields for Authoritative Zone resource
- Which func to use to get all networks/cidr? HOT 2
- searching for records using regex HOT 12
- which API is used to find associated network view for a given dns_view? HOT 3
- Add RecordNS support to the go client
- problem on tls: unsupported protocol version 301' HOT 1
- extra parameters when creating record using nextavailableip function
- Apply DHCP option to network
- [feature request] hability to configure basepath of wapi call
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from infoblox-go-client.