Linting and add custom fields

This commit is contained in:
Kalle Carlbark 2020-11-20 09:53:19 +01:00
parent 6e2b8836b2
commit 1f2c63c568
No known key found for this signature in database
GPG key ID: 5E4BAB01A57CDD62
2 changed files with 50 additions and 2 deletions

View file

@ -46,6 +46,9 @@ type TenancyTenantsList struct {
Comments string `json:"comments"`
Tags []interface{} `json:"tags"`
CustomFields struct {
AccountNumber string `json:"account_number"`
AtlasCustNumber interface{} `json:"atlas_cust_number"`
TextField interface{} `json:"text_field"`
} `json:"custom_fields"`
Created string `json:"created"`
LastUpdated time.Time `json:"last_updated"`
@ -66,7 +69,7 @@ type TenantFilter struct {
Offset int64 `schema:"offset,omitempty"`
Limit int64 `schema:"limit,omitempty"`
//User specific filters
// User specific filters
Name string `schema:"name,omitempty"`
Slug string `schema:"slug,omitempty"`
Group string `schema:"group,omitempty"`
@ -78,7 +81,7 @@ type TenantFilter struct {
// ListTenants returns Netbox tenancy_tenants_list
func (n *NetBox) ListTenants(i *TenancyTenantsList, f *TenantFilter) error {
var encoder = schema.NewEncoder()
encoder := schema.NewEncoder()
form := url.Values{}
err := encoder.Encode(f, form)

View file

@ -81,6 +81,51 @@ type IpamVLANsList struct {
} `json:"results"`
}
type VLAN struct {
ID int `json:"id"`
Site struct {
ID int `json:"id"`
URL string `json:"url"`
Name string `json:"name"`
Slug string `json:"slug"`
} `json:"site"`
Group struct {
ID int `json:"id"`
URL string `json:"url"`
Name string `json:"name"`
Slug string `json:"slug"`
VLANCount int `json:"vlan_count"`
} `json:"group"`
Vid int `json:"vid"`
Name string `json:"name"`
Tenant struct {
ID int `json:"id"`
URL string `json:"url"`
Name string `json:"name"`
Slug string `json:"slug"`
} `json:"tenant"`
Status struct {
Label string `json:"label"`
Value int `json:"value"`
} `json:"status"`
Role struct {
ID int `json:"id"`
URL string `json:"url"`
Name string `json:"name"`
Slug string `json:"slug"`
PrefixCount int `json:"prefix_count"`
VLANCount int `json:"vlan_count"`
} `json:"role"`
Description string `json:"description"`
Tags []string `json:"tags"`
DisplayName string `json:"display_name"`
CustomFields struct {
} `json:"custom_fields"`
Created string `json:"created"`
LastUpdated time.Time `json:"last_updated"`
PrefixCount int `json:"prefix_count"`
}
// VLANFilter is used to filter out returned object from Netbox API ipam_vlans_list
type VLANFilter struct {
Offset int64 `schema:"offset,omitempty"`