objects

package
v1.11.6 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

This file contains all objects that are common to all Netbox objects.

Index

Constants

View Source
const (
	DisplayWeightDefault = 100
	SearchWeightDefault  = 1000
)
View Source
const (
	AdminContactRoleName = "Admin"
)

Default role name for admins of vms.

View Source
const (
	MaxDescriptionLength = 200
)

Variables

View Source
var (
	SiteStatusActive          = SiteStatus{Choice{Value: "active", Label: "Active"}}
	SiteStatusOffline         = SiteStatus{Choice{Value: "offline", Label: "Offline"}}
	SiteStatusPlanned         = SiteStatus{Choice{Value: "planned", Label: "Planned"}}
	SiteStatusStaged          = SiteStatus{Choice{Value: "staged", Label: "Staged"}}
	SiteStatusFailed          = SiteStatus{Choice{Value: "failed", Label: "Failed"}}
	SiteStatusInventory       = SiteStatus{Choice{Value: "inventory", Label: "Inventory"}}
	SiteStatusDecommissioning = SiteStatus{
		Choice{Value: "decommissioning", Label: "Decommissioning"},
	}
)
View Source
var (
	FrontToRear = DeviceAirFlowType{Choice{Value: "front-to-rear", Label: "Front to rear"}}
	RearToFront = DeviceAirFlowType{Choice{Value: "rear-to-front", Label: "Rear to front"}}
	LeftToRight = DeviceAirFlowType{Choice{Value: "left-to-right", Label: "Left to right"}}
	RightToLeft = DeviceAirFlowType{Choice{Value: "right-to-left", Label: "Right to left"}}
	SideToRear  = DeviceAirFlowType{Choice{Value: "side-to-rear", Label: "Side to rear"}}
	Passive     = DeviceAirFlowType{Choice{Value: "passive", Label: "Passive"}}
	Mixed       = DeviceAirFlowType{Choice{Value: "mixed", Label: "Mixed"}}
)
View Source
var (
	DeviceStatusOffline         = DeviceStatus{Choice{Value: "offline", Label: "Offline"}}
	DeviceStatusActive          = DeviceStatus{Choice{Value: "active", Label: "Active"}}
	DeviceStatusPlanned         = DeviceStatus{Choice{Value: "planned", Label: "Planned"}}
	DeviceStatusStaged          = DeviceStatus{Choice{Value: "staged", Label: "Staged"}}
	DeviceStatusFailed          = DeviceStatus{Choice{Value: "failed", Label: "Failed"}}
	DeviceStatusInventory       = DeviceStatus{Choice{Value: "inventory", Label: "Inventory"}}
	DeviceStatusDecommissioning = DeviceStatus{
		Choice{Value: "decommissioning", Label: "Decommissioning"},
	}
)
View Source
var (
	// Netbox's Virtual interface types.
	VirtualInterfaceType = InterfaceType{Choice{Value: "virtual", Label: "Virtual"}}
	BridgeInterfaceType  = InterfaceType{Choice{Value: "bridge", Label: "Bridge"}}
	LAGInterfaceType     = InterfaceType{
		Choice{Value: "lag", Label: "Link Aggregation Group (LAG)"},
	}

	// Netbox's Ethernet (Fixed) interface types.
	BASEFXInterfaceType = InterfaceType{
		Choice{Value: "100base-fx", Label: "100BASE-FX (10/100ME FIBER)"},
	}
	BASELFXInterfaceType = InterfaceType{
		Choice{Value: "100base-lfx", Label: "100BASE-LFX (10/100ME FIBER)"},
	}
	BASETXInterfaceType = InterfaceType{
		Choice{Value: "100base-tx", Label: "100BASE-TX (10/100ME)"},
	}
	BASET1InterfaceType = InterfaceType{
		Choice{Value: "100base-t1", Label: "100BASE-T1 (10/100ME Single Pair)"},
	}
	GE1FixedInterfaceType = InterfaceType{
		Choice{Value: "1000base-t", Label: "1000BASE-T (1GE)"},
	}
	GE1GBICInterfaceType  = InterfaceType{Choice{Value: "1000base-x-gbic", Label: "GBIC (1GE)"}}
	GE1SFPInterfaceType   = InterfaceType{Choice{Value: "1000base-x-sfp", Label: "SFP (1GE)"}}
	GE2FixedInterfaceType = InterfaceType{
		Choice{Value: "2.5gbase-t", Label: "2.5GBASE-T (2.5GE)"},
	}
	GE5FixedInterfaceType  = InterfaceType{Choice{Value: "5gbase-t", Label: "5GBASE-T (5GE)"}}
	GE10FixedInterfaceType = InterfaceType{Choice{Value: "10gbase-t", Label: "10GBASE-T (10GE)"}}
	GE10CX4InterfaceType   = InterfaceType{
		Choice{Value: "10gbase-cx4", Label: "10GBASE-CX4 (10GE)"},
	}
	GE10SFPPInterfaceType   = InterfaceType{Choice{Value: "10gbase-x-sfpp", Label: "SFP+ (10GE)"}}
	GE10XFPInterfaceType    = InterfaceType{Choice{Value: "10gbase-x-xfp", Label: "XFP (10GE)"}}
	GE10XENPAKInterfaceType = InterfaceType{
		Choice{Value: "10gbase-x-xenpak", Label: "XENPAK (10GE)"},
	}
	GE10X2InterfaceType    = InterfaceType{Choice{Value: "10gbase-x-x2", Label: "X2 (10GE)"}}
	GE25SFP28InterfaceType = InterfaceType{
		Choice{Value: "25gbase-x-sfp28", Label: "SFP28 (25GE)"},
	}
	GE50SFP56InterfaceType = InterfaceType{
		Choice{Value: "50gbase-x-sfp56", Label: "SFP56 (50GE)"},
	}
	GE40QSFPPlusInterfaceType = InterfaceType{
		Choice{Value: "40gbase-x-qsfpp", Label: "QSFP+ (40GE)"},
	}
	GE50QSFP28InterfaceType = InterfaceType{
		Choice{Value: "50gbase-x-sfp28", Label: "QSFP28 (50GE)"},
	}
	GE100CFPInterfaceType  = InterfaceType{Choice{Value: "100gbase-x-cfp", Label: "CFP (100GE)"}}
	GE100CFP2InterfaceType = InterfaceType{
		Choice{Value: "100gbase-x-cfp2", Label: "CFP2 (100GE)"},
	}
	GE100CFP4InterfaceType = InterfaceType{
		Choice{Value: "100gbase-x-cfp4", Label: "CFP4 (100GE)"},
	}
	GE100CXPInterfaceType  = InterfaceType{Choice{Value: "100gbase-x-cxp", Label: "CXP (100GE)"}}
	GE100CPAKInterfaceType = InterfaceType{
		Choice{Value: "100gbase-x-cpak", Label: "Cisco CPAK (100GE)"},
	}
	GE100DSFPInterfaceType = InterfaceType{
		Choice{Value: "100gbase-x-dsfp", Label: "DSFP (100GE)"},
	}
	GE100SFPDDInterfaceType = InterfaceType{
		Choice{Value: "100gbase-x-sfpdd", Label: "SFP-DD (100GE)"},
	}
	GE100QSFP28InterfaceType = InterfaceType{
		Choice{Value: "100gbase-x-qsfp28", Label: "QSFP28 (100GE)"},
	}
	GE100QSFPDDInterfaceType = InterfaceType{
		Choice{Value: "100gbase-x-qsfpdd", Label: "QSFP-DD (100GE)"},
	}
	GE200CFP2InterfaceType = InterfaceType{
		Choice{Value: "200gbase-x-cfp2", Label: "CFP2 (200GE)"},
	}
	GE200QSFP56InterfaceType = InterfaceType{
		Choice{Value: "200gbase-x-qsfp56", Label: "QSFP56 (200GE)"},
	}
	GE200QSFPDDInterfaceType = InterfaceType{
		Choice{Value: "200gbase-x-qsfpdd", Label: "QSFP-DD (200GE)"},
	}
	GE400CFP2InterfaceType = InterfaceType{
		Choice{Value: "400gbase-x-cfp2", Label: "CFP2 (400GE)"},
	}
	GE400QSFP112InterfaceType = InterfaceType{
		Choice{Value: "400gbase-x-qsfp112", Label: "QSFP112 (400GE)"},
	}
	GE400QSFPDDInterfaceType = InterfaceType{
		Choice{Value: "400gbase-x-qsfpdd", Label: "QSFP-DD (400GE)"},
	}
	GE400OSFPInterfaceType = InterfaceType{
		Choice{Value: "400gbase-x-osfp", Label: "OSFP (400GE)"},
	}
	GE400OSFPRHSInterfaceType = InterfaceType{
		Choice{Value: "400gbase-x-osfp-rhs", Label: "OSFP-RHS (400GE)"},
	}
	GE400CDFPInterfaceType = InterfaceType{
		Choice{Value: "400gbase-x-cdfp", Label: "CDFP (400GE)"},
	}
	GE400CFP8InterfaceType = InterfaceType{
		Choice{Value: "400gbase-x-cfp8", Label: "CPF8 (400GE)"},
	}
	GE800QSFPDDInterfaceType = InterfaceType{
		Choice{Value: "800gbase-x-qsfpdd", Label: "QSFP-DD (800GE)"},
	}
	GE800OSFPInterfaceType = InterfaceType{
		Choice{Value: "800gbase-x-osfp", Label: "OSFP (800GE)"},
	}

	// Netbox's Wireless interface types.
	IEEE80211AInterfaceType  = InterfaceType{Choice{Value: "ieee802.11a", Label: "IEEE 802.11a"}}
	IEEE80211GInterfaceType  = InterfaceType{Choice{Value: "ieee802.11g", Label: "IEEE 802.11b/g"}}
	IEEE80211NInterfaceType  = InterfaceType{Choice{Value: "ieee802.11n", Label: "IEEE 802.11n"}}
	IEEE80211ACInterfaceType = InterfaceType{Choice{Value: "ieee802.11ac", Label: "IEEE 802.11ac"}}
	IEEE80211ADInterfaceType = InterfaceType{Choice{Value: "ieee802.11ad", Label: "IEEE 802.11ad"}}
	IEEE80211AXInterfaceType = InterfaceType{Choice{Value: "ieee802.11ax", Label: "IEEE 802.11ax"}}

	// Netbox's PON interface types.
	GPONInterfaceType = InterfaceType{
		Choice{Value: "gpon", Label: "GPON (2.5 Gbps / 1.25 Gps)"},
	}
	XGPONInterfaceType = InterfaceType{
		Choice{Value: "xg-pon", Label: "XG-PON (10 Gbps / 2.5 Gbps)"},
	}
	XGSPONInterfaceType = InterfaceType{Choice{Value: "xgs-pon", Label: "XGS-PON (10 Gbps)"}}
	NGPON2InterfaceType = InterfaceType{
		Choice{Value: "ng-pon2", Label: "NG-PON2 (TWDM-PON) (4x10 Gbps)"},
	}
	EPONInterfaceType     = InterfaceType{Choice{Value: "epon", Label: "EPON (1 Gbps)"}}
	TenGEPONInterfaceType = InterfaceType{Choice{Value: "10g-epon", Label: "10G-EPON (10 Gbps)"}}

	// Netbox's Cellular interface types.
	GSMInterfaceType  = InterfaceType{Choice{Value: "gsm", Label: "GSM"}}
	CDMAInterfaceType = InterfaceType{Choice{Value: "cdma", Label: "CDMA"}}
	LTEInterfaceType  = InterfaceType{Choice{Value: "lte", Label: "LTE"}}

	// Netbox's Fiber channel interface types.
	GFC1SFPInterfaceType      = InterfaceType{Choice{Value: "1gfc-sfp", Label: "SFP (1GFC)"}}
	GFC2SFPInterfaceType      = InterfaceType{Choice{Value: "2gfc-sfp", Label: "SFP (2GFC)"}}
	GFC4SFPInterfaceType      = InterfaceType{Choice{Value: "4gfc-sfp", Label: "SFP (4GFC)"}}
	GFC8SFPPInterfaceType     = InterfaceType{Choice{Value: "8gfc-sfpp", Label: "SFP+ (8GFC)"}}
	GFC16SFPPInterfaceType    = InterfaceType{Choice{Value: "16gfc-sfpp", Label: "SFP+ (16GFC)"}}
	GFC32SFP28InterfaceType   = InterfaceType{Choice{Value: "32gfc-sfp28", Label: "SFP28 (32GFC)"}}
	GFC64QSFPPInterfaceType   = InterfaceType{Choice{Value: "64gfc-qsfpp", Label: "QSFP (64GFC)"}}
	GFC128QSFP28InterfaceType = InterfaceType{
		Choice{Value: "128gfc-qsfp28", Label: "QSFP28 (128GFC)"},
	}

	// Other type used for interfaces that do not suffice the above types.
	OtherInterfaceType = InterfaceType{Choice{Value: "other", Label: "Other"}}
)

