vmanage

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL         string
	Username        string
	Password        string
	Session         *http.Cookie
	Token           string
	TLSClientConfig *tls.Config
}

func NewClient

func NewClient(baseURL string, username string, password string) *Client

func (*Client) Device

func (c *Client) Device(ctx context.Context) ([]Device, error)

func (*Client) DeviceCounter

func (c *Client) DeviceCounter(ctx context.Context) ([]DeviceCounter, error)

func (*Client) DeviceInterface

func (c *Client) DeviceInterface(ctx context.Context, synced bool, options *DeviceInterfaceListOptions) ([]DeviceInterface, error)

func (*Client) DeviceMonitor

func (c *Client) DeviceMonitor(ctx context.Context) ([]DeviceMonitor, error)

func (*Client) DeviceStateSystemStatus

func (c *Client) DeviceStateSystemStatus(ctx context.Context) ([]DeviceStateSystemStatus, error)

func (*Client) DeviceSystemStatus

func (c *Client) DeviceSystemStatus(ctx context.Context, synced bool, options *DeviceSystemStatusListOptions) ([]DeviceSystemStatus, error)

func (*Client) Fetch

func (c *Client) Fetch(ctx context.Context, endpoint string, options FetchOptions, results interface{}) (interface{}, error)

func (*Client) Login

func (c *Client) Login() error

func (*Client) Logout

func (c *Client) Logout() error

func (*Client) Request

func (c *Client) Request() (*resty.Request, error)

type Device

type Device struct {
	DeviceID            string   `json:"deviceId"`
	SystemIP            string   `json:"system-ip"`
	Hostname            string   `json:"host-name"`
	Reachability        string   `json:"reachability"`
	Status              string   `json:"status"`
	Personality         string   `json:"personality"`
	DeviceType          string   `json:"device-type"`
	Timezone            string   `json:"timezone"`
	DeviceGroups        []string `json:"device-groups"`
	Lastupdated         int64    `json:"lastupdated"`
	DomainID            string   `json:"domain-id,omitempty"`
	BoardSerial         string   `json:"board-serial"`
	CertificateValidity string   `json:"certificate-validity"`
	MaxControllers      string   `json:"max-controllers,omitempty"`
	UUID                string   `json:"uuid"`
	ControlConnections  string   `json:"controlConnections,omitempty"`
	DeviceModel         string   `json:"device-model"`
	Version             string   `json:"version"`
	ConnectedVManages   []string `json:"connectedVManages"`
	SiteID              string   `json:"site-id"`
	Latitude            string   `json:"latitude"`
	Longitude           string   `json:"longitude"`
	IsDeviceGeoData     bool     `json:"isDeviceGeoData"`
	Platform            string   `json:"platform"`
	UptimeDate          int64    `json:"uptime-date"`
	StatusOrder         int      `json:"statusOrder"`
	DeviceOS            string   `json:"device-os"`
	Validity            string   `json:"validity"`
	State               string   `json:"state"`
	StateDescription    string   `json:"state_description"`
	ModelSKU            string   `json:"model_sku"`
	LocalSystemIP       string   `json:"local-system-ip"`
	TotalCPUCount       string   `json:"total_cpu_count"`
	TestbedMode         bool     `json:"testbed_mode"`
	LayoutLevel         int      `json:"layoutLevel"`
	OmpPeers            string   `json:"ompPeers,omitempty"`
	LinuxCPUCount       string   `json:"linux_cpu_count,omitempty"`
}

func (*Device) IsReachable

func (d *Device) IsReachable() bool

type DeviceCounter

type DeviceCounter struct {
	SystemIP                       string `json:"system-ip"`
	NumberVsmartControlConnections int    `json:"number-vsmart-control-connections,omitempty"`
	ExpectedControlConnections     int    `json:"expectedControlConnections,omitempty"`
	OmpPeersUp                     int    `json:"ompPeersUp,omitempty"`
	OmpPeersDown                   int    `json:"ompPeersDown,omitempty"`
	RebootCount                    int    `json:"rebootCount"`
	CrashCount                     int    `json:"crashCount"`
}

type DeviceCounterList

type DeviceCounterList struct {
	Data []DeviceCounter `json:"data"`
}

type DeviceInterface

