netbox-community / go-netbox

The official Go API client for Netbox IPAM and DCIM service.
Other
194 stars 144 forks source link

Create tags with go-netbox and netbox 2.9 #101

Closed smutel closed 3 years ago

smutel commented 3 years ago

Hello,

Is-it possible to create a tag using go-netbox in netbox 2.9 ? Since netbox 2.9, tags are implemented differently in go-netbox (NestedTags). I didn't found any writable_tag.go ...

Thanks.

erikkn commented 3 years ago

Hey Smutel! Checkout this issue right here: https://github.com/netbox-community/go-netbox/issues/99

smutel commented 3 years ago

Hello Erik,

In this example, it's explained how to associate an existing tag to a resource. What about creating the tag from scratch ?

Thanks.

erikkn commented 3 years ago

What do you mean by creating a tag from scratch? When you say from scratch I start thinking about the extras package.

smutel commented 3 years ago

I mean like in the web interface Organization => Tags. Yes you are right it's the extras package then tags to manage tags through the API. But in the go-netbox library do we have something to add/remove tags ?

erikkn commented 3 years ago

Right, so when you say 'create tags from scratch' you mean how one would create tags through the 'Organization -> Tags' tab.

I do this by using the extras package, specifically, the ExtrasTagsCreate method -> https://godoc.org/github.com/netbox-community/go-netbox/netbox/client/extras#Client.ExtrasTagsCreate

smutel commented 3 years ago

Thanks for this info.