Documentation
¶
Index ¶
- Constants
- func InventoryItemsSort(items []*InventoryItem)
- type CommonEntity
- func (c *CommonEntity) GetMetaID() int64
- func (c *CommonEntity) GetMetaNetboxEntity() (out interface{}, ok bool)
- func (c *CommonEntity) GetMetaOriginalEntity() (out interface{}, ok bool)
- func (c *CommonEntity) HasNetboxEntity() bool
- func (c *CommonEntity) HasOriginalEntity() bool
- func (c *CommonEntity) SetNetboxEntity(id int64, netboxObj interface{})
- func (c *CommonEntity) SetOriginalEntity(originalObj interface{})
- type DedicatedServer
- type HashableEntity
- type Host
- type IPAddress
- type IPAddressFamily
- type IPAddressRole
- type IPAddressStatus
- type InterfaceType
- type InventoryItem
- type InventoryItemType
- type Metadata
- type NetworkInterface
- type VLAN
- type VLANStatus
- type VirtualServer
- type VirtualServerDisk
- type VirtualServerResources
Constants ¶
const ( VLANStatusUnknown = iota VLANStatusActive VLANStatusReserved VLANStatusDeprecated )
Variables ¶
This section is empty.
Functions ¶
func InventoryItemsSort ¶
func InventoryItemsSort(items []*InventoryItem)
InventoryItemsSort sorts a slice of inventory items by manufacturer, model, asset tag
Types ¶
type CommonEntity ¶
CommonEntity is a general object that should be extended by every Entity that interfaces with Netbox
func (*CommonEntity) GetMetaID ¶ added in v0.0.5
func (c *CommonEntity) GetMetaID() int64
func (*CommonEntity) GetMetaNetboxEntity ¶ added in v0.0.5
func (c *CommonEntity) GetMetaNetboxEntity() (out interface{}, ok bool)
func (*CommonEntity) GetMetaOriginalEntity ¶ added in v0.0.5
func (c *CommonEntity) GetMetaOriginalEntity() (out interface{}, ok bool)
func (*CommonEntity) HasNetboxEntity ¶ added in v0.0.5
func (c *CommonEntity) HasNetboxEntity() bool
func (*CommonEntity) HasOriginalEntity ¶ added in v0.0.5
func (c *CommonEntity) HasOriginalEntity() bool
func (*CommonEntity) SetNetboxEntity ¶ added in v0.0.5
func (c *CommonEntity) SetNetboxEntity(id int64, netboxObj interface{})
func (*CommonEntity) SetOriginalEntity ¶ added in v0.0.5
func (c *CommonEntity) SetOriginalEntity(originalObj interface{})
type DedicatedServer ¶
type DedicatedServer struct { Host AssetTag string SerialNumber string Inventory []*InventoryItem }
DedicatedServer represents a dedicated server
func NewDedicatedServer ¶ added in v0.0.2
func NewDedicatedServer() *DedicatedServer
func (DedicatedServer) Copy ¶
func (d DedicatedServer) Copy() DedicatedServer
Copy creates a deep copy of the given host
func (DedicatedServer) IsChanged ¶ added in v0.0.12
func (d DedicatedServer) IsChanged() bool
func (DedicatedServer) IsEqual ¶
func (d DedicatedServer) IsEqual(d2 DedicatedServer, deep bool) bool
IsEqual compares the current object with another VirtualServer object
type HashableEntity ¶
type HashableEntity interface {
GetHashableString() string
}
HashableEntity has a method to return a string that stays the same when the entity wasn't changed
type Host ¶
type Host struct { CommonEntity Hostname string IsManaged bool Tags []string Comments []string PrimaryIPv4 *IPAddress PrimaryIPv6 *IPAddress NetworkInterfaces []NetworkInterface }
Host represents a host
func NewHost ¶ added in v0.0.2
func NewHost() *Host
NewHost returns a new instance of an Host with Metadata initialized
func (Host) GetAllIPAddresses ¶ added in v0.0.12
GetAllIPAddresses returns all ip addresses that are assigned to any interface of this host
type IPAddress ¶
type IPAddress struct { //TODO: inherit from net.IPNet, get rid of "Type" Family IPAddressFamily Address string CIDR uint16 Status IPAddressStatus Role *IPAddressRole Tags []string Description string }
IPAddress represents an ip address
type IPAddressFamily ¶
type IPAddressFamily string
IPAddressFamily represents a type an ip-address can have
const ( //IPAddressFamilyIPv6 represents an ipv6 ip IPAddressFamilyIPv6 IPAddressFamily = "IPv6" //IPAddressFamilyIPv4 represents an ipv4 ip IPAddressFamilyIPv4 IPAddressFamily = "IPv4" )
type IPAddressRole ¶
type IPAddressRole int
const ( IPAddressRoleLoopback IPAddressRole IPAddressRoleSecondary IPAddressRoleAnycast IPAddressRoleVIP IPAddressRoleVRRP IPAddressRoleHSRP IPAddressRoleGLBP IPAddressRoleCARP )
type IPAddressStatus ¶
type IPAddressStatus int
const ( IPAddressStatusActive IPAddressStatus IPAddressStatusReserved IPAddressStatusDeprecated IPAddressStatusDHCP )
type InterfaceType ¶
type InterfaceType string
InterfaceType represents the type of an interface
const ( InterfaceTypeVirtualInterfacesVirtual InterfaceType = "virtual" InterfaceTypeVirtualInterfacesLinkAggregation InterfaceType = "lag" InterfaceTypeEthernetFixed100BaseTx100M InterfaceType = "100base-tx" InterfaceTypeEthernetFixed1000BaseT1G InterfaceType = "1000base-t" InterfaceTypeEthernetFixedGbic1G InterfaceType = "2.5gbase-t" InterfaceTypeEthernetFixedSfp1G InterfaceType = "5gbase-t" InterfaceTypeEthernetFixed10GbaseT10G InterfaceType = "10gbase-t" InterfaceTypeEthernetFixed10GbaseCx410G InterfaceType = "10gbase-cx4" InterfaceTypeEthernetModularSfpPlus10G InterfaceType = "10gbase-x-sfpp" InterfaceTypeEthernetModularXfp10G InterfaceType = "10gbase-x-xfp" InterfaceTypeEthernetModularXenpak10G InterfaceType = "10gbase-x-xenpak" InterfaceTypeEthernetModularX210G InterfaceType = "10gbase-x-x2" InterfaceTypeEthernetModularSfp2825G InterfaceType = "25gbase-x-sfp28" InterfaceTypeEthernetModularQsfpPlus40G InterfaceType = "40gbase-x-qsfpp" InterfaceTypeEthernetModularQsfp2850G InterfaceType = "50gbase-x-sfp28" InterfaceTypeEthernetModularCfp100G InterfaceType = "100gbase-x-cfp" InterfaceTypeEthernetModularCfp2100G InterfaceType = "100gbase-x-cfp2" InterfaceTypeEthernetModularCfp2200G InterfaceType = "200gbase-x-cfp2" InterfaceTypeEthernetModularCfp4100G InterfaceType = "100gbase-x-cfp4" InterfaceTypeEthernetModularCiscoCpak100G InterfaceType = "100gbase-x-cpak" InterfaceTypeEthernetModularQsfp28100G InterfaceType = "100gbase-x-qsfp28" InterfaceTypeEthernetModularQsfp56200G InterfaceType = "200gbase-x-qsfp56" InterfaceTypeEthernetModularQsfpDD400G InterfaceType = "400gbase-x-qsfpdd" InterfaceTypeEthernetModularOsfp400G InterfaceType = "400gbase-x-osfp" InterfaceTypeWirelessIEEE80211a InterfaceType = "ieee802.11a" InterfaceTypeWirelessIEEE80211bg InterfaceType = "ieee802.11g" InterfaceTypeWirelessIEEE80211n InterfaceType = "ieee802.11n" InterfaceTypeWirelessIEEE80211ac InterfaceType = "ieee802.11ac" InterfaceTypeWirelessIEEE80211ad InterfaceType = "ieee802.11ad" InterfaceTypeWirelessIEEE80211ax InterfaceType = "ieee802.11ax" InterfaceTypeCellularGsm InterfaceType = "gsm" InterfaceTypeCellularCdma InterfaceType = "cdma" InterfaceTypeCellularLte InterfaceType = "lte" InterfaceTypeSonetOc3Stm1 InterfaceType = "sonet-oc3" InterfaceTypeSonetOc12Stm4 InterfaceType = "sonet-oc12" InterfaceTypeSonetOc48Stm16 InterfaceType = "sonet-oc48" InterfaceTypeSonetOc192Stm64 InterfaceType = "sonet-oc192" InterfaceTypeSonetOc768Stm256 InterfaceType = "sonet-oc768" InterfaceTypeSonetOc1920Stm640 InterfaceType = "sonet-oc1920" InterfaceTypeSonetOc3840Stm1234 InterfaceType = "sonet-oc3840" InterfaceTypeFibreChannelSfp1G InterfaceType = "1gfc-sfp" InterfaceTypeFibreChannelSfp2G InterfaceType = "2gfc-sfp" InterfaceTypeFibreChannelSfp4G InterfaceType = "4gfc-sfp" InterfaceTypeFibreChannelSfpPlus8G InterfaceType = "8gfc-sfpp" InterfaceTypeFibreChannelSfpPlus16G InterfaceType = "16gfc-sfpp" InterfaceTypeFibreChannelSfp2832G InterfaceType = "32gfc-sfp28" InterfaceTypeFibreChannelQsfp28128G InterfaceType = "128gfc-sfp28" InterfaceTypeInifinibandSdr2G InterfaceType = "inifiband-sdr" InterfaceTypeInifinibandDdr4G InterfaceType = "inifiband-ddr" InterfaceTypeInifinibandQdr8G InterfaceType = "inifiband-qdr" InterfaceTypeInifinibandFdr1010G InterfaceType = "inifiband-fdr10" InterfaceTypeInifinibandFdr10135G InterfaceType = "inifiband-fdr" InterfaceTypeInifinibandEdr25G InterfaceType = "inifiband-edr" InterfaceTypeInifinibandHdr50G InterfaceType = "inifiband-hdr" InterfaceTypeInifinibandNdr100G InterfaceType = "inifiband-ndr" InterfaceTypeInifinibandXdr250G InterfaceType = "inifiband-xdr" InterfaceTypeSerialT115M InterfaceType = "t1" InterfaceTypeSerialE12M InterfaceType = "e1" InterfaceTypeSerialT3455M InterfaceType = "t3" InterfaceTypeSerialE334M InterfaceType = "e3" InterfaceTypeStackingCiscoStackWise InterfaceType = "cisco-stackwise" InterfaceTypeStackingCiscoStackWisePlus InterfaceType = "cisco-stackwise-plus" InterfaceTypeStackingCiscoFlexStack InterfaceType = "cisco-flexstack" InterfaceTypeStackingCiscoFlexStackPlus InterfaceType = "cisco-flexstack-plus" InterfaceTypeStackingJuniperVcp InterfaceType = "juniper-vcp" InterfaceTypeStackingExtremeSummitStack InterfaceType = "extreme-summitstack" InterfaceTypeStackingExtremeSummitStack128 InterfaceType = "extreme-summitstack-128" InterfaceTypeStackingExtremeSummitStack256 InterfaceType = "extreme-summitstack-256" InterfaceTypeStackingExtremeSummitStack512 InterfaceType = "extreme-summitstack-512" InterfaceTypeOther InterfaceType = "other" )
type InventoryItem ¶
type InventoryItem struct { CommonEntity Type InventoryItemType Manufacturer string Model string PartNumber string SerialNumber string AssetTag string Details map[string]string Tags []string }
InventoryItem represents a device / module that is attached to / built into a dedicated server
func NewInventoryItem ¶ added in v0.0.3
func NewInventoryItem() *InventoryItem
func (*InventoryItem) AddDetail ¶
func (i *InventoryItem) AddDetail(key string, val string)
func (InventoryItem) Copy ¶
func (i InventoryItem) Copy() (out InventoryItem)
func (InventoryItem) GetHashableString ¶
func (i InventoryItem) GetHashableString() string
func (InventoryItem) IsEqual ¶
func (i InventoryItem) IsEqual(i2 InventoryItem) bool
IsEqual compares an InventoryItem with another one
func (InventoryItem) String ¶
func (i InventoryItem) String() string
type InventoryItemType ¶
type InventoryItemType int
const ( InventoryItemTypeProcessor InventoryItemType InventoryItemTypeHarddrive InventoryItemTypeSolidStateDrive InventoryItemTypeGenericDrive InventoryItemTypeRAIDController InventoryItemTypeMainboard InventoryItemTypeMemoryModule InventoryItemTypeBasebandManagementController InventoryItemTypePowersupply InventoryItemTypeOther )
func InventoryItemTypeParse ¶
func InventoryItemTypeParse(s string) (out InventoryItemType, err error)
InventoryItemTypeParse returns an InventoryItemType based on the short string
func (InventoryItemType) MarshalJSON ¶
func (i InventoryItemType) MarshalJSON() ([]byte, error)
MarshalJSON implements the Marshaller interface
func (InventoryItemType) Short ¶
func (i InventoryItemType) Short() string
Short returns a short identifier for a given InventoryItemType
func (InventoryItemType) String ¶
func (i InventoryItemType) String() string
String implements the Stringer interface
type Metadata ¶
type Metadata struct { ID int64 OriginalEntity interface{} NetboxEntity interface{} }
Meta contain information that are relevant to communicate with Netbox
type NetworkInterface ¶
type NetworkInterface struct { CommonEntity Type InterfaceType Enabled bool IPAddresses []IPAddress IsManagement bool MACAddress net.HardwareAddr Name string TaggedVlans []VLAN UntaggedVlan *VLAN Tags []string Children []NetworkInterface }
NetworkInterface represents a network interface assigned to a host
func NewNetworkInterface ¶ added in v0.0.2
func NewNetworkInterface() *NetworkInterface
func (NetworkInterface) IsEqual ¶
func (netIf NetworkInterface) IsEqual(netIf2 NetworkInterface) bool
IsEqual compares the current NetworkInterface object against another NetworkInterface
type VLAN ¶
type VLAN struct { ID uint16 Name string Status VLANStatus Description string Tags []string }
type VLANStatus ¶
type VLANStatus int
type VirtualServer ¶
type VirtualServer struct { Host Hypervisor string Resources VirtualServerResources }
VirtualServer represents a virtual server
func NewVirtualServer ¶ added in v0.0.2
func NewVirtualServer() *VirtualServer
NewVirtualServer returns a new instance of VirtualServer
func (VirtualServer) Copy ¶
func (vm VirtualServer) Copy() (out VirtualServer)
Copy creates a deep copy of a VirtualServer object
func (VirtualServer) IsChanged ¶
func (vm VirtualServer) IsChanged() bool
IsChanged compares the current object against the original object
func (VirtualServer) IsEqual ¶
func (vm VirtualServer) IsEqual(vm2 VirtualServer, deep bool) bool
IsEqual compares the current object with another VirtualServer object
type VirtualServerDisk ¶
type VirtualServerDisk struct {
Size int64
}
VirtualServerDisk represents a disk of a virtual server
func (VirtualServerDisk) IsEqual ¶
func (d VirtualServerDisk) IsEqual(d2 VirtualServerDisk) bool
IsEqual compares the current object against another VirtualServerDisk object
type VirtualServerResources ¶
type VirtualServerResources struct { Cores int Memory int64 Disks []VirtualServerDisk }
VirtualServerResources represents the number of cores, memory and disks assigned to a VirtualServer object