type DeviceInterface struct {
	VdeviceName      string      `json:"vdevice-name"`
	RxErrors         int         `json:"rx-errors,omitempty"`
	TxKbps           int         `json:"tx-kbps,omitempty"`
	IfAdminStatus    string      `json:"if-admin-status"`
	TxErrors         int         `json:"tx-errors,omitempty"`
	TxPps            int         `json:"tx-pps,omitempty"`
	Ifname           string      `json:"ifname"`
	RxPps            int         `json:"rx-pps,omitempty"`
	AfType           string      `json:"af-type"`
	IfOperStatus     string      `json:"if-oper-status"`
	IfIndex          interface{} `json:"ifindex"` // some types return int, some string
	RxPackets        int         `json:"rx-packets,omitempty"`
	SecondaryAddress string      `json:"secondary-address,omitempty"`
	VpnID            string      `json:"vpn-id"`
	VdeviceHostName  string      `json:"vdevice-host-name"`
	RxDrops          int         `json:"rx-drops,omitempty"`
	TxDrops          int         `json:"tx-drops,omitempty"`
	Uptime           string      `json:"uptime,omitempty"`
	Ipv6Address      string      `json:"ipv6-address"`
	Secondary        string      `json:"secondary,omitempty"`
	IPAddress        string      `json:"ip-address"`
	Hwaddr           string      `json:"hwaddr,omitempty"`
	VdeviceDataKey   string      `json:"vdevice-dataKey"`
	TxOctets         int         `json:"tx-octets,omitempty"`
	TxPackets        int         `json:"tx-packets,omitempty"`
	RxOctets         int         `json:"rx-octets,omitempty"`
	RxKbps           int         `json:"rx-kbps,omitempty"`
	Lastupdated      int64       `json:"lastupdated"`
	PortType         string      `json:"port-type,omitempty"`
	UptimeDate       int64       `json:"uptime-date,omitempty"`
	EncapType        string      `json:"encap-type,omitempty"`
}

TODO: consolidate different interface types?

func (*DeviceInterface) IfIndexInt

func (d *DeviceInterface) IfIndexInt() int

func (*DeviceInterface) IsUpAdmin

func (d *DeviceInterface) IsUpAdmin() bool

func (*DeviceInterface) IsUpOper

func (d *DeviceInterface) IsUpOper() bool

type DeviceInterfaceList

type DeviceInterfaceList struct {
	Data []DeviceInterface `json:"data"`
}

type DeviceInterfaceListOptions

type DeviceInterfaceListOptions struct {
	VpnID    string `url:"vpn-id,omitempty"`
	Ifname   string `url:"ifname,omitempty"`
	AfType   string `url:"af-type,omitempty"`
	DeviceID string `url:"deviceId,omitempty"`
}

func (*DeviceInterfaceListOptions) Params

type DeviceList

type DeviceList struct {
	Data []Device `json:"data"`
}

type DeviceMonitor

type DeviceMonitor struct {
	DeviceModel string `json:"device-model"`
	DeviceType  string `json:"device-type"`
	SystemIP    string `json:"system-ip"`
	ID          int    `json:"_id"`
	HostName    string `json:"host-name"`
	SiteID      string `json:"site-id"`
	LayoutLevel int    `json:"layoutLevel"`
	Status      string `json:"status"`
}

type DeviceMonitorList

type DeviceMonitorList struct {
	Data []DeviceMonitor `json:"data"`
}

type DeviceStateSystemStatus

type DeviceStateSystemStatus struct {
	RecordID                string `json:"recordId"`
	BoardType               string `json:"board_type"`
	VdeviceName             string `json:"vdevice-name"`
	TotalCPUCount           string `json:"total_cpu_count"`
	RebootType              string `json:"reboot_type"`
	FpCPUCount              string `json:"fp_cpu_count,omitempty"`
	StateDescription        string `json:"state_description"`
	Rid                     int    `json:"@rid"`
	Personality             string `json:"personality"`
	DiskStatus              string `json:"disk_status"`
	State                   string `json:"state"`
	LinuxCPUCount           string `json:"linux_cpu_count,omitempty"`
	RebootReason            string `json:"reboot_reason"`
	TestbedMode             string `json:"testbed_mode"`
	CreateTimeStamp         int64  `json:"createTimeStamp"`
	ModelSku                string `json:"model_sku"`
	VdeviceHostName         string `json:"vdevice-host-name"`
	Version                 string `json:"version"`
	TcpdCPUCount            string `json:"tcpd_cpu_count,omitempty"`
	VdeviceDataKey          string `json:"vdevice-dataKey"`
	VmanageSystemIP         string `json:"vmanage-system-ip"`
	BootloaderVersion       string `json:"bootloader_version"`
	FipsMode                string `json:"fips_mode"`
	Lastupdated             int64  `json:"lastupdated"`
	BuildNumber             string `json:"build_number"`
	LoghostStatus           string `json:"loghost_status"`
	UptimeDate              int64  `json:"uptime-date"`
	VmanageStorageDiskMount string `json:"vmanage-storage-disk-mount,omitempty"`
}

