-
Notifications
You must be signed in to change notification settings - Fork 179
Description
Hi,
I maintain a fork of the old (openapi 2) go-netbox at https://github.com/fbreckle/go-netbox. I specifically, and exclusively, use that library to support my terraform provider at https://github.com/e-breuninger/terraform-provider-netbox.
Since I am not really a fan of backporting the (painfully frequent) breaking api changes to my go-netbox fork, I plan to eventually migrate back to this official client.
As I planned to look at the 4.2 changes today, I figured I might as well check how a migration to this client could work by implementing the netbox_site terraform resource. Specifically, a site has a foreign-key relation to region, meaning I usually pass a region ID to go-netbox when creating the site. The region ID is an int64.
How does this work in this new client? The DcimSitesCreate function gets its values from a WritableSiteRequest. What I do not understand is how I am supposed to fill out the WritableSiteRequest object. In our example, region, it needs a NullableBriefRegionRequest. But that in turn is made from a name and slug, not by an ID.
I looked around the models and it seems this is not an issue specific to the Site object.
Basically, what I am asking is:
Can anyone provide a code example for the following workflow?
- Create region, save ID
- Create site where the region is set to the previously created region by ID