storage

package
v0.0.0-...-4a56adb Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitDB

func InitDB() *gorm.DB

InitDB creates and migrates the database

func InitRODB

func InitRODB() *gorm.DB

InitRODB creates a new read only db handler

Types

type BladeStorage

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

BladeStorage stores all of the tasty Blade, needs to be injected into Chassis and Blade Resource. In the real world, you would use a database for that.

func NewBladeStorage

func NewBladeStorage(db *gorm.DB) *BladeStorage

NewBladeStorage initializes the storage

func (BladeStorage) Count

func (b BladeStorage) Count(filters *filter.Filters) (count int, err error)

Count get blades count based on the filter

func (BladeStorage) GetAll

func (b BladeStorage) GetAll(offset string, limit string) (count int, blades []model.Blade, err error)

GetAll of the Blades

func (BladeStorage) GetAllByChassisID

func (b BladeStorage) GetAllByChassisID(offset string, limit string, serials []string) (count int, blades []model.Blade, err error)

GetAllByChassisID retrieve Blades by chassisID

func (BladeStorage) GetAllByDisksID

func (b BladeStorage) GetAllByDisksID(offset string, limit string, serials []string) (count int, blades []model.Blade, err error)

GetAllByDisksID retrieve discretes by disksID

func (BladeStorage) GetAllByFilters

func (b BladeStorage) GetAllByFilters(offset string, limit string, filters *filter.Filters) (count int, blades []model.Blade, err error)

GetAllByFilters get all blades based on the filter

func (BladeStorage) GetAllByNicsID

func (b BladeStorage) GetAllByNicsID(offset string, limit string, macAddresses []string) (count int, blades []model.Blade, err error)

GetAllByNicsID retrieve Blades by nicsID

func (BladeStorage) GetAllByStorageBladesID

func (b BladeStorage) GetAllByStorageBladesID(offset string, limit string, serials []string) (count int, blades []model.Blade, err error)

GetAllByStorageBladesID retrieves Blades by StorageBladesID

func (BladeStorage) GetAllWithAssociations

func (b BladeStorage) GetAllWithAssociations(offset string, limit string, include []string) (count int, blades []model.Blade, err error)

GetAllWithAssociations returns all chassis with their relationships

func (BladeStorage) GetOne

func (b BladeStorage) GetOne(serial string) (blade model.Blade, err error)

GetOne Blade

func (*BladeStorage) RemoveOldDiskRefs

func (b *BladeStorage) RemoveOldDiskRefs(blade *model.Blade) (count int, serials []string, err error)

RemoveOldDiskRefs deletes all the old references from Nics that used to be inside of the chassis

func (*BladeStorage) RemoveOldNicRefs

func (b *BladeStorage) RemoveOldNicRefs(blade *model.Blade) (count int, macAddresses []string, err error)

RemoveOldNicRefs deletes all the old references from Nics that used to be inside of the chassis

func (*BladeStorage) RemoveOldRefs

func (b *BladeStorage) RemoveOldRefs(blade *model.Blade) (err error)

RemoveOldRefs deletes all the old references from all attached components

func (*BladeStorage) UpdateOrCreate

func (b *BladeStorage) UpdateOrCreate(blade *model.Blade) (serial string, err error)

UpdateOrCreate updates or create a new object

type ChassisStorage

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

ChassisStorage stores all Chassis

func NewChassisStorage

func NewChassisStorage(db *gorm.DB) *ChassisStorage

NewChassisStorage initializes the storage

func (ChassisStorage) Count

func (c ChassisStorage) Count(filters *filter.Filters) (count int, err error)

Count get chassis count based on the filter

func (ChassisStorage) GetAll

func (c ChassisStorage) GetAll(offset string, limit string) (count int, chassis []model.Chassis, err error)

GetAll returns all chassis

func (ChassisStorage) GetAllByBladesID

func (c ChassisStorage) GetAllByBladesID(offset string, limit string, serials []string) (count int, chassis []model.Chassis, err error)

GetAllByBladesID Chassis

func (ChassisStorage) GetAllByFansID

func (c ChassisStorage) GetAllByFansID(offset string, limit string, serials []string) (count int, chassis []model.Chassis, err error)

