How to work with go-netbox client
Hi, i want to send data to netbox using go-netbox client.
client := netbox.NewNetboxWithAPIKey("netbox.example.org", "<api-token>")
ipaddress := "192.168.0.100"
ipAddress := &models.IPAddress{
Address: &ipaddress,
Description: "Example IP Address",
}
createdIPAddress, err := client.Ipam.IpamIPAddressesCreate(ipAddress, ?)
What i need to pass to authInfo ?
You can just pass
nilto it.When the client is created with an API key, this API key will be used to issue requests. So it's OK to pass
nilto the func. See the source code where a defaultruntime.ClientAuthInfoWriteris created.If the client is created without feeding the API key and you need to provide a
runtime.ClientAuthInfoWriterto a func, you can create one like this:References:
Authenticating to the API:
github.com/go-openapi/runtime/client: see the list of funcs that return a
runtime.ClientAuthInfoWriter.