devices

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package devices devices/devices.go

Package devices devices/ngfw.go

Package devices devices/panorama.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertInventoryToDeviceList added in v1.0.1

func ConvertInventoryToDeviceList(inventory *config.Inventory) []map[string]string

ConvertInventoryToDeviceList converts the devices in an inventory to a list of maps with "hostname" and "ip-address" keys. It takes in an `inventory` of type `*config.Inventory` and returns a slice of `map[string]string`. Each map in the slice represents a device in the inventory, with "hostname" as the key and the device's hostname as the value, and "ip-address" as the key and the device's IP address as the value. The function iterates over the devices in the inventory and appends a map for each device to the `deviceList` slice. Finally, it returns the `deviceList` slice.

Types

type DeviceManager

type DeviceManager struct {
	// contains filtered or unexported fields
}

DeviceManager handles device-related operations

func NewDeviceManager

func NewDeviceManager(conf *config.Config, l *logger.Logger) *DeviceManager

NewDeviceManager creates a new instance of DeviceManager with the provided configuration and logger. The panosClientFactory field is set to nil initially and can be set later based on the workflow. The function returns a pointer to the created DeviceManager.

func (*DeviceManager) GetDeviceList

func (dm *DeviceManager) GetDeviceList(noPanorama bool) ([]map[string]string, error)

GetDeviceList retrieves a list of devices and their information. If noPanorama is true, it retrieves the devices from the local inventory file. If noPanorama is false, it retrieves the devices from Panorama. It returns the list of devices as an array of maps, where each map contains the device information.

func (*DeviceManager) SetNgfwWorkflow added in v1.0.1

func (dm *DeviceManager) SetNgfwWorkflow()

SetNgfwWorkflow sets the PAN-OS client factory to create a real PAN-OS client for NGFW.

func (*DeviceManager) SetPanoramaWorkflow added in v1.0.1

func (dm *DeviceManager) SetPanoramaWorkflow()

SetPanoramaWorkflow sets the PAN-OS client factory to create a real Panorama client.

type PanosClient added in v1.0.1

type PanosClient interface {
	Initialize() error
	Op(cmd interface{}, vsys string, extras interface{}, ans interface{}) ([]byte, error)
}

PanosClient interface for the PAN-OS operations we need

type PanosClientFactory added in v1.0.1

type PanosClientFactory func(hostname, username, password string) PanosClient

PanosClientFactory is a function type that creates a PanosClient

Jump to

Keyboard shortcuts

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