model

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: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blade

type Blade struct {
	Serial               string       `json:"serial" gorm:"primary_key"`
	Name                 string       `json:"name"`
	BiosVersion          string       `json:"bios_version"`
	BmcType              string       `json:"bmc_type"`
	BmcAddress           string       `json:"bmc_address"`
	BmcVersion           string       `json:"bmc_version"`
	BmcSSHReachable      bool         `json:"bmc_ssh_reachable"`
	BmcWEBReachable      bool         `json:"bmc_web_reachable"`
	BmcIpmiReachable     bool         `json:"bmc_ipmi_reachable"`
	BmcLicenceType       string       `json:"bmc_licence_type"`
	BmcLicenceStatus     string       `json:"bmc_licence_status"`
	BmcAuth              bool         `json:"bmc_auth"`
	Disks                []*Disk      `json:"-" gorm:"ForeignKey:BladeSerial"`
	Nics                 []*Nic       `json:"-" gorm:"ForeignKey:BladeSerial"`
	BladePosition        int          `json:"blade_position"`
	Model                string       `json:"model"`
	TempC                int          `json:"temp_c"`
	PowerKw              float64      `json:"power_kw"`
	PowerState           string       `json:"power_state"`
	Status               string       `json:"status"`
	Vendor               string       `json:"vendor"`
	ChassisSerial        string       `json:"-"`
	Processor            string       `json:"processor"`
	ProcessorCount       int          `json:"processor_count"`
	ProcessorCoreCount   int          `json:"processor_core_count"`
	ProcessorThreadCount int          `json:"processor_thread_count"`
	StorageBlade         StorageBlade `json:"-" gorm:"ForeignKey:BladeSerial"`
	Memory               int          `json:"memory_in_gb"`
	UpdatedAt            time.Time    `json:"updated_at"`
}

Blade contains all the blade information we will expose across different vendors

func NewBladeFromDevice

func NewBladeFromDevice(b *devices.Blade) (blade *Blade)

NewBladeFromDevice will create a new object coming from the bmc blade devices

func (*Blade) Diff

func (b *Blade) Diff(blade *Blade) (differences []string)

Diff compare to objects and return list of string with their differences

func (Blade) GetID

func (b Blade) GetID() string

GetID to satisfy jsonapi.MarshalIdentifier interface

func (Blade) GetReferencedIDs

func (b Blade) GetReferencedIDs() []jsonapi.ReferenceID

GetReferencedIDs to satisfy the jsonapi.MarshalLinkedRelations interface

func (Blade) GetReferences

func (b Blade) GetReferences() []jsonapi.Reference

GetReferences to satisfy the jsonapi.MarshalReferences interface

func (*Blade) HasNic

func (b *Blade) HasNic(macAddress string) bool

HasNic checks whether a nic is connected to the discrete

type Chassis

type Chassis struct {
	Serial            string          `json:"serial" gorm:"primary_key"`
	Name              string          `json:"name"`
	BmcAddress        string          `json:"bmc_address"`
	BmcSSHReachable   bool            `json:"bmc_ssh_reachable"`
	BmcWEBReachable   bool            `json:"bmc_web_reachable"`
	BmcAuth           bool            `json:"bmc_auth"`
	Blades            []*Blade        `json:"-" gorm:"ForeignKey:ChassisSerial"`
	FaultySlots       pq.Int64Array   `json:"faulty_slots" gorm:"type:integer[2]"`
	StorageBlades     []*StorageBlade `json:"-" gorm:"ForeignKey:ChassisSerial"`
	Nics              []*Nic          `json:"-" gorm:"ForeignKey:ChassisSerial"`
	Psus              []*Psu          `json:"-" gorm:"ForeignKey:ChassisSerial"`
	Fans              []*Fan          `json:"-" gorm:"ForeignKey:ChassisSerial"`
	PsuRedundancyMode string          `json:"psu_redundancy_mode"`
	IsPsuRedundant    bool            `json:"is_psu_redundant"`
	TempC             int             `json:"temp_c"`
	PassThru          string          `json:"pass_thru"`
	Status            string          `json:"status"`
	PowerKw           float64         `json:"power_kw"`
	Model             string          `json:"model"`
	Vendor            string          `json:"vendor"`
	FwVersion         string          `json:"fw_version"`
	UpdatedAt         time.Time       `json:"updated_at"`
	Managed           bool            `json:"managed"`
}

