common

package
v0.6.13 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2022 License: Apache-2.0 Imports: 7 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 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 RestDeleteObject added in v0.3.3

func RestDeleteObject(c echo.Context) error

func RestDeleteObject is a rest api wrapper for DeleteObject. RestDeleteObject godoc @Summary Delete an object @Description Delete an object @Tags [Admin] System management @Accept json @Produce json @Param key query string true "delete object value by key" @Success 200 {object} common.SimpleMsg @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /object [delete]

func RestDeleteObjects added in v0.3.3

func RestDeleteObjects(c echo.Context) error

func RestDeleteObjects is a rest api wrapper for DeleteObjects. RestDeleteObjects godoc @Summary Delete child objects along with the given object @Description Delete child objects along with the given object @Tags [Admin] System management @Accept json @Produce json @Param key query string true "Delete child objects based on the given key string" @Success 200 {object} common.SimpleMsg @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /objects [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 RestGetConnConfig

func RestGetConnConfig(c echo.Context) error

RestGetConnConfig func is a rest api wrapper for GetConnConfig. RestGetConnConfig godoc @Summary Get registered ConnConfig info @Description Get registered ConnConfig info @Tags [Admin] Multi-Cloud environment configuration @Accept json @Produce json @Param connConfigName path string true "Name of connection config (cloud config)" @Success 200 {object} common.ConnConfig @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /connConfig/{connConfigName} [get]

func RestGetConnConfigList

func RestGetConnConfigList(c echo.Context) error

RestGetConnConfigList func is a rest api wrapper for GetConnConfigList. RestGetConnConfigList godoc @Summary List all registered ConnConfig @Description List all registered ConnConfig @Tags [Admin] Multi-Cloud environment configuration @Accept json @Produce json @Success 200 {object} common.ConnConfigList @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /connConfig [get]

func RestGetHealth

func RestGetHealth(c echo.Context) error

RestGetHealth func is for checking Tumblebug server health. RestGetHealth godoc @Summary Check Tumblebug is alive @Description Check Tumblebug 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 RestGetObject added in v0.3.3

func RestGetObject(c echo.Context) error

func RestGetObject is a rest api wrapper for GetObject. RestGetObject godoc @Summary Get value of an object @Description Get value of an object @Tags [Admin] System management @Accept json @Produce json @Param key query string true "get object value by key" @Success 200 {object} common.SimpleMsg @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /object [get]

func RestGetObjects added in v0.3.3

func RestGetObjects(c echo.Context) error

func RestGetObjects is a rest api wrapper for GetObjectList. RestGetObjects godoc @Summary List all objects for a given key @Description List all objects for a given key @Tags [Admin] System management @Accept json @Produce json @Param key query string true "retrieve objects by key" @Success 200 {object} common.SimpleMsg @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /objects [get]

func RestGetRegion

func RestGetRegion(c echo.Context) error

RestGetRegion func is a rest api wrapper for GetRegion. RestGetRegion godoc @Summary Get registered region info @Description Get registered region info @Tags [Admin] Multi-Cloud environment configuration @Accept json @Produce json @Param regionName path string true "Name of region to retrieve" @Success 200 {object} common.Region @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /region/{regionName} [get]

func RestGetRegionList

func RestGetRegionList(c echo.Context) error

RestGetRegionList func is a rest api wrapper for GetRegionList. RestGetRegionList godoc @Summary List all registered regions @Description List all registered regions @Tags [Admin] Multi-Cloud environment configuration @Accept json @Produce json @Success 200 {object} common.RegionList @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /region [get]

func RestInitAllConfig added in v0.3.9

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 added in v0.3.9

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 RestInspectResources added in v0.3.6

func RestInspectResources(c echo.Context) error

RestInspectResources godoc @Summary Inspect Resources (vNet, securityGroup, sshKey, vm) registered in CB-Tumblebug, CB-Spider, CSP @Description Inspect Resources (vNet, securityGroup, sshKey, vm) registered in CB-Tumblebug, CB-Spider, CSP @Tags [Admin] System management @Accept json @Produce json @Param connectionName body RestInspectResourcesRequest true "Specify connectionName and resource type" @Success 200 {object} mcis.InspectResource @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /inspectResources [post]

func RestInspectResourcesOverview added in v0.5.4

func RestInspectResourcesOverview(c echo.Context) error

RestInspectResourcesOverview godoc @Summary Inspect Resources Overview (vNet, securityGroup, sshKey, vm) registered in CB-Tumblebug and CSP for all connections @Description Inspect Resources Overview (vNet, securityGroup, sshKey, vm) registered in CB-Tumblebug and CSP for all connections @Tags [Admin] System management @Accept json @Produce json @Success 200 {object} mcis.InspectResourceAllResult @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /inspectResourcesOverview [get]

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 RestRegisterCspNativeResources added in v0.5.3

func RestRegisterCspNativeResources(c echo.Context) error

RestRegisterCspNativeResources godoc @Summary Register CSP Native Resources (vNet, securityGroup, sshKey, vm) to CB-Tumblebug @Description Register CSP Native Resources (vNet, securityGroup, sshKey, vm) to CB-Tumblebug @Tags [Admin] System management @Accept json @Produce json @Param Request body RestRegisterCspNativeResourcesRequest true "Specify connectionName, NS Id, and MCIS Name"" @Param option query string false "Option to specify resourceType" Enums(onlyVm, exceptVm) @Success 200 {object} mcis.RegisterResourceResult @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /registerCspResources [post]

func RestRegisterCspNativeResourcesAll added in v0.5.3

func RestRegisterCspNativeResourcesAll(c echo.Context) error

RestRegisterCspNativeResourcesAll godoc @Summary Register CSP Native Resources (vNet, securityGroup, sshKey, vm) from all Clouds to CB-Tumblebug @Description Register CSP Native Resources (vNet, securityGroup, sshKey, vm) from all Clouds to CB-Tumblebug @Tags [Admin] System management @Accept json @Produce json @Param Request body RestRegisterCspNativeResourcesRequestAll true "Specify NS Id and MCIS Name" @Param option query string false "Option to specify resourceType" Enums(onlyVm, exceptVm) @Success 200 {object} mcis.RegisterResourceAllResult @Failure 404 {object} common.SimpleMsg @Failure 500 {object} common.SimpleMsg @Router /registerCspResourcesAll [post]

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 added in v0.3.11

type JSONResult struct {
}

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

type ObjectList added in v0.3.3

type ObjectList struct {
	Object []string `json:"object"`
}

ObjectList struct consists of object IDs

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 RestInspectResourcesRequest added in v0.3.6

type RestInspectResourcesRequest struct {
	ConnectionName string `json:"connectionName" example:"aws-ap-southeast-1"`
	ResourceType   string `json:"resourceType" example:"vNet" enums:"vNet,securityGroup,sshKey,vm"`
}

Request struct for RestInspectResources

type RestRegisterCspNativeResourcesRequest added in v0.5.3

type RestRegisterCspNativeResourcesRequest struct {
	ConnectionName string `json:"connectionName" example:"aws-ap-southeast-1"`
	NsId           string `json:"nsId" example:"ns01"`
	McisName       string `json:"mcisName" example:"csp"`
}

Request struct for RestRegisterCspNativeResources

type RestRegisterCspNativeResourcesRequestAll added in v0.5.3

type RestRegisterCspNativeResourcesRequestAll struct {
	NsId     string `json:"nsId" example:"ns01"`
	McisName string `json:"mcisName" example:"csp"`
}

Request struct for RestRegisterCspNativeResources

type Status

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

type TbConnectionName added in v0.3.7

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