2015-07-20 07:51:27 -05:00
|
|
|
package models
|
|
|
|
|
|
|
|
import (
|
2015-07-21 05:30:31 -05:00
|
|
|
"errors"
|
2015-07-20 07:51:27 -05:00
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2020-11-05 06:07:06 -06:00
|
|
|
var ErrInvalidQuotaTarget = errors.New("invalid quota target")
|
2015-07-21 05:30:31 -05:00
|
|
|
|
2015-07-20 07:51:27 -05:00
|
|
|
type Quota struct {
|
|
|
|
Id int64
|
|
|
|
OrgId int64
|
2015-09-11 10:17:10 -05:00
|
|
|
UserId int64
|
|
|
|
Target string
|
2015-07-20 07:51:27 -05:00
|
|
|
Limit int64
|
|
|
|
Created time.Time
|
|
|
|
Updated time.Time
|
|
|
|
}
|
|
|
|
|
2015-09-11 10:17:10 -05:00
|
|
|
type QuotaScope struct {
|
|
|
|
Name string
|
|
|
|
Target string
|
|
|
|
DefaultLimit int64
|
2015-07-20 07:51:27 -05:00
|
|
|
}
|
|
|
|
|
2015-09-11 10:17:10 -05:00
|
|
|
type OrgQuotaDTO struct {
|
|
|
|
OrgId int64 `json:"org_id"`
|
|
|
|
Target string `json:"target"`
|
|
|
|
Limit int64 `json:"limit"`
|
|
|
|
Used int64 `json:"used"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type UserQuotaDTO struct {
|
|
|
|
UserId int64 `json:"user_id"`
|
|
|
|
Target string `json:"target"`
|
|
|
|
Limit int64 `json:"limit"`
|
|
|
|
Used int64 `json:"used"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type GlobalQuotaDTO struct {
|
|
|
|
Target string `json:"target"`
|
|
|
|
Limit int64 `json:"limit"`
|
|
|
|
Used int64 `json:"used"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type GetOrgQuotaByTargetQuery struct {
|
2021-09-29 09:16:40 -05:00
|
|
|
Target string
|
|
|
|
OrgId int64
|
|
|
|
Default int64
|
|
|
|
UnifiedAlertingEnabled bool
|
|
|
|
Result *OrgQuotaDTO
|
2015-07-20 07:51:27 -05:00
|
|
|
}
|
|
|
|
|
2015-09-11 10:17:10 -05:00
|
|
|
type GetOrgQuotasQuery struct {
|
2021-09-29 09:16:40 -05:00
|
|
|
OrgId int64
|
|
|
|
UnifiedAlertingEnabled bool
|
|
|
|
Result []*OrgQuotaDTO
|
2015-09-11 10:17:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type GetUserQuotaByTargetQuery struct {
|
2021-09-29 09:16:40 -05:00
|
|
|
Target string
|
|
|
|
UserId int64
|
|
|
|
Default int64
|
|
|
|
UnifiedAlertingEnabled bool
|
|
|
|
Result *UserQuotaDTO
|
2015-09-11 10:17:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type GetUserQuotasQuery struct {
|
2021-09-29 09:16:40 -05:00
|
|
|
UserId int64
|
|
|
|
UnifiedAlertingEnabled bool
|
|
|
|
Result []*UserQuotaDTO
|
2015-09-11 10:17:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type GetGlobalQuotaByTargetQuery struct {
|
2021-09-29 09:16:40 -05:00
|
|
|
Target string
|
|
|
|
Default int64
|
|
|
|
UnifiedAlertingEnabled bool
|
|
|
|
Result *GlobalQuotaDTO
|
2015-09-11 10:17:10 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
type UpdateOrgQuotaCmd struct {
|
|
|
|
Target string `json:"target"`
|
|
|
|
Limit int64 `json:"limit"`
|
|
|
|
OrgId int64 `json:"-"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type UpdateUserQuotaCmd struct {
|
|
|
|
Target string `json:"target"`
|
|
|
|
Limit int64 `json:"limit"`
|
|
|
|
UserId int64 `json:"-"`
|
|
|
|
}
|