Chassis contains all the chassis the information we will expose across different vendors

func NewChassisFromDevice

func NewChassisFromDevice(c *devices.Chassis) (chassis *Chassis)

NewChassisFromDevice will create a new object coming from the bmc discrete devices

func (*Chassis) Diff

func (c *Chassis) Diff(chassis *Chassis) (differences []string)

Diff compare to objects and return list of string with their differences

func (Chassis) GetID

func (c Chassis) GetID() string

GetID to satisfy jsonapi.MarshalIdentifier interface

func (Chassis) GetReferencedIDs

func (c Chassis) GetReferencedIDs() []jsonapi.ReferenceID

GetReferencedIDs to satisfy the jsonapi.MarshalLinkedRelations interface

func (Chassis) GetReferences

func (c Chassis) GetReferences() []jsonapi.Reference

GetReferences to satisfy the jsonapi.MarshalReferences interface

func (*Chassis) HasBlade

func (c *Chassis) HasBlade(serial string) bool

HasBlade checks whether a blade is connected to the chassis

func (*Chassis) HasNic

func (c *Chassis) HasNic(macAddress string) bool

HasNic checks whether a nic is connected to the chassis

func (*Chassis) HasPsu

func (c *Chassis) HasPsu(serial string) bool

HasPsu checks whether a psu is connected to the chassis

func (*Chassis) HasStorageBlade

func (c *Chassis) HasStorageBlade(serial string) bool

HasStorageBlade checks whether a storageblade is connected to the chassis

type DiscoverHint

type DiscoverHint struct {
	IP        string `gorm:"primary_key;column:ip"`
	Hint      string `gorm:"column:hint"`
	UpdatedAt time.Time
}

type Discrete

type Discrete struct {
	Serial               string    `json:"serial" gorm:"primary_key"`
	Name                 string    `json:"name"`
	BiosVersion          string    `json:"bios_version"`
	BmcType              string    `json:"bmc_type"`
	BmcAddress           string    `json:"bmc_address"`
	BmcVersion           string    `json:"bmc_version"`
	BmcSSHReachable      bool      `json:"bmc_ssh_reachable"`
	BmcWEBReachable      bool      `json:"bmc_web_reachable"`
	BmcIpmiReachable     bool      `json:"bmc_ipmi_reachable"`
	BmcLicenceType       string    `json:"bmc_licence_type"`
	BmcLicenceStatus     string    `json:"bmc_licence_status"`
	BmcAuth              bool      `json:"bmc_auth"`
	Disks                []*Disk   `json:"-" gorm:"ForeignKey:BladeSerial"`
	Nics                 []*Nic    `json:"-" gorm:"ForeignKey:DiscreteSerial"`
	Psus                 []*Psu    `json:"-" gorm:"ForeignKey:DiscreteSerial"`
	Model                string    `json:"model"`
	TempC                int       `json:"temp_c"`
	PowerKw              float64   `json:"power_kw"`
	PowerState           string    `json:"power_state"`
	Status               string    `json:"status"`
	Vendor               string    `json:"vendor"`
	Processor            string    `json:"processor"`
	ProcessorCount       int       `json:"processor_count"`
	ProcessorCoreCount   int       `json:"processor_core_count"`
	ProcessorThreadCount int       `json:"processor_thread_count"`
	Memory               int       `json:"memory_in_gb"`
	UpdatedAt            time.Time `json:"updated_at"`
}

Discrete contains all the discrete information we will expose across different vendors

func NewDiscreteFromDevice

func NewDiscreteFromDevice(d *devices.Discrete) (discrete *Discrete)

NewDiscreteFromDevice will create a new object coming from the bmc discrete devices

func (*Discrete) Diff

func (d *Discrete) Diff(discrete *Discrete) (differences []string)

Diff compare to objects and return list of string with their differences

func (Discrete) GetID

