From 066a3e5251d86ad643139f0f53bf1708595c19ba Mon Sep 17 00:00:00 2001 From: Kalle Carlbark Date: Tue, 10 Sep 2019 22:05:25 +0200 Subject: [PATCH] first commit --- README.md | 0 netbox_interfaces.go | 76 ++++++++++++++++++++++++++++++++++++++++++++ netboxclient.go | 25 +++++++++++++++ 3 files changed, 101 insertions(+) create mode 100644 README.md create mode 100644 netbox_interfaces.go create mode 100644 netboxclient.go diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/netbox_interfaces.go b/netbox_interfaces.go new file mode 100644 index 0000000..96e1454 --- /dev/null +++ b/netbox_interfaces.go @@ -0,0 +1,76 @@ +package main + +type dcim_interfaces_create struct { + Device int `json:"device"` + Name string `json:"name"` + Type int `json:"type"` + Enabled bool `json:"enabled"` + Lag int `json:"lag"` + Mtu int `json:"mtu"` + MacAddress string `json:"mac_address"` + MgmtOnly bool `json:"mgmt_only"` + Description string `json:"description"` + ConnectionStatus bool `json:"connection_status"` + Cable struct { + Label string `json:"label"` + } `json:"cable"` + Mode int `json:"mode"` + UntaggedVlan int `json:"untagged_vlan"` + TaggedVlans []int `json:"tagged_vlans"` + Tags []string `json:"tags"` +} + +type dcim_interfaces_list struct { + Count int `json:"count"` + Next interface{} `json:"next"` + Previous interface{} `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"` + Name string `json:"name"` + Type struct { + Value int `json:"value"` + Label string `json:"label"` + } `json:"type"` + FormFactor struct { + Value int `json:"value"` + Label string `json:"label"` + } `json:"form_factor"` + Enabled bool `json:"enabled"` + Lag struct { + ID int `json:"id"` + URL string `json:"url"` + Device struct { + ID int `json:"id"` + URL string `json:"url"` + Name string `json:"name"` + DisplayName string `json:"display_name"` + } `json:"device"` + Name string `json:"name"` + Cable interface{} `json:"cable"` + ConnectionStatus interface{} `json:"connection_status"` + } `json:"lag"` + Mtu interface{} `json:"mtu"` + MacAddress interface{} `json:"mac_address"` + MgmtOnly bool `json:"mgmt_only"` + Description string `json:"description"` + ConnectedEndpointType interface{} `json:"connected_endpoint_type"` + ConnectedEndpoint interface{} `json:"connected_endpoint"` + ConnectionStatus interface{} `json:"connection_status"` + Cable interface{} `json:"cable"` + Mode interface{} `json:"mode"` + UntaggedVlan interface{} `json:"untagged_vlan"` + TaggedVlans []interface{} `json:"tagged_vlans"` + Tags []interface{} `json:"tags"` + CountIpaddresses int `json:"count_ipaddresses"` + } `json:"results"` +} + +func (i *NbInterfaces) CreateInterface() { + + diff --git a/netboxclient.go b/netboxclient.go new file mode 100644 index 0000000..56c28c4 --- /dev/null +++ b/netboxclient.go @@ -0,0 +1,25 @@ +package main + +import ( + "fmt" + "net/http" + "net/url" + "io/ioutil" +) + +type DeviceInterface struct { + Id int `json:"id"` + Device int `json:"device"` + Name string `json:"name"` + Type int `json:"type"` + FormFactor string `json:"form_factor"` + Enabled bool `json:"enabled"` + Lag int `json:"lag"` + Mtu int `json:"mtu"` + MacAddress string `json:"mac_address"` + +func main() { + +} + +func (i * InterfacesCreate