Predefined types see : https://github.com/netbox-community/netbox/blob/ec245b968f50bdbafaadd5d6b885832d858fa167/netbox/dcim/choices.py#L800

View Source
var (
	InterfaceModeAccess    = InterfaceMode{Choice{Value: "access", Label: "Access"}}
	InterfaceModeTagged    = InterfaceMode{Choice{Value: "tagged", Label: "Tagged"}}
	InterfaceModeTaggedAll = InterfaceMode{Choice{Value: "tagged-all", Label: "Tagged (All)"}}
)
View Source
var (
	DuplexHalf = InterfaceDuplex{Choice{Value: "half", Label: "Half"}}
	DuplexFull = InterfaceDuplex{Choice{Value: "full", Label: "Full"}}
	DuplexAuto = InterfaceDuplex{Choice{Value: "auto", Label: "Auto"}}
)

https://github.com/netbox-community/netbox/blob/1b9e6bed55d4ee53f60bcd6540bce953ddbf4167/netbox/dcim/choices.py#L1155

View Source
var (
	VDCStatusActive  = VDCStatus{Choice{Value: "active", Label: "Active"}}
	VDCStatusPlanned = VDCStatus{Choice{Value: "planned", Label: "Planned"}}
	VDCStatusOffline = VDCStatus{Choice{Value: "offline", Label: "Offline"}}
)
View Source
var (
	CustomFieldTypeText     = CustomFieldType{Choice{Value: "text", Label: "Text"}}
	CustomFieldTypeLongText = CustomFieldType{Choice{Value: "longtext", Label: "Text (long)"}}
	CustomFieldTypeInteger  = CustomFieldType{Choice{Value: "integer", Label: "Integer"}}
	CustomFieldTypeDecimal  = CustomFieldType{Choice{Value: "decimal", Label: "Decimal"}}
	CustomFieldTypeBoolean  = CustomFieldType{
		Choice{Value: "boolean", Label: "Boolean (true/false)"},
	}
	CustomFieldTypeDate = CustomFieldType{Choice{Value: "date", Label: "Date"}}
)

Predefined netbox's types for CustomFields https://github.com/netbox-community/netbox/blob/35be4f05ef376e28d9af4d7245ba10cc286bb62a/netbox/extras/choices.py#L10

View Source
var (
	CustomFieldUIVisibleAlways = CustomFieldUIVisible{Choice{Value: "always", Label: "Always"}}
	CustomFieldUIVisibleIfSet  = CustomFieldUIVisible{Choice{Value: "if-set", Label: "If set"}}
	CustomFieldUIVisibleHidden = CustomFieldUIVisible{Choice{Value: "hidden", Label: "Hidden"}}
)
View Source
var (
	CustomFieldUIEditableYes    = CustomFieldUIEditable{Choice{Value: "yes", Label: "Yes"}}
	CustomFieldUIEditableNo     = CustomFieldUIEditable{Choice{Value: "no", Label: "No"}}
	CustomFieldUIEditableHidden = CustomFieldUIEditable{Choice{Value: "hidden", Label: "Hidden"}}
)
View Source
var (
	IPAddressStatusActive   = IPAddressStatus{Choice{Value: "active", Label: "Active"}}
	IPAddressStatusReserved = IPAddressStatus{Choice{Value: "reserved", Label: "Reserved"}}
	IPAddressStatusDHCP     = IPAddressStatus{Choice{Value: "dhcp", Label: "DHCP"}}
	IPAddressStatusSLAAC    = IPAddressStatus{Choice{Value: "slaac", Label: "SLAAC"}}
)
View Source
var (
	IPAddressRoleLoopback  = IPAddressRole{Choice{Value: "loopback", Label: "Loopback"}}
	IPAddressRoleSecondary = IPAddressRole{Choice{Value: "secondary", Label: "Secondary"}}
	IPAddressRoleAnycast   = IPAddressRole{Choice{Value: "anycast", Label: "Anycast"}}
	IPAddressRoleVIP       = IPAddressRole{Choice{Value: "vip", Label: "VIP"}}
	IPAddressRoleVRRP      = IPAddressRole{Choice{Value: "vrrp", Label: "VRRP"}}
	IPAddressRoleHSRP      = IPAddressRole{Choice{Value: "hsrp", Label: "HSRP"}}
	IPAddressRoleGLBP      = IPAddressRole{Choice{Value: "glbp", Label: "GLBP"}}
	IPAddressRoleCARP      = IPAddressRole{Choice{Value: "carp", Label: "CARP"}}
)
View Source
var (
	VlanStatusActive     = VlanStatus{Choice{Value: "active", Label: "Active"}}
	VlanStatusReserved   = VlanStatus{Choice{Value: "reserved", Label: "Reserved"}}
	VlanStatusDeprecated = VlanStatus{Choice{Value: "deprecated", Label: "Deprecated"}}
)
View Source
var (
	PrefixStatusContainer  = PrefixStatus{Choice{Value: "container", Label: "Container"}}
	PrefixStatusActive     = PrefixStatus{Choice{Value: "active", Label: "Active"}}
	PrefixStatusReserved   = PrefixStatus{Choice{Value: "reserved", Label: "Reserved"}}
	PrefixStatusDeprecated = PrefixStatus{Choice{Value: "deprecated", Label: "Deprecated"}}
)

