communicator

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: BSD-2-Clause Imports: 23 Imported by: 0

Documentation

Overview

Package communicator contains the logic for interacting with device classes. It contains methods that read out the .yaml files representing device classes. On top of that, code communicators that extend .yaml files can be added here.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MatchDeviceClass

func MatchDeviceClass(ctx context.Context, identifier string) (bool, error)

MatchDeviceClass checks if the device class in the context matches the given identifier.

Types

type Condition

type Condition struct {
	Type      string    `yaml:"type"`
	MatchMode matchMode `yaml:"match_mode" mapstructure:"match_mode"`
	Value     []string  `yaml:"values" mapstructure:"values"`
}

Condition is a single condition.

type ConditionSet

type ConditionSet struct {
	LogicalOperator logicalOperator
	Conditions      []condition
}

ConditionSet defines a set of conditions.

type HTTPCondition

type HTTPCondition struct {
	Condition `yaml:",inline" mapstructure:",squash"`
	URI       string
}

HTTPCondition is a condition based on http.

type ModelCondition

type ModelCondition struct {
	Condition `yaml:",inline" mapstructure:",squash"`
}

ModelCondition is a condition based on a model.

type ModelSeriesCondition

type ModelSeriesCondition struct {
	Condition `yaml:",inline" mapstructure:",squash"`
}

ModelSeriesCondition is a condition based on a model series.

type NetworkDeviceCommunicator

type NetworkDeviceCommunicator interface {

	// GetDeviceClass returns the device class of a network device.
	GetDeviceClass() string

	// GetAvailableComponents returns the components available for a network device.
	GetAvailableComponents() []string

	// GetIdentifyProperties returns the identify properties of a device like vendor, model...
	GetIdentifyProperties(ctx context.Context) (device.Properties, error)

	// GetCPUComponent returns the cpu component of a device if available.
	GetCPUComponent(ctx context.Context) (device.CPUComponent, error)

	// GetUPSComponent returns the ups component of a device if available.
	GetUPSComponent(ctx context.Context) (device.UPSComponent, error)

	// GetSBCComponent returns the sbc component of a device if available.
	GetSBCComponent(ctx context.Context) (device.SBCComponent, error)

	// GetServerComponent returns the sbc component of a device if available.
	GetServerComponent(ctx context.Context) (device.ServerComponent, error)

	// GetDiskComponent returns the disk component of a device if available.
	GetDiskComponent(ctx context.Context) (device.DiskComponent, error)

	// GetHardwareHealthComponent returns the hardware health component of a device if available.
	GetHardwareHealthComponent(ctx context.Context) (device.HardwareHealthComponent, error)
	// contains filtered or unexported methods
}

NetworkDeviceCommunicator represents a communicator for a device.

func CreateNetworkDeviceCommunicator

func CreateNetworkDeviceCommunicator(ctx context.Context, deviceClassIdentifier string) (NetworkDeviceCommunicator, error)

CreateNetworkDeviceCommunicator creates a communicator.

func IdentifyNetworkDeviceCommunicator

func IdentifyNetworkDeviceCommunicator(ctx context.Context) (NetworkDeviceCommunicator, error)

IdentifyNetworkDeviceCommunicator identifies a devices and creates a network device communicator.

type SnmpCondition

type SnmpCondition struct {
	Condition                    `yaml:",inline" mapstructure:",squash"`
	network.SNMPGetConfiguration `yaml:",inline" mapstructure:",squash"`
}

SnmpCondition is a condition based on snmp.

type VendorCondition

type VendorCondition struct {
	Condition `yaml:",inline" mapstructure:",squash"`
}

VendorCondition is a condition based on a vendor.

Jump to

Keyboard shortcuts

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