resource

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2021 License: Apache-2.0 Imports: 19 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	CPU     = "cpu"
	Memory  = "memory"
	Owner   = "owner"
	Project = "project"
	Cluster = "cluster"
	Day     = "day"
	Week    = "week"
	Month   = "month"
)
View Source
const (
	G         = 1 << 30
	MilliCore = 1000
)
View Source
const Lang = "Lang"

Variables

This section is empty.

Functions

func GetHeader

func GetHeader(ctx context.Context, key string) string

GetHeader .

Types

type DailyClusterQuota

type DailyClusterQuota struct {
	Index      int64 `gorm:"column:idx"`
	CpuTotal   int64 `gorm:"column:cpu_total"`
	CpuRequest int64 `gorm:"column:cpu_requested"`
	MemTotal   int64 `gorm:"column:mem_total"`
	MemRequest int64 `gorm:"column:mem_requested"`
}

type DailyProjectQuota

type DailyProjectQuota struct {
	Index      int64 `gorm:"column:idx"`
	CpuQuota   int64 `gorm:"column:cpu_quota"`
	CpuRequest int64 `gorm:"column:cpu_request"`
	MemQuota   int64 `gorm:"column:mem_quota"`
	MemRequest int64 `gorm:"column:mem_request"`
}

type GaugeData

type GaugeData struct {
	Split []float64 `json:"split"`
	Title string    `json:"title"`
	Value []float64 `json:"value"`
	Name  string    `json:"name"`
}

type Histogram

type Histogram struct {
	XAxis  XAxis            `json:"xAxis"`
	YAxis  YAxis            `json:"yAxis"`
	Series []HistogramSerie `json:"series"`
	Name   string           `json:"name"`
}

type HistogramSerie

type HistogramSerie struct {
	Data []float64 `json:"data"`
	Name string    `json:"name"`
	Type string    `json:"type"`
}

type PieData

type PieData struct {
	Series []PieSerie `json:"series"`
}

type PieSerie

type PieSerie struct {
	Data []SerieData `json:"data"`
	Name string      `json:"name"`
	Type string      `json:"type"`
}

type Quota

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

type ReportTable

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

func NewReportTable

func NewReportTable(opts ...ReportTableOption) *ReportTable

func (*ReportTable) GetResourceOverviewReport

func (rt *ReportTable) GetResourceOverviewReport(ctx context.Context, orgID int64, clusterNames []string,
	cpuPerNode, memPerNode uint64, groupBy string) (*apistructs.ResourceOverviewReportData, error)

type ReportTableOption

type ReportTableOption func(table *ReportTable)

func ReportTableWithBundle

func ReportTableWithBundle(bdl *bundle.Bundle) ReportTableOption

func ReportTableWithCMP

func ReportTableWithCMP(cmp interface {
	ListSteveResource(ctx context.Context, req *apistructs.SteveRequest) ([]types.APIObject, error)
	GetNamespacesResources(ctx context.Context, nReq *pb.GetNamespacesResourcesRequest) (*pb.GetNamespacesResourcesResponse, error)
}) ReportTableOption

func ReportTableWithTrans

func ReportTableWithTrans(trans i18n.Translator) ReportTableOption

type Resource

type Resource struct {
	Bdl    *bundle.Bundle
	Ctx    context.Context
	Server cmp_interface.Provider
	I18N   i18n.Translator
	DB     *dbclient.DBClient
}

func New

func New(ctx context.Context, i18n i18n.Translator, mServer cmp_interface.Provider) *Resource

func (*Resource) FilterCluster

func (r *Resource) FilterCluster(clusters []apistructs.ClusterInfo, clusterNames []string) []string

func (*Resource) GetClusterPie

func (r *Resource) GetClusterPie(ctx context.Context, resourceType string, resources *pb.GetClusterResourcesResponse) (clusterPie *PieData, err error)

func (*Resource) GetClusterTrend

func (r *Resource) GetClusterTrend(ctx context.Context, ordId int64, userId string, request *apistructs.TrendRequest) (td *Histogram, err error)

func (*Resource) GetGauge

func (r *Resource) GetGauge(ctx context.Context, ordId string, userID string, request *apistructs.GaugeRequest) (data map[string]*GaugeData, err error)

func (*Resource) GetPie

func (r *Resource) GetPie(ctx context.Context, ordId, userId string, request *apistructs.ClassRequest) (data map[string]*PieData, err error)

func (*Resource) GetPrincipalPie

func (r *Resource) GetPrincipalPie(ctx context.Context, resType string, resp *apistructs.GetQuotaOnClustersResponse, resource *apistructs.ResourceResp) (principalPie *PieData, err error)

func (*Resource) GetProjectPie

func (r *Resource) GetProjectPie(ctx context.Context, resType string, resp *apistructs.GetQuotaOnClustersResponse, resource *apistructs.ResourceResp) (projectPie *PieData, err error)

func (*Resource) GetProjectTrend

func (r *Resource) GetProjectTrend(ctx context.Context, ordId, userId string, request *apistructs.TrendRequest) (td *Histogram, err error)

func (*Resource) GetQuotaResource

func (r *Resource) GetQuotaResource(ctx context.Context, ordId string, userID string, clusterNames []string) (resp *apistructs.ResourceResp, err error)

func (*Resource) I18n

func (r *Resource) I18n(lang i18n.LanguageCodes, key string, args ...interface{}) string

func (*Resource) Init

func (r *Resource) Init(ctx servicehub.Context) error

func (*Resource) PieSort

func (r *Resource) PieSort(series []SerieData)

type SerieData

type SerieData struct {
	Value float64 `json:"value"`
	Name  string  `json:"name"`
}

type Series

type Series struct {
	Name string    `json:"name"`
	Type string    `json:"type"`
	Data []float64 `json:"data"`
}

type XAxis

type XAxis struct {
	Type string   `json:"type"`
	Data []string `json:"data"`
}

type YAxis

type YAxis struct {
	Type string `json:"type"`
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

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