type DeviceStateSystemStatusList

type DeviceStateSystemStatusList struct {
	Data []DeviceStateSystemStatus `json:"data"`
}

type DeviceSystemStatus

type DeviceSystemStatus struct {
	MemUsed                  string `json:"mem_used"`
	Procs                    string `json:"procs"`
	DiskAvail                string `json:"disk_avail"`
	DiskMount                string `json:"disk_mount"`
	BoardType                string `json:"board_type"`
	VdeviceName              string `json:"vdevice-name"`
	TotalCPUCount            string `json:"total_cpu_count"`
	MemCached                string `json:"mem_cached"`
	Timezone                 string `json:"timezone"`
	DiskFs                   string `json:"disk_fs"`
	FpCPUCount               string `json:"fp_cpu_count"`
	ChassisSerialNumber      string `json:"chassis-serial-number"`
	Min1Avg                  string `json:"min1_avg"`
	StateDescription         string `json:"state_description"`
	Personality              string `json:"personality"`
	DiskUsed                 string `json:"disk_used"`
	DiskUse                  string `json:"disk_use"`
	DiskStatus               string `json:"disk_status"`
	State                    string `json:"state"`
	ConfigDateDateTimeString string `json:"config_date/date-time-string"`
	LinuxCPUCount            string `json:"linux_cpu_count"`
	CPUUser                  string `json:"cpu_user"`
	TestbedMode              string `json:"testbed_mode"`
	Min15Avg                 string `json:"min15_avg"`
	DiskSize                 string `json:"disk_size"`
	CPUIdle                  string `json:"cpu_idle"`
	MemBuffers               string `json:"mem_buffers"`
	ModelSku                 string `json:"model_sku"`
	CPUSystem                string `json:"cpu_system"`
	Version                  string `json:"version"`
	Min5Avg                  string `json:"min5_avg"`
	TcpdCPUCount             string `json:"tcpd_cpu_count"`
	VdeviceHostName          string `json:"vdevice-host-name"`
	MemTotal                 string `json:"mem_total"`
	Uptime                   string `json:"uptime"`
	VdeviceDataKey           string `json:"vdevice-dataKey"`
	MemFree                  string `json:"mem_free"`
	BootloaderVersion        string `json:"bootloader_version"`
	FipsMode                 string `json:"fips_mode"`
	BuildNumber              string `json:"build_number"`
	Lastupdated              int64  `json:"lastupdated"`
	LoghostStatus            string `json:"loghost_status"`
	UptimeDate               int64  `json:"uptime-date"`
}

func (*DeviceSystemStatus) CPU

func (*DeviceSystemStatus) Memory

type DeviceSystemStatusCPU

type DeviceSystemStatusCPU struct {
	UserPercentage   float64
	SystemPercentage float64
	IdlePercentage   float64
	LoadAvg1         float64
	LoadAvg5         float64
	LoadAvg15        float64
}

type DeviceSystemStatusList

type DeviceSystemStatusList struct {
	Data []DeviceSystemStatus `json:"data"`
}

type DeviceSystemStatusListOptions

type DeviceSystemStatusListOptions struct {
	DeviceID string `url:"deviceId,omitempty"`
}

func (*DeviceSystemStatusListOptions) Params

type DeviceSystemStatusMemory

type DeviceSystemStatusMemory struct {
	Used    int
	Free    int
	Total   int
	Buffers int
	Cached  int
}

type FetchOptions

type FetchOptions interface {
	Params() url.Values
}

Jump to

Keyboard shortcuts

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