https://github.com/netbox-community/netbox/blob/b408beaed52cb9fc5f7e197a7e00479af3714564/netbox/ipam/choices.py#L21

View Source
var (
	ContactAssignmentPriorityPrimary = ContactAssignmentPriority{
		Choice{Value: "primary", Label: "Primary"},
	}
	ContactAssignmentPrioritySecondary = ContactAssignmentPriority{
		Choice{Value: "secondary", Label: "Secondary"},
	}
	ContactAssignmentPriorityTertiary = ContactAssignmentPriority{
		Choice{Value: "tertiary", Label: "Tertiary"},
	}
	ContactAssignmentPriorityInactive = ContactAssignmentPriority{
		Choice{Value: "inactive", Label: "Inactive"},
	}
)

https://github.com/netbox-community/netbox/blob/487f1ccfde26ef3c1f8a28089826acc0cd6fadb2/netbox/tenancy/choices.py#L10

View Source
var (
	ClusterStatusActive  = ClusterStatus{Choice{Value: "active", Label: "Active"}}
	ClusterStatusOffline = ClusterStatus{Choice{Value: "offline", Label: "Offline"}}
)
View Source
var (
	VMStatusActive  = VMStatus{Choice{Value: "active", Label: "Active"}}
	VMStatusOffline = VMStatus{Choice{Value: "offline", Label: "Offline"}}
)
View Source
var (
	VMInterfaceModeAccess    = VMInterfaceMode{Choice{Value: "access", Label: "Access"}}
	VMInterfaceModeTagged    = VMInterfaceMode{Choice{Value: "tagged", Label: "Tagged"}}
	VMInterfaceModeTaggedAll = VMInterfaceMode{Choice{Value: "tagged-all", Label: "Tagged (All)"}}
)
View Source
var (
	WirelessLanStatusActive     = WirelessLANStatus{Choice{Value: "active", Label: "Active"}}
	WirelessLanStatusReserved   = WirelessLANStatus{Choice{Value: "reserved", Label: "Reserved"}}
	WirelessLanStatusDisabled   = WirelessLANStatus{Choice{Value: "disabled", Label: "Disabled"}}
	WirelessLanStatusDeprecated = WirelessLANStatus{
		Choice{Value: "deprecated", Label: "Deprecated"},
	}
)
View Source
var (
	WirelessLanAuthTypeOpen        = WirelessLANAuthType{Choice{Value: "open", Label: "Open"}}
	WirelessLanAuthTypeWep         = WirelessLANAuthType{Choice{Value: "wep", Label: "WEP"}}
	WirelessLanAuthTypeWpaPersonal = WirelessLANAuthType{
		Choice{Value: "wpa-personal", Label: "WPA Personal (PSK)"},
	}
	WirelessLanAuthTypeWpaEnterprise = WirelessLANAuthType{
		Choice{Value: "wpa-enterprise", Label: "WPA Enterprise"},
	}
)
View Source
var (
	WirelessLANAuthCipherAuto = WirelessLANAuthCipher{Choice{Value: "auto", Label: "Auto"}}
	WirelessLANAuthCipherTkip = WirelessLANAuthCipher{Choice{Value: "tkip", Label: "TKIP"}}
	WirelessLANAuthCipherAes  = WirelessLANAuthCipher{Choice{Value: "aes", Label: "AES"}}
)
View Source
var (
	FilterLogicLoose = FilterLogic{Choice{Value: "loose", Label: "Loose"}}
)

Maps interface speed (Kbps) to interface type.

Functions

This section is empty.

Types

type Choice

type Choice struct {
	Value string `json:"value,omitempty"`
	Label string `json:"label,omitempty"`
}

Choice represents a choice in a Netbox's choice field. This struct is used as an embedded struct in other structs that represent Choice fields.

func (Choice) String

func (c Choice) String() string

type Cluster

type Cluster struct {
	NetboxObject
	// Name is the name of the cluster. This field is required.
	Name string `json:"name,omitempty"`
	// Type is the type of the cluster. This field is required.
	// e.g. oVirt,VMware...
	Type *ClusterType `json:"type,omitempty"`
	// ClusterGroup is the cluster group to which this cluster belongs.
	Group *ClusterGroup `json:"group,omitempty"`
	// ScopeType is the scope of the cluster.
	ScopeType constants.ContentType `json:"scope_type,omitempty"`
	// ScopeID is the ID of the scope object.
	ScopeID int `json:"scope_id,omitempty"`
	// Status is the operational status of the cluster. This field is required.
	Status ClusterStatus `json:"status,omitempty"`
	// TenantGroup is the tenant group to which this cluster belongs.
	TenantGroup *TenantGroup `json:"tenant_group,omitempty"`
	// Tenant is the tenant to which this cluster belongs.
	Tenant *Tenant `json:"tenant,omitempty"`
}

func (*Cluster) GetAPIPath

func (c *Cluster) GetAPIPath() constants.APIPath

func (*Cluster) GetID

func (c *Cluster) GetID() int

Cluster implements IDItem interface.

func (*Cluster) GetNetboxObject

func (c *Cluster) GetNetboxObject() *NetboxObject

Cluster implements OrphanItem interface.

func (*Cluster) GetObjectType

func (c *Cluster) GetObjectType() constants.ContentType

func (Cluster) String

func (c Cluster) String() string

type ClusterGroup

type ClusterGroup struct {
	NetboxObject
	// Name is the name of the cluster group. This field is required.
	Name string `json:"name,omitempty"`
	// Slug is the slugified version of the cluster group name. This field is read-only.
	Slug string `json:"slug,omitempty"`
}

func (*ClusterGroup) GetAPIPath

func (cg *ClusterGroup) GetAPIPath() constants.APIPath

func (*ClusterGroup) GetID

func (cg *ClusterGroup) GetID() int

ClusterGroup implements IDItem interface.

func (*ClusterGroup) GetNetboxObject

func (cg *ClusterGroup) GetNetboxObject() *NetboxObject

ClusterGroup implements OrphanItem interface.

func (*ClusterGroup) GetObjectType

func (cg *ClusterGroup) GetObjectType() constants.ContentType

func (ClusterGroup) String

func (cg ClusterGroup) String() string

type ClusterStatus

type ClusterStatus struct {
	Choice
}

type ClusterType

type ClusterType struct {
	NetboxObject
	// Name is the name of the cluster type. This field is required.
	Name string `json:"name,omitempty"`
	// Slug is the slugified version of the cluster type name. This field is read-only.
	Slug string `json:"slug,omitempty"`
}

func (*ClusterType) GetAPIPath

func (ct *ClusterType) GetAPIPath() constants.APIPath

func (*ClusterType) GetID

func (ct *ClusterType) GetID() int

ClusterType implements IDItem interface.

func (*ClusterType) GetNetboxObject

func (ct *ClusterType) GetNetboxObject() *NetboxObject

ClusterType implements OrphanItem interface.

func (*ClusterType) GetObjectType

func (ct *ClusterType) GetObjectType() constants.ContentType

func (ClusterType) String

func (ct ClusterType) String() string

type Contact

type Contact struct {
	NetboxObject
	// Name is the name of the Contact. This field is required.
	Name string `json:"name,omitempty"`
	// Title is the title of the Contact.]
	Title string `json:"title,omitempty"`
	// Phone is the phone number of the contact.
	Phone string `json:"phone,omitempty"`
	// Email is the email of the contact.
	Email string `json:"email,omitempty"`
	// Address is the address of the contact.
	Address string `json:"address,omitempty"`
	// Link is the web link of the contact.
	Link string `json:"link,omitempty"`
	// Comments for the contact.
	Comments string `json:"comments,omitempty"`
}

