router

package
v0.0.0-...-cc59c3f Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 61 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BusiGroup

func BusiGroup(ctx *ctx.Context, id int64) *models.BusiGroup

根据业务组ID获取业务组对象。

func CaptchaVerify

func CaptchaVerify(id string, value string) bool

验证

func Dangerous

func Dangerous(c *gin.Context, v interface{}, code ...int)

根据传入的错误信息或错误对象,在 Gin 框架的上下文中响应一个包含错误信息的 JSON 响应

func Dashboard

func Dashboard(ctx *ctx.Context, id int64) *models.Dashboard

根据仪表板ID获取仪表板对象。

func DatasourceCheck

func DatasourceCheck(ds models.Datasource) error

func Render

func Render(c *gin.Context, data, msg interface{})

根据传入的数据对象和可选的错误消息,在 Gin 框架的上下文中渲染 JSON 响应

func TaskCreate

func TaskCreate(v interface{}, ibexc aconf.Ibex) (int64, error)

用于创建任务, return task.id, error

func User

func User(ctx *ctx.Context, id int64) *models.User

根据用户ID获取用户对象

func UserGroup

func UserGroup(ctx *ctx.Context, id int64) *models.UserGroup

根据团队ID获取团队对象。

func Username

func Username(c *gin.Context) string

Types

type AccessDetails

type AccessDetails struct {
	AccessUuid   string
	UserIdentity string
}

type AlertCard

type AlertCard struct {
	Title    string  `json:"title"`
	Total    int     `json:"total"`
	EventIds []int64 `json:"event_ids"`
	Severity int     `json:"severity"`
}

type AlertCate

type AlertCate struct {
	Name       string             `json:"name"`
	IconUrl    string             `json:"icon_url"`
	AlertRules []models.AlertRule `json:"alert_rules"`
	Favorite   bool               `json:"favorite"`
}

type BoardCate

type BoardCate struct {
	Name     string    `json:"name"`
	IconUrl  string    `json:"icon_url"`
	Boards   []Payload `json:"boards"`
	Favorite bool      `json:"favorite"`
}

type CallbackOutput

type CallbackOutput struct {
	Redirect     string       `json:"redirect"`
	User         *models.User `json:"user"`
	AccessToken  string       `json:"access_token"`
	RefreshToken string       `json:"refresh_token"`
}

type CaptchaRedisStore

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

func (*CaptchaRedisStore) Get

func (s *CaptchaRedisStore) Get(id string, clear bool) string

func (*CaptchaRedisStore) Set

func (s *CaptchaRedisStore) Set(id string, value string) error

func (*CaptchaRedisStore) Verify

func (s *CaptchaRedisStore) Verify(id, answer string, clear bool) bool

type CaptchaReqBody

type CaptchaReqBody struct {
	Id          string
	VerifyValue string
}

type ChartGroupPure

type ChartGroupPure struct {
	Name   string      `json:"name"`
	Weight int         `json:"weight"`
	Charts []ChartPure `json:"charts"`
}

type ChartPure

type ChartPure struct {
	Configs string `json:"configs"`
	Weight  int    `json:"weight"`
}

type DashboardPure

type DashboardPure struct {
	Name        string           `json:"name"`
	Tags        string           `json:"tags"`
	Configs     string           `json:"configs"`
	ChartGroups []ChartGroupPure `json:"chart_groups"`
}

type DoneIdsReply

type DoneIdsReply struct {
	Err string `json:"err"`
	Dat struct {
		List []int64 `json:"list"`
	} `json:"dat"`
}

type InstantFormItem

type InstantFormItem struct {
	Time  int64  `json:"time" binding:"required"`
	Query string `json:"query" binding:"required"`
}

type Payload

type Payload struct {
	Cate    string      `json:"cate"`
	Fname   string      `json:"fname"`
	Name    string      `json:"name"`
	Configs interface{} `json:"configs"`
	Tags    string      `json:"tags"`
}

type RSAConfigOutput

type RSAConfigOutput struct {
	OpenRSA      bool
	RSAPublicKey string
}

type RedirectOutput

type RedirectOutput struct {
	Redirect string `json:"redirect"`
	State    string `json:"state"`
}

type Router

type Router struct {
	HTTP              httpx.Config
	Center            cconf.Center
	Operations        cconf.Operation
	DatasourceCache   *memsto.DatasourceCacheType
	NotifyConfigCache *memsto.NotifyConfigCacheType
	PromClients       *prom.PromClientMap
	Redis             storage.Redis
	MetaSet           *metas.Set
	IdentSet          *idents.Set
	TargetCache       *memsto.TargetCacheType
	Sso               *sso.SsoClient
	UserCache         *memsto.UserCacheType
	UserGroupCache    *memsto.UserGroupCacheType
	Ctx               *ctx.Context

	DatasourceCheckHook func(*gin.Context) bool
}

func (*Router) Board

func (rt *Router) Board(id int64) *models.Board

func (*Router) Config

func (rt *Router) Config(r *gin.Engine)

配置 Gin 框架的路由和中间件,从而定义了应用程序的不同路由和处理函数

type SsoConfigOutput

type SsoConfigOutput struct {
	OidcDisplayName  string `json:"oidcDisplayName"`
	CasDisplayName   string `json:"casDisplayName"`
	OauthDisplayName string `json:"oauthDisplayName"`
}

type TargetQuery

type TargetQuery struct {
	Filters []models.HostQuery `json:"queries"`
	P       int                `json:"p"`
	Limit   int                `json:"limit"`
}

type TaskCreateReply

type TaskCreateReply struct {
	Err string `json:"err"`
	Dat int64  `json:"dat"` // task.id
}

type TokenDetails

type TokenDetails struct {
	AccessToken  string // 访问令牌
	RefreshToken string // 刷新令牌
	AccessUuid   string // 访问令牌的唯一标识符
	RefreshUuid  string // 刷新令牌的唯一标识符
	AtExpires    int64  // 访问令牌的过期时间戳
	RtExpires    int64  // 刷新令牌的过期时间戳
}

token 结构体

Jump to

Keyboard shortcuts

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