host

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Controller

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

func NewController

func NewController() *Controller

func (*Controller) RegisterRoute

func (c *Controller) RegisterRoute(engine *gin.RouterGroup)

type Group

type Group struct {
	ID    uuid.UUID `json:"id" gorm:"type:uuid;primaryKey" swaggerignore:"true" example:"00000000-0000-0000-0000-000000000000"`
	Title string    `json:"title" gorm:"unique;not null" validate:"required"`
	Hosts []*Host   `json:"hosts" gorm:"foreignkey:GroupId" swaggerignore:"true"`

	CreatedAt time.Time `json:"createdAt" swaggerignore:"true"`
	UpdatedAt time.Time `json:"updatedAt" swaggerignore:"true"`
}

func (*Group) BeforeCreate

func (g *Group) BeforeCreate(tx *gorm.DB) error

func (*Group) TableName

func (g *Group) TableName() string

type Host

type Host struct {
	ID       uuid.UUID        `json:"id" gorm:"type:uuid;primaryKey" swaggerignore:"true" example:"00000000-0000-0000-0000-000000000000"`
	Title    string           `json:"title" gorm:"not null" validate:"required"`
	Desc     string           `json:"desc"`
	HostInfo sshutil.HostInfo `json:"hostInfo" gorm:"not null"`
	MetaInfo MetaInfo         `json:"metaInfo" swaggerignore:"true"`
	Group    Group            `json:"group" swaggerignore:"true" validate:"omitempty"`
	GroupId  uuid.UUID        `json:"groupId"`

	database.BaseModel
}

func (*Host) BeforeCreate

func (m *Host) BeforeCreate(tx *gorm.DB) error

func (*Host) TableName

func (m *Host) TableName() string

type MetaInfo

type MetaInfo struct {
	OS       string `json:"os"`
	Kernel   string `json:"kernel"`
	Hostname string `json:"hostname"`
	Arch     string `json:"arch"`
	Cpu      string `json:"cpu"`
	Mem      string `json:"mem"`
}

func (*MetaInfo) Scan

func (m *MetaInfo) Scan(val interface{}) error

func (MetaInfo) Value

func (m MetaInfo) Value() (driver.Value, error)

type Service

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

func GetService

func GetService() *Service

func (*Service) AddGroup

func (s *Service) AddGroup(group *Group) error

AddGroup add host group

func (*Service) AddHost

func (s *Service) AddHost(host *Host) error

AddHost add host

func (*Service) DeleteGroup

func (s *Service) DeleteGroup(id uuid.UUID) error

DeleteGroup delete host group

func (*Service) DeleteHost

func (s *Service) DeleteHost(id uuid.UUID) error

DeleteHost delete host

func (*Service) DetailHost

func (s *Service) DetailHost(id uuid.UUID) (*Host, error)

DetailHost detail host

func (*Service) Initialize

func (s *Service) Initialize() error

func (*Service) ListGroup

func (s *Service) ListGroup(group *Group) ([]*Group, error)

ListGroup list host group

func (*Service) ListHost

func (s *Service) ListHost(host *Host) ([]*Host, error)

ListHost list host

func (*Service) UpdateGroup

func (s *Service) UpdateGroup(group *Group) error

UpdateGroup update host group

func (*Service) UpdateHost

func (s *Service) UpdateHost(host *Host) error

UpdateHost update host

Jump to

Keyboard shortcuts

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