func (*Contact) GetAPIPath

func (c *Contact) GetAPIPath() constants.APIPath

func (*Contact) GetID

func (c *Contact) GetID() int

Contact implements IDItem interface.

func (*Contact) GetNetboxObject

func (c *Contact) GetNetboxObject() *NetboxObject

Contact implements OrphanItem interface.

func (*Contact) GetObjectType

func (c *Contact) GetObjectType() constants.ContentType

func (Contact) String

func (c Contact) String() string

type ContactAssignment

type ContactAssignment struct {
	NetboxObject
	// Content type (e.g. virtualization.virtualmachine). This field is necessary
	ModelType constants.ContentType `json:"object_type,omitempty"`
	// ID of the dependent object. This field is necessary
	ObjectID int `json:"object_id,omitempty"`
	// Contact for this assignment. This field is necessary
	Contact *Contact `json:"contact,omitempty"`
	// Role of the Contact assignment. This field is necessary
	Role *ContactRole `json:"role,omitempty"`
	// Priority of the Contact Assignment
	Priority *ContactAssignmentPriority `json:"priority,omitempty"`
}

func (*ContactAssignment) GetAPIPath

func (ca *ContactAssignment) GetAPIPath() constants.APIPath

func (*ContactAssignment) GetID

func (ca *ContactAssignment) GetID() int

ContactAssignment implements IDItem interface.

func (*ContactAssignment) GetNetboxObject

func (ca *ContactAssignment) GetNetboxObject() *NetboxObject

ContactAssignment implements OrphanItem interface.

func (*ContactAssignment) GetObjectType

func (ca *ContactAssignment) GetObjectType() constants.ContentType

func (ContactAssignment) String

func (ca ContactAssignment) String() string

type ContactAssignmentPriority

type ContactAssignmentPriority struct {
	Choice
}

type ContactGroup

type ContactGroup struct {
	NetboxObject
	// Name is the name of the ContactGroup. This field is required.
	Name string `json:"name,omitempty"`
	// Slug is the slug for the ContactGroup. This field is required.
	Slug string `json:"slug,omitempty"`
	// Parent contact group.
	Parent *ContactGroup `json:"parent,omitempty"`
}

func (*ContactGroup) GetID

func (cg *ContactGroup) GetID() int

ContactGroup implements IDItem interface.

func (*ContactGroup) GetNetboxObject

func (cg *ContactGroup) GetNetboxObject() *NetboxObject

ContactGroup implements OrphanItem interface.

func (*ContactGroup) GetObjectType

func (cg *ContactGroup) GetObjectType() constants.ContentType

func (ContactGroup) String

func (cg ContactGroup) String() string

type ContactRole

type ContactRole struct {
	NetboxObject
	// Name is the name of the role. This field is required.
	Name string `json:"name,omitempty"`
	// Slug is the slug of the role. This field is required.
	Slug string `json:"slug,omitempty"`
}

Contacts can be organized by functional roles. For example, we might create roles for administrative, emergency, operational contacts.

func (*ContactRole) GetID

func (cr *ContactRole) GetID() int

ContactRole implements IDItem interface.

func (*ContactRole) GetNetboxObject

func (cr *ContactRole) GetNetboxObject() *NetboxObject

ContactRole implements OrphanItem interface.

func (*ContactRole) GetObjectType

func (cr *ContactRole) GetObjectType() constants.ContentType

func (ContactRole) String

func (cr ContactRole) String() string

type CustomField

type CustomField struct {
	ID int `json:"id,omitempty"`
	// Name of the custom field (e.g. host_cpu_cores). This field is required.
	Name string `json:"name,omitempty"`
	// Label represents name of the field as displayed to users (e.g. Physical CPU cores).
	// If not provided, the name will be used instead.
	Label string `json:"label,omitempty"`
	// Type is the type of the custom field.
	// Valid choices are: text, integer, boolean, date, url, select, multiselect. This field is required.
	Type CustomFieldType `json:"type,omitempty"`
	// Type of the related object (for object/multi-object fields only) (e.g. objects.device). This field is required.
	ObjectTypes []constants.ContentType `json:"object_types,omitempty"`
	// Description is a description of the field. This field is optional.
	Description string `json:"description,omitempty"`
	// Weighting for search. Lower values are considered more important. Default (1000).
	SearchWeight int `json:"search_weight,omitempty"`
	// Filter logic. This field is required. (Default loose).
	FilterLogic FilterLogic `json:"filter_logic,omitempty"`
	// UI visible. This field is required. (Default read-write).
	CustomFieldUIVisible *CustomFieldUIVisible `json:"ui_visible,omitempty"`
	// UI editable. This field is required. (Default read-write).
	CustomFieldUIEditable *CustomFieldUIEditable `json:"ui_editable,omitempty"`
	// Display Weight. Fields with higher weights appear lower in a form (default is 100).
	DisplayWeight int `json:"weight,omitempty"`
	// Default value for the field (must be a JSON value). Encapsulate strings with double quotes (e.g. "Foo").
	Default interface{} `json:"default"`
	// If this field is required or not.
	Required bool `json:"required"`
}

func (*CustomField) GetAPIPath

func (cf *CustomField) GetAPIPath() constants.APIPath

func (*CustomField) GetID

func (cf *CustomField) GetID() int

CustomField implements IDItem interface.

func (*CustomField) GetObjectType

func (cf *CustomField) GetObjectType() constants.ContentType

func (CustomField) String

func (cf CustomField) String() string

type CustomFieldType

type CustomFieldType struct {
	Choice
}

CustomFieldTypes are predefined netbox's types for CustomFields.

type CustomFieldUIEditable

type CustomFieldUIEditable struct {
	Choice
}

type CustomFieldUIVisible

type CustomFieldUIVisible struct {
	Choice
}

type Device

type Device struct {
	NetboxObject

	// Device
	// Name is the name of the device.
	Name string `json:"name,omitempty"`
	// DeviceRole is the functional role of the device. This field is required.
	DeviceRole *DeviceRole `json:"role,omitempty"`

	// Hardware
	// DeviceType is the type of device. This field is required.
	DeviceType *DeviceType `json:"device_type,omitempty"`
	// Airflow is the airflow pattern of the device.
	Airflow *DeviceAirFlowType `json:"airflow,omitempty"`
	// Status is the status of the device.
	SerialNumber string `json:"serial,omitempty"`
	// AssetTag is an unique tag for identifying the device.
	AssetTag string `json:"asset_tag,omitempty"`

	// Location
	// Site is the site to which the device belongs. This field is required.
	Site *Site `json:"site,omitempty"`
	// Location is the location of the device.
	Location *Location `json:"location,omitempty"`

	// Management
	// Status of the device (e.g. active, offline, planned, etc.). This field is required.
	Status *DeviceStatus `json:"status,omitempty"`
	// Platform of the device (e.g. Cisco IOS, Dell OS9, etc.).
	Platform *Platform `json:"platform,omitempty"`

	// PrimaryIPv4 is the primary IPv4 address assigned to the server.
	PrimaryIPv4 *IPAddress `json:"primary_ip4,omitempty"`
	// PrimaryIPv6 is the primary IPv6 address assigned to the server.
	PrimaryIPv6 *IPAddress `json:"primary_ip6,omitempty"`

	// Virtualization
	// Cluster is the cluster to which the device belongs. (e.g. VMWare server belonging to a specific cluster).
	Cluster *Cluster `json:"cluster,omitempty"`

	// Tenancy
	// Tenant group
	Tenant *Tenant `json:"tenant,omitempty"`

	// The priority of the device in the virtual chassis
	// Priority
	// Additional comments.
	Comments string `json:"comments,omitempty"`
}

Device can be any piece of physical hardware, such as a server, router, or switch.

func (*Device) GetAPIPath

func (d *Device) GetAPIPath() constants.APIPath

func (*Device) GetID

func (d *Device) GetID() int

Device implements IDItem interface.

func (*Device) GetNetboxObject

func (d *Device) GetNetboxObject() *NetboxObject

Device implements OrphanItem interface.

func (*Device) GetObjectType

func (d *Device) GetObjectType() constants.ContentType

func (*Device) GetPrimaryIPv4Address

func (d *Device) GetPrimaryIPv4Address() *IPAddress

Device implements IPAddressOwner interface.

func (*Device) GetPrimaryIPv6Address

func (d *Device) GetPrimaryIPv6Address() *IPAddress

func (*Device) SetPrimaryIPAddress

func (d *Device) SetPrimaryIPAddress(ip *IPAddress)

func (*Device) SetPrimaryIPv6Address

func (d *Device) SetPrimaryIPv6Address(ip *IPAddress)

