Update NewInterface

To match Netbox version
This commit is contained in:
Kalle Carlbark 2022-02-14 11:21:57 +01:00
parent 236a9bb23e
commit 2bd3658b60
No known key found for this signature in database

View file

@ -16,23 +16,39 @@ type InterfacesService service
// NewInterface is used for creating a new interface
type NewInterface struct {
MacAddress string `json:"mac_address,omitempty"`
Name string `json:"name"`
Cable struct {
Label string `json:"label,omitempty"`
} `json:"cable,omitempty"`
Description string `json:"description,omitempty"`
TaggedVLANs []int `json:"tagged_vlans,omitempty"`
Tags []string `json:"tags,omitempty"`
Device int `json:"device"`
Mtu int `json:"mtu,omitempty"`
Lag int `json:"lag,omitempty"`
UntaggedVLAN int `json:"untagged_vlan,omitempty"`
Type int `json:"type,omitempty"`
Mode int `json:"mode,omitempty"`
ConnectionStatus bool `json:"connection_status,omitempty"`
Enabled bool `json:"enabled,omitempty"`
MgmtOnly bool `json:"mgmt_only,omitempty"`
CustomFields interface{} `json:"custom_fields"`
WWN string `json:"wwn"`
Label string `json:"label"`
Type string `json:"type"`
Cable struct {
Label string `json:"label"`
} `json:"cable"`
RFChannel string `json:"rf_channel"`
RFRole string `json:"rf_role"`
Name string `json:"name"`
Description string `json:"description"`
MACAddress string `json:"mac_address"`
Mode string `json:"mode"`
TaggedVLANs []int `json:"tagged_vlans"`
WirelessLANs []int `json:"wireless_lans"`
Tags []struct {
Name string `json:"name"`
Slug string `json:"slug"`
Color string `json:"color"`
} `json:"tags"`
Device int `json:"device"`
Parent int `json:"parent"`
RFChannelFrequency int `json:"rf_channel_frequency"`
RFChannelWidth int `json:"rf_channel_width"`
TXPower int `json:"tx_power"`
UntaggedVLAN int `json:"untagged_vlan"`
Bridge int `json:"bridge"`
LAG int `json:"lag"`
MTU int `json:"mtu"`
WirelessLink int `json:"wireless_link"`
Enabled bool `json:"enabled"`
MarkConnected bool `json:"mark_connected"`
MGMTOnly bool `json:"mgmt_only"`
}
// Interfaces is a list of interfaces
@ -45,136 +61,136 @@ type Interfaces struct {
// Interface is one interface
type Interface struct {
ID int `json:"id"`
URL string `json:"url"`
Display string `json:"display"`
Device struct {
ID int `json:"id"`
CustomFields struct{} `json:"custom_fields"`
LastUpdated time.Time `json:"last_updated"`
LinkPeer interface{} `json:"link_peer"`
ConnectedEndpoint interface{} `json:"connected_endpoint"`
Parent struct {
Occupied string `json:"_occupied"`
URL string `json:"url"`
Display string `json:"display"`
Name string `json:"name"`
Device struct {
URL string `json:"url"`
Display string `json:"display"`
Name string `json:"name"`
ID int `json:"id"`
} `json:"device"`
Cable int `json:"cable"`
ID int `json:"id"`
} `json:"parent"`
Device struct {
URL string `json:"url"`
Display string `json:"display"`
Name string `json:"name"`
ID int `json:"id"`
} `json:"device"`
Name string `json:"name"`
Label string `json:"label"`
Type struct {
Label string `json:"label"`
Value string `json:"value"`
} `json:"type"`
Enabled bool `json:"enabled"`
Parent struct {
ID int `json:"id"`
URL string `json:"url"`
Display string `json:"display"`
Device struct {
ID int `json:"id"`
URL string `json:"url"`
Display string `json:"display"`
Name string `json:"name"`
} `json:"device"`
Name string `json:"name"`
Cable int `json:"cable"`
Occupied string `json:"_occupied"`
} `json:"parent"`
Bridge struct {
ID int `json:"id"`
URL string `json:"url"`
Display string `json:"display"`
Device struct {
ID int `json:"id"`
URL string `json:"url"`
Display string `json:"display"`
Name string `json:"name"`
} `json:"device"`
Name string `json:"name"`
Cable int `json:"cable"`
Occupied string `json:"_occupied"`
} `json:"bridge"`
Lag struct {
ID int `json:"id"`
URL string `json:"url"`
Display string `json:"display"`
Device struct {
ID int `json:"id"`
URL string `json:"url"`
Display string `json:"display"`
Name string `json:"name"`
} `json:"device"`
Name string `json:"name"`
Cable int `json:"cable"`
Occupied string `json:"_occupied"`
} `json:"lag"`
Mtu int `json:"mtu"`
MacAddress string `json:"mac_address"`
Wwn string `json:"wwn"`
MgmtOnly bool `json:"mgmt_only"`
Description string `json:"description"`
Mode struct {
Label string `json:"label"`
Value string `json:"value"`
} `json:"mode"`
RFRole struct {
Label string `json:"label"`
Value string `json:"value"`
} `json:"rf_role"`
RFChannel struct {
Label string `json:"label"`
Value string `json:"value"`
} `json:"rf_channel"`
RFChannelFrequency int `json:"rf_channel_frequency"`
RFChannelWidth int `json:"rf_channel_width"`
TXPower int `json:"tx_power"`
UntaggedVlan struct {
ID int `json:"id"`
URL string `json:"url"`
Display string `json:"display"`
Vid int `json:"vid"`
Name string `json:"name"`
} `json:"untagged_vlan"`
TaggedVlans []struct {
ID int `json:"id"`
URL string `json:"url"`
Display string `json:"display"`
Vid int `json:"vid"`
Name string `json:"name"`
} `json:"tagged_vlans"`
MarkConnected bool `json:"mark_connected"`
Cable struct {
ID int `json:"id"`
RFRole struct {
Label string `json:"label"`
Value string `json:"value"`
} `json:"rf_role"`
Type struct {
Label string `json:"label"`
Value string `json:"value"`
} `json:"type"`
Mode struct {
Label string `json:"label"`
Value string `json:"value"`
} `json:"mode"`
Display string `json:"display"`
LinkPeerType string `json:"link_peer_type"`
MACAddress string `json:"mac_address"`
WWN string `json:"wwn"`
URL string `json:"url"`
Description string `json:"description"`
ConnectedEndpointType string `json:"connected_endpoint_type"`
Label string `json:"label"`
Name string `json:"name"`
Created string `json:"created"`
Cable struct {
URL string `json:"url"`
Display string `json:"display"`
Label string `json:"label"`
ID int `json:"id"`
} `json:"cable"`
WirelessLink struct {
ID int `json:"id"`
URL string `json:"url"`
Display string `json:"display"`
Ssid string `json:"ssid"`
ID int `json:"id"`
} `json:"wireless_link"`
LinkPeer interface{} `json:"link_peer"`
LinkPeerType string `json:"link_peer_type"`
WirelessLans []struct {
ID int `json:"id"`
WirelessLANs []struct {
URL string `json:"url"`
Display string `json:"display"`
Ssid string `json:"ssid"`
} `json:"wireless_lans"`
ConnectedEndpoint interface{} `json:"connected_endpoint"`
ConnectedEndpointType string `json:"connected_endpoint_type"`
ConnectedEndpointReachable bool `json:"connected_endpoint_reachable"`
Tags []struct {
ID int `json:"id"`
} `json:"wireless_lans"`
TaggedVLANs []struct {
URL string `json:"url"`
Display string `json:"display"`
Name string `json:"name"`
ID int `json:"id"`
Vid int `json:"vid"`
} `json:"tagged_vlans"`
Tags []struct {
URL string `json:"url"`
Display string `json:"display"`
Name string `json:"name"`
Slug string `json:"slug"`
Color string `json:"color"`
ID int `json:"id"`
} `json:"tags"`
CustomFields struct{} `json:"custom_fields"`
Created string `json:"created"`
LastUpdated time.Time `json:"last_updated"`
CountIpaddresses int `json:"count_ipaddresses"`
CountFhrpGroups int `json:"count_fhrp_groups"`
Occupied bool `json:"_occupied"`
UntaggedVLAN struct {
URL string `json:"url"`
Display string `json:"display"`
Name string `json:"name"`
ID int `json:"id"`
Vid int `json:"vid"`
} `json:"untagged_vlan"`
LAG struct {
Occupied string `json:"_occupied"`
URL string `json:"url"`
Display string `json:"display"`
Name string `json:"name"`
Device struct {
URL string `json:"url"`
Display string `json:"display"`
Name string `json:"name"`
ID int `json:"id"`
} `json:"device"`
Cable int `json:"cable"`
ID int `json:"id"`
} `json:"lag"`
Bridge struct {
Occupied string `json:"_occupied"`
URL string `json:"url"`
Display string `json:"display"`
Name string `json:"name"`
Device struct {
URL string `json:"url"`
Display string `json:"display"`
Name string `json:"name"`
ID int `json:"id"`
} `json:"device"`
Cable int `json:"cable"`
ID int `json:"id"`
} `json:"bridge"`
CountIPAddresses int `json:"count_ipaddresses"`
MTU int `json:"mtu"`
TXPower int `json:"tx_power"`
CountFHRPGroups int `json:"count_fhrp_groups"`
RFChannelFrequency int `json:"rf_channel_frequency"`
ID int `json:"id"`
RFChannelWidth int `json:"rf_channel_width"`
ConnectedEndpointReachable bool `json:"connected_endpoint_reachable"`
MarkConnected bool `json:"mark_connected"`
MGMTOnly bool `json:"mgmt_only"`
Enabled bool `json:"enabled"`
Occupied bool `json:"_occupied"`
}
// InterfaceFilter is used to filter out returned object from Netbox API dcim_interfaces_list