trafficlimit

package
v1.6.5-rc7 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Create

func Create(ctx context.Context, r *CreateReq) (*models.TrafficLimit, error)

func CreateScheduler

func CreateScheduler(ctx context.Context, projectKey string, trafficInfo *models.TrafficLimitInfo) error

func DeleteScheduler

func DeleteScheduler(projectKey string) error

func GetByProjectAndType

func GetByProjectAndType(ctx context.Context, id types.SFID, apiType enums.TrafficLimitType) (*models.TrafficLimit, error)

func GetByProjectAndTypeMustDB

func GetByProjectAndTypeMustDB(ctx context.Context, id types.SFID, apiType enums.TrafficLimitType) (*models.TrafficLimit, error)

func GetBySFID

func GetBySFID(ctx context.Context, id types.SFID) (*models.TrafficLimit, error)

func GetStartAt added in v1.3.1

func GetStartAt(projectKey string, duration types.Duration) (startAt time.Time)

func Init

func Init(ctx context.Context) error

func ListByCond

func ListByCond(ctx context.Context, r *CondArgs) (data []models.TrafficLimit, err error)

func Remove

func Remove(ctx context.Context, r *CondArgs) error

func RemoveBySFID

func RemoveBySFID(ctx context.Context, id types.SFID) error

func RestartScheduler

func RestartScheduler(ctx context.Context, projectKey string, trafficInfo *models.TrafficLimitInfo) error

func TrafficLimit

func TrafficLimit(ctx context.Context, apiType enums.TrafficLimitType) error

func Update

func Update(ctx context.Context, r *UpdateReq) (*models.TrafficLimit, error)

func UpdateScheduler

func UpdateScheduler(ctx context.Context, projectKey string, trafficInfo *models.TrafficLimitInfo) error

Types

type CondArgs

type CondArgs struct {
	ProjectID types.SFID             `name:"-"`
	ApiType   enums.TrafficLimitType `in:"query" name:"apiType,omitempty"`
}

func (*CondArgs) Condition

func (r *CondArgs) Condition() builder.SqlCondition

type CreateReq

type CreateReq struct {
	Threshold int                    `json:"threshold"`
	Duration  types.Duration         `json:"duration"`
	ApiType   enums.TrafficLimitType `json:"apiType"`
}

type Detail

type Detail struct {
	ProjectName string `json:"projectName" db:"f_project_name"`
	models.TrafficLimit
	datatypes.OperationTimes
}

type ListDetailRsp

type ListDetailRsp struct {
	Total int64     `json:"total"`
	Data  []*Detail `json:"data"`
}

func ListDetail

func ListDetail(ctx context.Context, r *ListReq) (*ListDetailRsp, error)

type ListReq

type ListReq struct {
	CondArgs
	datatypes.Pager
}

func (*ListReq) Additions

func (r *ListReq) Additions() builder.Additions

type ListRsp

type ListRsp struct {
	Data  []models.TrafficLimit `json:"data"`
	Total int64                 `json:"total"`
}

func List

func List(ctx context.Context, r *ListReq) (*ListRsp, error)

type TrafficScheduler

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

func (*TrafficScheduler) Do

func (ts *TrafficScheduler) Do() error

func (*TrafficScheduler) Start

func (ts *TrafficScheduler) Start()

func (*TrafficScheduler) StartNow

func (ts *TrafficScheduler) StartNow()

func (*TrafficScheduler) Stop

func (ts *TrafficScheduler) Stop()

type UpdateReq

type UpdateReq struct {
	TrafficLimitID types.SFID     `json:"-"`
	Threshold      int            `json:"threshold"`
	Duration       types.Duration `json:"duration"`
}

Jump to

Keyboard shortcuts

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