netbox

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 25, 2023 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bool

func Bool(b *bool) bool

func Int64

func Int64(i *int64) int64

func String

func String(s *string) string

Types

type Device

type Device struct {
	CustomFields       map[string]interface{}
	DeviceRole         string          // DeviceRole.Name
	DeviceType         string          // DeviceType.Model
	DeviceManufacturer string          // DeviceType.Manufacturer.Name
	Display            string          // Display
	ID                 int64           // ID
	Location           string          // Location.Name
	Name               string          // Name
	ParentDeviceID     int64           // ParentDevice.ID
	Platform           string          // Platform.Name
	PrimaryIP          netip.Prefix    // PrimaryIP.Address
	PrimaryIP4         netip.Prefix    // PrimaryIP4.Address
	PrimaryIP6         netip.Prefix    // PrimaryIP6.Address
	Tags               map[string]bool // Tags.Name -> true
}

Extracted from netbox/models/device's Device, but reduced to basic Go types to make it easier to work with the subset that I care about.

func GetDevice

func GetDevice(c *client.NetBoxAPI, id int64) (*Device, error)

type Devices

type Devices []*Device

func ListDevices

func ListDevices(c *client.NetBoxAPI) (Devices, error)

type IPAddr

type IPAddr struct {
	CustomFields       map[string]interface{}
	Address            netip.Prefix
	AssignedObjectID   int64
	AssignedObjectType string
	Description        string
	Display            string
	DNSName            string
	Family             string
	ID                 int64
	Role               string
	Status             string
	Tags               map[string]bool // Tags.Name -> true
	VRF                string
}

Extracted from netbox/models/device's Device, but reduced to basic Go types to make it easier to work with the subset that I care about.

func GetIPAddr

func GetIPAddr(c *client.NetBoxAPI, id int64) (*IPAddr, error)

type IPAddrs

type IPAddrs []*IPAddr

func ListIPAddrs

func ListIPAddrs(c *client.NetBoxAPI) (IPAddrs, error)

func (IPAddrs) ForInterfaceID

func (ips IPAddrs) ForInterfaceID(id int64) IPAddrs

type IPPrefix

type IPPrefix struct {
	ID          int64
	Prefix      netip.Prefix
	Display     string
	Family      string
	Status      string
	Description string
	Tags        map[string]bool // Tags.Name -> true
	VRF         string
}

func GetIPPrefix

func GetIPPrefix(c *client.NetBoxAPI, id int64) (*IPPrefix, error)

type IPPrefixes

type IPPrefixes []*IPPrefix

func ListIPPrefixes

func ListIPPrefixes(c *client.NetBoxAPI) (IPPrefixes, error)

type Interface

type Interface struct {
	CableID                     int64
	CableDisplay                string
	CableLabel                  string
	CableEnd                    string
	ConnectedEndpoints          []string
	ConnectedEndpointsReachable bool // why is it a bool when ConnectedEndpoints is a list?
	CustomFields                map[string]interface{}
	Description                 string
	DeviceID                    int64
	Display                     string
	Enabled                     bool
	ID                          int64
	Label                       string
	LAGName                     string // lag.name
	LinkPeers                   []string
	LinkPeersType               string
	MACAddress                  string
	MarkConnected               bool
	MgmtOnly                    bool
	MTU                         int64
	Name                        string
	ParentID                    int64
	ParentName                  string
	PoeMode                     string // poe_mode.value
	PoeType                     string // poe_type.value
	Speed                       int64
	TaggedVLANNames             []string
	TaggedVLANIDs               []int64
	TaggedVLANVIDs              []int64
	Tags                        map[string]bool // Tags.Name -> true
	Type                        string          // type.value
	UntaggedVLANName            string
	UntaggedVLANID              int64
	UntaggedVLANVID             int64
	VRF                         string   // presumably?  Not currently using.
	WirelessLANs                []string // wireless_lans.ssid

}

Extracted from netbox/models/device's Interface, but reduced to basic Go types to make it easier to work with the subset that I care about.

func GetInterface

func GetInterface(c *client.NetBoxAPI, id int64) (*Interface, error)

type Interfaces

type Interfaces []*Interface

func ListInterfaces

func ListInterfaces(c *client.NetBoxAPI) (Interfaces, error)

func (Interfaces) ForDeviceID

func (ints Interfaces) ForDeviceID(id int64) Interfaces

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL