models

package
v0.0.0-...-5fda629 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2022 License: MulanPSL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddResource

func AddResource(data map[string]interface{}) error

添加资源

func AddTags

func AddTags(data map[string]interface{}) error

添加标签

func CheckMetricExist

func CheckMetricExist(guId string) (bool, error)

func CloseDB

func CloseDB()

close database connection

func DeleteResource

func DeleteResource(guId string) error

删除指定资源

func DeleteResources

func DeleteResources(guIds []string) error

删除指定资源--通过guIds

func DeleteTagInfos

func DeleteTagInfos(guId string) error

func ExistResourceByGuId

func ExistResourceByGuId(guId string) (bool, error)

检测资源是否已存在

func GetResourceTotal

func GetResourceTotal(maps interface{}) (int, error)

获取资源列表数目

func InsertMetricInfo

func InsertMetricInfo(data map[string]interface{}) error

func Setup

func Setup()

initializes the database instance

func UpdateMetricInfo

func UpdateMetricInfo(guId string, data interface{}) error

func UpdateStatus

func UpdateStatus(guId string, data interface{}) error

更新状态

func UpdateSubNode

func UpdateSubNode(guId string, data interface{}) error

更新资源子节点

func UpdateTags

func UpdateTags(data map[string]interface{}) error

更新标签

Types

type CategoryName

type CategoryName struct {
	Name string `json:"name"`
}

func GetDistinctCategoryNames

func GetDistinctCategoryNames() ([]*CategoryName, error)

type CityResource

type CityResource struct {
	Name  string `json:"name"`
	Value int    `json:"value"`
}

func GetResourcesByCity

func GetResourcesByCity() ([]CityResource, error)

type Metric

type Metric struct {
	ID       int     `json:"id"`
	GuId     string  `json:"guId"`
	CpuSet   string  `json:"cpuSet"`
	CpuRatio float64 `json:"cpuRatio"`
}

type Model

type Model struct {
	ID         int `gorm:"primary_key" json:"id"`
	CreatedOn  int `json:"created_on"`
	ModifiedOn int `json:"modified_on"`
	DeletedOn  int `json:"deleted_on"`
}

type Resource

type Resource struct {
	ID          int    `json:"id"`
	GuId        string `json:"guId"`
	Description string `json:"description"`
	Status      int    `json:"status"`
	Area        string `json:"area"`
	PreNode     string `json:"preNode"`
	SubNode     string `json:"subNode"`
	OType       int    `json:"oType"`
	Utilization int    `json:"utilization"`
	CreateTime  string `json:"createTime"`
	UpdateTime  string `json:"updateTime"`
	IsMonitor   int    `json:"isMonitor"`
	IsControl   int    `json:"isControl"`
}

func GetResource

func GetResource(guId string) (*Resource, error)

查看资源(根据GUID)

func GetResources

func GetResources(pageNum int, pageSize int, maps interface{}) ([]*Resource, error)

获取资源列表

func SearchResources

func SearchResources(str1 string, str2 string) ([]*Resource, error)

查询资源(模糊查询)

type ResourceDynamic

type ResourceDynamic struct {
	ID          int    `json:"id"`
	GuId        string `json:"guId"`
	Description string `json:"description"`
	Status      int    `json:"status"`
	Area        string `json:"area"`
	PreNode     string `json:"preNode"`
	SubNode     string `json:"subNode"`
	OType       int    `json:"oType"`
	Utilization int    `json:"utilization"`
	CreateTime  string `json:"createTime"`
	UpdateTime  string `json:"updateTime"`
	IsMonitor   int    `json:"isMonitor"`
	IsControl   int    `json:"isControl"`
	SumNode     int    `json:"sumNode"`
	AliveNode   int    `json:"aliveNode"`
}

type ResourceMetric

type ResourceMetric struct {
	ID          int     `json:"id"`
	GuId        string  `json:"guId"`
	Description string  `json:"description"`
	Status      int     `json:"status"`
	Area        string  `json:"area"`
	PreNode     string  `json:"preNode"`
	SubNode     string  `json:"subNode"`
	OType       int     `json:"oType"`
	Utilization int     `json:"utilization"`
	CreateTime  string  `json:"createTime"`
	UpdateTime  string  `json:"updateTime"`
	IsMonitor   int     `json:"isMonitor"`
	IsControl   int     `json:"isControl"`
	CpuSet      string  `json:"cpuSet"`
	CpuRatio    float64 `json:"cpuRatio"`
}

func GetTagGroupInfos

func GetTagGroupInfos(maps map[string]interface{}) ([]*ResourceMetric, error)

type Tag

type Tag struct {
	ID         int    `json:"id"`
	ResourceId int    `json:"resourceId"`
	GuId       string `json:"guId"`
	TagKey     string `json:"tagKey"`
	TagType    string `json:"tagType"`
	TagValue   string `json:"tagValue"`
	CreateTime string `json:"createTime"`
	UpdateTime string `json:"updateTime"`
}

func GetDistinctTagInfos

func GetDistinctTagInfos() ([]*Tag, error)

func GetResourceTagByKey

func GetResourceTagByKey(guid string, key string) (*Tag, error)

func GetTagInfos

func GetTagInfos() ([]*Tag, error)

func GetTagInfosByGuId

func GetTagInfosByGuId(guId string) ([]*Tag, error)

type TypeCount

type TypeCount struct {
	OType int `json:"oType"`
	Count int `json:"count"`
}

func SearchResourcesNum

func SearchResourcesNum(maps map[string]int) ([]TypeCount, error)

查询对应设备类型数量

type UtilizationInfo

type UtilizationInfo struct {
	Name  string `json:"name"`
	Value int    `json:"value"`
}

func GetUtilizationInfos

func GetUtilizationInfos(queryStrs []string) ([]UtilizationInfo, error)

Jump to

Keyboard shortcuts

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