GetAllByFansID Chassis

func (ChassisStorage) GetAllByFilters

func (c ChassisStorage) GetAllByFilters(offset string, limit string, filters *filter.Filters) (count int, chassis []model.Chassis, err error)

GetAllByFilters get all Chassis based on the filter

func (ChassisStorage) GetAllByNicsID

func (c ChassisStorage) GetAllByNicsID(offset string, limit string, macAddresses []string) (count int, chassis []model.Chassis, err error)

GetAllByNicsID retrieve chassis by nicsID

func (ChassisStorage) GetAllByPsusID

func (c ChassisStorage) GetAllByPsusID(offset string, limit string, serials []string) (count int, chassis []model.Chassis, err error)

GetAllByPsusID retrieve chassis by psusID

func (ChassisStorage) GetAllByStorageBladesID

func (c ChassisStorage) GetAllByStorageBladesID(offset string, limit string, serials []string) (count int, chassis []model.Chassis, err error)

GetAllByStorageBladesID Chassis

func (ChassisStorage) GetAllWithAssociations

func (c ChassisStorage) GetAllWithAssociations(offset string, limit string, include []string) (count int, chassis []model.Chassis, err error)

GetAllWithAssociations returns all Chassis with their relationships

func (ChassisStorage) GetOne

func (c ChassisStorage) GetOne(serial string) (chassis model.Chassis, err error)

GetOne Chassis

func (*ChassisStorage) RemoveOldBladesRefs

func (c *ChassisStorage) RemoveOldBladesRefs(chassis *model.Chassis) (count int, serials []string, err error)

RemoveOldBladesRefs deletes all the old references from StorageBlades that used to be inside of the chassis

func (*ChassisStorage) RemoveOldNicRefs

func (c *ChassisStorage) RemoveOldNicRefs(chassis *model.Chassis) (count int, macAddresses []string, err error)

RemoveOldNicRefs deletes all the old references from Nics that used to be inside of the chassis

func (*ChassisStorage) RemoveOldPsuRefs

func (c *ChassisStorage) RemoveOldPsuRefs(chassis *model.Chassis) (count int, serials []string, err error)

RemoveOldPsuRefs deletes all the old references from Psus that used to be inside of the chassis

func (*ChassisStorage) RemoveOldRefs

func (c *ChassisStorage) RemoveOldRefs(chassis *model.Chassis) (err error)

RemoveOldRefs deletes all the old references from all attached components

func (*ChassisStorage) RemoveOldStorageBladesRefs

func (c *ChassisStorage) RemoveOldStorageBladesRefs(chassis *model.Chassis) (count int, serials []string, err error)

RemoveOldStorageBladesRefs deletes all the old references from StorageBlades that used to be inside of the chassis

func (*ChassisStorage) UpdateOrCreate

func (c *ChassisStorage) UpdateOrCreate(chassis *model.Chassis) (serial string, err error)

UpdateOrCreate updates or create a new object

type DiscoverHintStorage

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

DiscoverHintStorage stores all DiscoverHints

func NewDiscoverHintStorage

func NewDiscoverHintStorage(db *gorm.DB) *DiscoverHintStorage

NewDiscoverHintStorage initializes the storage

func (DiscoverHintStorage) Count

func (s DiscoverHintStorage) Count(filters *filter.Filters) (count int, err error)

Count gets DiscoverHints count based on the filter

func (DiscoverHintStorage) GetAll

func (s DiscoverHintStorage) GetAll(offset string, limit string) (count int, ips []model.DiscoverHint, err error)

GetAll of the DiscoverHints

func (DiscoverHintStorage) GetAllByFilters

func (s DiscoverHintStorage) GetAllByFilters(offset string, limit string, filters *filter.Filters) (count int, ips []model.DiscoverHint, err error)

GetAllByFilters get all Discover Hints based on the filter

func (DiscoverHintStorage) GetOne

func (s DiscoverHintStorage) GetOne(id string) (scan model.DiscoverHint, err error)

GetOne Host

type DiscreteStorage

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

DiscreteStorage stores all of the tasty Discrete, needs to be injected into Chassis and Discrete Resource. In the real world, you would use a database for that.

