I have a collection of network objects in my Infoblox (IPAM) server and would like to allocate an IP address from one of them based on a search into their extattr fields.
Each network object has an extended attribute named CITYCODE, and many networks have the same value for that code. I want to allocate an IP address from any of those networks.
How can I use the next_available_ip function to create a record:host object, where the IPV4ADDR is determined by the next_available_ip function?
Answering my own question because it took some poking with other example code I found to get one that worked exactly right for me.
First you need a JSON body that specifies the fully qualified name of the new record:host. For my purposes I'm just generating random values. Note, that the domain must already exist (likely as a zone:auth object).
If the domain does not already exist you'll get the error: "The action is not allowed. A parent was not found."
Instead of specifying an actual ipv4addr, instead specify the target object and the function you will run against it. Since we want to run the next_available_ip function, the object is network.
The search we want to do is against an extensible attribute, so the _object_parameters are set to say "find networks that have an extensible attribute called -CITYCODE- with value -MZAPPKAK-. The asterisk is important and must be kept.
The result code should be 201, and the result body will be a REF to the record:host that was created. Do a standard GET on the returned REF to learn what IP was found and placed on the record.