func (Device) String

func (d Device) String() string

type DeviceRole

type DeviceRole struct {
	NetboxObject
	// Name is the name of the device role. This field is required.
	Name string `json:"name,omitempty"`
	// URL-friendly unique shorthand. This field is required.
	Slug string `json:"slug,omitempty"`
	// Color of the device role. This field is required.
	Color constants.Color `json:"color,omitempty"`
	// VMRole is whether this device role is used to represent virtual machines.
	VMRole bool `json:"vm_role,omitempty"`
}

DeviceRole represents the functional role of a device. For example, a device may play the role of a router, a switch, a firewall, etc.

func (*DeviceRole) GetAPIPath

func (dr *DeviceRole) GetAPIPath() constants.APIPath

func (*DeviceRole) GetID

func (dr *DeviceRole) GetID() int

DeviceRole implements IDItem interface.

func (*DeviceRole) GetNetboxObject

func (dr *DeviceRole) GetNetboxObject() *NetboxObject

DeviceRole implements OrphanItem interface.

func (*DeviceRole) GetObjectType

func (dr *DeviceRole) GetObjectType() constants.ContentType

func (DeviceRole) String

func (dr DeviceRole) String() string

type DeviceStatus

type DeviceStatus struct {
	Choice
}

type DeviceType

type DeviceType struct {
	NetboxObject
	// Manufacturer is the manufacturer of the device type. This field is required.
	Manufacturer *Manufacturer `json:"manufacturer,omitempty"`
	// Model is the model of the device type. This field is required.
	Model string `json:"model,omitempty"`
	// Slug is a URL-friendly unique shorthand. This field is required.
	Slug string `json:"slug,omitempty"`
}

DeviceType represents the physical and operational characteristics of a device. For example, a device type may represent a Cisco C2960 switch running IOS 15.2.

func (*DeviceType) GetAPIPath

func (dt *DeviceType) GetAPIPath() constants.APIPath

func (*DeviceType) GetID

func (dt *DeviceType) GetID() int

DeviceType implements OrphanItem interface.

func (*DeviceType) GetNetboxObject

func (dt *DeviceType) GetNetboxObject() *NetboxObject

DeviceType implements OrphanItem interface.

func (*DeviceType) GetObjectType

func (dt *DeviceType) GetObjectType() constants.ContentType

func (DeviceType) String

func (dt DeviceType) String() string

type FilterLogic

type FilterLogic struct {
	Choice
}

type IDItem

type IDItem interface {
	GetID() int
	GetObjectType() constants.ContentType
	GetAPIPath() constants.APIPath
}

type IPAddress

type IPAddress struct {
	NetboxObject
	// IPv4 or IPv6 address (with mask). This field is required.
	Address string `json:"address,omitempty"`
	// The status of this IP address.
	Status *IPAddressStatus `json:"status,omitempty"`
	// Role of the IP address.
	Role *IPAddressRole `json:"role,omitempty"`
	// Hostname or FQDN (not case-sensitive)
	DNSName string `json:"dns_name,omitempty"`
	// Tenancy
	Tenant *Tenant `json:"tenant,omitempty"`

	// AssignedObjectType is either a DeviceInterface or a VMInterface.
	AssignedObjectType constants.ContentType `json:"assigned_object_type,omitempty"`
	// ID of the assigned object (either an ID of DeviceInterface or an ID of VMInterface).
	AssignedObjectID int `json:"assigned_object_id,omitempty"`
}

func (*IPAddress) GetAPIPath

func (ip *IPAddress) GetAPIPath() constants.APIPath

func (*IPAddress) GetID

func (ip *IPAddress) GetID() int

IPAddress implements IDItem interface.

func (*IPAddress) GetNetboxObject

func (ip *IPAddress) GetNetboxObject() *NetboxObject

IPAddress implements OrphanItem interface.

func (*IPAddress) GetObjectType

func (ip *IPAddress) GetObjectType() constants.ContentType

func (IPAddress) String

func (ip IPAddress) String() string

type IPAddressOwner

type IPAddressOwner interface {
	GetID() int
	GetObjectType() constants.ContentType
	GetAPIPath() constants.APIPath
	GetPrimaryIPv4Address() *IPAddress
	GetPrimaryIPv6Address() *IPAddress
	SetPrimaryIPAddress(ip *IPAddress)
	SetPrimaryIPv6Address(ip *IPAddress)
}

type IPAddressRole

type IPAddressRole struct {
	Choice
}

type IPAddressStatus

type IPAddressStatus struct {
	Choice
}

type IPRange

type IPRange struct {
	NetboxObject
}

type Interface

type Interface struct {
	NetboxObject
	// Device is the device to which the interface belongs. This field is required.
	Device *Device `json:"device,omitempty"`
	// Name is the name of the interface. This field is required.
	Name string `json:"name,omitempty"`
	// Status whether the interface is enabled or not.
	Status bool `json:"enabled,omitempty"`
	// Type is the type of interface. This field is required. Can only be one of the predetermined values.
	Type *InterfaceType `json:"type,omitempty"`
	// Interface speed in kbps
	Speed InterfaceSpeed `json:"speed,omitempty"`
	// Related Interfaces
	// Parent is the parent interface, if any.
	ParentInterface *Interface `json:"parent,omitempty"`
	// BridgedInterface is the bridged interface, if any.
	BridgedInterface *Interface `json:"bridge,omitempty"`
	// LAG is the LAG to which the interface belongs, if any.
	LAG *Interface `json:"lag,omitempty"`
	// MTU is the maximum transmission unit (MTU) configured for the interface.
	MTU int `json:"mtu,omitempty"`
	// PrimaryMACAddress is the primary MAC address of the interface.
	PrimaryMACAddress *MACAddress `json:"primary_mac_address,omitempty"`

	// Duplex is the duplex mode of the interface
	Duplex *InterfaceDuplex `json:"duplex,omitempty"`

	// 802.1Q Mode
	Mode *InterfaceMode `json:"mode,omitempty"`
	// TaggedVlans is a list of all the VLANs to which the interface is tagged.
	TaggedVlans []*Vlan `json:"tagged_vlans,omitempty"`
	// UntaggedVlan
	UntaggedVlan *Vlan `json:"untagged_vlan,omitempty"`
	// VirtualDeviceContexts
	Vdcs []*VirtualDeviceContext `json:"vdcs,omitempty"`
}

Interface represents a physical data interface within a device.

func (*Interface) GetAPIPath

func (i *Interface) GetAPIPath() constants.APIPath

func (*Interface) GetID

func (i *Interface) GetID() int

Interface implements IDItem interface.

func (*Interface) GetNetboxObject

func (i *Interface) GetNetboxObject() *NetboxObject

Interface implements OrphanItem interface.

func (*Interface) GetObjectType

func (i *Interface) GetObjectType() constants.ContentType

func (*Interface) GetPrimaryMACAddress

func (i *Interface) GetPrimaryMACAddress() *MACAddress

Interface Implements MACAddressOwner interface.

func (*Interface) SetPrimaryMACAddress

func (i *Interface) SetPrimaryMACAddress(mac *MACAddress)

func (Interface) String

func (i Interface) String() string

type InterfaceDuplex

type InterfaceDuplex struct {
	Choice
}

type InterfaceMode

type InterfaceMode struct {
	Choice
}

type InterfaceSpeed

type InterfaceSpeed int64

Interface speed in kbps.

const (
	MBPS10      InterfaceSpeed = 10000
	MBPS100     InterfaceSpeed = 100000
	GBPS1       InterfaceSpeed = 1000000
	GBPS2       InterfaceSpeed = 2000000
	GBPS2Point5 InterfaceSpeed = 2500000
	GBPS4       InterfaceSpeed = 4000000
	GBPS5       InterfaceSpeed = 5000000
	GBPS8       InterfaceSpeed = 8000000
	GBPS10      InterfaceSpeed = 10000000
	GBPS16      InterfaceSpeed = 16000000
	GBPS25      InterfaceSpeed = 25000000
	GBPS32      InterfaceSpeed = 32000000
	GBPS40      InterfaceSpeed = 40000000
	GBPS50      InterfaceSpeed = 50000000
	GBPS64      InterfaceSpeed = 64000000
	GBPS100     InterfaceSpeed = 100000000
	GBPS128     InterfaceSpeed = 128000000
	GBPS200     InterfaceSpeed = 200000000
	GBPS400     InterfaceSpeed = 400000000
	GBPS800     InterfaceSpeed = 800000000
)

Available interface speeds: https://github.com/netbox-community/netbox/blob/72e93b04daf38b0a5f7dab70e96a9f96edd02649/netbox/dcim/choices.py#L1229

