mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
This reverts commit 326ea86a57.
This commit is contained in:
committed by
GitHub
parent
228ec4c0f3
commit
96cdf77995
91
pkg/models/quotas.go
Normal file
91
pkg/models/quotas.go
Normal file
@@ -0,0 +1,91 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"time"
|
||||
)
|
||||
|
||||
var ErrInvalidQuotaTarget = errors.New("invalid quota target")
|
||||
|
||||
type Quota struct {
|
||||
Id int64
|
||||
OrgId int64
|
||||
UserId int64
|
||||
Target string
|
||||
Limit int64
|
||||
Created time.Time
|
||||
Updated time.Time
|
||||
}
|
||||
|
||||
type QuotaScope struct {
|
||||
Name string
|
||||
Target string
|
||||
DefaultLimit int64
|
||||
}
|
||||
|
||||
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 {
|
||||
Target string
|
||||
OrgId int64
|
||||
Default int64
|
||||
UnifiedAlertingEnabled bool
|
||||
Result *OrgQuotaDTO
|
||||
}
|
||||
|
||||
type GetOrgQuotasQuery struct {
|
||||
OrgId int64
|
||||
UnifiedAlertingEnabled bool
|
||||
Result []*OrgQuotaDTO
|
||||
}
|
||||
|
||||
type GetUserQuotaByTargetQuery struct {
|
||||
Target string
|
||||
UserId int64
|
||||
Default int64
|
||||
UnifiedAlertingEnabled bool
|
||||
Result *UserQuotaDTO
|
||||
}
|
||||
|
||||
type GetUserQuotasQuery struct {
|
||||
UserId int64
|
||||
UnifiedAlertingEnabled bool
|
||||
Result []*UserQuotaDTO
|
||||
}
|
||||
|
||||
type GetGlobalQuotaByTargetQuery struct {
|
||||
Target string
|
||||
Default int64
|
||||
UnifiedAlertingEnabled bool
|
||||
Result *GlobalQuotaDTO
|
||||
}
|
||||
|
||||
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:"-"`
|
||||
}
|
||||
@@ -76,6 +76,10 @@ type UserTokenService interface {
|
||||
GetUserRevokedTokens(ctx context.Context, userId int64) ([]*UserToken, error)
|
||||
}
|
||||
|
||||
type ActiveTokenService interface {
|
||||
ActiveTokenCount(ctx context.Context) (int64, error)
|
||||
}
|
||||
|
||||
type UserTokenBackgroundService interface {
|
||||
registry.BackgroundService
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user