common

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package common is to handle REST API for common funcitonalities

Package common is to handle REST API for common funcitonalities

Package common is to handle REST API for common funcitonalities

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RestCheckHTTPVersion

func RestCheckHTTPVersion(c echo.Context) error

RestCheckHTTPVersion godoc @Summary Check HTTP version of incoming request @Description Checks and logs the HTTP version of the incoming request to the server console. @Tags [Admin] System management @Accept json @Produce json @Success 200 {object} common.SimpleMsg @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /httpVersion [get]

func RestCheckNs

func RestCheckNs(c echo.Context) error

func RestDelAllNs

func RestDelAllNs(c echo.Context) error

RestDelAllNs godoc @Summary Delete all namespaces @Description Delete all namespaces @Tags [Namespace] Namespace management @Accept json @Produce json @Success 200 {object} common.SimpleMsg @Failure 404 {object} common.SimpleMsg @Router /ns [delete]

func RestDelNs

func RestDelNs(c echo.Context) error

RestDelNs godoc @Summary Delete namespace @Description Delete namespace @Tags [Namespace] Namespace management @Accept json @Produce json @Param nsId path string true "Namespace ID" default(ns01) @Success 200 {object} common.SimpleMsg @Failure 404 {object} common.SimpleMsg @Router /ns/{nsId} [delete]

func RestGetAllConfig

func RestGetAllConfig(c echo.Context) error

RestGetAllConfig godoc @Summary List all configs @Description List all configs @Tags [Admin] System environment @Accept json @Produce json @Success 200 {object} RestGetAllConfigResponse @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /config [get]

func RestGetAllNs

func RestGetAllNs(c echo.Context) error

RestGetAllNs godoc @Summary List all namespaces or namespaces' ID @Description List all namespaces or namespaces' ID @Tags [Namespace] Namespace management @Accept json @Produce json @Param option query string false "Option" Enums(id) @Success 200 {object} JSONResult{[DEFAULT]=RestGetAllNsResponse,[ID]=common.IdList} "Different return structures by the given option param" @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /ns [get]

func RestGetConfig

func RestGetConfig(c echo.Context) error

RestGetConfig godoc @Summary Get config @Description Get config @Tags [Admin] System environment @Accept json @Produce json @Param configId path string true "Config ID" @Success 200 {object} common.ConfigInfo @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /config/{configId} [get]

func RestGetHealth

func RestGetHealth(c echo.Context) error

RestGetHealth func is for checking Beetle server health. RestGetHealth godoc @Summary Check Beetle is alive @Description Check Beetle is alive @Tags [Admin] System management @Accept json @Produce json @Success 200 {object} common.SimpleMsg @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /health [get]

func RestGetNs

func RestGetNs(c echo.Context) error

RestGetNs godoc @Summary Get namespace @Description Get namespace @Tags [Namespace] Namespace management @Accept json @Produce json @Param nsId path string true "Namespace ID" default(ns01) @Success 200 {object} common.NsInfo @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /ns/{nsId} [get]

func RestInitAllConfig

func RestInitAllConfig(c echo.Context) error

RestInitAllConfig godoc @Summary Init all configs @Description Init all configs @Tags [Admin] System environment @Accept json @Produce json @Success 200 {object} common.SimpleMsg @Failure 404 {object} common.SimpleMsg @Router /config [delete]

func RestInitConfig

func RestInitConfig(c echo.Context) error

RestInitConfig godoc @Summary Init config @Description Init config @Tags [Admin] System environment @Accept json @Produce json @Param configId path string true "Config ID" @Success 200 {object} common.ConfigInfo @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /config/{configId} [delete]

func RestPostConfig

func RestPostConfig(c echo.Context) error

RestPostConfig godoc @Summary Create or Update config @Description Create or Update config (SPIDER_REST_URL, DRAGONFLY_REST_URL, ...) @Tags [Admin] System environment @Accept json @Produce json @Param config body common.ConfigReq true "Key and Value for configuration" @Success 200 {object} common.ConfigInfo @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /config [post]

func RestPostNs

func RestPostNs(c echo.Context) error

RestPostNs godoc @Summary Create namespace @Description Create namespace @Tags [Namespace] Namespace management @Accept json @Produce json @Param nsReq body common.NsReq true "Details for a new namespace" @Success 200 {object} common.NsInfo @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /ns [post]

func RestPutNs

func RestPutNs(c echo.Context) error

RestPutNs godoc @Summary Update namespace @Description Update namespace @Tags [Namespace] Namespace management @Accept json @Produce json @Param nsId path string true "Namespace ID" default(ns01) @Param namespace body common.NsReq true "Details to update existing namespace" @Success 200 {object} common.NsInfo @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /ns/{nsId} [put]

func Send

func Send(c echo.Context, httpCode int, json interface{}) error

func SendExistence

func SendExistence(c echo.Context, httpCode int, existence bool) error

func SendMessage

func SendMessage(c echo.Context, httpCode int, msg string) error

func Validate

func Validate(c echo.Context, params []string) error

Types

type Existence

type Existence struct {
	Exists bool `json:"exists"`
}

type JSONResult

type JSONResult struct {
}

JSONResult's data field will be overridden by the specific type

type RestGetAllConfigResponse

type RestGetAllConfigResponse struct {
	//Name string     `json:"name"`
	Config []common.ConfigInfo `json:"config"`
}

Response structure for RestGetAllConfig

type RestGetAllNsResponse

type RestGetAllNsResponse struct {
	//Name string     `json:"name"`
	Ns []common.NsInfo `json:"ns"`
}

Response structure for RestGetAllNs

type Status

type Status struct {
	Message string `json:"message"`
}

type TbConnectionName

type TbConnectionName struct {
	ConnectionName string `json:"connectionName"`
}

Jump to

Keyboard shortcuts

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