type InterfaceType

type InterfaceType struct {
	Choice
}

type Location

type Location struct {
	NetboxObject
	// Site is the site to which the location belongs. This field is required.
	Site *Site
	// Name is the name of the location. This field is required.
	Name string
	// URL-friendly unique shorthand. This field is required.
	Slug string
	// Status is the status of the location. This field is required.
	Status *SiteStatus
}

Location represents a physical location, such as a floor or room in a building.

func (*Location) GetAPIPath

func (l *Location) GetAPIPath() constants.APIPath

func (*Location) GetID

func (l *Location) GetID() int

Location implements IDItem interface.

func (*Location) GetNetboxObject

func (l *Location) GetNetboxObject() *NetboxObject

Location implements OrphanItem interface.

func (*Location) GetObjectType

func (l *Location) GetObjectType() constants.ContentType

func (Location) String

func (l Location) String() string

type MACAddress

type MACAddress struct {
	NetboxObject
	// MAC is the MAC address. This field is required.
	MAC string `json:"mac_address,omitempty"`
	// AssignedObjectType is the type of object to which the MAC address is assigned.
	AssignedObjectType constants.ContentType `json:"assigned_object_type,omitempty"`
	// AssignedObjectID is the ID of the object to which the MAC address is assigned.
	AssignedObjectID int `json:"assigned_object_id,omitempty"`
}

func (*MACAddress) GetAPIPath

func (m *MACAddress) GetAPIPath() constants.APIPath

func (*MACAddress) GetID

func (m *MACAddress) GetID() int

MACAddress implements IDItem interface.

func (*MACAddress) GetNetboxObject

func (m *MACAddress) GetNetboxObject() *NetboxObject

MACAddress implements OrphanItem interface.

func (*MACAddress) GetObjectType

func (m *MACAddress) GetObjectType() constants.ContentType

func (MACAddress) String

func (m MACAddress) String() string

type MACAddressOwner

type MACAddressOwner interface {
	GetID() int
	GetObjectType() constants.ContentType
	GetAPIPath() constants.APIPath
	GetPrimaryMACAddress() *MACAddress
	SetPrimaryMACAddress(mac *MACAddress)
}

type Manufacturer

type Manufacturer struct {
	NetboxObject
	// Name of the manufacturer (e.g. Cisco). This field is required.
	Name string `json:"name,omitempty"`
	// URL-friendly unique shorthand. This field is required.
	Slug string `json:"slug,omitempty"`
}

Manufacturer represents a hardware manufacturer (e.g. Cisco, HP, ...).

func (*Manufacturer) GetAPIPath

func (m *Manufacturer) GetAPIPath() constants.APIPath

func (*Manufacturer) GetID

func (m *Manufacturer) GetID() int

Manufacturer implements IDItem interface.

func (*Manufacturer) GetNetboxObject

func (m *Manufacturer) GetNetboxObject() *NetboxObject

Manufacturer implements OrphanItem interface.

func (*Manufacturer) GetObjectType

func (m *Manufacturer) GetObjectType() constants.ContentType

func (Manufacturer) String

func (m Manufacturer) String() string

type NetboxObject

type NetboxObject struct {
	// Netbox's ID of the object.
	ID int `json:"id,omitempty"`
	// List of tags assigned to this object.
	Tags []*Tag `json:"tags,omitempty"`
	// Description represents custom description of the object.
	Description string `json:"description,omitempty"`
	// Array of custom fields, in format customFieldLabel: customFieldValue
	CustomFields map[string]interface{} `json:"custom_fields,omitempty"`
}

Struct representing attributes that are common to all objects in Netbox. We can this struct as an embedded struct in other structs that represent Netbox objects.

func (*NetboxObject) AddTag

func (n *NetboxObject) AddTag(newTag *Tag)

AddTag adds a tag to the NetboxObject if it doesn't have it already. If the tag is already present, nothing happens.

func (*NetboxObject) GetCustomField

func (n *NetboxObject) GetCustomField(label string) interface{}

func (*NetboxObject) GetID

func (n *NetboxObject) GetID() int

func (*NetboxObject) HasTag

func (n *NetboxObject) HasTag(tag *Tag) bool

HasTag checks if the NetboxObject has a tag. It returns true if the object has the tag, otherwise false.

func (*NetboxObject) HasTagByName

func (n *NetboxObject) HasTagByName(tagName string) bool

HasTagByName checks if the NetboxObject has a tag by name. It returns true if the object has the tag, otherwise false.

func (*NetboxObject) RemoveTag

func (n *NetboxObject) RemoveTag(tag *Tag)

RemoveTag removes a tag from the NetboxObject. If the tag is not present, nothing happens.

func (*NetboxObject) SetCustomField

func (n *NetboxObject) SetCustomField(label string, value interface{})

func (NetboxObject) String

func (n NetboxObject) String() string

type OrphanItem

type OrphanItem interface {
	GetID() int
	GetObjectType() constants.ContentType
	GetAPIPath() constants.APIPath
	GetNetboxObject() *NetboxObject
}

type Platform

type Platform struct {
	NetboxObject
	// Name of the platform. This field is required.
	Name string `json:"name,omitempty"`
	// URL-friendly unique shorthand. This field is required.
	Slug string `json:"slug,omitempty"`
	// Manufacturer is the manufacturer of the platform.
	Manufacturer *Manufacturer `json:"manufacturer,omitempty"`
}

Platform represents an operating system or other software platform which may be running on a device.

func (*Platform) GetAPIPath

func (p *Platform) GetAPIPath() constants.APIPath

func (*Platform) GetID

func (p *Platform) GetID() int

Implements IDItem interface.

func (*Platform) GetNetboxObject

func (p *Platform) GetNetboxObject() *NetboxObject

Implements OrphanItem interface.

func (*Platform) GetObjectType

func (p *Platform) GetObjectType() constants.ContentType

func (Platform) String

func (p Platform) String() string

type Prefix

type Prefix struct {
	NetboxObject
	// Prefix is a IPv4 or IPv6 network address (with mask). This field is required.
	Prefix string `json:"prefix,omitempty"`
	// Status of the prefix (default "active").
	Status *PrefixStatus `json:"status,omitempty"`

	// Site that this prefix belongs to.
	ScopeID   int                   `json:"scope_id,omitempty"`
	ScopeType constants.ContentType `json:"scope_type,omitempty"`

	// Vlan that this prefix belongs to.
	Vlan *Vlan `json:"vlan,omitempty"`

	// Tenant that this prefix belongs to.
	Tenant *Tenant `json:"tenant,omitempty"`

	Comments string `json:"comments,omitempty"`
}

func (*Prefix) GetAPIPath

func (p *Prefix) GetAPIPath() constants.APIPath

func (*Prefix) GetID

func (p *Prefix) GetID() int

Prefix implements IDItem interface.

func (*Prefix) GetNetboxObject

func (p *Prefix) GetNetboxObject() *NetboxObject

Prefix implements OrphanItem interface.

func (*Prefix) GetObjectType

func (p *Prefix) GetObjectType() constants.ContentType

func (Prefix) String

func (p Prefix) String() string

type PrefixStatus

type PrefixStatus struct {
	Choice
}

type Region

type Region struct {
	NetboxObject
	// Name is the name of the region. This field is required.
	Name string `json:"name,omitempty"`
	// Slug is a URL-friendly unique shorthand. This field is required.
	Slug string `json:"slug,omitempty"`
}

func (*Region) GetAPIPath

func (r *Region) GetAPIPath() constants.APIPath

func (*Region) GetID

func (r *Region) GetID() int

Implements IDItem interface.

func (*Region) GetNetboxObject

func (r *Region) GetNetboxObject() *NetboxObject

Implements OrphanItem interface.

func (*Region) GetObjectType

func (r *Region) GetObjectType() constants.ContentType

func (Region) String

func (r Region) String() string

type Site

type Site struct {
	NetboxObject
	// Full name for the site. This field is required.
	Name string `json:"name,omitempty"`
	// URL-friendly unique shorthand. This field is required.
	Slug string `json:"slug,omitempty"`
	// Site status. This field is required.
	Status *SiteStatus `json:"status,omitempty"`
	// Tenant of the site
	Tenant *Tenant `json:"tenant,omitempty"`

	// Physical location of the building
	PhysicalAddress string `json:"physical_address,omitempty"`

	// Latitude of the site.
	Latitude float64 `json:"latitude,omitempty"`
	// Longitude of the site.
	Longitude float64 `json:"longitude,omitempty"`
}

Site ares used for functional groupings. A site usually represents a building within a region.

func (*Site) GetAPIPath

func (s *Site) GetAPIPath() constants.APIPath

