api

package
v0.0.1-dev-fe9d83c Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	API = "api"

	Code   = "code"
	Status = "status"
	Msg    = "msg"
	Data   = "data"
)

Variables

View Source
var (
	Role string
	V1   = fmt.Sprintf("/%s/%s", API, "v1")

	ControlHandlers   = map[string][]Handler{}
	ComputeHandlers   = map[string][]Handler{}
	StorageHandlers   = map[string][]Handler{}
	NetworkHandlers   = map[string][]Handler{}
	ModeratorHandlers = map[string][]Handler{}
	EdgeCoreHandlers  = map[string][]Handler{}
)

Functions

func GenControlConvergedHandlers

func GenControlConvergedHandlers() map[string][]Handler

func GetGroupHandlersByRole

func GetGroupHandlersByRole(role string) map[string][]Handler

func GetReqId

func GetReqId(c *gin.Context) string

func ParseWatch

func ParseWatch(c *gin.Context) (bool, error)

func RegisterHandlersToRoles

func RegisterHandlersToRoles(module string, handlers []Handler, rolesToRegister ...string)

func SetBadRequest

func SetBadRequest(c *gin.Context, err error)

func SetErrVariantAlsoNegotiates

func SetErrVariantAlsoNegotiates(c *gin.Context, err error)

func SetInternalServerError

func SetInternalServerError(c *gin.Context, err error)

func SetRedirect

func SetRedirect(c *gin.Context, redirectUrl string)

func SetStatusAccepted

func SetStatusAccepted(c *gin.Context, msg string)

func SetStatusConflict

func SetStatusConflict(c *gin.Context, err error)

func SetStatusCreated

func SetStatusCreated(c *gin.Context, msg string, data any)

func SetStatusNotFound

func SetStatusNotFound(c *gin.Context, err error)

func SetStatusOk

func SetStatusOk(c *gin.Context, msg string, data any)

func SetUnauthorized

func SetUnauthorized(c *gin.Context, err error)

Types

type ComputeStatisticData

type ComputeStatisticData struct {
	Code   int                 `json:"code"`
	Status string              `json:"status"`
	Msg    string              `json:"msg"`
	Data   v1.ComputeStatistic `json:"data"`
}

type Handler

type Handler struct {
	Version              string
	Method               string
	Path                 string
	Func                 gin.HandlerFunc
	IsNotUnderDataCenter bool
}

func (Handler) IsUnderDataCenter

func (h Handler) IsUnderDataCenter() bool

type NodeData

type NodeData struct {
	Code   int     `json:"code"`
	Status string  `json:"status"`
	Msg    string  `json:"msg"`
	Data   v1.Node `json:"data"`
}

type SupportFileListData

type SupportFileListData struct {
	Code   int            `json:"code"`
	Status string         `json:"status"`
	Msg    string         `json:"msg"`
	Data   []support.File `json:"data"`
}

type TuningListData

type TuningListData struct {
	Code   int         `json:"code"`
	Status string      `json:"status"`
	Msg    string      `json:"msg"`
	Data   []v1.Tuning `json:"data"`
}

Jump to

Keyboard shortcuts

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