components

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToJSON

func ToJSON(component *Component) ([]byte, error)

Method to convert struct to JSON

Types

type Component

type Component struct {
	Uid                 uuid.UUID `json:"uid" db:"uid"`
	Id                  string    `json:"xname" db:"xname"`
	Type                string    `json:"type" db:"type"`
	State               string    `json:"state,omitempty" db:"state"`
	Flag                string    `json:"flag,omitempty" db:"flag"`
	Enabled             bool      `json:"enabled,omitempty" db:"enabled"`
	SwStatus            string    `json:"sw_status,omitempty" db:"sw_status"`
	Role                string    `json:"role,omitempty" db:"role"`
	SubRole             string    `json:"sub_role,omitempty" db:"subrole"`
	NID                 uint      `json:"nid,omitempty" db:"nid"`
	Subtype             string    `json:"sub_type,omitempty" db:"subtype"`
	NetType             string    `json:"net_type,omitempty" db:"net_type"`
	Arch                string    `json:"arch,omitempty" db:"arch"`
	Class               string    `json:"class,omitempty" db:"class"`
	ReservationDisabled bool      `json:"reservation_disabled,omitempty" db:"reservation_disabled"`
	Locked              bool      `json:"locked,omitempty" db:"locked"`
}

Component is the base type for all hardware. It represents nodes, BMCs, Switches, etc... and can be extended to represnt other items as well. The UID field is a UUID that is generated by the system. The ID field is more commonly referred to as the Xname which uniquely identifies components and describes their location in the system. The official xname decoder ring is at https://cray-hpe.github.io/docs-csm/en-14/operations/component_names_xnames/

func FromJSON

func FromJSON(jsonData []byte) (*Component, error)

-- JSON Conversion for Component -- Method to convert JSON to struct

func (*Component) ToJSON

func (c *Component) ToJSON() ([]byte, error)

Method to convert struct to JSON

func (*Component) Validate

func (c *Component) Validate() error

type ComponentDatabase

type ComponentDatabase interface {
	InsertComponent(component *Component) (string, error)
	UpdateComponent(component *Component) error
	DeleteComponent(id string) error
	GetComponent(id string) (*Component, error)
}

Jump to

Keyboard shortcuts

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