func (*Site) GetID

func (s *Site) GetID() int

Implements IDItem interface.

func (*Site) GetNetboxObject

func (s *Site) GetNetboxObject() *NetboxObject

Implements OrphanItem interface.

func (*Site) GetObjectType

func (s *Site) GetObjectType() constants.ContentType

func (Site) String

func (s Site) String() string

type SiteGroup

type SiteGroup struct {
	NetboxObject
	// Name of the site group. This field is required.
	Name string `json:"name,omitempty"`
	// URL-friendly unique shorthand. This field is required.
	Slug string `json:"slug,omitempty"`
	// Parent SiteGroup of the site group
	Parent *SiteGroup `json:"parent,omitempty"`
}

func (*SiteGroup) GetAPIPath

func (sg *SiteGroup) GetAPIPath() constants.APIPath

func (*SiteGroup) GetID

func (sg *SiteGroup) GetID() int

Implements IDItem interface.

func (*SiteGroup) GetNetboxObject

func (sg *SiteGroup) GetNetboxObject() *NetboxObject

Implements OrphanItem interface.

func (*SiteGroup) GetObjectType

func (sg *SiteGroup) GetObjectType() constants.ContentType

func (SiteGroup) String

func (sg SiteGroup) String() string

type SiteStatus

type SiteStatus struct {
	Choice
}

type Tag

type Tag struct {
	ID          int             `json:"id,omitempty"`
	Name        string          `json:"name,omitempty"`
	Slug        string          `json:"slug,omitempty"`
	Color       constants.Color `json:"color,omitempty"`
	Description string          `json:"description,omitempty"`
}

func (*Tag) GetAPIPath

func (t *Tag) GetAPIPath() constants.APIPath

func (*Tag) GetID

func (t *Tag) GetID() int

Tag implements IDItem interface.

func (*Tag) GetObjectType

func (t *Tag) GetObjectType() constants.ContentType

func (Tag) String

func (t Tag) String() string

type Tenant

type Tenant struct {
	NetboxObject
	// Name is the name of the tenant. This field is required.
	Name string `json:"name,omitempty"`
	// Slug is the URL-friendly version of the tenant name. This field is read-only.
	Slug string `json:"slug,omitempty"`
	// Group is the tenant group to which this tenant belongs.
	Group *TenantGroup `json:"group,omitempty"`
}

func (*Tenant) GetAPIPath

func (t *Tenant) GetAPIPath() constants.APIPath

func (*Tenant) GetID

func (t *Tenant) GetID() int

Tenant implements IDItem interface.

func (*Tenant) GetNetboxObject

func (t *Tenant) GetNetboxObject() *NetboxObject

Tenant implements OrphanItem interface.

func (*Tenant) GetObjectType

func (t *Tenant) GetObjectType() constants.ContentType

func (Tenant) String

func (t Tenant) String() string

type TenantGroup

type TenantGroup struct {
	NetboxObject
	// Name is the name of the tenant group. This field is required.
	Name string `json:"name,omitempty"`
	// Slug is the URL-friendly version of the tenant group name. This field is read-only.
	Slug string `json:"slug,omitempty"`
}

func (*TenantGroup) GetAPIPath

func (tg *TenantGroup) GetAPIPath() constants.APIPath

func (*TenantGroup) GetID

func (tg *TenantGroup) GetID() int

TenantGroup implements IDItem interface.

func (*TenantGroup) GetNetboxObject

func (tg *TenantGroup) GetNetboxObject() *NetboxObject

TenantGroup implements OrphanItem interface.

func (*TenantGroup) GetObjectType

func (tg *TenantGroup) GetObjectType() constants.ContentType

type VDCStatus

type VDCStatus struct {
	Choice
}

Virtual Device Context status.

type VM

type VM struct {
	NetboxObject
	// Name is the name of the virtual machine. This field is required.
	Name string `json:"name,omitempty"`
	// Status is the status of the virtual machine. This field is required.
	Status *VMStatus `json:"status,omitempty"`
	// Site is the site to which this virtual machine belongs.
	Site *Site `json:"site,omitempty"`
	// Cluster is the cluster to which this virtual machine belongs.
	Cluster *Cluster `json:"cluster,omitempty"`
	// Host is a specific host that this virtual machine is hosted on.
	Host *Device `json:"device,omitempty"`

	// TenantGroup is the datacenter that this virtual machine belongs to.
	TenantGroup *TenantGroup `json:"tenant_group,omitempty"`
	// Tenant is the tenant to which this virtual machine belongs.
	Tenant *Tenant `json:"tenant,omitempty"`

	// Platform is the platform of the virtual machine.
	Platform *Platform `json:"platform,omitempty"`
	// PrimaryIPv4 is the primary IPv4 address assigned to the virtual machine.
	PrimaryIPv4 *IPAddress `json:"primary_ip4,omitempty"`
	// PrimaryIPv6 is the primary IPv6 address assigned to the virtual machine.
	PrimaryIPv6 *IPAddress `json:"primary_ip6,omitempty"`

	// VCPUs is the number of virtual CPUs allocated to the virtual machine.
	VCPUs float32 `json:"vcpus,omitempty"`
	// Memory is the amount of memory allocated to the virtual machine in MB.
	Memory int `json:"memory,omitempty"`
	// Disk is the amount of disk space allocated to the virtual machine in GB.
	Disk int `json:"disk,omitempty"`
	// Role of the virtual machine.
	Role *DeviceRole `json:"role,omitempty"`

	// Additional Comments
	Comments string `json:"comments,omitempty"`
}

VM represents a netbox's virtual machine.

func (*VM) GetAPIPath

func (vm *VM) GetAPIPath() constants.APIPath

func (*VM) GetID

func (vm *VM) GetID() int

VM implements IDItem interface.

func (*VM) GetNetboxObject

func (vm *VM) GetNetboxObject() *NetboxObject

VM implements OrphanItem interface.

func (*VM) GetObjectType

func (vm *VM) GetObjectType() constants.ContentType

func (*VM) GetPrimaryIPv4Address

func (vm *VM) GetPrimaryIPv4Address() *IPAddress

VM implements IPAddressOwner interface.

func (*VM) GetPrimaryIPv6Address

func (vm *VM) GetPrimaryIPv6Address() *IPAddress

func (*VM) SetPrimaryIPAddress

func (vm *VM) SetPrimaryIPAddress(ip *IPAddress)

func (*VM) SetPrimaryIPv6Address

func (vm *VM) SetPrimaryIPv6Address(ip *IPAddress)

func (VM) String

func (vm VM) String() string

type VMInterface

type VMInterface struct {
	NetboxObject
	// VM that this interface belongs to. This field is required.
	VM *VM `json:"virtual_machine,omitempty"`
	// Name is the name of the interface. This field is required.
	Name string `json:"name,omitempty"`
	// PrimaryMACAddress is the primary MAC address of the interface.
	PrimaryMACAddress *MACAddress `json:"primary_mac_address,omitempty"`
	// MTU of the interface.
	MTU int `json:"mtu,omitempty"`
	// Enabled is true if interface is enabled, false otherwise.
	Enabled bool `json:"enabled,omitempty"`
	// Related parent interface of this interface.
	ParentInterface *VMInterface `json:"parent,omitempty"`
	// Related bridged interface
	BridgedInterface *VMInterface `json:"bridge,omitempty"`
	// 802.1Q VLAN Tagging Mode
	Mode *VMInterfaceMode `json:"mode,omitempty"`
	// When Mode=VMInterfaceModeTagged: TaggedVlans is a list of all the VLANs that are tagged on the interface.
	TaggedVlans []*Vlan `json:"tagged_vlans,omitempty"`
	// When mode=VMInterfaceModeAccess: UntaggedVlan is the VLAN that is untagged on the interface.
	UntaggedVlan *Vlan `json:"untagged_vlan,omitempty"`
}

func (*VMInterface) GetAPIPath

func (vmi *VMInterface) GetAPIPath() constants.APIPath

func (*VMInterface) GetID

func (vmi *VMInterface) GetID() int

VMInterface implements IDItem interface.

func (*VMInterface) GetNetboxObject

func (vmi *VMInterface) GetNetboxObject() *NetboxObject

VMInterface implements OrphanItem interface.

func (*VMInterface) GetObjectType

func (vmi *VMInterface) GetObjectType() constants.ContentType

func (*VMInterface) GetPrimaryMACAddress

func (vmi *VMInterface) GetPrimaryMACAddress() *MACAddress

VMInterface also implements MACAddressOwner interface.

func (*VMInterface) SetPrimaryMACAddress

func (vmi *VMInterface) SetPrimaryMACAddress(mac *MACAddress)

func (VMInterface) String