func NewDiscreteStorage

func NewDiscreteStorage(db *gorm.DB) *DiscreteStorage

NewDiscreteStorage initializes the storage

func (DiscreteStorage) Count

func (d DiscreteStorage) Count(filters *filter.Filters) (count int, err error)

Count get discretes count based on the filter

func (DiscreteStorage) GetAll

func (d DiscreteStorage) GetAll(offset string, limit string) (count int, discretes []model.Discrete, err error)

GetAll of the Discretes

func (DiscreteStorage) GetAllByDisksID

func (d DiscreteStorage) GetAllByDisksID(offset string, limit string, serials []string) (count int, discretes []model.Discrete, err error)

GetAllByDisksID retrieve discretes by disksID

func (DiscreteStorage) GetAllByFilters

func (d DiscreteStorage) GetAllByFilters(offset string, limit string, filters *filter.Filters) (count int, discretes []model.Discrete, err error)

GetAllByFilters get all discretes based on the filter

func (DiscreteStorage) GetAllByNicsID

func (d DiscreteStorage) GetAllByNicsID(offset string, limit string, macAddresses []string) (count int, discretes []model.Discrete, err error)

GetAllByNicsID retrieve Discretes by nicsID

func (DiscreteStorage) GetAllByPsusID

func (d DiscreteStorage) GetAllByPsusID(offset string, limit string, serials []string) (count int, discretes []model.Discrete, err error)

GetAllByPsusID retrieve discretes by psusID

func (DiscreteStorage) GetAllWithAssociations

func (d DiscreteStorage) GetAllWithAssociations(offset string, limit string, include []string) (count int, discretes []model.Discrete, err error)

GetAllWithAssociations returns all chassis with their relationships

func (DiscreteStorage) GetOne

func (d DiscreteStorage) GetOne(serial string) (discrete model.Discrete, err error)

GetOne Discrete

func (*DiscreteStorage) RemoveOldDiskRefs

func (d *DiscreteStorage) RemoveOldDiskRefs(discrete *model.Discrete) (count int, serials []string, err error)

RemoveOldDiskRefs deletes all the old references from Nics that used to be inside of the chassis

func (*DiscreteStorage) RemoveOldNicRefs

func (d *DiscreteStorage) RemoveOldNicRefs(discrete *model.Discrete) (count int, macAddresses []string, err error)

RemoveOldNicRefs deletes all the old references from Nics that used to be inside of the chassis

func (*DiscreteStorage) RemoveOldPsuRefs

func (d *DiscreteStorage) RemoveOldPsuRefs(discrete *model.Discrete) (count int, serials []string, err error)

RemoveOldPsuRefs deletes all the old references from Psus that used to be inside of the chassis

func (*DiscreteStorage) RemoveOldRefs

func (d *DiscreteStorage) RemoveOldRefs(discrete *model.Discrete) (err error)

RemoveOldRefs deletes all the old references from all attached components

func (*DiscreteStorage) UpdateOrCreate

func (d *DiscreteStorage) UpdateOrCreate(discrete *model.Discrete) (serial string, err error)

UpdateOrCreate updates or create a new object

type DiskStorage

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

DiskStorage stores all disks used by blades

func NewDiskStorage

func NewDiskStorage(db *gorm.DB) *DiskStorage

NewDiskStorage initializes the storage

func (DiskStorage) Count

func (d DiskStorage) Count(filters *filter.Filters) (count int, err error)

Count get disks count based on the filter

func (DiskStorage) GetAll

func (d DiskStorage) GetAll(offset string, limit string) (count int, disks []model.Disk, err error)

GetAll disks

func (DiskStorage) GetAllByBladeID

func (d DiskStorage) GetAllByBladeID(offset string, limit string, serials []string) (count int, disks []model.Disk, err error)

GetAllByBladeID of the disks by BladeID

func (DiskStorage) GetAllByDiscreteID

func (d DiskStorage) GetAllByDiscreteID(offset string, limit string, serials []string) (count int, disks []model.Disk, err error)

GetAllByDiscreteID of the disks by DiscreteID

func (DiskStorage) GetAllByFilters

