netbox

package
v0.0.0-...-7f29812 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2025 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device struct {
	ID         int    `json:"id"`
	Name       string `json:"name"`
	DeviceType struct {
		ID           int `json:"id"`
		Manufacturer struct {
			ID   int    `json:"id"`
			Name string `json:"name"`
		} `json:"manufacturer"`
		Model string `json:"model"`
	} `json:"device_type"`
	Role struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"role"`
	Tenant struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"tenant"`
	Site struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"site"`
	Status struct {
		Value string `json:"value"`
		Label string `json:"label"`
	} `json:"status"`
	PrimaryIP4 struct {
		ID      int    `json:"id"`
		Address string `json:"address"`
	} `json:"primary_ip4"`
	PrimaryIP6  interface{} `json:"primary_ip6"` // Can be null or an object
	Description string      `json:"description"`
	Created     string      `json:"created"`
	LastUpdated string      `json:"last_updated"`
}

Device represents a NetBox device as returned by the API.

type DeviceResponse

type DeviceResponse struct {
	Results  []Device `json:"results"`
	Count    int      `json:"count"`
	Next     string   `json:"next"`     // Pagination URL
	Previous string   `json:"previous"` // Pagination URL
}

DeviceResponse represents the NetBox API response.

type NetboxIntegration

type NetboxIntegration struct {
	Config        models.SourceConfig
	KvClient      proto.KVServiceClient // For writing sweep Config
	GrpcConn      *grpc.ClientConn      // Connection to reuse
	ServerName    string
	ExpandSubnets bool
}

NetboxIntegration manages the NetBox API integration.

func (*NetboxIntegration) Fetch

func (n *NetboxIntegration) Fetch(ctx context.Context) (map[string][]byte, error)

Fetch retrieves devices from NetBox and generates sweep config.

Jump to

Keyboard shortcuts

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