func (vmi VMInterface) String() string

type VMInterfaceMode

type VMInterfaceMode struct {
	Choice
}

802.1Q VLAN Tagging Mode (Access, Tagged, Tagged All).

type VMStatus

type VMStatus struct {
	Choice
}

type VidRange

type VidRange [2]int

type VirtualDeviceContext

type VirtualDeviceContext struct {
	NetboxObject
	// Name of the VirtualDeviceContext. This field is required.
	Name string `json:"name,omitempty"`
	// Device that VirtualDeviceContext belongs to. This field is required.
	Device *Device `json:"device,omitempty"`
	// Status of the VirtualDeviceContext. This field is required.
	Status *VDCStatus `json:"status,omitempty"`
	// Unique identifier for VirtualDeviceContext within Single Device.
	Identifier int `json:"identifier,omitempty"`
	// Tenant for this VirtualDeviceContext.
	Tenant *Tenant `json:"tenant,omitempty"`
	// Primary IPv4 for VirtualDeviceContext.
	PrimaryIPv4 *IPAddress `json:"primary_ipv4,omitempty"`
	// Primary IPv6 for VirtualDeviceContext.
	PrimaryIPv6 *IPAddress `json:"primary_ipv6,omitempty"`
}

VirtualDeviceContext represents extra virtual context within a device.

func (*VirtualDeviceContext) GetAPIPath

func (vdc *VirtualDeviceContext) GetAPIPath() constants.APIPath

func (*VirtualDeviceContext) GetID

func (vdc *VirtualDeviceContext) GetID() int

VirtualDeviceContext implements IDItem interface.

func (*VirtualDeviceContext) GetNetboxObject

func (vdc *VirtualDeviceContext) GetNetboxObject() *NetboxObject

VirtualDeviceContext implements OrphanItem interface.

func (*VirtualDeviceContext) GetObjectType

func (vdc *VirtualDeviceContext) GetObjectType() constants.ContentType

func (VirtualDeviceContext) String

func (vdc VirtualDeviceContext) String() string

type VirtualDisk added in v1.11.0

type VirtualDisk struct {
	NetboxObject
	// VM that this disk belongs to. This field is required.
	VM *VM `json:"virtual_machine,omitempty"`
	// Name is the name of the disk. This field is required.
	Name string `json:"name,omitempty"`
	// Size is the size of the disk in MB. This field is required.
	Size int `json:"size,omitempty"`
}

func (*VirtualDisk) GetAPIPath added in v1.11.0

func (vd *VirtualDisk) GetAPIPath() constants.APIPath

func (*VirtualDisk) GetID added in v1.11.0

func (vd *VirtualDisk) GetID() int

VirtualDisk implements IDItem interface.

func (*VirtualDisk) GetNetboxObject added in v1.11.0

func (vd *VirtualDisk) GetNetboxObject() *NetboxObject

VMInterface implements OrphanItem interface.

func (*VirtualDisk) GetObjectType added in v1.11.0

func (vd *VirtualDisk) GetObjectType() constants.ContentType

func (VirtualDisk) String added in v1.11.0

func (vd VirtualDisk) String() string

type Vlan

type Vlan struct {
	NetboxObject
	// Name of the VLAN. This field is required.
	Name string `json:"name,omitempty"`
	// VID of the VLAN. This field is required.
	Vid int `json:"vid,omitempty"`
	// VlanGroup that this vlan belongs to.
	Group *VlanGroup `json:"group,omitempty"`
	// Status of the VLAN. This field is required. Default is "active".
	Status *VlanStatus `json:"status,omitempty"`
	// Tenant that this VLAN belongs to.
	Tenant *Tenant `json:"tenant,omitempty"`
	// Site that this VLAN belongs to.
	Site *Site `json:"site,omitempty"`
	// Comments about this Vlan.
	Comments string `json:"comments,omitempty"`
}

func (*Vlan) GetAPIPath

func (v *Vlan) GetAPIPath() constants.APIPath

func (*Vlan) GetID

func (v *Vlan) GetID() int

Vlan implements IDItem interface.

func (*Vlan) GetNetboxObject

func (v *Vlan) GetNetboxObject() *NetboxObject

Vlan implements OrphanItem interface.

func (*Vlan) GetObjectType

func (v *Vlan) GetObjectType() constants.ContentType

func (Vlan) String

func (v Vlan) String() string

type VlanGroup

type VlanGroup struct {
	NetboxObject
	// Name of the VlanGroup. This field is required.
	Name string `json:"name,omitempty"`
	// Slug of the VlanGroup. This field is required.
	Slug string `json:"slug,omitempty"`
	// VidRanges is a list of VID ranges that this VlanGroup can use.
	VidRanges []VidRange `json:"vid_ranges,omitempty"`
	// ScopeType is the scope of the VlanGroup.
	ScopeType constants.ContentType `json:"scope_type,omitempty"`
	// ScopeID is the ID of the scope object.
	ScopeID int `json:"scope_id,omitempty"`
}

func (*VlanGroup) GetAPIPath

func (vg *VlanGroup) GetAPIPath() constants.APIPath

func (*VlanGroup) GetID

func (vg *VlanGroup) GetID() int

VlanGroup implements IDItem interface.

func (*VlanGroup) GetNetboxObject

func (vg *VlanGroup) GetNetboxObject() *NetboxObject

VlanGroup implements OrphanItem interface.

func (*VlanGroup) GetObjectType

func (vg *VlanGroup) GetObjectType() constants.ContentType

func (VlanGroup) String

func (vg VlanGroup) String() string

type VlanStatus

type VlanStatus struct {
	Choice
}

type WirelessLAN

type WirelessLAN struct {
	NetboxObject
	// SSID is the name of the wireless lan. This field is required.
	SSID string `json:"ssid,omitempty"`
	// Vlan that the wireless lan is associated with.
	Vlan *Vlan `json:"vlan,omitempty"`
	// Group is the group of the wireless lan.
	Group *WirelessLANGroup `json:"group,omitempty"`
	// Status is the status of the wireless lan. This field is required.
	Status *WirelessLANStatus `json:"status,omitempty"`
	// Tenant of the wireless lan.
	Tenant *Tenant `json:"tenant,omitempty"`
	// AuthType is the authentication type of the wireless lan.
	AuthType *WirelessLANAuthType `json:"auth_type,omitempty"`
	// AuthCipher is the authentication cipher of the wireless lan.
	AuthCipher *WirelessLANAuthCipher `json:"auth_cipher,omitempty"`
	// AuthPsk is the pre-shared key of the wireless lan.
	AuthPsk string `json:"auth_psk,omitempty"`
	// Comments is the comments about the wireless lan.
	Comments string `json:"comments,omitempty"`
}

func (*WirelessLAN) GetAPIPath

func (wl *WirelessLAN) GetAPIPath() constants.APIPath

func (*WirelessLAN) GetID

func (wl *WirelessLAN) GetID() int

WirelessLAN implements IDItem interface.

func (*WirelessLAN) GetNetboxObject

func (wl *WirelessLAN) GetNetboxObject() *NetboxObject

WirelessLAN implements OrphanItem interface.

func (*WirelessLAN) GetObjectType

func (wl *WirelessLAN) GetObjectType() constants.ContentType

func (WirelessLAN) String

func (wl WirelessLAN) String() string

type WirelessLANAuthCipher

type WirelessLANAuthCipher struct {
	Choice
}

type WirelessLANAuthType

type WirelessLANAuthType struct {
	Choice
}

type WirelessLANGroup

type WirelessLANGroup struct {
	NetboxObject
	// Name is the name of the wireless lan group. This field is required.
	Name string `json:"name,omitempty"`
	// Slug is the slug of the wireless lan group. This field is required.
	Slug string `json:"slug,omitempty"`
	// Parent is the parent wireless lan group.
	Parent *WirelessLANGroup `json:"parent,omitempty"`
}

func (*WirelessLANGroup) GetAPIPath

func (wlg *WirelessLANGroup) GetAPIPath() constants.APIPath

func (*WirelessLANGroup) GetID

func (wlg *WirelessLANGroup) GetID() int

WirelessLANGroup implements IDItem interface.

func (*WirelessLANGroup) GetNetboxObject

func (wlg *WirelessLANGroup) GetNetboxObject() *NetboxObject

WirelessLANGroup implements OrphanItem interface.

func (*WirelessLANGroup) GetObjectType

func (wlg *WirelessLANGroup) GetObjectType() constants.ContentType

func (WirelessLANGroup) String

func (wlg WirelessLANGroup) String() string

type WirelessLANStatus

type WirelessLANStatus struct {
	Choice
}

Jump to

Keyboard shortcuts

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