func (d DiskStorage) GetAllByFilters(offset string, limit string, filters *filter.Filters) (count int, disks []model.Disk, err error)

GetAllByFilters get all blades based on the filter

func (DiskStorage) GetAllWithAssociations

func (d DiskStorage) GetAllWithAssociations(offset string, limit string, include []string) (count int, disks []model.Disk, err error)

GetAllWithAssociations returns all chassis with their relationships

func (DiskStorage) GetOne

func (d DiskStorage) GetOne(serial string) (Disk model.Disk, err error)

GetOne z

type FanStorage

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

FanStorage stores all fans used by blades

func NewFanStorage

func NewFanStorage(db *gorm.DB) *FanStorage

NewFanStorage initializes the storage

func (FanStorage) Count

func (f FanStorage) Count(filters *filter.Filters) (count int, err error)

Count get fans count based on the filter

func (FanStorage) GetAll

func (f FanStorage) GetAll(offset string, limit string) (count int, fans []model.Fan, err error)

GetAll fans

func (FanStorage) GetAllByChassisID

func (f FanStorage) GetAllByChassisID(offset string, limit string, serials []string) (count int, fans []model.Fan, err error)

GetAllByChassisID of the fans by ChassisID

func (FanStorage) GetAllByDiscreteID

func (f FanStorage) GetAllByDiscreteID(offset string, limit string, serials []string) (count int, fans []model.Fan, err error)

GetAllByDiscreteID of the fans by DiscreteID

func (FanStorage) GetAllByFilters

func (f FanStorage) GetAllByFilters(offset string, limit string, filters *filter.Filters) (count int, fans []model.Fan, err error)

GetAllByFilters get all blades based on the filter

func (FanStorage) GetAllWithAssociations

func (f FanStorage) GetAllWithAssociations(offset string, limit string, include []string) (count int, fans []model.Fan, err error)

GetAllWithAssociations returns all chassis with their relationships

func (FanStorage) GetOne

func (f FanStorage) GetOne(serial string) (fan model.Fan, err error)

GetOne fan

type NicStorage

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

NicStorage stores all nics used by blades

func NewNicStorage

func NewNicStorage(db *gorm.DB) *NicStorage

NewNicStorage initializes the storage

func (NicStorage) Count

func (n NicStorage) Count(filters *filter.Filters) (count int, err error)

Count get nics count based on the filter

func (NicStorage) GetAll

func (n NicStorage) GetAll(offset string, limit string) (count int, nics []model.Nic, err error)

GetAll nics

func (NicStorage) GetAllByBladeID

func (n NicStorage) GetAllByBladeID(offset string, limit string, serials []string) (count int, nics []model.Nic, err error)

GetAllByBladeID of the nics by BladeID

func (NicStorage) GetAllByChassisID

func (n NicStorage) GetAllByChassisID(offset string, limit string, serials []string) (count int, nics []model.Nic, err error)

GetAllByChassisID of the nics by ChassisID

func (NicStorage) GetAllByDiscreteID

func (n NicStorage) GetAllByDiscreteID(offset string, limit string, serials []string) (count int, nics []model.Nic, err error)

GetAllByDiscreteID of the nics by DiscreteID

func (NicStorage) GetAllByFilters

func (n NicStorage) GetAllByFilters(offset string, limit string, filters *filter.Filters) (count int, nics []model.Nic, err error)

GetAllByFilters get all blades based on the filter

func (NicStorage) GetAllWithAssociations

func (n NicStorage) GetAllWithAssociations(offset string, limit string, include []string) (count int, nics []model.Nic, err error)

GetAllWithAssociations returns all chassis with their relationships

func (NicStorage) GetOne

func (n NicStorage) GetOne(macAddress string) (nic model.Nic, err error)

GetOne nic

type PsuStorage

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

PsuStorage stores all psus used by blades

func NewPsuStorage

func NewPsuStorage(db *gorm.DB) *PsuStorage

NewPsuStorage initializes the storage

func (PsuStorage) Count

func (p PsuStorage) Count(filters *filter.Filters) (count int, err error)

Count get psus count based on the filter

func (PsuStorage) GetAll

func (p PsuStorage) GetAll(offset string, limit string) (count int, psus []model.Psu, err error)

