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"` Comments string `json:"comments"`
Tags []interface{} `json:"tags"` Tags []interface{} `json:"tags"`
CustomFields struct { CustomFields struct {
AccountNumber string `json:"account_number"`
AtlasCustNumber interface{} `json:"atlas_cust_number"`
TextField interface{} `json:"text_field"`
} `json:"custom_fields"` } `json:"custom_fields"`
Created string `json:"created"` Created string `json:"created"`
LastUpdated time.Time `json:"last_updated"` LastUpdated time.Time `json:"last_updated"`
@ -78,7 +81,7 @@ type TenantFilter struct {
// ListTenants returns Netbox tenancy_tenants_list // ListTenants returns Netbox tenancy_tenants_list
func (n *NetBox) ListTenants(i *TenancyTenantsList, f *TenantFilter) error { func (n *NetBox) ListTenants(i *TenancyTenantsList, f *TenantFilter) error {
var encoder = schema.NewEncoder() encoder := schema.NewEncoder()
form := url.Values{} form := url.Values{}
err := encoder.Encode(f, form) err := encoder.Encode(f, form)

View file

@ -81,6 +81,51 @@ type IpamVLANsList struct {
} `json:"results"` } `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 // VLANFilter is used to filter out returned object from Netbox API ipam_vlans_list
type VLANFilter struct { type VLANFilter struct {
Offset int64 `schema:"offset,omitempty"` Offset int64 `schema:"offset,omitempty"`