store

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InventorySourceYAML = "inventoryStoreYAML"
)

Variables

View Source
var (
	ErrNoAttributes          = errors.New("no flasher attribute found")
	ErrAttributeList         = errors.New("error in serverservice flasher attribute list")
	ErrAttributeCreate       = errors.New("error in serverservice flasher attribute create")
	ErrAttributeUpdate       = errors.New("error in serverservice flasher attribute update")
	ErrVendorModelAttributes = errors.New("device vendor, model attributes not found in serverservice")
	ErrDeviceStatus          = errors.New("error serverservice device status")

	ErrDeviceID = errors.New("device UUID error")

	// ErrBMCAddress is returned when an error occurs in the BMC address lookup.
	ErrBMCAddress = errors.New("error in server BMC Address")

	// ErrDeviceState is returned when an error occurs in the device state  lookup.
	ErrDeviceState = errors.New("error in device state")

	// ErrServerserviceAttrObj is retuned when an error occurred in unpacking the attribute.
	ErrServerserviceAttrObj = errors.New("serverservice attribute error")

	// ErrServerserviceVersionedAttrObj is retuned when an error occurred in unpacking the versioned attribute.
	ErrServerserviceVersionedAttrObj = errors.New("serverservice versioned attribute error")

	// ErrServerserviceQuery is returned when a server service query fails.
	ErrServerserviceQuery = errors.New("serverservice query returned error")

	ErrFirmwareSetLookup = errors.New("firmware set error")
)
View Source
var (
	ErrYamlSource = errors.New("error in Yaml inventory")
)

Functions

This section is empty.

Types

type Mock

type Mock struct{}

func (*Mock) AssetByID

func (s *Mock) AssetByID(_ context.Context, _ string) (*model.Asset, error)

AssetByID returns device attributes by its identifier

func (*Mock) FirmwareByDeviceVendorModel

func (s *Mock) FirmwareByDeviceVendorModel(_ context.Context, _, _ string) ([]*model.Firmware, error)

func (*Mock) FirmwareSetByID

func (s *Mock) FirmwareSetByID(_ context.Context, _ uuid.UUID) ([]*model.Firmware, error)

FirmwareSetByID returns a list of firmwares part of a firmware set identified by the given id.

type Repository

type Repository interface {
	// AssetByID returns asset.
	AssetByID(ctx context.Context, id string) (*model.Asset, error)

	FirmwareSetByID(ctx context.Context, id uuid.UUID) ([]*model.Firmware, error)

	// FirmwareByDeviceVendorModel returns the firmware for the device vendor, model.
	FirmwareByDeviceVendorModel(ctx context.Context, deviceVendor, deviceModel string) ([]*model.Firmware, error)
}

func NewMockInventory

func NewMockInventory() (Repository, error)

func NewServerserviceStore

func NewServerserviceStore(ctx context.Context, config *app.ServerserviceOptions, logger *logrus.Logger) (Repository, error)

func NewYamlInventory

func NewYamlInventory(yamlFile string) (Repository, error)

NewYamlInventory returns a Yaml type that implements the inventory interface.

type Serverservice

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

func (*Serverservice) AssetByID

func (s *Serverservice) AssetByID(ctx context.Context, id string) (*model.Asset, error)

AssetByID returns an Asset object with various attributes populated.

func (*Serverservice) FirmwareByDeviceVendorModel

func (s *Serverservice) FirmwareByDeviceVendorModel(ctx context.Context, deviceVendor, deviceModel string) ([]*model.Firmware, error)

FirmwareByDeviceVendorModel returns the firmware for the device vendor, model.

func (*Serverservice) FirmwareSetByID

func (s *Serverservice) FirmwareSetByID(ctx context.Context, id uuid.UUID) ([]*model.Firmware, error)

FirmwareSetByID returns a list of firmwares part of a firmware set identified by the given id.

type Yaml

type Yaml struct {
	YamlFile string
}

Yaml type implements the inventory interface

func (*Yaml) AssetByID

func (c *Yaml) AssetByID(_ context.Context, _ string) (*model.Asset, error)

AssetByID returns device attributes by its identifier

func (*Yaml) FirmwareByDeviceVendorModel

func (c *Yaml) FirmwareByDeviceVendorModel(_ context.Context, _, _ string) ([]*model.Firmware, error)

FirmwareByDeviceVendorModel returns the firmware for the device vendor, model.

func (*Yaml) FirmwareSetByID

func (c *Yaml) FirmwareSetByID(_ context.Context, _ uuid.UUID) ([]*model.Firmware, error)

FirmwareSetByID returns a list of firmwares part of a firmware set identified by the given id.

Jump to

Keyboard shortcuts

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