GetAll psus

func (PsuStorage) GetAllByChassisID

func (p PsuStorage) GetAllByChassisID(offset string, limit string, serials []string) (count int, psus []model.Psu, err error)

GetAllByChassisID of the psus by ChassisID

func (PsuStorage) GetAllByDiscreteID

func (p PsuStorage) GetAllByDiscreteID(offset string, limit string, serials []string) (count int, psus []model.Psu, err error)

GetAllByDiscreteID of the psus by DiscreteID

func (PsuStorage) GetAllByFilters

func (p PsuStorage) GetAllByFilters(offset string, limit string, filters *filter.Filters) (count int, psus []model.Psu, err error)

GetAllByFilters get all blades based on the filter

func (PsuStorage) GetAllWithAssociations

func (p PsuStorage) GetAllWithAssociations(offset string, limit string, include []string) (count int, psus []model.Psu, err error)

GetAllWithAssociations returns all chassis with their relationships

func (PsuStorage) GetOne

func (p PsuStorage) GetOne(serial string) (psu model.Psu, err error)

GetOne psu

type ScannedPortStorage

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

ScannedPortStorage stores all ScannedPorts

func NewScannedPortStorage

func NewScannedPortStorage(db *gorm.DB) *ScannedPortStorage

NewScannedPortStorage initializes the storage

func (ScannedPortStorage) Count

func (s ScannedPortStorage) Count(filters *filter.Filters) (count int, err error)

Count get ScannedPorts count based on the filter

func (ScannedPortStorage) GetAll

func (s ScannedPortStorage) GetAll(offset string, limit string) (count int, ports []model.ScannedPort, err error)

GetAll of the ScannedPorts

func (ScannedPortStorage) GetAllByFilters

func (s ScannedPortStorage) GetAllByFilters(offset string, limit string, filters *filter.Filters) (count int, ports []model.ScannedPort, err error)

GetAllByFilters get all chassis based on the filter

func (ScannedPortStorage) GetOne

func (s ScannedPortStorage) GetOne(id string) (scan model.ScannedPort, err error)

GetOne Host

type StorageBladeStorage

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

StorageBladeStorage stores all the storage blades we have in the company

func NewStorageBladeStorage

func NewStorageBladeStorage(db *gorm.DB) *StorageBladeStorage

NewStorageBladeStorage initializes the storage

func (StorageBladeStorage) Count

func (b StorageBladeStorage) Count(filters *filter.Filters) (count int, err error)

Count get blades count based on the filter

func (StorageBladeStorage) GetAll

func (b StorageBladeStorage) GetAll(offset string, limit string) (count int, storageBlades []model.StorageBlade, err error)

GetAll of the Blades

func (StorageBladeStorage) GetAllByBladeID

func (b StorageBladeStorage) GetAllByBladeID(offset string, limit string, serials []string) (count int, storageBlades []model.StorageBlade, err error)

GetAllByBladeID retrieves StorageBlades by bladesID

func (StorageBladeStorage) GetAllByChassisID

func (b StorageBladeStorage) GetAllByChassisID(offset string, limit string, serials []string) (count int, storageBlades []model.StorageBlade, err error)

GetAllByChassisID retrieves StorageBlades by chassisID

func (StorageBladeStorage) GetAllByFilters

func (b StorageBladeStorage) GetAllByFilters(offset string, limit string, filters *filter.Filters) (count int, storageBlades []model.StorageBlade, err error)

GetAllByFilters get all StorageBlades based on the filter

func (StorageBladeStorage) GetAllWithAssociations

func (b StorageBladeStorage) GetAllWithAssociations(offset string, limit string, include []string) (count int, storageBlades []model.StorageBlade, err error)

GetAllWithAssociations returns all chassis with their relationships

func (StorageBladeStorage) GetOne

func (b StorageBladeStorage) GetOne(serial string) (storageBlade model.StorageBlade, err error)

GetOne StorageBlade

func (*StorageBladeStorage) UpdateOrCreate

func (b *StorageBladeStorage) UpdateOrCreate(storageBlade *model.StorageBlade) (serial string, err error)

UpdateOrCreate a StorageBlade

Jump to

Keyboard shortcuts

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