models

package
v0.0.0-...-12382fa Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Quota

type Quota struct {
	ID           int64            `orm:"pk;auto;column(id)" json:"id"`
	Ref          driver.RefObject `orm:"-" json:"ref"`
	Reference    string           `orm:"column(reference)" json:"-"`
	ReferenceID  string           `orm:"column(reference_id)" json:"-"`
	Hard         string           `orm:"column(hard);type(jsonb)" json:"-"`
	Used         string           `orm:"column(used);type(jsonb)" json:"-"`
	CreationTime time.Time        `orm:"column(creation_time);auto_now_add" json:"creation_time"`
	UpdateTime   time.Time        `orm:"column(update_time);auto_now" json:"update_time"`

	HardVersion int64 `orm:"column(hard_version)" json:"-"`
	UsedVersion int64 `orm:"column(used_version)" json:"-"`

	HardChanged bool `orm:"-" json:"-"`
	UsedChanged bool `orm:"-" json:"-"`
}

Quota quota model for manager

func (*Quota) GetHard

func (q *Quota) GetHard() (types.ResourceList, error)

GetHard returns quota hard

func (*Quota) GetUsed

func (q *Quota) GetUsed() (types.ResourceList, error)

GetUsed returns quota used

func (*Quota) GetWarningResources

func (q *Quota) GetWarningResources(warningPercent int) ([]types.ResourceName, error)

GetWarningResources returns resource names which exceeded the warning percent

func (*Quota) MarshalJSON

func (q *Quota) MarshalJSON() ([]byte, error)

MarshalJSON ...

func (*Quota) SetHard

func (q *Quota) SetHard(hardLimits types.ResourceList) *Quota

SetHard set hard value of the quota

func (*Quota) SetUsed

func (q *Quota) SetUsed(used types.ResourceList) *Quota

SetUsed set used value of the quota

Jump to

Keyboard shortcuts

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