From 6e2b8836b29b593eb1231f839501619ddabeb3bb Mon Sep 17 00:00:00 2001 From: Kalle Carlbark Date: Thu, 15 Oct 2020 13:23:05 +0200 Subject: [PATCH] Update to work with netbox > 2.9.0. Take 3. --- netbox_secrets.go | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/netbox_secrets.go b/netbox_secrets.go index 2d5808e..5f974b8 100644 --- a/netbox_secrets.go +++ b/netbox_secrets.go @@ -3,11 +3,9 @@ package netboxgo import ( "crypto/tls" "encoding/json" - "io/ioutil" "net/http" "net/url" - "time" "github.com/gorilla/schema" @@ -34,10 +32,16 @@ type SecretsList struct { Slug string `json:"slug"` SecretCount int `json:"secret_count"` } `json:"role"` - Name string `json:"name"` - Plaintext string `json:"plaintext"` - Hash string `json:"hash"` - Tags []string `json:"tags"` + Name string `json:"name"` + Plaintext string `json:"plaintext"` + Hash string `json:"hash"` + Tags []struct { + ID int `json:"id"` + URL string `json:"url"` + Name string `json:"name"` + Slug string `json:"slug"` + Color string `json:"color"` + } `json:"tags"` CustomFields struct { } `json:"custom_fields"` Created string `json:"created"` @@ -50,7 +54,7 @@ type SecretFilter struct { Offset int64 `schema:"offset,omitempty"` Limit int64 `schema:"limit,omitempty"` - //User specific filters + // User specific filters Name string `schema:"name,omitempty"` Role string `schema:"role,omitempty"` RoleID string `schema:"role_id,omitempty"` @@ -64,7 +68,7 @@ type SecretFilter struct { // ListSecrets returns Netbox Secrets func (n *NetBox) ListSecrets(i *SecretsList, f *SecretFilter) error { - var encoder = schema.NewEncoder() + encoder := schema.NewEncoder() form := url.Values{} err := encoder.Encode(f, form)