Update to work with netbox > 2.9.0. Take 3.

This commit is contained in:
Kalle Carlbark 2020-10-15 13:23:05 +02:00
parent d84b5df6dd
commit 6e2b8836b2
No known key found for this signature in database
GPG key ID: 5E4BAB01A57CDD62

View file

@ -3,11 +3,9 @@ package netboxgo
import (
"crypto/tls"
"encoding/json"
"io/ioutil"
"net/http"
"net/url"
"time"
"github.com/gorilla/schema"
@ -37,7 +35,13 @@ type SecretsList struct {
Name string `json:"name"`
Plaintext string `json:"plaintext"`
Hash string `json:"hash"`
Tags []string `json:"tags"`
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)