func (d Discrete) GetID() string

GetID to satisfy jsonapi.MarshalIdentifier interface

func (Discrete) GetReferencedIDs

func (d Discrete) GetReferencedIDs() []jsonapi.ReferenceID

GetReferencedIDs to satisfy the jsonapi.MarshalLinkedRelations interface

func (Discrete) GetReferences

func (d Discrete) GetReferences() []jsonapi.Reference

GetReferences to satisfy the jsonapi.MarshalReferences interface

func (*Discrete) HasNic

func (d *Discrete) HasNic(macAddress string) bool

HasNic checks whether a nic is connected to the discrete

func (*Discrete) HasPsu

func (d *Discrete) HasPsu(serial string) bool

HasPsu checks whether a psu is connected to the discrete

type Disk

type Disk struct {
	Serial         string    `json:"serial" gorm:"primary_key"`
	Status         string    `json:"status"`
	Type           string    `json:"type"`
	Size           string    `json:"size"`
	Model          string    `json:"model"`
	Location       string    `json:"location"`
	FwVersion      string    `json:"fw_version"`
	UpdatedAt      time.Time `json:"updated_at"`
	BladeSerial    string    `json:"-"`
	DiscreteSerial string    `json:"-"`
}

Disk represents a disk device

func (*Disk) Diff

func (d *Disk) Diff(disk *Disk) (differences []string)

Diff compare to objects and return list of string with their differences

func (Disk) GetID

func (d Disk) GetID() string

GetID to satisfy jsonapi.MarshalIdentifier interface

func (Disk) GetReferencedIDs

func (d Disk) GetReferencedIDs() []jsonapi.ReferenceID

GetReferencedIDs to satisfy the jsonapi.MarshalLinkedRelations interface

func (Disk) GetReferences

func (d Disk) GetReferences() []jsonapi.Reference

GetReferences to satisfy the jsonapi.MarshalReferences interface

type Fan

type Fan struct {
	Serial        string    `json:"serial" gorm:"primary_key"`
	Status        string    `json:"status"`
	Position      int       `json:"position"`
	Model         string    `json:"model"`
	CurrentRPM    int64     `json:"current_rpm"`
	PowerKw       float64   `json:"power_kw"`
	ChassisSerial string    `json:"-"`
	UpdatedAt     time.Time `json:"updated_at"`
}

Fan contains the network information of the cards attached to blades or chassis

func (*Fan) Diff

func (p *Fan) Diff(fan *Fan) (differences []string)

Diff compare to objects and return list of string with their differences

func (Fan) GetID

func (p Fan) GetID() string

GetID to satisfy jsonapi.MarshalIdentifier interface

func (Fan) GetReferencedIDs

func (p Fan) GetReferencedIDs() []jsonapi.ReferenceID

GetReferencedIDs to satisfy the jsonapi.MarshalLinkedRelations interface

func (Fan) GetReferences

func (p Fan) GetReferences() []jsonapi.Reference

GetReferences to satisfy the jsonapi.MarshalReferences interface

type Nic

type Nic struct {
	MacAddress     string    `json:"mac_address" gorm:"primary_key"`
	Name           string    `json:"name"`
	Speed          string    `json:"speed"`
	UpdatedAt      time.Time `json:"updated_at"`
	BladeSerial    string    `json:"-"`
	DiscreteSerial string    `json:"-"`
	ChassisSerial  string    `json:"-"`
}

Nic contains the network information of the cards attached to blades or chassis

func (*Nic) Diff

func (n *Nic) Diff(nic *Nic) (differences []string)

Diff compare to objects and return list of string with their differences

func (Nic) GetID

func (n Nic) GetID() string

GetID to satisfy jsonapi.MarshalIdentifier interface

func (Nic) GetReferencedIDs

func (n Nic) GetReferencedIDs() []jsonapi.ReferenceID

GetReferencedIDs to satisfy the jsonapi.MarshalLinkedRelations interface

func (Nic) GetReferences

func (n Nic) GetReferences() []jsonapi.Reference

GetReferences to satisfy the jsonapi.MarshalReferences interface

type Psu

