ovp8xx

package
v2.8.1 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetEnv

func GetEnv(key, fallback string) string

func IsTimeoutError added in v2.4.0

func IsTimeoutError(err error) bool

IsTimeoutError checks if the given error is a network timeout error. It returns true if the error is a network error and the timeout flag is set, otherwise it returns false.

Types

type Client

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

func NewClient

func NewClient(opts ...ClientOption) *Client

NewClient creates a new OVP8xx client with the provided options. The opts parameter is a variadic parameter that allows specifying multiple client options. Example usage:

client := NewClient(WithHost("192.168.47.11"))
// ...

func (*Client) FactoryReset

func (device *Client) FactoryReset(keepNetworkSettings bool) error

FactoryReset performs a factory reset on the OVP8xx device. If keepNetworkSettings is set to true, the network settings will be preserved after the reset. Returns an error if the factory reset fails or if there is an issue with the XML-RPC client.

func (*Client) Get

func (device *Client) Get(pointers []string) (Config, error)

Get retrieves the configuration for the specified pointers from the OVP8xx device. The pointers parameter is a slice of strings that contains the pointers to retrieve the configuration for. The function returns the retrieved configuration as a Config struct and an error if any occurred. Example usage:

config, err := device.Get([]string{"/device", "/ports"})
// ...

func (*Client) GetDiagnosticClient

func (device *Client) GetDiagnosticClient() *DiagnosisClient

GetDiagnosticClient returns a new instance of DiagnosisClient that can be used to perform diagnostic operations on the OVP8xx device.

func (*Client) GetInit

func (device *Client) GetInit() (Config, error)

GetInit retrieves the initial configuration from the OVP8xx device. It returns a Config struct representing the device configuration and an error if any.

func (*Client) GetSchema

func (device *Client) GetSchema(pointers []string) (string, error)

GetSchema retrieves the schema for the specified pointers from the OVP8xx device. It returns the schema in JSON format as a string. If an error occurs during the retrieval process, it returns an empty string and the error.

func (*Client) IsAvailable added in v2.4.0

func (d *Client) IsAvailable(timeout time.Duration, opts ...WaitForOption) (bool, error)

IsAvailable checks if the client is available by making a XML-RPC get request to query the "/device" object. This is useful to wait until a device is ready for communication. It returns a boolean indicating the availability status and an error if any. The function uses a timeout duration to limit the execution time of the request. Example usage:

ok, err := device.IsAvailable(time.Duration(timeout) * time.Second, ovp8xx.AndPortsAreOnline())
// ...

func (*Client) Reboot

func (device *Client) Reboot() error

Reboot sends a reboot command to the OVP8xx device. If an error occurs during the connection or the method call, it is returned.

func (*Client) RebootToSWUpdate

func (device *Client) RebootToSWUpdate() error

RebootToSWUpdate reboots the OVP8xx device into software update mode. It establishes a connection with the device using XML-RPC and calls the "rebootToRecovery" method. This method is typically used to initiate a firmware update on the device. Returns an error if there was a problem establishing the connection or calling the method.

func (*Client) Remove added in v2.8.0

func (device *Client) Remove(pointer string) error

Remove does remove an element from the device temporary configuration. The scope of this method is limited to the following regular expressions: - ^\/applications\/instances\/app\d+$ - ^\/device\/log\/components\/[a-zA-Z0-9\-_]+$ - ^\/applications\/instances\/app\d+/presets/\d+$

If an error occurs during the connection or the method call, it is returned.

func (*Client) SaveInit

func (device *Client) SaveInit(pointers []string) error

SaveInit saves the configuration of the OVP8xx device. If no pointers are provided, it saves the complete configuration. If pointers are provided, it saves only the specified configuration pointers. It returns an error if there was a problem saving the configuration.

func (*Client) Set

func (device *Client) Set(conf Config) error

Set sets the configuration of the OVP8xx device. It takes a Config object as input and returns an error if any.

type ClientOption

type ClientOption func(c *Client)

func WithHost

func WithHost(host string) ClientOption

WithHost sets the host for the OVP8xx client. It returns a ClientOption function that can be used to configure the client.

type Config

type Config struct {
	JSON string
}

func NewConfig

func NewConfig(opts ...ConfigOption) *Config

func (Config) String

func (c Config) String() string

type ConfigOption

type ConfigOption func(c *Config)

func WitJSONString

func WitJSONString(json string) ConfigOption

type DiagnosisClient

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

func (*DiagnosisClient) GetFilterSchema

func (device *DiagnosisClient) GetFilterSchema() (Config, error)

GetFilterSchema retrieves the filter schema from the DiagnosisClient. It returns a Config object representing the filter schema and an error if any.

func (*DiagnosisClient) GetFiltered

func (device *DiagnosisClient) GetFiltered(conf Config) (Config, error)

GetFiltered retrieves a filtered configuration from the DiagnosisClient. It takes a Config object as input and returns a Config object and an error.

type WaitForConfig added in v2.4.1

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

WaitForConfig represents the configuration for waiting for a specific stage.

type WaitForOption added in v2.4.1

type WaitForOption func(c *WaitForConfig)

WaitForOption is a function type that is used as an option for configuring the behavior of the WaitFor function. It takes a pointer to a WaitForConfig struct as a parameter and can be used to modify its properties.

func AndAppsAreOnline added in v2.4.1

func AndAppsAreOnline() WaitForOption

AndAppsAreOnline returns a WaitForOption function that sets the stage to "applications".

func AndPortsAreOnline added in v2.4.1

func AndPortsAreOnline() WaitForOption

AndPortsAreOnline returns a WaitForOption function that sets the stage to "ports".

Jump to

Keyboard shortcuts

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