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 ( import (
"crypto/tls" "crypto/tls"
"encoding/json" "encoding/json"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"net/url" "net/url"
"time" "time"
"github.com/gorilla/schema" "github.com/gorilla/schema"
@ -37,7 +35,13 @@ type SecretsList struct {
Name string `json:"name"` Name string `json:"name"`
Plaintext string `json:"plaintext"` Plaintext string `json:"plaintext"`
Hash string `json:"hash"` 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 { CustomFields struct {
} `json:"custom_fields"` } `json:"custom_fields"`
Created string `json:"created"` Created string `json:"created"`
@ -50,7 +54,7 @@ type SecretFilter struct {
Offset int64 `schema:"offset,omitempty"` Offset int64 `schema:"offset,omitempty"`
Limit int64 `schema:"limit,omitempty"` Limit int64 `schema:"limit,omitempty"`
//User specific filters // User specific filters
Name string `schema:"name,omitempty"` Name string `schema:"name,omitempty"`
Role string `schema:"role,omitempty"` Role string `schema:"role,omitempty"`
RoleID string `schema:"role_id,omitempty"` RoleID string `schema:"role_id,omitempty"`
@ -64,7 +68,7 @@ type SecretFilter struct {
// ListSecrets returns Netbox Secrets // ListSecrets returns Netbox Secrets
func (n *NetBox) ListSecrets(i *SecretsList, f *SecretFilter) error { func (n *NetBox) ListSecrets(i *SecretsList, f *SecretFilter) error {
var encoder = schema.NewEncoder() encoder := schema.NewEncoder()
form := url.Values{} form := url.Values{}
err := encoder.Encode(f, form) err := encoder.Encode(f, form)