type Psu struct {
	Serial         string    `json:"serial" gorm:"primary_key"`
	CapacityKw     float64   `json:"capacity_kw"`
	PowerKw        float64   `json:"power_kw"`
	Status         string    `json:"status"`
	PartNumber     string    `json:"part_number"`
	UpdatedAt      time.Time `json:"updated_at"`
	DiscreteSerial string    `json:"-"`
	ChassisSerial  string    `json:"-"`
}

Psu contains the network information of the cards attached to blades or chassis

func (*Psu) Diff

func (p *Psu) Diff(psu *Psu) (differences []string)

Diff compare to objects and return list of string with their differences

func (Psu) GetID

func (p Psu) GetID() string

GetID to satisfy jsonapi.MarshalIdentifier interface

func (Psu) GetReferencedIDs

func (p Psu) GetReferencedIDs() []jsonapi.ReferenceID

GetReferencedIDs to satisfy the jsonapi.MarshalLinkedRelations interface

func (Psu) GetReferences

func (p Psu) GetReferences() []jsonapi.Reference

GetReferences to satisfy the jsonapi.MarshalReferences interface

type ScannedPort

type ScannedPort struct {
	ID        string    `gorm:"primary_key" json:"-"`
	Site      string    `gorm:"unique_index:scanned_result" json:"site"`
	CIDR      string    `gorm:"unique_index:scanned_result;column:cidr" json:"cidr"`
	IP        string    `gorm:"unique_index:scanned_result" json:"ip"`
	Port      int       `gorm:"unique_index:scanned_result" json:"port"`
	Protocol  string    `gorm:"unique_index:scanned_result" json:"protocol"`
	ScannedBy string    `gorm:"unique_index:scanned_result" json:"scanned_by"`
	State     string    `json:"state"`
	UpdatedAt time.Time `json:"updated_at"`
}

ScannedPort contains all ports found by the scanner

func (*ScannedPort) BeforeCreate

func (s *ScannedPort) BeforeCreate(scope *gorm.Scope) (err error)

BeforeCreate run all operations before creating the object

func (*ScannedPort) GenID

func (s *ScannedPort) GenID() string

GenID generates the ID based on the date we have

func (ScannedPort) GetID

func (s ScannedPort) GetID() string

GetID to satisfy jsonapi.MarshalIdentifier interface

func (ScannedPort) GetName

func (s ScannedPort) GetName() string

GetName to satisfy jsonapi naming schema

type StorageBlade

type StorageBlade struct {
	Serial        string    `json:"serial" gorm:"primary_key"`
	FwVersion     string    `json:"fw_version"`
	BladePosition int       `json:"blade_position"`
	Model         string    `json:"model"`
	TempC         int       `json:"temp_c"`
	PowerKw       float64   `json:"power_kw"`
	Status        string    `json:"status"`
	Vendor        string    `json:"vendor"`
	ChassisSerial string    `json:"-"`
	BladeSerial   string    `json:"-"`
	UpdatedAt     time.Time `json:"updated_at"`
}

StorageBlade contains all the storage blade information we will expose across different vendors

func NewStorageBladeFromDevice

func NewStorageBladeFromDevice(b *devices.StorageBlade) (blade *StorageBlade)

NewStorageBladeFromDevice will create a new object coming from the bmc blade devices

func (*StorageBlade) Diff

func (s *StorageBlade) Diff(storageBlade *StorageBlade) (differences []string)

Diff compare to objects and return list of string with their differences

func (StorageBlade) GetID

func (s StorageBlade) GetID() string

GetID to satisfy jsonapi.MarshalIdentifier interface

func (StorageBlade) GetName

func (s StorageBlade) GetName() string

GetName to satisfy jsonapi naming schema

func (StorageBlade) GetReferencedIDs

func (s StorageBlade) GetReferencedIDs() []jsonapi.ReferenceID

GetReferencedIDs to satisfy the jsonapi.MarshalLinkedRelations interface

func (StorageBlade) GetReferences

func (s StorageBlade) GetReferences() []jsonapi.Reference

GetReferences to satisfy the jsonapi.MarshalReferences interface

Jump to

Keyboard shortcuts

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