db

package
v0.0.0-...-81c02da Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DAO

type DAO struct {
	*redis.Client
}

DAO struct provides access to Redis

func CreateDAO

func CreateDAO(c *config.PluginConfig, sentinelMasterName string, getTLSConfig TLSConfig) *DAO

CreateDAO creates new instance of DAO

func (*DAO) FindChassis

func (c *DAO) FindChassis(chassisOid string) (*redfish.Chassis, error)

FindChassis finds requested chassis or returns nil if chassis doesn't exists

type Key

type Key string

Key is an string alias representing Redis key. Implementation of Key wrapper comes with number of utility functions. Key wraps number of tokens separated with a ":" separator, for example: "foo", "foo:bar", "foo:bar:foobar", etc. Last token is called ID, all other tokens taken together are called PREFIX.

func CreateContainedInKey

func CreateContainedInKey(tokens ...string) Key

CreateContainedInKey utility function which produces key for CONTAINEDIN relation, for example: "CONTAINEDIN:CHASSIS"

func CreateContainsKey

func CreateContainsKey(tokens ...string) Key

CreateContainsKey utility function which produces key for CONTAINS relation, for example: "CONTAINS:CHASSIS"

func CreateKey

func CreateKey(tokens ...string) Key

CreateKey creates new instance of key

func (Key) ID

func (k Key) ID() string

ID returns unwrapped key with trimmed ending wildcard

func (Key) String

func (k Key) String() string

String returns unwrapped key

func (Key) WithWildcard

func (k Key) WithWildcard() Key

WithWildcard returns key which contains value of current key(k) concatenated with wildcard("*")

type TLSConfig

type TLSConfig func(*config.PluginConfig) (*tls.Config, error)

TLSConfig is a custom type created for for function declaration

var GetTLSConfig TLSConfig = func(c *config.PluginConfig) (*tls.Config, error) {
	caCert, err := ioutil.ReadFile(c.PKIRootCAPath)
	if err != nil {
		return &tls.Config{}, err
	}
	pool := x509.NewCertPool()
	pool.AppendCertsFromPEM(caCert)
	cert, err := tls.LoadX509KeyPair(c.PKICertificatePath, c.PKIPrivateKeyPath)
	if err != nil {
		return &tls.Config{}, err
	}
	cfg := &tls.Config{
		RootCAs:      pool,
		MinVersion:   c.TLSConf.MinVersion,
		Certificates: []tls.Certificate{cert},
	}
	return cfg, nil
}

GetTLSConfig gets the plugin configuration and returns the tls client configuration for redis server authentication

Jump to

Keyboard shortcuts

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