Migrate to use secrets store plugin

Move secrets related code to plugin_secrets_store
While here, mute gosecs false positive for G101 on
secretsPath
This commit is contained in:
Kalle Carlbark 2022-01-31 16:38:37 +01:00
parent 92eacc150c
commit 2bca52c094
No known key found for this signature in database
6 changed files with 381 additions and 381 deletions

View file

@ -14,200 +14,196 @@ type DevicesService service
// Devices is used for Netbox dcim_device_list return struct // Devices is used for Netbox dcim_device_list return struct
type Devices struct { type Devices struct {
Count int `json:"count"`
Next string `json:"next"` Next string `json:"next"`
Previous string `json:"previous"` Previous string `json:"previous"`
Results []Device `json:"results"` Results []Device `json:"results"`
Count int `json:"count"`
} }
type Device struct { type Device struct {
ID int `json:"id"` LastUpdated time.Time `json:"last_updated"`
Name string `json:"name"` CustomFields interface{} `json:"custom_fields,omitempty"`
DisplayName string `json:"display_name"` ConfigContext interface{} `json:"config_context"`
DeviceType struct {
ID int `json:"id"`
URL string `json:"url"`
Manufacturer struct {
ID int `json:"id"`
URL string `json:"url"`
Name string `json:"name"`
Slug string `json:"slug"`
DevicetypeCount int `json:"devicetype_count"`
} `json:"manufacturer"`
Model string `json:"model"`
Slug string `json:"slug"`
DisplayName string `json:"display_name"`
DeviceCount int `json:"device_count"`
} `json:"device_type"`
DeviceRole struct {
ID int `json:"id"`
URL string `json:"url"`
Name string `json:"name"`
Slug string `json:"slug"`
DeviceCount int `json:"device_count"`
VirtualmachineCount int `json:"virtualmachine_count"`
} `json:"device_role"`
Tenant struct {
ID int `json:"id"`
URL string `json:"url"`
Name string `json:"name"`
Slug string `json:"slug"`
} `json:"tenant"`
Platform struct {
ID int `json:"id"`
URL string `json:"url"`
Name string `json:"name"`
Slug string `json:"slug"`
DeviceCount int `json:"device_count"`
VirtualmachineCount int `json:"virtualmachine_count"`
} `json:"platform"`
Serial string `json:"serial"`
AssetTag string `json:"asset_tag"`
Site struct {
ID int `json:"id"`
URL string `json:"url"`
Name string `json:"name"`
Slug string `json:"slug"`
} `json:"site"`
Rack struct {
ID int `json:"id"`
URL string `json:"url"`
Name string `json:"name"`
DisplayName string `json:"display_name"`
DeviceCount int `json:"device_count"`
} `json:"rack"`
Position int `json:"position"`
Face struct {
Label string `json:"label"`
Value string `json:"value"`
} `json:"face"`
ParentDevice struct {
ID int `json:"id"`
URL string `json:"url"`
Name string `json:"name"`
DisplayName string `json:"display_name"`
} `json:"parent_device"`
Status struct { Status struct {
Label string `json:"label"` Label string `json:"label"`
Value string `json:"value"` Value string `json:"value"`
} `json:"status"` } `json:"status"`
PrimaryIP struct { Face struct {
ID int `json:"id"` Label string `json:"label"`
URL string `json:"url"` Value string `json:"value"`
Family int `json:"family"` } `json:"face"`
Address string `json:"address"`
} `json:"primary_ip"`
PrimaryIP4 struct {
ID int `json:"id"`
URL string `json:"url"`
Family int `json:"family"`
Address string `json:"address"`
} `json:"primary_ip4"`
PrimaryIP6 struct {
ID int `json:"id"`
URL string `json:"url"`
Family int `json:"family"`
Address string `json:"address"`
} `json:"primary_ip6"`
Cluster struct {
ID int `json:"id"`
URL string `json:"url"`
Name string `json:"name"` Name string `json:"name"`
VirtualmachineCount int `json:"virtualmachine_count"` AssetTag string `json:"asset_tag"`
} `json:"cluster"` Comments string `json:"comments"`
VirtualChassis struct { DisplayName string `json:"display_name"`
ID int `json:"id"` Created string `json:"created"`
URL string `json:"url"` Serial string `json:"serial"`
Master struct { ParentDevice struct {
ID int `json:"id"`
URL string `json:"url"` URL string `json:"url"`
Name string `json:"name"` Name string `json:"name"`
DisplayName string `json:"display_name"` DisplayName string `json:"display_name"`
} `json:"master"`
MemberCount int `json:"member_count"`
} `json:"virtual_chassis"`
VcPosition int `json:"vc_position"`
VcPriority int `json:"vc_priority"`
Comments string `json:"comments"`
// LocalContextData string `json:"local_context_data"`
Tags []struct {
ID int `json:"id"` ID int `json:"id"`
} `json:"parent_device"`
Tenant struct {
URL string `json:"url"`
Name string `json:"name"`
Slug string `json:"slug"`
ID int `json:"id"`
} `json:"tenant"`
Site struct {
URL string `json:"url"`
Name string `json:"name"`
Slug string `json:"slug"`
ID int `json:"id"`
} `json:"site"`
Tags []struct {
URL string `json:"url"` URL string `json:"url"`
Name string `json:"name"` Name string `json:"name"`
Slug string `json:"slug"` Slug string `json:"slug"`
Color string `json:"color"` Color string `json:"color"`
ID int `json:"id"`
} `json:"tags"` } `json:"tags"`
CustomFields interface{} `json:"custom_fields,omitempty"` Rack struct {
ConfigContext interface{} `json:"config_context"` URL string `json:"url"`
Created string `json:"created"` Name string `json:"name"`
LastUpdated time.Time `json:"last_updated"` DisplayName string `json:"display_name"`
ID int `json:"id"`
DeviceCount int `json:"device_count"`
} `json:"rack"`
PrimaryIP4 struct {
URL string `json:"url"`
Address string `json:"address"`
ID int `json:"id"`
Family int `json:"family"`
} `json:"primary_ip4"`
PrimaryIP struct {
URL string `json:"url"`
Address string `json:"address"`
ID int `json:"id"`
Family int `json:"family"`
} `json:"primary_ip"`
Cluster struct {
URL string `json:"url"`
Name string `json:"name"`
ID int `json:"id"`
VirtualmachineCount int `json:"virtualmachine_count"`
} `json:"cluster"`
PrimaryIP6 struct {
URL string `json:"url"`
Address string `json:"address"`
ID int `json:"id"`
Family int `json:"family"`
} `json:"primary_ip6"`
VirtualChassis struct {
URL string `json:"url"`
Master struct {
URL string `json:"url"`
Name string `json:"name"`
DisplayName string `json:"display_name"`
ID int `json:"id"`
} `json:"master"`
ID int `json:"id"`
MemberCount int `json:"member_count"`
} `json:"virtual_chassis"`
DeviceRole struct {
URL string `json:"url"`
Name string `json:"name"`
Slug string `json:"slug"`
ID int `json:"id"`
DeviceCount int `json:"device_count"`
VirtualmachineCount int `json:"virtualmachine_count"`
} `json:"device_role"`
Platform struct {
URL string `json:"url"`
Name string `json:"name"`
Slug string `json:"slug"`
ID int `json:"id"`
DeviceCount int `json:"device_count"`
VirtualmachineCount int `json:"virtualmachine_count"`
} `json:"platform"`
DeviceType struct {
URL string `json:"url"`
Model string `json:"model"`
Slug string `json:"slug"`
DisplayName string `json:"display_name"`
Manufacturer struct {
URL string `json:"url"`
Name string `json:"name"`
Slug string `json:"slug"`
ID int `json:"id"`
DevicetypeCount int `json:"devicetype_count"`
} `json:"manufacturer"`
ID int `json:"id"`
DeviceCount int `json:"device_count"`
} `json:"device_type"`
Position int `json:"position"`
VcPriority int `json:"vc_priority"`
VcPosition int `json:"vc_position"`
ID int `json:"id"`
} }
type NewDevice struct { type NewDevice struct {
Name string `json:"name,omitempty"` CustomFields interface{} `json:"custom_fields,omitempty"`
DeviceType int `json:"device_type,omitempty"` Face string `json:"face,omitempty"`
DeviceRole int `json:"device_role,omitempty"` LocalContextData string `json:"local_context_data,omitempty"`
Tenant int `json:"tenant,omitempty"` Comments string `json:"comments,omitempty"`
Platform int `json:"platform,omitempty"` Status string `json:"status,omitempty"`
Serial string `json:"serial,omitempty"` Serial string `json:"serial,omitempty"`
AssetTag string `json:"asset_tag,omitempty"` AssetTag string `json:"asset_tag,omitempty"`
Site int `json:"site,omitempty"`
Rack int `json:"rack,omitempty"`
Position int `json:"position,omitempty"`
Face string `json:"face,omitempty"`
ParentDevice struct { ParentDevice struct {
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
} `json:"parent_device,omitempty"` } `json:"parent_device,omitempty"`
Status string `json:"status,omitempty"` Name string `json:"name,omitempty"`
PrimaryIP4 int `json:"primary_ip4,omitempty"`
PrimaryIP6 int `json:"primary_ip6,omitempty"`
Cluster int `json:"cluster,omitempty"`
VirtualChassis int `json:"virtual_chassis,omitempty"`
VcPosition int `json:"vc_position,omitempty"`
VcPriority int `json:"vc_priority,omitempty"`
Comments string `json:"comments,omitempty"`
LocalContextData string `json:"local_context_data,omitempty"`
Tags []struct { Tags []struct {
Name string `json:"name"` Name string `json:"name"`
Slug string `json:"slug"` Slug string `json:"slug"`
Color string `json:"color"` Color string `json:"color"`
} `json:"tags"` } `json:"tags"`
CustomFields interface{} `json:"custom_fields,omitempty"` Cluster int `json:"cluster,omitempty"`
Platform int `json:"platform,omitempty"`
Tenant int `json:"tenant,omitempty"`
PrimaryIP4 int `json:"primary_ip4,omitempty"`
PrimaryIP6 int `json:"primary_ip6,omitempty"`
Site int `json:"site,omitempty"`
VirtualChassis int `json:"virtual_chassis,omitempty"`
VcPosition int `json:"vc_position,omitempty"`
VcPriority int `json:"vc_priority,omitempty"`
DeviceRole int `json:"device_role,omitempty"`
DeviceType int `json:"device_type,omitempty"`
Position int `json:"position,omitempty"`
Rack int `json:"rack,omitempty"`
} }
type UpdateDevice struct { type UpdateDevice struct {
Name string `json:"name,omitempty"` CustomFields interface{} `json:"custom_fields,omitempty"`
DeviceType int `json:"device_type,omitempty"`
DeviceRole int `json:"device_role,omitempty"`
Tenant int `json:"tenant,omitempty"`
Platform int `json:"platform,omitempty"`
Serial string `json:"serial,omitempty"`
AssetTag string `json:"asset_tag,omitempty"`
Site int `json:"site,omitempty"`
Rack int `json:"rack,omitempty"`
Position int `json:"position,omitempty"`
Face string `json:"face,omitempty"`
ParentDevice *struct { ParentDevice *struct {
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
} `json:"parent_device,omitempty"` } `json:"parent_device,omitempty"`
Face string `json:"face,omitempty"`
LocalContextData string `json:"local_context_data,omitempty"`
Comments string `json:"comments,omitempty"`
Serial string `json:"serial,omitempty"`
AssetTag string `json:"asset_tag,omitempty"`
Status string `json:"status,omitempty"` Status string `json:"status,omitempty"`
Name string `json:"name,omitempty"`
Tags []string `json:"tags,omitempty"`
Position int `json:"position,omitempty"`
DeviceType int `json:"device_type,omitempty"`
Site int `json:"site,omitempty"`
PrimaryIP4 int `json:"primary_ip4,omitempty"` PrimaryIP4 int `json:"primary_ip4,omitempty"`
PrimaryIP6 int `json:"primary_ip6,omitempty"` PrimaryIP6 int `json:"primary_ip6,omitempty"`
Cluster int `json:"cluster,omitempty"` Cluster int `json:"cluster,omitempty"`
VirtualChassis int `json:"virtual_chassis,omitempty"` VirtualChassis int `json:"virtual_chassis,omitempty"`
VcPosition int `json:"vc_position,omitempty"` VcPosition int `json:"vc_position,omitempty"`
VcPriority int `json:"vc_priority,omitempty"` VcPriority int `json:"vc_priority,omitempty"`
Comments string `json:"comments,omitempty"` Platform int `json:"platform,omitempty"`
LocalContextData string `json:"local_context_data,omitempty"` Tenant int `json:"tenant,omitempty"`
Tags []string `json:"tags,omitempty"` Rack int `json:"rack,omitempty"`
CustomFields interface{} `json:"custom_fields,omitempty"` DeviceRole int `json:"device_role,omitempty"`
} }
// DeviceFilter is used to filter dcim_device_list query to the Netbox API // DeviceFilter is used to filter dcim_device_list query to the Netbox API
type DeviceFilter struct { type DeviceFilter struct {
Offset int64 `schema:"offset,omitempty"`
Limit int64 `schema:"limit,omitempty"`
// User specific filters // User specific filters
ID string `schema:"id,omitempty"` ID string `schema:"id,omitempty"`
Name string `schema:"name,omitempty"` Name string `schema:"name,omitempty"`
@ -249,6 +245,9 @@ type DeviceFilter struct {
Interfaces string `schema:"interfaces,omitempty"` Interfaces string `schema:"interfaces,omitempty"`
PassThroughPorts string `schema:"pass_through_ports,omitempty"` PassThroughPorts string `schema:"pass_through_ports,omitempty"`
Tag string `schema:"tag,omitempty"` Tag string `schema:"tag,omitempty"`
Offset int `schema:"offset,omitempty"`
Limit int `schema:"limit,omitempty"`
} }
const devicesPath = dcimPath + "/devices" const devicesPath = dcimPath + "/devices"

View file

@ -10,10 +10,7 @@ import (
"log" "log"
"net/http" "net/http"
"net/url" "net/url"
"strings"
"time" "time"
"github.com/pkg/errors"
) )
// Client struct is used to create a new NetBox endpoint // Client struct is used to create a new NetBox endpoint
@ -162,43 +159,6 @@ func (c *Client) SetToken(token string) {
c.Token = token c.Token = token
} }
// FetchSessionKey fetches sessionkey
func (c *Client) FetchSessionKey(privatekey string) error {
form := url.Values{}
form.Add("private_key", privatekey)
query := form.Encode()
ctx := context.Background()
req, err := http.NewRequestWithContext(ctx, "POST", c.baseURL.String()+secretsPath+"/get-session-key/", strings.NewReader(query))
if err != nil {
return err
}
req.Header.Add("Accept", "application/json")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
if c.FetchMode != "" {
req.Header.Add("js.fetch:mode", "no-cors")
}
req.Header.Add("Authorization", " Token "+c.Token)
var sessionkey NetBoxSessionKey
res, err := c.do(req, &sessionkey)
if err != nil {
return err
}
if res.StatusCode != http.StatusOK {
return errors.Errorf("response was: %d should be %d\n%s\n", res.StatusCode, http.StatusOK, res.Header)
}
c.SessionKey = sessionkey.XSessionKey
return nil
}
// newRequest is used to make new request to endpoints // newRequest is used to make new request to endpoints
func (c *Client) newRequest(ctx context.Context, method, path string, query string, body interface{}) (*http.Request, error) { func (c *Client) newRequest(ctx context.Context, method, path string, query string, body interface{}) (*http.Request, error) {
var err error var err error

139
plugin_secrets_store.go Normal file
View file

@ -0,0 +1,139 @@
package netboxgo
import (
"context"
"fmt"
"net/http"
"net/url"
"strings"
"time"
"github.com/gorilla/schema"
"github.com/pkg/errors"
)
type SecretsService service
// Secrets contains secrets
type Secrets struct {
Next interface{} `json:"next"`
Previous interface{} `json:"previous"`
Results []struct {
CustomFields struct{} `json:"custom_fields"`
LastUpdated time.Time `json:"last_updated"`
Role struct {
URL string `json:"url"`
Display string `json:"display"`
Name string `json:"name"`
Slug string `json:"slug"`
ID int `json:"id"`
} `json:"role"`
AssignedObject struct {
URL string `json:"url"`
Display string `json:"display"`
Name string `json:"name"`
ID int `json:"id"`
} `json:"assigned_object"`
Name string `json:"name"`
Created string `json:"created"`
AssignedObjectType string `json:"assigned_object_type"`
Display string `json:"display"`
Plaintext string `json:"plaintext"`
Hash string `json:"hash"`
URL string `json:"url"`
Tags []interface{} `json:"tags"`
AssignedObjectID int `json:"assigned_object_id"`
ID int `json:"id"`
} `json:"results"`
Count int `json:"count"`
}
// SecretFilter is used to filter out secrets
type SecretFilter struct {
Offset int64 `schema:"offset,omitempty"`
Limit int64 `schema:"limit,omitempty"`
// User specific filters
Name string `schema:"name,omitempty"`
Role string `schema:"role,omitempty"`
RoleID string `schema:"role_id,omitempty"`
DeviceID string `schema:"device_id,omitempty"`
TypeID string `schema:"type_id,omitempty"`
Device string `schema:"device,omitempty"`
IDIn string `schema:"id__in,omitempty"`
Q string `schema:"q,omitempty"`
Tag string `schema:"tag,omitempty"`
}
// #nosec CWE-798 - gosec mute false positive
const secretsPath = "/plugins/netbox_secretstore"
// List secrets. SecretsFilter is used to list based on filter queries.
func (s *SecretsService) List(ctx context.Context, f *SecretFilter) (*Secrets, error) {
var secrets Secrets
var query string
var req *http.Request
var err error
if s.client.SessionKey == "" {
return &secrets, fmt.Errorf("session key needed when interacting with secrets. no session key found: you need to fetch a session key with FetchSessionKey()")
}
encoder := schema.NewEncoder()
form := url.Values{}
err = encoder.Encode(f, form)
if err != nil {
return &secrets, err
}
query = form.Encode()
req, err = s.client.newRequest(ctx, "GET", secretsPath+"/secrets", query, nil)
if err != nil {
return &secrets, err
}
_, err = s.client.do(req, &secrets)
if err != nil {
return &secrets, err
}
return &secrets, nil
}
// FetchSessionKey fetches sessionkey
func (s *SecretsService) FetchSessionKey(privatekey string) error {
form := url.Values{}
form.Add("private_key", privatekey)
query := form.Encode()
ctx := context.Background()
req, err := http.NewRequestWithContext(ctx, "POST", s.client.baseURL.String()+secretsPath+"/get-session-key/", strings.NewReader(query))
if err != nil {
return err
}
req.Header.Add("Accept", "application/json")
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
if s.client.FetchMode != "" {
req.Header.Add("js.fetch:mode", "no-cors")
}
req.Header.Add("Authorization", " Token "+s.client.Token)
var sessionkey NetBoxSessionKey
res, err := s.client.do(req, &sessionkey)
if err != nil {
return err
}
if res.StatusCode != http.StatusOK {
return errors.Errorf("response was: %d should be %d\n%s\n", res.StatusCode, http.StatusOK, res.Header)
}
s.client.SessionKey = sessionkey.XSessionKey
return nil
}

View file

@ -29,11 +29,8 @@ type NewPrefix struct {
IsPool bool `json:"is_pool"` IsPool bool `json:"is_pool"`
} }
// Prefixes is used for the return value from NetBox API ipam_prefixes_list // Prefix is a prefix
type Prefixes struct { type Prefix struct {
Next string `json:"next"`
Previous string `json:"previous"`
Results []struct {
LastUpdated time.Time `json:"last_updated"` LastUpdated time.Time `json:"last_updated"`
CustomFields interface{} `json:"custom_fields"` CustomFields interface{} `json:"custom_fields"`
VLAN struct { VLAN struct {
@ -41,7 +38,7 @@ type Prefixes struct {
Name string `json:"name"` Name string `json:"name"`
DisplayName string `json:"display_name"` DisplayName string `json:"display_name"`
ID int `json:"id"` ID int `json:"id"`
Vid int `json:"vid"` VID int `json:"vid"`
} `json:"vlan"` } `json:"vlan"`
Tenant struct { Tenant struct {
URL string `json:"url"` URL string `json:"url"`
@ -62,7 +59,7 @@ type Prefixes struct {
Prefix string `json:"prefix"` Prefix string `json:"prefix"`
Description string `json:"description"` Description string `json:"description"`
Created string `json:"created"` Created string `json:"created"`
Vrf struct { VRF struct {
URL string `json:"url"` URL string `json:"url"`
Name string `json:"name"` Name string `json:"name"`
Rd string `json:"rd"` Rd string `json:"rd"`
@ -90,7 +87,13 @@ type Prefixes struct {
} `json:"role"` } `json:"role"`
ID int `json:"id"` ID int `json:"id"`
IsPool bool `json:"is_pool"` IsPool bool `json:"is_pool"`
} `json:"results"` }
// Prefixes is used for the return value from NetBox API ipam_prefixes_list
type Prefixes struct {
Next string `json:"next"`
Previous string `json:"previous"`
Results []Prefix `json:"results"`
Count int `json:"count"` Count int `json:"count"`
} }

View file

@ -1,101 +0,0 @@
package netboxgo
import (
"context"
"fmt"
"net/http"
"net/url"
"time"
"github.com/gorilla/schema"
)
type SecretsService service
// Secrets contains secrets
type Secrets struct {
Count int `json:"count"`
Next string `json:"next"`
Previous string `json:"previous"`
Results []struct {
ID int `json:"id"`
Device struct {
ID int `json:"id"`
URL string `json:"url"`
Name string `json:"name"`
DisplayName string `json:"display_name"`
} `json:"device"`
Role struct {
ID int `json:"id"`
URL string `json:"url"`
Name string `json:"name"`
Slug string `json:"slug"`
SecretCount int `json:"secret_count"`
} `json:"role"`
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 interface{} `json:"custom_fields"`
Created string `json:"created"`
LastUpdated time.Time `json:"last_updated"`
} `json:"results"`
}
// SecretFilter is used to filter out secrets
type SecretFilter struct {
Offset int64 `schema:"offset,omitempty"`
Limit int64 `schema:"limit,omitempty"`
// User specific filters
Name string `schema:"name,omitempty"`
Role string `schema:"role,omitempty"`
RoleID string `schema:"role_id,omitempty"`
DeviceID string `schema:"device_id,omitempty"`
TypeID string `schema:"type_id,omitempty"`
Device string `schema:"device,omitempty"`
IDIn string `schema:"id__in,omitempty"`
Q string `schema:"q,omitempty"`
Tag string `schema:"tag,omitempty"`
}
const secretsPath = "/secrets"
// List secrets. SecretsFilter is used to list based on filter queries.
func (s *SecretsService) List(ctx context.Context, f *SecretFilter) (*Secrets, error) {
var secrets Secrets
var query string
var req *http.Request
var err error
if s.client.SessionKey == "" {
return &secrets, fmt.Errorf("session key needed when interacting with secrets. no session key found: you need to fetch a session key with FetchSessionKey()")
}
encoder := schema.NewEncoder()
form := url.Values{}
err = encoder.Encode(f, form)
if err != nil {
return &secrets, err
}
query = form.Encode()
req, err = s.client.newRequest(ctx, "GET", secretsPath+"/secrets", query, nil)
if err != nil {
return &secrets, err
}
_, err = s.client.do(req, &secrets)
if err != nil {
return &secrets, err
}
return &secrets, nil
}

View file

@ -26,28 +26,28 @@ type NewTenant struct {
// Tenant represents a tenant // Tenant represents a tenant
type Tenant struct { type Tenant struct {
LastUpdated time.Time `json:"last_updated"` LastUpdated time.Time `json:"last_updated"`
CustomFields interface{} `json:"custom_fields"` CustomFields map[string]interface{} `json:"custom_fields"`
VirtualmachineCount interface{} `json:"virtualmachine_count"` Created string `json:"created"`
RackCount interface{} `json:"rack_count"` Name string `json:"name"`
IpaddressCount interface{} `json:"ipaddress_count"` Slug string `json:"slug"`
CircuitCount interface{} `json:"circuit_count"` Description string `json:"description"`
VrfCount interface{} `json:"vrf_count"` Comments string `json:"comments"`
Group struct { Group struct {
URL string `json:"url"` URL string `json:"url"`
Name string `json:"name"` Name string `json:"name"`
Slug string `json:"slug"` Slug string `json:"slug"`
ID int `json:"id"` ID int `json:"id"`
} `json:"group"` } `json:"group"`
Created string `json:"created"`
Comments string `json:"comments"`
Description string `json:"description"`
Slug string `json:"slug"`
Name string `json:"name"`
Tags []interface{} `json:"tags"` Tags []interface{} `json:"tags"`
VRFCount int `json:"vrf_count"`
CircuitCount int `json:"circuit_count"`
IPAddressCount int `json:"ipaddress_count"`
VirtualmachineCount int `json:"virtualmachine_count"`
RackCount int `json:"rack_count"`
DeviceCount int `json:"device_count"` DeviceCount int `json:"device_count"`
PrefixCount int `json:"prefix_count"` PrefixCount int `json:"prefix_count"`
SiteCount int `json:"site_count"` SiteCount int `json:"site_count"`
VlanCount int `json:"vlan_count"` VLANCount int `json:"vlan_count"`
ID int `json:"id"` ID int `json:"id"`
} }