From 42a0bb87e12ca9c87e9940c64369ccbab227f4d5 Mon Sep 17 00:00:00 2001 From: Kalle Carlbark Date: Sun, 9 Feb 2020 22:59:14 +0100 Subject: [PATCH] Fix listprefixes struct. --- netbox_prefixes.go | 60 +++++++++++++++++++++++++++++++++------------- 1 file changed, 43 insertions(+), 17 deletions(-) diff --git a/netbox_prefixes.go b/netbox_prefixes.go index 398bb3c..377bd0e 100644 --- a/netbox_prefixes.go +++ b/netbox_prefixes.go @@ -33,32 +33,58 @@ type IpamPrefixesCreate struct { // IpamPrefixList is used for the return value from NetBox API ipam_prefixes_list type IpamPrefixesList struct { - Count int `json:"count"` - Next string `json:"next"` - Previous interface{} `json:"previous"` + Count int `json:"count"` + Next string `json:"next"` + Previous string `json:"previous"` Results []struct { ID int `json:"id"` Family struct { - Value int `json:"value"` Label string `json:"label"` + Value int `json:"value"` } `json:"family"` - Prefix string `json:"prefix"` - Site interface{} `json:"site"` - Vrf interface{} `json:"vrf"` - Tenant interface{} `json:"tenant"` - Vlan interface{} `json:"vlan"` + Prefix string `json:"prefix"` + Site struct { + ID int `json:"id"` + URL string `json:"url"` + Name string `json:"name"` + Slug string `json:"slug"` + } `json:"site"` + Vrf struct { + ID int `json:"id"` + URL string `json:"url"` + Name string `json:"name"` + Rd string `json:"rd"` + PrefixCount int `json:"prefix_count"` + } `json:"vrf"` + Tenant struct { + ID int `json:"id"` + URL string `json:"url"` + Name string `json:"name"` + Slug string `json:"slug"` + } `json:"tenant"` + Vlan struct { + ID int `json:"id"` + URL string `json:"url"` + Vid int `json:"vid"` + Name string `json:"name"` + DisplayName string `json:"display_name"` + } `json:"vlan"` Status struct { - Value int `json:"value"` Label string `json:"label"` + Value int `json:"value"` } `json:"status"` - Role interface{} `json:"role"` - IsPool bool `json:"is_pool"` - Description string `json:"description"` - Tags []interface{} `json:"tags"` + 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"` + IsPool bool `json:"is_pool"` + Description string `json:"description"` + Tags []string `json:"tags"` CustomFields struct { - IpamPrefixRouted interface{} `json:"ipam_prefix_routed"` - IpamPrefixRoutedLastUpdate interface{} `json:"ipam_prefix_routed_last_update"` - IpamPrefixExitpoint interface{} `json:"ipam_prefix_exitpoint"` } `json:"custom_fields"` Created string `json:"created"` LastUpdated time.Time `json:"last_updated"`