From 90d304532f13f5b91336510dae62350d9181b02b Mon Sep 17 00:00:00 2001 From: powerkimhub Date: Tue, 27 Aug 2024 18:05:57 +0900 Subject: [PATCH] Add swagger API documentation for VPC, SG and KeyPair Management APIs --- Makefile | 14 +- api-runtime/rest-runtime/CBSpiderRuntime.go | 14 +- api-runtime/rest-runtime/KeyPairRest.go | 231 +++++--- api-runtime/rest-runtime/SecurityGroupRest.go | 335 ++++++++---- api-runtime/rest-runtime/VPC-SubnetRest.go | 498 +++++++++++++----- api-runtime/rest-runtime/docs/docs.go | 347 ------------ api-runtime/rest-runtime/docs/swagger.json | 285 ---------- api-runtime/rest-runtime/docs/swagger.yaml | 182 ------- .../cloud-driver/interfaces/resources/IId.go | 4 +- .../interfaces/resources/KeyPairHandler.go | 15 +- .../interfaces/resources/KeyValue.go | 4 +- .../interfaces/resources/SecurityHandler.go | 23 +- .../interfaces/resources/VPCHandler.go | 20 +- go.mod | 18 +- go.sum | 51 +- 15 files changed, 817 insertions(+), 1224 deletions(-) delete mode 100644 api-runtime/rest-runtime/docs/docs.go delete mode 100644 api-runtime/rest-runtime/docs/swagger.json delete mode 100644 api-runtime/rest-runtime/docs/swagger.yaml diff --git a/Makefile b/Makefile index d372cc7fe..df9e56683 100644 --- a/Makefile +++ b/Makefile @@ -1,14 +1,14 @@ -default: cli +default: swag cli @echo -e '\t[CB-Spider] build ./bin/cb-spider....' @go mod download @go mod tidy @go build -o bin/cb-spider ./api-runtime -dyna plugin plug dynamic: cli +dyna plugin plug dynamic: swag cli @echo -e '\t[CB-Spider] build ./bin/cb-spider with plugin mode...' @go mod download @go build -tags dyna -o bin/cb-spider-dyna ./api-runtime @./build_all_driver_lib.sh; -cc: +cc: swag @echo -e '\t[CB-Spider] build ./bin/cb-spider-arm for arm...' GOOS=linux GOARCH=arm go build -o cb-spider-arm ./api-runtime clean clear: @@ -36,5 +36,11 @@ cli: swag swagger: @echo -e '\t[CB-Spider] build Swagger docs' - @~/go/bin/swag i -g api-runtime/rest-runtime/CBSpiderRuntime.go -o api-runtime/rest-runtime/docs + @~/go/bin/swag i -g api-runtime/rest-runtime/CBSpiderRuntime.go -d ./,./cloud-control-manager -o api + @sed -i 's/github_com_cloud-barista_cb-spider_cloud-control-manager_cloud-driver_interfaces_resources./spider./g' ./api/docs.go + @sed -i 's/github_com_cloud-barista_cb-spider_cloud-control-manager_cloud-driver_interfaces_resources./spider./g' ./api/swagger.json + @sed -i 's/github_com_cloud-barista_cb-spider_cloud-control-manager_cloud-driver_interfaces_resources./spider./g' ./api/swagger.yaml + @sed -i 's/restruntime./spider./g' ./api/docs.go + @sed -i 's/restruntime./spider./g' ./api/swagger.json + @sed -i 's/restruntime./spider./g' ./api/swagger.yaml diff --git a/api-runtime/rest-runtime/CBSpiderRuntime.go b/api-runtime/rest-runtime/CBSpiderRuntime.go index 96deb3fd4..473e27d56 100644 --- a/api-runtime/rest-runtime/CBSpiderRuntime.go +++ b/api-runtime/rest-runtime/CBSpiderRuntime.go @@ -32,7 +32,7 @@ import ( "github.com/labstack/echo/v4/middleware" // echo-swagger middleware - _ "github.com/cloud-barista/cb-spider/api-runtime/rest-runtime/docs" + _ "github.com/cloud-barista/cb-spider/api" echoSwagger "github.com/swaggo/echo-swagger" "github.com/natefinch/lumberjack" @@ -52,8 +52,11 @@ var cblog *logrus.Logger // @license.url http://www.apache.org/licenses/LICENSE-2.0.html // @host localhost:1024 + // @BasePath /spider +// @schemes http + // @securityDefinitions.basic BasicAuth func init() { @@ -89,7 +92,7 @@ type route struct { // JSON Simple message struct type SimpleMsg struct { - Message string `json:"message" example:"Any message"` + Message string `json:"message" validate:"required" example:"Any message" description:"A simple message to be returned by the API"` } //// CB-Spider Servcie Address Configuration @@ -185,7 +188,9 @@ func RunServer() { {"GET", "/", aw.SpiderInfo}, //----------Swagger - {"GET", "/swagger/*", echoSwagger.WrapHandler}, + {"GET", "/api", echoSwagger.WrapHandler}, + {"GET", "/api/", echoSwagger.WrapHandler}, + {"GET", "/api/*", echoSwagger.WrapHandler}, //----------EndpointInfo {"GET", "/endpointinfo", endpointInfo}, @@ -598,6 +603,9 @@ func ApiServer(routes []route) { // for WebTerminal e.Static("/spider/adminweb/static", filepath.Join(cbspiderRoot, "api-runtime/rest-runtime/admin-web/static")) + // for swagger + e.Static("/spider/swagger", filepath.Join(cbspiderRoot, "api")) + e.HideBanner = true e.HidePort = true diff --git a/api-runtime/rest-runtime/KeyPairRest.go b/api-runtime/rest-runtime/KeyPairRest.go index c48b21c04..2f481d1d9 100644 --- a/api-runtime/rest-runtime/KeyPairRest.go +++ b/api-runtime/rest-runtime/KeyPairRest.go @@ -20,20 +20,34 @@ import ( "strconv" ) -//================ Disk Handler +//================ KeyPair Handler -type keyRegisterReq struct { - ConnectionName string +// KeyRegisterRequest represents the request body for registering a KeyPair. +type KeyRegisterRequest struct { + ConnectionName string `json:"ConnectionName" validate:"required" example:"aws-connection"` ReqInfo struct { - Name string - CSPId string - } + Name string `json:"Name" validate:"required" example:"keypair-01"` + CSPId string `json:"CSPId" validate:"required" example:"csp-key-1234"` + } `json:"ReqInfo" validate:"required"` } +// registerKey godoc +// @ID register-key +// @Summary Register KeyPair +// @Description Register a new KeyPair with the specified name and CSP ID. +// @Tags [KeyPair management] +// @Accept json +// @Produce json +// @Param KeyRegisterRequest body restruntime.KeyRegisterRequest true "Request body for registering a KeyPair" +// @Success 200 {object} cres.KeyPairInfo "Details of the registered KeyPair" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /regkeypair [post] func RegisterKey(c echo.Context) error { cblog.Info("call RegisterKey()") - req := keyRegisterReq{} + req := KeyRegisterRequest{} if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -51,15 +65,24 @@ func RegisterKey(c echo.Context) error { return c.JSON(http.StatusOK, result) } -// (1) get args from REST Call -// (2) call common-runtime API -// (3) return REST Json Format +// unregisterKey godoc +// @ID unregister-key +// @Summary Unregister KeyPair +// @Description Unregister a KeyPair with the specified name. +// @Tags [KeyPair management] +// @Accept json +// @Produce json +// @Param ConnectionRequest body restruntime.ConnectionRequest true "Request body for unregistering a KeyPair" +// @Param Name path string true "The name of the KeyPair to unregister" +// @Success 200 {object} BooleanInfo "Result of the unregister operation" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /regkeypair/{Name} [delete] func UnregisterKey(c echo.Context) error { cblog.Info("call UnregisterKey()") - var req struct { - ConnectionName string - } + var req ConnectionRequest if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -78,42 +101,33 @@ func UnregisterKey(c echo.Context) error { return c.JSON(http.StatusOK, &resultInfo) } -// type keyPairCreateReq struct { -// ConnectionName string -// ReqInfo struct { -// Name string -// } -// } - -// JSONResult's data field will be overridden by the specific type -type JSONResult struct { - //Code int `json:"code" ` - //Message string `json:"message"` - //Data interface{} `json:"data"` +// KeyCreateRequest represents the request body for creating a KeyPair. +type KeyCreateRequest struct { + ConnectionName string `json:"ConnectionName" validate:"required" example:"aws-connection"` + IDTransformMode string `json:"IDTransformMode,omitempty" validate:"omitempty" example:"ON"` // ON: transform CSP ID, OFF: no-transform CSP ID + ReqInfo struct { + Name string `json:"Name" validate:"required" example:"keypair-01"` + TagList []cres.KeyValue `json:"TagList,omitempty" validate:"omitempty"` + } `json:"ReqInfo" validate:"required"` } // createKey godoc -// @Summary Create SSH Key -// @Description Create SSH Key -// @Tags [CCM] Access key management +// @ID create-key +// @Summary Create KeyPair +// @Description Create a new KeyPair with the specified configurations. +// @Tags [KeyPair management] // @Accept json // @Produce json -// @Param keyPairCreateReq body JSONResult{ConnectionName=string,ReqInfo=JSONResult{Name=string}} true "Request body to create key" -// @Success 200 {object} resources.KeyPairInfo -// @Failure 404 {object} SimpleMsg -// @Failure 500 {object} SimpleMsg +// @Param KeyCreateRequest body restruntime.KeyCreateRequest true "Request body for creating a KeyPair" +// @Success 200 {object} cres.KeyPairInfo "Details of the created KeyPair" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" // @Router /keypair [post] func CreateKey(c echo.Context) error { cblog.Info("call CreateKey()") - var req struct { - ConnectionName string - IDTransformMode string // ON | OFF, default is ON - ReqInfo struct { - Name string - TagList []cres.KeyValue - } - } + var req KeyCreateRequest if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -134,12 +148,28 @@ func CreateKey(c echo.Context) error { return c.JSON(http.StatusOK, result) } +// KeyListResponse represents the response body for listing KeyPairs. +type KeyListResponse struct { + Result []*cres.KeyPairInfo `json:"keypair"` +} + +// listKey godoc +// @ID list-key +// @Summary List KeyPairs +// @Description Retrieve a list of KeyPairs associated with a specific connection. +// @Tags [KeyPair management] +// @Accept json +// @Produce json +// @Param ConnectionName query string true "The name of the Connection to list KeyPairs for" +// @Success 200 {object} restruntime.KeyListResponse "List of KeyPairs" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid query parameter" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /keypair [get] func ListKey(c echo.Context) error { cblog.Info("call ListKey()") - var req struct { - ConnectionName string - } + var req ConnectionRequest if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -156,23 +186,28 @@ func ListKey(c echo.Context) error { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - var jsonResult struct { - Result []*cres.KeyPairInfo `json:"keypair"` - } + var jsonResult KeyListResponse jsonResult.Result = result return c.JSON(http.StatusOK, &jsonResult) } -// list all KeyPairs for management -// (1) get args from REST Call -// (2) get all KeyPair List by common-runtime API -// (3) return REST Json Format +// listAllKey godoc +// @ID list-all-key +// @Summary List All KeyPairs +// @Description Retrieve a list of all KeyPairs across all connections. +// @Tags [KeyPair management] +// @Accept json +// @Produce json +// @Param ConnectionName query string true "The name of the Connection" +// @Success 200 {object} AllResourceListResponse "List of all KeyPairs with their respective lists" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid query parameter" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /allkeypair [get] func ListAllKey(c echo.Context) error { cblog.Info("call ListAllKey()") - var req struct { - ConnectionName string - } + var req ConnectionRequest if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -192,12 +227,24 @@ func ListAllKey(c echo.Context) error { return c.JSON(http.StatusOK, &allResourceList) } +// getKey godoc +// @ID get-key +// @Summary Get KeyPair +// @Description Retrieve details of a specific KeyPair. +// @Tags [KeyPair management] +// @Accept json +// @Produce json +// @Param ConnectionName query string true "The name of the Connection to get a KeyPair for" +// @Param Name path string true "The name of the KeyPair to retrieve" +// @Success 200 {object} cres.KeyPairInfo "Details of the KeyPair" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /keypair/{Name} [get] func GetKey(c echo.Context) error { cblog.Info("call GetKey()") - var req struct { - ConnectionName string - } + var req ConnectionRequest if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -217,15 +264,25 @@ func GetKey(c echo.Context) error { return c.JSON(http.StatusOK, result) } -// (1) get args from REST Call -// (2) call common-runtime API -// (3) return REST Json Format +// deleteKey godoc +// @ID delete-key +// @Summary Delete KeyPair +// @Description Delete a specified KeyPair. +// @Tags [KeyPair management] +// @Accept json +// @Produce json +// @Param ConnectionRequest body restruntime.ConnectionRequest true "Request body for deleting a KeyPair" +// @Param Name path string true "The name of the KeyPair to delete" +// @Param force query string false "Force delete the KeyPair" +// @Success 200 {object} BooleanInfo "Result of the delete operation" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /keypair/{Name} [delete] func DeleteKey(c echo.Context) error { cblog.Info("call DeleteKey()") - var req struct { - ConnectionName string - } + var req ConnectionRequest if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -244,15 +301,24 @@ func DeleteKey(c echo.Context) error { return c.JSON(http.StatusOK, &resultInfo) } -// (1) get args from REST Call -// (2) call common-runtime API -// (3) return REST Json Format +// deleteCSPKey godoc +// @ID delete-csp-key +// @Summary Delete CSP KeyPair +// @Description Delete a specified CSP KeyPair. +// @Tags [KeyPair management] +// @Accept json +// @Produce json +// @Param ConnectionRequest body restruntime.ConnectionRequest true "Request body for deleting a CSP KeyPair" +// @Param Id path string true "The CSP KeyPair ID to delete" +// @Success 200 {object} BooleanInfo "Result of the delete operation" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /cspkeypair/{Id} [delete] func DeleteCSPKey(c echo.Context) error { cblog.Info("call DeleteCSPKey()") - var req struct { - ConnectionName string - } + var req ConnectionRequest if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -271,6 +337,15 @@ func DeleteCSPKey(c echo.Context) error { return c.JSON(http.StatusOK, &resultInfo) } +// countAllKeys godoc +// @ID count-all-keys +// @Summary Count All KeyPairs +// @Description Get the total number of KeyPairs across all connections. +// @Tags [KeyPair management] +// @Produce json +// @Success 200 {object} CountResponse "Total count of KeyPairs" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /countkeypair [get] func CountAllKeys(c echo.Context) error { // Call common-runtime API to get count of Keys count, err := cmrt.CountAllKeys() @@ -279,15 +354,24 @@ func CountAllKeys(c echo.Context) error { } // Prepare JSON result - var jsonResult struct { - Count int `json:"count"` + jsonResult := CountResponse{ + Count: int(count), } - jsonResult.Count = int(count) // Return JSON response return c.JSON(http.StatusOK, jsonResult) } +// countKeysByConnection godoc +// @ID count-keys-by-connection +// @Summary Count KeyPairs by Connection +// @Description Get the total number of KeyPairs for a specific connection. +// @Tags [KeyPair management] +// @Produce json +// @Param ConnectionName path string true "The name of the Connection" +// @Success 200 {object} CountResponse "Total count of KeyPairs for the connection" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /countkeypair/{ConnectionName} [get] func CountKeysByConnection(c echo.Context) error { // Call common-runtime API to get count of Keys count, err := cmrt.CountKeysByConnection(c.Param("ConnectionName")) @@ -296,10 +380,9 @@ func CountKeysByConnection(c echo.Context) error { } // Prepare JSON result - var jsonResult struct { - Count int `json:"count"` + jsonResult := CountResponse{ + Count: int(count), } - jsonResult.Count = int(count) // Return JSON response return c.JSON(http.StatusOK, jsonResult) diff --git a/api-runtime/rest-runtime/SecurityGroupRest.go b/api-runtime/rest-runtime/SecurityGroupRest.go index 7abe2d114..369225e40 100644 --- a/api-runtime/rest-runtime/SecurityGroupRest.go +++ b/api-runtime/rest-runtime/SecurityGroupRest.go @@ -23,19 +23,33 @@ import ( //================ SecurityGroup Handler -type securityGroupRegisterReq struct { - ConnectionName string +// SecurityGroupRegisterRequest represents the request body for registering a SecurityGroup. +type SecurityGroupRegisterRequest struct { + ConnectionName string `json:"ConnectionName" validate:"required" example:"aws-connection"` ReqInfo struct { - VPCName string - Name string - CSPId string - } + VPCName string `json:"VPCName" validate:"required" example:"vpc-01"` + Name string `json:"Name" validate:"required" example:"sg-01"` + CSPId string `json:"CSPId" validate:"required" example:"csp-sg-1234"` + } `json:"ReqInfo" validate:"required"` } +// registerSecurity godoc +// @ID register-securitygroup +// @Summary Register SecurityGroup +// @Description Register a new Security Group with the specified name and CSP ID. +// @Tags [SecurityGroup management] +// @Accept json +// @Produce json +// @Param SecurityGroupRegisterRequest body restruntime.SecurityGroupRegisterRequest true "Request body for registering a SecurityGroup" +// @Success 200 {object} cres.SecurityInfo "Details of the registered SecurityGroup" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /regsecuritygroup [post] func RegisterSecurity(c echo.Context) error { cblog.Info("call RegisterSecurity()") - req := securityGroupRegisterReq{} + req := SecurityGroupRegisterRequest{} if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -53,15 +67,24 @@ func RegisterSecurity(c echo.Context) error { return c.JSON(http.StatusOK, result) } -// (1) get args from REST Call -// (2) call common-runtime API -// (3) return REST Json Format +// unregisterSecurity godoc +// @ID unregister-securitygroup +// @Summary Unregister SecurityGroup +// @Description Unregister a Security Group with the specified name. +// @Tags [SecurityGroup management] +// @Accept json +// @Produce json +// @Param ConnectionRequest body restruntime.ConnectionRequest true "Request body for unregistering a SecurityGroup" +// @Param Name path string true "The name of the SecurityGroup to unregister" +// @Success 200 {object} BooleanInfo "Result of the unregister operation" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /regsecuritygroup/{Name} [delete] func UnregisterSecurity(c echo.Context) error { cblog.Info("call UnregisterSecurity()") - var req struct { - ConnectionName string - } + req := ConnectionRequest{} if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -80,36 +103,35 @@ func UnregisterSecurity(c echo.Context) error { return c.JSON(http.StatusOK, &resultInfo) } -type securityGroupCreateReq struct { - ConnectionName string - IDTransformMode string // ON | OFF, default is ON +// SecurityGroupCreateRequest represents the request body for creating a SecurityGroup. +type SecurityGroupCreateRequest struct { + ConnectionName string `json:"ConnectionName" validate:"required" example:"aws-connection"` + IDTransformMode string `json:"IDTransformMode,omitempty" validate:"omitempty" example:"ON"` // ON: transform CSP ID, OFF: no-transform CSP ID ReqInfo struct { - Name string - VPCName string - Direction string - SecurityRules *[]cres.SecurityRuleInfo - TagList []dri.KeyValue - } + Name string `json:"Name" validate:"required" example:"sg-01"` + VPCName string `json:"VPCName" validate:"required" example:"vpc-01"` + SecurityRules *[]cres.SecurityRuleInfo `json:"SecurityRules" validate:"required"` + TagList []dri.KeyValue `json:"TagList,omitempty" validate:"omitempty"` + } `json:"ReqInfo" validate:"required"` } -/* - // createSecurity godoc - -// @Summary Create Security Group -// @Description Create Security Group -// @Tags [CCM] Security Group management +// createSecurity godoc +// @ID create-securitygroup +// @Summary Create SecurityGroup +// @Description Create a new Security Group with specified rules and tags. +// @Tags [SecurityGroup management] // @Accept json // @Produce json -// @Param securityGroupCreateReq body securityGroupCreateReq true "Request body to create Security Group" -// @Success 200 {object} resources.SecurityInfo -// @Failure 404 {object} SimpleMsg -// @Failure 500 {object} SimpleMsg +// @Param SecurityGroupCreateRequest body restruntime.SecurityGroupCreateRequest true "Request body for creating a SecurityGroup" +// @Success 200 {object} cres.SecurityInfo "Details of the created SecurityGroup" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" // @Router /securitygroup [post] -*/ func CreateSecurity(c echo.Context) error { cblog.Info("call CreateSecurity()") - req := securityGroupCreateReq{} + req := SecurityGroupCreateRequest{} if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -117,10 +139,8 @@ func CreateSecurity(c echo.Context) error { // Rest RegInfo => Driver ReqInfo reqInfo := cres.SecurityReqInfo{ - //IId: cres.IID{req.ReqInfo.VPCName + cm.SG_DELIMITER + req.ReqInfo.Name, ""}, - IId: cres.IID{req.ReqInfo.Name, req.ReqInfo.Name}, // for NCP: fixed NameID => SystemID, Driver: (1)search systemID with fixed NameID (2)replace fixed NameID into SysemID - VpcIID: cres.IID{req.ReqInfo.VPCName, ""}, - // deprecated; Direction: req.ReqInfo.Direction, + IId: cres.IID{req.ReqInfo.Name, req.ReqInfo.Name}, + VpcIID: cres.IID{req.ReqInfo.VPCName, ""}, SecurityRules: req.ReqInfo.SecurityRules, TagList: req.ReqInfo.TagList, } @@ -134,56 +154,75 @@ func CreateSecurity(c echo.Context) error { return c.JSON(http.StatusOK, result) } +// ListSecurityResponse represents the response body for listing SecurityGroups. +type ListSecurityResponse struct { + Result []*cres.SecurityInfo `json:"securitygroup" validate:"required" description:"A list of security group information"` +} + +// listSecurity godoc +// @ID list-securitygroup +// @Summary List SecurityGroups +// @Description Retrieve a list of Security Groups associated with a specific connection. +// @Tags [SecurityGroup management] +// @Accept json +// @Produce json +// @Param ConnectionName query string true "The name of the Connection to list SecurityGroups for" +// @Success 200 {object} restruntime.ListSecurityResponse "List of SecurityGroups" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid query parameter" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /securitygroup [get] func ListSecurity(c echo.Context) error { cblog.Info("call ListSecurity()") - var req struct { - ConnectionName string - } + req := ConnectionRequest{} if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - // To support for Get-Query Param Type API if req.ConnectionName == "" { req.ConnectionName = c.QueryParam("ConnectionName") } - // Call common-runtime API result, err := cmrt.ListSecurity(req.ConnectionName, SG) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - var jsonResult struct { - Result []*cres.SecurityInfo `json:"securitygroup"` + jsonResult := ListSecurityResponse{ + Result: result, } - jsonResult.Result = result + return c.JSON(http.StatusOK, &jsonResult) } -// list all SGs for management -// (1) get args from REST Call -// (2) get all SG List by common-runtime API -// (3) return REST Json Format +// listAllSecurity godoc +// @ID list-all-securitygroups +// @Summary List All SecurityGroups +// @Description Retrieve a list of all Security Groups across all connections. +// @Tags [SecurityGroup management] +// @Accept json +// @Produce json +// @Param ConnectionName query string true "The name of the Connection" +// @Success 200 {object} AllResourceListResponse "List of all SecurityGroups with their respective lists" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /allsecuritygroup [get] func ListAllSecurity(c echo.Context) error { cblog.Info("call ListAllSecurity()") - var req struct { - ConnectionName string - } + req := ConnectionRequest{} if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - // To support for Get-Query Param Type API if req.ConnectionName == "" { req.ConnectionName = c.QueryParam("ConnectionName") } - // Call common-runtime API allResourceList, err := cmrt.ListAllResource(req.ConnectionName, SG) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -192,23 +231,33 @@ func ListAllSecurity(c echo.Context) error { return c.JSON(http.StatusOK, &allResourceList) } +// getSecurity godoc +// @ID get-securitygroup +// @Summary Get SecurityGroup +// @Description Retrieve details of a specific Security Group. +// @Tags [SecurityGroup management] +// @Accept json +// @Produce json +// @Param ConnectionName query string true "The name of the Connection to get a SecurityGroup for" +// @Param Name path string true "The name of the SecurityGroup to retrieve" +// @Success 200 {object} cres.SecurityInfo "Details of the SecurityGroup" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /securitygroup/{Name} [get] func GetSecurity(c echo.Context) error { cblog.Info("call GetSecurity()") - var req struct { - ConnectionName string - } + req := ConnectionRequest{} if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - // To support for Get-Query Param Type API if req.ConnectionName == "" { req.ConnectionName = c.QueryParam("ConnectionName") } - // Call common-runtime API result, err := cmrt.GetSecurity(req.ConnectionName, SG, c.Param("Name")) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -217,21 +266,30 @@ func GetSecurity(c echo.Context) error { return c.JSON(http.StatusOK, result) } -// (1) get args from REST Call -// (2) call common-runtime API -// (3) return REST Json Format +// deleteSecurity godoc +// @ID delete-securitygroup +// @Summary Delete SecurityGroup +// @Description Delete a specified Security Group. +// @Tags [SecurityGroup management] +// @Accept json +// @Produce json +// @Param ConnectionRequest body restruntime.ConnectionRequest true "Request body for deleting a SecurityGroup" +// @Param Name path string true "The name of the SecurityGroup to delete" +// @Param force query string false "Force delete the SecurityGroup" +// @Success 200 {object} BooleanInfo "Result of the delete operation" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /securitygroup/{Name} [delete] func DeleteSecurity(c echo.Context) error { cblog.Info("call DeleteSecurity()") - var req struct { - ConnectionName string - } + req := ConnectionRequest{} if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - // Call common-runtime API result, err := cmrt.DeleteSecurity(req.ConnectionName, SG, c.Param("Name"), c.QueryParam("force")) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -244,21 +302,29 @@ func DeleteSecurity(c echo.Context) error { return c.JSON(http.StatusOK, &resultInfo) } -// (1) get args from REST Call -// (2) call common-runtime API -// (3) return REST Json Format +// deleteCSPSecurity godoc +// @ID delete-csp-securitygroup +// @Summary Delete CSP SecurityGroup +// @Description Delete a specified CSP Security Group. +// @Tags [SecurityGroup management] +// @Accept json +// @Produce json +// @Param ConnectionRequest body restruntime.ConnectionRequest true "Request body for deleting a CSP SecurityGroup" +// @Param Id path string true "The CSP SecurityGroup ID to delete" +// @Success 200 {object} BooleanInfo "Result of the delete operation" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /cspsecuritygroup/{Id} [delete] func DeleteCSPSecurity(c echo.Context) error { cblog.Info("call DeleteCSPSecurity()") - var req struct { - ConnectionName string - } + req := ConnectionRequest{} if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - // Call common-runtime API result, _, err := cmrt.DeleteCSPResource(req.ConnectionName, SG, c.Param("Id")) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -271,41 +337,55 @@ func DeleteCSPSecurity(c echo.Context) error { return c.JSON(http.StatusOK, &resultInfo) } -type ruleControlReq struct { - ConnectionName string +// RuleControlRequest represents the request body for controlling rules in a SecurityGroup. +type RuleControlRequest struct { + ConnectionName string `json:"ConnectionName" validate:"required" example:"aws-connection"` ReqInfo struct { RuleInfoList []struct { - Direction string - IPProtocol string - FromPort string - ToPort string - CIDR string - } - } + Direction string `json:"Direction" validate:"required" example:"inbound"` + IPProtocol string `json:"IPProtocol" validate:"required" example:"TCP"` + FromPort string `json:"FromPort" validate:"required" example:"22"` + ToPort string `json:"ToPort" validate:"required" example:"22"` + CIDR string `json:"CIDR,omitempty" validate:"omitempty" example:"0.0.0.0/0(default)"` + } `json:"RuleInfoList" validate:"required"` + } `json:"ReqInfo" validate:"required"` } -// (1) get rules info from REST Call -// (2) call common-runtime API -// (3) return REST Json Format +// addRules godoc +// @ID add-rules-securitygroup +// @Summary Add Rules to SecurityGroup +// @Description Add new rules to a Security Group. +// @Tags [SecurityGroup management] +// @Accept json +// @Produce json +// @Param SGName path string true "The name of the SecurityGroup to add rules to" +// @Param RuleControlRequest body restruntime.RuleControlRequest true "Request body for adding rules" +// @Success 200 {object} cres.SecurityInfo "Details of the SecurityGroup after adding rules" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /securitygroup/{SGName}/rules [post] func AddRules(c echo.Context) error { cblog.Info("call AddRules()") - req := ruleControlReq{} + req := RuleControlRequest{} if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - // Rest RegInfo => Driver ReqInfo - // create RuleInfo List reqRuleInfoList := []cres.SecurityRuleInfo{} for _, info := range req.ReqInfo.RuleInfoList { - ruleInfo := cres.SecurityRuleInfo{Direction: info.Direction, - IPProtocol: info.IPProtocol, FromPort: info.FromPort, ToPort: info.ToPort, CIDR: info.CIDR} + ruleInfo := cres.SecurityRuleInfo{ + Direction: info.Direction, + IPProtocol: info.IPProtocol, + FromPort: info.FromPort, + ToPort: info.ToPort, + CIDR: info.CIDR, + } reqRuleInfoList = append(reqRuleInfoList, ruleInfo) } - // Call common-runtime API result, err := cmrt.AddRules(req.ConnectionName, c.Param("SGName"), reqRuleInfoList) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -314,29 +394,41 @@ func AddRules(c echo.Context) error { return c.JSON(http.StatusOK, result) } -// (1) get rules info from REST Call -// (2) call common-runtime API -// (3) return REST Json Format +// removeRules godoc +// @ID remove-rules-securitygroup +// @Summary Remove Rules from SecurityGroup +// @Description Remove existing rules from a Security Group. +// @Tags [SecurityGroup management] +// @Accept json +// @Produce json +// @Param SGName path string true "The name of the SecurityGroup to remove rules from" +// @Param RuleControlRequest body restruntime.RuleControlRequest true "Request body for removing rules" +// @Success 200 {object} BooleanInfo "Result of the remove operation" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /securitygroup/{SGName}/rules [delete] func RemoveRules(c echo.Context) error { cblog.Info("call RemoveRules()") - req := ruleControlReq{} + req := RuleControlRequest{} if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - // Rest RegInfo => Driver ReqInfo - // create RuleInfo List reqRuleInfoList := []cres.SecurityRuleInfo{} for _, info := range req.ReqInfo.RuleInfoList { - ruleInfo := cres.SecurityRuleInfo{Direction: info.Direction, - IPProtocol: info.IPProtocol, FromPort: info.FromPort, ToPort: info.ToPort, CIDR: info.CIDR} + ruleInfo := cres.SecurityRuleInfo{ + Direction: info.Direction, + IPProtocol: info.IPProtocol, + FromPort: info.FromPort, + ToPort: info.ToPort, + CIDR: info.CIDR, + } reqRuleInfoList = append(reqRuleInfoList, ruleInfo) } - // Call common-runtime API - // no force option result, err := cmrt.RemoveRules(req.ConnectionName, c.Param("SGName"), reqRuleInfoList) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -349,36 +441,51 @@ func RemoveRules(c echo.Context) error { return c.JSON(http.StatusOK, &resultInfo) } +// countAllSecurityGroups godoc +// @ID count-all-securitygroups +// @Summary Count All SecurityGroups +// @Description Get the total number of Security Groups across all connections. +// @Tags [SecurityGroup management] +// @Produce json +// @Success 200 {object} CountResponse "Total count of SecurityGroups" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /countsecuritygroup [get] func CountAllSecurityGroups(c echo.Context) error { - // Call common-runtime API to get count of SecurityGroups + cblog.Info("call CountAllSecurityGroups()") + count, err := cmrt.CountAllSecurityGroups() if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - // Prepare JSON result - var jsonResult struct { - Count int `json:"count"` + jsonResult := CountResponse{ + Count: int(count), } - jsonResult.Count = int(count) - // Return JSON response return c.JSON(http.StatusOK, jsonResult) } +// countSecurityGroupsByConnection godoc +// @ID count-securitygroups-by-connection +// @Summary Count SecurityGroups by Connection +// @Description Get the total number of Security Groups for a specific connection. +// @Tags [SecurityGroup management] +// @Produce json +// @Param ConnectionName path string true "The name of the Connection" +// @Success 200 {object} CountResponse "Total count of SecurityGroups for the connection" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /countsecuritygroup/{ConnectionName} [get] func CountSecurityGroupsByConnection(c echo.Context) error { - // Call common-runtime API to get count of SecurityGroups + cblog.Info("call CountSecurityGroupsByConnection()") + count, err := cmrt.CountSecurityGroupsByConnection(c.Param("ConnectionName")) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - // Prepare JSON result - var jsonResult struct { - Count int `json:"count"` + jsonResult := CountResponse{ + Count: int(count), } - jsonResult.Count = int(count) - // Return JSON response return c.JSON(http.StatusOK, jsonResult) } diff --git a/api-runtime/rest-runtime/VPC-SubnetRest.go b/api-runtime/rest-runtime/VPC-SubnetRest.go index e0d8d5081..08e41c913 100644 --- a/api-runtime/rest-runtime/VPC-SubnetRest.go +++ b/api-runtime/rest-runtime/VPC-SubnetRest.go @@ -18,24 +18,37 @@ import ( "github.com/labstack/echo/v4" - dri "github.com/cloud-barista/cb-spider/cloud-control-manager/cloud-driver/interfaces/resources" "strconv" ) //================ VPC Handler -type vpcRegisterReq struct { - ConnectionName string +// VPCRegisterRequest represents the request body for registering a VPC. +type VPCRegisterRequest struct { + ConnectionName string `json:"ConnectionName" validate:"required" example:"aws-connection"` ReqInfo struct { - Name string - CSPId string - } + Name string `json:"Name" validate:"required" example:"vpc-01"` + CSPId string `json:"CSPId" validate:"required" example:"csp-vpc-1234"` + } `json:"ReqInfo" validate:"required"` } +// registerVPC godoc +// @ID register-vpc +// @Summary Register VPC +// @Description Register a new Virtual Private Cloud (VPC) with the specified name and CSP ID. +// @Tags [VPC management] +// @Accept json +// @Produce json +// @Param VPCRegisterRequest body restruntime.VPCRegisterRequest true "Request body for registering a VPC" +// @Success 200 {object} cres.VPCInfo "Details of the registered VPC" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /regvpc [post] func RegisterVPC(c echo.Context) error { cblog.Info("call RegisterVPC()") - req := vpcRegisterReq{} + req := VPCRegisterRequest{} if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -53,20 +66,34 @@ func RegisterVPC(c echo.Context) error { return c.JSON(http.StatusOK, result) } -type subnetRegisterReq struct { - ConnectionName string +// SubnetRegisterRequest represents the request body for registering a subnet. +type SubnetRegisterRequest struct { + ConnectionName string `json:"ConnectionName" validate:"required" example:"aws-connection"` ReqInfo struct { - Name string - Zone string - VPCName string - CSPId string - } + Name string `json:"Name" validate:"required" example:"subnet-01"` + Zone string `json:"Zone,omitempty" validate:"omitempty" example:"us-east-1a"` + VPCName string `json:"VPCName" validate:"required" example:"vpc-01"` + CSPId string `json:"CSPId" validate:"required" example:"csp-subnet-1234"` + } `json:"ReqInfo" validate:"required"` } +// registerSubnet godoc +// @ID register-subnet +// @Summary Register Subnet +// @Description Register a new Subnet within a specified VPC. +// @Tags [VPC management] +// @Accept json +// @Produce json +// @Param SubnetRegisterRequest body restruntime.SubnetRegisterRequest true "Request body for registering a Subnet" +// @Success 200 {object} cres.SubnetInfo "Details of the registered Subnet" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /regsubnet [post] func RegisterSubnet(c echo.Context) error { cblog.Info("call RegisterSubnet()") - req := subnetRegisterReq{} + req := SubnetRegisterRequest{} if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -84,17 +111,32 @@ func RegisterSubnet(c echo.Context) error { return c.JSON(http.StatusOK, result) } -type subnetUnregisterReq struct { - ConnectionName string +// SubnetUnregisterRequest represents the request body for unregistering a subnet. +type SubnetUnregisterRequest struct { + ConnectionName string `json:"ConnectionName" validate:"required" example:"aws-connection"` ReqInfo struct { - VPCName string - } + VPCName string `json:"VPCName" validate:"required" example:"vpc-01"` + } `json:"ReqInfo" validate:"required"` } +// unregisterSubnet godoc +// @ID unregister-subnet +// @Summary Unregister Subnet +// @Description Unregister a Subnet from a specified VPC. +// @Tags [VPC management] +// @Accept json +// @Produce json +// @Param SubnetUnregisterRequest body restruntime.SubnetUnregisterRequest true "Request body for unregistering a Subnet" +// @Param Name path string true "The name of the Subnet to unregister" +// @Success 200 {object} BooleanInfo "Result of the unregister operation" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /regsubnet/{Name} [delete] func UnregisterSubnet(c echo.Context) error { cblog.Info("call UnregisterSubnet()") - req := subnetUnregisterReq{} + req := SubnetUnregisterRequest{} if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -106,18 +148,36 @@ func UnregisterSubnet(c echo.Context) error { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - return c.JSON(http.StatusOK, result) + resultInfo := BooleanInfo{ + Result: strconv.FormatBool(result), + } + + return c.JSON(http.StatusOK, &resultInfo) } -// (1) get args from REST Call -// (2) call common-runtime API -// (3) return REST Json Format +// ConnectionRequest represents the request body for common use. +type ConnectionRequest struct { + ConnectionName string `json:"ConnectionName" validate:"required" example:"aws-connection"` +} + +// unregisterVPC godoc +// @ID unregister-vpc +// @Summary Unregister VPC +// @Description Unregister a VPC with the specified name. +// @Tags [VPC management] +// @Accept json +// @Produce json +// @Param ConnectionRequest body restruntime.ConnectionRequest true "Request body for unregistering a VPC" +// @Param Name path string true "The name of the VPC to unregister" +// @Success 200 {object} BooleanInfo "Result of the unregister operation" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /regvpc/{Name} [delete] func UnregisterVPC(c echo.Context) error { cblog.Info("call UnregisterVPC()") - var req struct { - ConnectionName string - } + var req ConnectionRequest if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -136,37 +196,40 @@ func UnregisterVPC(c echo.Context) error { return c.JSON(http.StatusOK, &resultInfo) } -type vpcCreateReq struct { - ConnectionName string - IDTransformMode string // ON | OFF, default is ON +// CreateVPCRequest represents the request body for creating a VPC. +type CreateVPCRequest struct { + ConnectionName string `json:"ConnectionName" validate:"required" example:"aws-connection"` + IDTransformMode string `json:"IDTransformMode,omitempty" validate:"omitempty" example:"ON"` // ON: transform CSP ID, OFF: no-transform CSP ID ReqInfo struct { - Name string - IPv4_CIDR string + Name string `json:"Name" validate:"required" example:"vpc-01"` + IPv4_CIDR string `json:"IPv4_CIDR" validate:"omitempty"` // Some CSPs unsupported VPC CIDR SubnetInfoList []struct { - Name string - Zone string - IPv4_CIDR string - TagList []dri.KeyValue - } - TagList []dri.KeyValue - } + Name string `json:"Name" validate:"required" example:"subnet-01"` + Zone string `json:"Zone,omitempty" validate:"omitempty"` + IPv4_CIDR string `json:"IPv4_CIDR" validate:"required" example:"10.0.8.0/22"` + TagList []cres.KeyValue `json:"TagList,omitempty" validate:"omitempty"` + } `json:"SubnetInfoList" validate:"required"` + TagList []cres.KeyValue `json:"TagList,omitempty" validate:"omitempty"` + } `json:"ReqInfo" validate:"required"` } // createVPC godoc +// @ID create-vpc // @Summary Create VPC -// @Description Create VPC -// @Tags [CCM] VPC management +// @Description Create a new Virtual Private Cloud (VPC) with specified subnet configurations. +// @Tags [VPC management] // @Accept json // @Produce json -// @Param vpcCreateReq body vpcCreateReq true "Request body to create VPC" -// @Success 200 {object} resources.VPCInfo -// @Failure 404 {object} SimpleMsg -// @Failure 500 {object} SimpleMsg +// @Param CreateVPCRequest body restruntime.CreateVPCRequest true "Request body for creating a VPC" +// @Success 200 {object} cres.VPCInfo "Details of the created VPC" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" // @Router /vpc [post] func CreateVPC(c echo.Context) error { cblog.Info("call CreateVPC()") - req := vpcCreateReq{} + req := CreateVPCRequest{} if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -196,12 +259,30 @@ func CreateVPC(c echo.Context) error { return c.JSON(http.StatusOK, result) } +type ListVPCReq struct { + ConnectionName string `json:"ConnectionName" query:"ConnectionName" example:"aws-connection"` +} +type ListVPCResponse struct { + Result []*cres.VPCInfo `json:"vpc" validate:"required" description:"A list of VPC information"` +} + +// listVPC godoc +// @ID list-vpc +// @Summary List VPCs +// @Description Retrieve a list of Virtual Private Clouds (VPCs) associated with a specific connection. +// @Tags [VPC management] +// @Accept json +// @Produce json +// @Param ConnectionName query string true "The name of the Connection to list VPCs for" +// @Success 200 {object} ListVPCResponse "List of VPCs" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid query parameter" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /vpc [get] func ListVPC(c echo.Context) error { cblog.Info("call ListVPC()") - var req struct { - ConnectionName string - } + var req ListVPCReq if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -218,24 +299,37 @@ func ListVPC(c echo.Context) error { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - var jsonResult struct { - Result []*cres.VPCInfo `json:"vpc"` + jsonResult := ListVPCResponse{ + Result: result, } - jsonResult.Result = result return c.JSON(http.StatusOK, &jsonResult) } -// list all VPCs for management -// (1) get args from REST Call -// (2) get all VPC List by common-runtime API -// (3) return REST Json Format +// AllResourceListResponse represents the response body structure for the ListAllVPC API. +type AllResourceListResponse struct { + MappedList []*cres.IID `json:"MappedList" validate:"required" description:"A list of resources that are mapped between CB-Spider and CSP"` + OnlySpiderList []*cres.IID `json:"OnlySpiderList" validate:"required" description:"A list of resources that exist only in CB-Spider"` + OnlyCSPList []*cres.IID `json:"OnlyCSPList" validate:"required" description:"A list of resources that exist only in the CSP"` +} + +// listAllVPC godoc +// @ID list-all-vpc +// @Summary List All VPCs +// @Description Retrieve a list of all Virtual Private Clouds (VPCs) across all connections. +// @Tags [VPC management] +// @Accept json +// @Produce json +// @Param ConnectionName query string true "The name of the Connection" +// @Success 200 {object} AllResourceListResponse "List of all VPCs with their respective lists" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /allvpc [get] func ListAllVPC(c echo.Context) error { cblog.Info("call ListAllVPC()") - var req struct { - ConnectionName string - } + var req ConnectionRequest if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -255,24 +349,46 @@ func ListAllVPC(c echo.Context) error { return c.JSON(http.StatusOK, &allResourceList) } -func GetVPC(c echo.Context) error { - cblog.Info("call GetVPC()") +// AddSubnetRequest represents the request body for adding a subnet to a VPC. +type AddSubnetRequest struct { + ConnectionName string `json:"ConnectionName" validate:"required" example:"aws-connection"` + IDTransformMode string `json:"IDTransformMode,omitempty" validate:"omitempty" example:"ON"` // ON: transform CSP ID, OFF: no-transform CSP ID + ReqInfo struct { + Name string `json:"Name" validate:"required" example:"subnet-01"` + Zone string `json:"Zone,omitempty" validate:"omitempty" example:"us-east-1a"` + IPv4_CIDR string `json:"IPv4_CIDR" validate:"required" example:"10.0.12.0/22"` + TagList []cres.KeyValue `json:"TagList,omitempty" validate:"omitempty"` + } `json:"ReqInfo" validate:"required"` +} - var req struct { - ConnectionName string - } +// addSubnet godoc +// @ID add-subnet +// @Summary Add Subnet +// @Description Add a new Subnet to an existing VPC. +// @Tags [VPC management] +// @Accept json +// @Produce json +// @Param VPCName path string true "The name of the VPC to add the Subnet to" +// @Param AddSubnetRequest body restruntime.AddSubnetRequest true "Request body for adding a Subnet" +// @Success 200 {object} cres.SubnetInfo "Details of the added Subnet" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /vpc/{VPCName}/subnet [post] +func AddSubnet(c echo.Context) error { + cblog.Info("call AddSubnet()") + + var req AddSubnetRequest if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - // To support for Get-Query Param Type API - if req.ConnectionName == "" { - req.ConnectionName = c.QueryParam("ConnectionName") - } + // Rest RegInfo => Driver ReqInfo + reqSubnetInfo := cres.SubnetInfo{IId: cres.IID{req.ReqInfo.Name, ""}, IPv4_CIDR: req.ReqInfo.IPv4_CIDR, Zone: req.ReqInfo.Zone, TagList: req.ReqInfo.TagList} // Call common-runtime API - result, err := cmrt.GetVPC(req.ConnectionName, VPC, c.Param("Name")) + result, err := cmrt.AddSubnet(req.ConnectionName, SUBNET, c.Param("VPCName"), reqSubnetInfo, req.IDTransformMode) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } @@ -280,22 +396,32 @@ func GetVPC(c echo.Context) error { return c.JSON(http.StatusOK, result) } -// (1) get args from REST Call -// (2) call common-runtime API -// (3) return REST Json Format -func DeleteVPC(c echo.Context) error { - cblog.Info("call DeleteVPC()") +// removeSubnet godoc +// @ID remove-subnet +// @Summary Remove Subnet +// @Description Remove an existing Subnet from a VPC. +// @Tags [VPC management] +// @Accept json +// @Produce json +// @Param VPCName path string true "The name of the VPC" +// @Param SubnetName path string true "The name of the Subnet to remove" +// @Param ConnectionRequest body restruntime.ConnectionRequest true "Request body for removing a Subnet" +// @Success 200 {object} BooleanInfo "Result of the remove operation" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /vpc/{VPCName}/subnet/{SubnetName} [delete] +func RemoveSubnet(c echo.Context) error { + cblog.Info("call RemoveSubnet()") - var req struct { - ConnectionName string - } + var req ConnectionRequest if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } // Call common-runtime API - result, err := cmrt.DeleteVPC(req.ConnectionName, VPC, c.Param("Name"), c.QueryParam("force")) + result, err := cmrt.RemoveSubnet(req.ConnectionName, c.Param("VPCName"), c.Param("SubnetName"), c.QueryParam("force")) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } @@ -307,22 +433,32 @@ func DeleteVPC(c echo.Context) error { return c.JSON(http.StatusOK, &resultInfo) } -// (1) get args from REST Call -// (2) call common-runtime API -// (3) return REST Json Format -func DeleteCSPVPC(c echo.Context) error { - cblog.Info("call DeleteCSPVPC()") +// removeCSPSubnet godoc +// @ID remove-csp-subnet +// @Summary Remove CSP Subnet +// @Description Remove an existing CSP Subnet from a VPC. +// @Tags [VPC management] +// @Accept json +// @Produce json +// @Param VPCName path string true "The name of the VPC" +// @Param Id path string true "The CSP Subnet ID to remove" +// @Param ConnectionRequest body restruntime.ConnectionRequest true "Request body for removing a CSP Subnet" +// @Success 200 {object} BooleanInfo "Result of the remove operation" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /vpc/{VPCName}/cspsubnet/{Id} [delete] +func RemoveCSPSubnet(c echo.Context) error { + cblog.Info("call RemoveCSPSubnet()") - var req struct { - ConnectionName string - } + var req ConnectionRequest if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } // Call common-runtime API - result, _, err := cmrt.DeleteCSPResource(req.ConnectionName, VPC, c.Param("Id")) + result, err := cmrt.RemoveCSPSubnet(req.ConnectionName, c.Param("VPCName"), c.Param("Id")) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } @@ -334,32 +470,36 @@ func DeleteCSPVPC(c echo.Context) error { return c.JSON(http.StatusOK, &resultInfo) } -// (1) get subnet info from REST Call -// (2) call common-runtime API -// (3) return REST Json Format -func AddSubnet(c echo.Context) error { - cblog.Info("call AddSubnet()") +// getVPC godoc +// @ID get-vpc +// @Summary Get VPC +// @Description Retrieve details of a specific Virtual Private Cloud (VPC). +// @Tags [VPC management] +// @Accept json +// @Produce json +// @Param ConnectionName query string true "The name of the Connection to get a VPC for" +// @Param Name path string true "The name of the VPC to retrieve" +// @Success 200 {object} cres.VPCInfo "Details of the VPC" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /vpc/{Name} [get] +func GetVPC(c echo.Context) error { + cblog.Info("call GetVPC()") - var req struct { - ConnectionName string - IDTransformMode string // ON | OFF, default is ON - ReqInfo struct { - Name string - Zone string - IPv4_CIDR string - TagList []dri.KeyValue - } - } + var req ConnectionRequest if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - // Rest RegInfo => Driver ReqInfo - reqSubnetInfo := cres.SubnetInfo{IId: cres.IID{req.ReqInfo.Name, ""}, IPv4_CIDR: req.ReqInfo.IPv4_CIDR, Zone: req.ReqInfo.Zone, TagList: req.ReqInfo.TagList} + // To support for Get-Query Param Type API + if req.ConnectionName == "" { + req.ConnectionName = c.QueryParam("ConnectionName") + } // Call common-runtime API - result, err := cmrt.AddSubnet(req.ConnectionName, SUBNET, c.Param("VPCName"), reqSubnetInfo, req.IDTransformMode) + result, err := cmrt.GetVPC(req.ConnectionName, VPC, c.Param("Name")) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } @@ -367,22 +507,32 @@ func AddSubnet(c echo.Context) error { return c.JSON(http.StatusOK, result) } -// (1) get args from REST Call -// (2) call common-runtime API -// (3) return REST Json Format -func RemoveSubnet(c echo.Context) error { - cblog.Info("call RemoveSubnet()") +// deleteVPC godoc +// @ID delete-vpc +// @Summary Delete VPC +// @Description Delete a specified Virtual Private Cloud (VPC). +// @Tags [VPC management] +// @Accept json +// @Produce json +// @Param ConnectionRequest body restruntime.ConnectionRequest true "Request body for deleting a VPC" +// @Param Name path string true "The name of the VPC to delete" +// @Param force query string false "Force delete the VPC" +// @Success 200 {object} BooleanInfo "Result of the delete operation" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /vpc/{Name} [delete] +func DeleteVPC(c echo.Context) error { + cblog.Info("call DeleteVPC()") - var req struct { - ConnectionName string - } + var req ConnectionRequest if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } // Call common-runtime API - result, err := cmrt.RemoveSubnet(req.ConnectionName, c.Param("VPCName"), c.Param("SubnetName"), c.QueryParam("force")) + result, err := cmrt.DeleteVPC(req.ConnectionName, VPC, c.Param("Name"), c.QueryParam("force")) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } @@ -394,22 +544,31 @@ func RemoveSubnet(c echo.Context) error { return c.JSON(http.StatusOK, &resultInfo) } -// (1) get args from REST Call -// (2) call common-runtime API -// (3) return REST Json Format -func RemoveCSPSubnet(c echo.Context) error { - cblog.Info("call RemoveCSPSubnet()") +// deleteCSPVPC godoc +// @ID delete-csp-vpc +// @Summary Delete CSP VPC +// @Description Delete a specified CSP Virtual Private Cloud (VPC). +// @Tags [VPC management] +// @Accept json +// @Produce json +// @Param ConnectionRequest body restruntime.ConnectionRequest true "Request body for deleting a CSP VPC" +// @Param Id path string true "The CSP VPC ID to delete" +// @Success 200 {object} BooleanInfo "Result of the delete operation" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /cspvpc/{Id} [delete] +func DeleteCSPVPC(c echo.Context) error { + cblog.Info("call DeleteCSPVPC()") - var req struct { - ConnectionName string - } + var req ConnectionRequest if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } // Call common-runtime API - result, err := cmrt.RemoveCSPSubnet(req.ConnectionName, c.Param("VPCName"), c.Param("Id")) + result, _, err := cmrt.DeleteCSPResource(req.ConnectionName, VPC, c.Param("Id")) if err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } @@ -421,15 +580,31 @@ func RemoveCSPSubnet(c echo.Context) error { return c.JSON(http.StatusOK, &resultInfo) } +// GetSGOwnerVPCRequest represents the request body for retrieving the owner VPC of a Security Group. +type GetSGOwnerVPCRequest struct { + ConnectionName string `json:"ConnectionName" validate:"required" example:"aws-connection"` + ReqInfo struct { + CSPId string `json:"CSPId" validate:"required" example:"csp-sg-1234"` + } `json:"ReqInfo" validate:"required"` +} + +// getSGOwnerVPC godoc +// @ID get-sg-owner-vpc +// @Summary Get Security Group Owner VPC +// @Description Retrieve the owner VPC of a specified Security Group. +// @Tags [VPC management] +// @Accept json +// @Produce json +// @Param GetSGOwnerVPCRequest body restruntime.GetSGOwnerVPCRequest true "Request body for getting Security Group Owner VPC" +// @Success 200 {object} cres.IID "Details of the owner VPC" +// @Failure 400 {object} SimpleMsg "Bad Request, possibly due to invalid JSON structure or missing fields" +// @Failure 404 {object} SimpleMsg "Resource Not Found" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /getsecuritygroupowner [post] func GetSGOwnerVPC(c echo.Context) error { cblog.Info("call GetSGOwnerVPC()") - var req struct { - ConnectionName string - ReqInfo struct { - CSPId string - } - } + var req GetSGOwnerVPCRequest if err := c.Bind(&req); err != nil { return echo.NewHTTPError(http.StatusInternalServerError, err.Error()) @@ -444,6 +619,20 @@ func GetSGOwnerVPC(c echo.Context) error { return c.JSON(http.StatusOK, result) } +// CountResponse represents the response body for counting all VPCs. +type CountResponse struct { + Count int `json:"count" validate:"required" example:"5" description:"The total number of resources counted"` +} + +// countAllVPCs godoc +// @ID count-all-vpcs +// @Summary Count All VPCs +// @Description Get the total number of VPCs across all connections. +// @Tags [VPC management] +// @Produce json +// @Success 200 {object} CountResponse "Total count of VPCs" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /countvpc [get] func CountAllVPCs(c echo.Context) error { cblog.Info("call CountAllVPCs()") @@ -454,16 +643,27 @@ func CountAllVPCs(c echo.Context) error { } // Prepare JSON result - var jsonResult struct { - Count int `json:"count"` + jsonResult := CountResponse{ + Count: int(count), } - jsonResult.Count = int(count) // Return JSON response return c.JSON(http.StatusOK, jsonResult) } +// countVPCsByConnection godoc +// @ID count-vpcs-by-connection +// @Summary Count VPCs by Connection +// @Description Get the total number of VPCs for a specific connection. +// @Tags [VPC management] +// @Produce json +// @Param ConnectionName path string true "The name of the Connection" +// @Success 200 {object} CountResponse "Total count of VPCs for the connection" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /countvpc/{ConnectionName} [get] func CountVPCsByConnection(c echo.Context) error { + cblog.Info("call CountVPCsByConnection()") + // Call common-runtime API to get count of VPCs count, err := cmrt.CountVPCsByConnection(c.Param("ConnectionName")) if err != nil { @@ -471,15 +671,23 @@ func CountVPCsByConnection(c echo.Context) error { } // Prepare JSON result - var jsonResult struct { - Count int `json:"count"` + jsonResult := CountResponse{ + Count: int(count), } - jsonResult.Count = int(count) // Return JSON response return c.JSON(http.StatusOK, jsonResult) } +// countAllSubnets godoc +// @ID count-all-subnets +// @Summary Count All Subnets +// @Description Get the total number of Subnets across all connections. +// @Tags [VPC management] +// @Produce json +// @Success 200 {object} CountResponse "Total count of Subnets" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /countsubnet [get] func CountAllSubnets(c echo.Context) error { // Call common-runtime API to get count of Subnets count, err := cmrt.CountAllSubnets() @@ -488,15 +696,24 @@ func CountAllSubnets(c echo.Context) error { } // Prepare JSON result - var jsonResult struct { - Count int `json:"count"` + jsonResult := CountResponse{ + Count: int(count), } - jsonResult.Count = int(count) // Return JSON response return c.JSON(http.StatusOK, jsonResult) } +// countSubnetsByConnection godoc +// @ID count-subnets-by-connection +// @Summary Count Subnets by Connection +// @Description Get the total number of Subnets for a specific connection. +// @Tags [VPC management] +// @Produce json +// @Param ConnectionName path string true "The name of the Connection" +// @Success 200 {object} CountResponse "Total count of Subnets for the connection" +// @Failure 500 {object} SimpleMsg "Internal Server Error" +// @Router /countsubnet/{ConnectionName} [get] func CountSubnetsByConnection(c echo.Context) error { // Call common-runtime API to get count of Subnets count, err := cmrt.CountSubnetsByConnection(c.Param("ConnectionName")) @@ -505,10 +722,9 @@ func CountSubnetsByConnection(c echo.Context) error { } // Prepare JSON result - var jsonResult struct { - Count int `json:"count"` + jsonResult := CountResponse{ + Count: int(count), } - jsonResult.Count = int(count) // Return JSON response return c.JSON(http.StatusOK, jsonResult) diff --git a/api-runtime/rest-runtime/docs/docs.go b/api-runtime/rest-runtime/docs/docs.go deleted file mode 100644 index a2448e728..000000000 --- a/api-runtime/rest-runtime/docs/docs.go +++ /dev/null @@ -1,347 +0,0 @@ -// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT -// This file was generated by swaggo/swag - -package docs - -import ( - "bytes" - "encoding/json" - "strings" - - "github.com/alecthomas/template" - "github.com/swaggo/swag" -) - -var doc = `{ - "schemes": {{ marshal .Schemes }}, - "swagger": "2.0", - "info": { - "description": "{{.Description}}", - "title": "{{.Title}}", - "contact": { - "name": "API Support", - "url": "http://cloud-barista.github.io", - "email": "contact-to-cloud-barista@googlegroups.com" - }, - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html" - }, - "version": "{{.Version}}" - }, - "host": "{{.Host}}", - "basePath": "{{.BasePath}}", - "paths": { - "/keypair": { - "post": { - "description": "Create SSH Key", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "[CCM] Access key management" - ], - "summary": "Create SSH Key", - "parameters": [ - { - "description": "Request body to create key", - "name": "keyPairCreateReq", - "in": "body", - "required": true, - "schema": { - "allOf": [ - { - "$ref": "#/definitions/restruntime.JSONResult" - }, - { - "type": "object", - "properties": { - "ConnectionName": { - "type": "string" - }, - "ReqInfo": { - "allOf": [ - { - "$ref": "#/definitions/restruntime.JSONResult" - }, - { - "type": "object", - "properties": { - "Name": { - "type": "string" - } - } - } - ] - } - } - } - ] - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/resources.KeyPairInfo" - } - }, - "404": { - "description": "Not Found", - "schema": { - "$ref": "#/definitions/restruntime.SimpleMsg" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/restruntime.SimpleMsg" - } - } - } - } - }, - "/vpc": { - "post": { - "description": "Create VPC", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "[CCM] VPC management" - ], - "summary": "Create VPC", - "parameters": [ - { - "description": "Request body to create VPC", - "name": "vpcCreateReq", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/restruntime.vpcCreateReq" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/resources.VPCInfo" - } - }, - "404": { - "description": "Not Found", - "schema": { - "$ref": "#/definitions/restruntime.SimpleMsg" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/restruntime.SimpleMsg" - } - } - } - } - } - }, - "definitions": { - "resources.IID": { - "type": "object", - "properties": { - "nameId": { - "description": "NameID by user", - "type": "string" - }, - "systemId": { - "description": "SystemID by CloudOS", - "type": "string" - } - } - }, - "resources.KeyPairInfo": { - "type": "object", - "properties": { - "fingerprint": { - "type": "string" - }, - "iid": { - "description": "{NameId, SystemId}", - "$ref": "#/definitions/resources.IID" - }, - "keyValueList": { - "type": "array", - "items": { - "$ref": "#/definitions/resources.KeyValue" - } - }, - "privateKey": { - "type": "string" - }, - "publicKey": { - "type": "string" - }, - "vmuserID": { - "type": "string" - } - } - }, - "resources.KeyValue": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - } - }, - "resources.SubnetInfo": { - "type": "object", - "properties": { - "iid": { - "description": "{NameId, SystemId}", - "$ref": "#/definitions/resources.IID" - }, - "ipv4_CIDR": { - "type": "string" - }, - "keyValueList": { - "type": "array", - "items": { - "$ref": "#/definitions/resources.KeyValue" - } - } - } - }, - "resources.VPCInfo": { - "type": "object", - "properties": { - "iid": { - "description": "{NameId, SystemId}", - "$ref": "#/definitions/resources.IID" - }, - "ipv4_CIDR": { - "type": "string" - }, - "keyValueList": { - "type": "array", - "items": { - "$ref": "#/definitions/resources.KeyValue" - } - }, - "subnetInfoList": { - "type": "array", - "items": { - "$ref": "#/definitions/resources.SubnetInfo" - } - } - } - }, - "restruntime.JSONResult": { - "type": "object" - }, - "restruntime.SimpleMsg": { - "type": "object", - "properties": { - "message": { - "type": "string", - "example": "Any message" - } - } - }, - "restruntime.vpcCreateReq": { - "type": "object", - "properties": { - "connectionName": { - "type": "string" - }, - "reqInfo": { - "type": "object", - "properties": { - "ipv4_CIDR": { - "type": "string" - }, - "name": { - "type": "string" - }, - "subnetInfoList": { - "type": "array", - "items": { - "type": "object", - "properties": { - "ipv4_CIDR": { - "type": "string" - }, - "name": { - "type": "string" - } - } - } - } - } - } - } - } - }, - "securityDefinitions": { - "BasicAuth": { - "type": "basic" - } - } -}` - -type swaggerInfo struct { - Version string - Host string - BasePath string - Schemes []string - Title string - Description string -} - -// SwaggerInfo holds exported Swagger Info so clients can modify it -var SwaggerInfo = swaggerInfo{ - Version: "latest", - Host: "localhost:1024", - BasePath: "/spider", - Schemes: []string{}, - Title: "CB-Spider REST API", - Description: "CB-Spider REST API", -} - -type s struct{} - -func (s *s) ReadDoc() string { - sInfo := SwaggerInfo - sInfo.Description = strings.Replace(sInfo.Description, "\n", "\\n", -1) - - t, err := template.New("swagger_info").Funcs(template.FuncMap{ - "marshal": func(v interface{}) string { - a, _ := json.Marshal(v) - return string(a) - }, - }).Parse(doc) - if err != nil { - return doc - } - - var tpl bytes.Buffer - if err := t.Execute(&tpl, sInfo); err != nil { - return doc - } - - return tpl.String() -} - -func init() { - swag.Register(swag.Name, &s{}) -} diff --git a/api-runtime/rest-runtime/docs/swagger.json b/api-runtime/rest-runtime/docs/swagger.json deleted file mode 100644 index 1b8a61b25..000000000 --- a/api-runtime/rest-runtime/docs/swagger.json +++ /dev/null @@ -1,285 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "description": "CB-Spider REST API", - "title": "CB-Spider REST API", - "contact": { - "name": "API Support", - "url": "http://cloud-barista.github.io", - "email": "contact-to-cloud-barista@googlegroups.com" - }, - "license": { - "name": "Apache 2.0", - "url": "http://www.apache.org/licenses/LICENSE-2.0.html" - }, - "version": "latest" - }, - "host": "localhost:1024", - "basePath": "/spider", - "paths": { - "/keypair": { - "post": { - "description": "Create SSH Key", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "[CCM] Access key management" - ], - "summary": "Create SSH Key", - "parameters": [ - { - "description": "Request body to create key", - "name": "keyPairCreateReq", - "in": "body", - "required": true, - "schema": { - "allOf": [ - { - "$ref": "#/definitions/restruntime.JSONResult" - }, - { - "type": "object", - "properties": { - "ConnectionName": { - "type": "string" - }, - "ReqInfo": { - "allOf": [ - { - "$ref": "#/definitions/restruntime.JSONResult" - }, - { - "type": "object", - "properties": { - "Name": { - "type": "string" - } - } - } - ] - } - } - } - ] - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/resources.KeyPairInfo" - } - }, - "404": { - "description": "Not Found", - "schema": { - "$ref": "#/definitions/restruntime.SimpleMsg" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/restruntime.SimpleMsg" - } - } - } - } - }, - "/vpc": { - "post": { - "description": "Create VPC", - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "tags": [ - "[CCM] VPC management" - ], - "summary": "Create VPC", - "parameters": [ - { - "description": "Request body to create VPC", - "name": "vpcCreateReq", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/restruntime.vpcCreateReq" - } - } - ], - "responses": { - "200": { - "description": "OK", - "schema": { - "$ref": "#/definitions/resources.VPCInfo" - } - }, - "404": { - "description": "Not Found", - "schema": { - "$ref": "#/definitions/restruntime.SimpleMsg" - } - }, - "500": { - "description": "Internal Server Error", - "schema": { - "$ref": "#/definitions/restruntime.SimpleMsg" - } - } - } - } - } - }, - "definitions": { - "resources.IID": { - "type": "object", - "properties": { - "nameId": { - "description": "NameID by user", - "type": "string" - }, - "systemId": { - "description": "SystemID by CloudOS", - "type": "string" - } - } - }, - "resources.KeyPairInfo": { - "type": "object", - "properties": { - "fingerprint": { - "type": "string" - }, - "iid": { - "description": "{NameId, SystemId}", - "$ref": "#/definitions/resources.IID" - }, - "keyValueList": { - "type": "array", - "items": { - "$ref": "#/definitions/resources.KeyValue" - } - }, - "privateKey": { - "type": "string" - }, - "publicKey": { - "type": "string" - }, - "vmuserID": { - "type": "string" - } - } - }, - "resources.KeyValue": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "value": { - "type": "string" - } - } - }, - "resources.SubnetInfo": { - "type": "object", - "properties": { - "iid": { - "description": "{NameId, SystemId}", - "$ref": "#/definitions/resources.IID" - }, - "ipv4_CIDR": { - "type": "string" - }, - "keyValueList": { - "type": "array", - "items": { - "$ref": "#/definitions/resources.KeyValue" - } - } - } - }, - "resources.VPCInfo": { - "type": "object", - "properties": { - "iid": { - "description": "{NameId, SystemId}", - "$ref": "#/definitions/resources.IID" - }, - "ipv4_CIDR": { - "type": "string" - }, - "keyValueList": { - "type": "array", - "items": { - "$ref": "#/definitions/resources.KeyValue" - } - }, - "subnetInfoList": { - "type": "array", - "items": { - "$ref": "#/definitions/resources.SubnetInfo" - } - } - } - }, - "restruntime.JSONResult": { - "type": "object" - }, - "restruntime.SimpleMsg": { - "type": "object", - "properties": { - "message": { - "type": "string", - "example": "Any message" - } - } - }, - "restruntime.vpcCreateReq": { - "type": "object", - "properties": { - "connectionName": { - "type": "string" - }, - "reqInfo": { - "type": "object", - "properties": { - "ipv4_CIDR": { - "type": "string" - }, - "name": { - "type": "string" - }, - "subnetInfoList": { - "type": "array", - "items": { - "type": "object", - "properties": { - "ipv4_CIDR": { - "type": "string" - }, - "name": { - "type": "string" - } - } - } - } - } - } - } - } - }, - "securityDefinitions": { - "BasicAuth": { - "type": "basic" - } - } -} \ No newline at end of file diff --git a/api-runtime/rest-runtime/docs/swagger.yaml b/api-runtime/rest-runtime/docs/swagger.yaml deleted file mode 100644 index 88fe753c5..000000000 --- a/api-runtime/rest-runtime/docs/swagger.yaml +++ /dev/null @@ -1,182 +0,0 @@ -basePath: /spider -definitions: - resources.IID: - properties: - nameId: - description: NameID by user - type: string - systemId: - description: SystemID by CloudOS - type: string - type: object - resources.KeyPairInfo: - properties: - fingerprint: - type: string - iid: - $ref: '#/definitions/resources.IID' - description: '{NameId, SystemId}' - keyValueList: - items: - $ref: '#/definitions/resources.KeyValue' - type: array - privateKey: - type: string - publicKey: - type: string - vmuserID: - type: string - type: object - resources.KeyValue: - properties: - key: - type: string - value: - type: string - type: object - resources.SubnetInfo: - properties: - iid: - $ref: '#/definitions/resources.IID' - description: '{NameId, SystemId}' - ipv4_CIDR: - type: string - keyValueList: - items: - $ref: '#/definitions/resources.KeyValue' - type: array - type: object - resources.VPCInfo: - properties: - iid: - $ref: '#/definitions/resources.IID' - description: '{NameId, SystemId}' - ipv4_CIDR: - type: string - keyValueList: - items: - $ref: '#/definitions/resources.KeyValue' - type: array - subnetInfoList: - items: - $ref: '#/definitions/resources.SubnetInfo' - type: array - type: object - restruntime.JSONResult: - type: object - restruntime.SimpleMsg: - properties: - message: - example: Any message - type: string - type: object - restruntime.vpcCreateReq: - properties: - connectionName: - type: string - reqInfo: - properties: - ipv4_CIDR: - type: string - name: - type: string - subnetInfoList: - items: - properties: - ipv4_CIDR: - type: string - name: - type: string - type: object - type: array - type: object - type: object -host: localhost:1024 -info: - contact: - email: contact-to-cloud-barista@googlegroups.com - name: API Support - url: http://cloud-barista.github.io - description: CB-Spider REST API - license: - name: Apache 2.0 - url: http://www.apache.org/licenses/LICENSE-2.0.html - title: CB-Spider REST API - version: latest -paths: - /keypair: - post: - consumes: - - application/json - description: Create SSH Key - parameters: - - description: Request body to create key - in: body - name: keyPairCreateReq - required: true - schema: - allOf: - - $ref: '#/definitions/restruntime.JSONResult' - - properties: - ConnectionName: - type: string - ReqInfo: - allOf: - - $ref: '#/definitions/restruntime.JSONResult' - - properties: - Name: - type: string - type: object - type: object - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/resources.KeyPairInfo' - "404": - description: Not Found - schema: - $ref: '#/definitions/restruntime.SimpleMsg' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/restruntime.SimpleMsg' - summary: Create SSH Key - tags: - - '[CCM] Access key management' - /vpc: - post: - consumes: - - application/json - description: Create VPC - parameters: - - description: Request body to create VPC - in: body - name: vpcCreateReq - required: true - schema: - $ref: '#/definitions/restruntime.vpcCreateReq' - produces: - - application/json - responses: - "200": - description: OK - schema: - $ref: '#/definitions/resources.VPCInfo' - "404": - description: Not Found - schema: - $ref: '#/definitions/restruntime.SimpleMsg' - "500": - description: Internal Server Error - schema: - $ref: '#/definitions/restruntime.SimpleMsg' - summary: Create VPC - tags: - - '[CCM] VPC management' -securityDefinitions: - BasicAuth: - type: basic -swagger: "2.0" diff --git a/cloud-control-manager/cloud-driver/interfaces/resources/IId.go b/cloud-control-manager/cloud-driver/interfaces/resources/IId.go index 977092efe..534811914 100644 --- a/cloud-control-manager/cloud-driver/interfaces/resources/IId.go +++ b/cloud-control-manager/cloud-driver/interfaces/resources/IId.go @@ -12,6 +12,6 @@ package resources // Integrated-ID consisting of User's ID and CloudOS's ID type IID struct { - NameId string // NameID by user - SystemId string // SystemID by CloudOS + NameId string `json:"NameId" validate:"required" example:"user-defined-name"` + SystemId string `json:"SystemId" validate:"required" example:"csp-defined-id"` } diff --git a/cloud-control-manager/cloud-driver/interfaces/resources/KeyPairHandler.go b/cloud-control-manager/cloud-driver/interfaces/resources/KeyPairHandler.go index e0f7bcb6d..b7c37d74c 100644 --- a/cloud-control-manager/cloud-driver/interfaces/resources/KeyPairHandler.go +++ b/cloud-control-manager/cloud-driver/interfaces/resources/KeyPairHandler.go @@ -17,15 +17,16 @@ type KeyPairReqInfo struct { TagList []KeyValue } +// KeyPairInfo represents information about a KeyPair. type KeyPairInfo struct { - IId IID // {NameId, SystemId} - Fingerprint string - PublicKey string - PrivateKey string - VMUserID string + IId IID `json:"IId" validate:"required"` // {NameId, SystemId} + Fingerprint string `json:"Fingerprint,omitempty" validate:"omitempty" example:"3b:16:bf:1b:13:4b:b3:58:97:dc:72:19:45:bb:2c:8f"` // Unique identifier for the public key + PublicKey string `json:"PublicKey,omitempty" validate:"omitempty" example:"ssh-rsa AAAAB3..."` // Public part of the KeyPair + PrivateKey string `json:"PrivateKey,omitempty" validate:"omitempty" example:"-----BEGIN PRIVATE KEY-----..."` // Private part of the KeyPair + VMUserID string `json:"VMUserID,omitempty" validate:"omitempty" example:"cb-user"` // cb-user or Administrator - TagList []KeyValue - KeyValueList []KeyValue + TagList []KeyValue `json:"TagList,omitempty" validate:"omitempty"` // List of tags associated with this KeyPair + KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty"` // Additional metadata as key-value pairs } type KeyPairHandler interface { diff --git a/cloud-control-manager/cloud-driver/interfaces/resources/KeyValue.go b/cloud-control-manager/cloud-driver/interfaces/resources/KeyValue.go index 656166a9f..887f5bc21 100644 --- a/cloud-control-manager/cloud-driver/interfaces/resources/KeyValue.go +++ b/cloud-control-manager/cloud-driver/interfaces/resources/KeyValue.go @@ -11,6 +11,6 @@ package resources type KeyValue struct { - Key string - Value string + Key string `json:"Key" validate:"required" example:"key1"` + Value string `json:"Value,omitempty" validate:"omitempty" example:"value1"` } diff --git a/cloud-control-manager/cloud-driver/interfaces/resources/SecurityHandler.go b/cloud-control-manager/cloud-driver/interfaces/resources/SecurityHandler.go index f26018186..96426c69f 100644 --- a/cloud-control-manager/cloud-driver/interfaces/resources/SecurityHandler.go +++ b/cloud-control-manager/cloud-driver/interfaces/resources/SecurityHandler.go @@ -21,24 +21,23 @@ type SecurityReqInfo struct { TagList []KeyValue } -// @definitionAlias cres.SecurityRuleInfo type SecurityRuleInfo struct { - Direction string - IPProtocol string - FromPort string - ToPort string - CIDR string + Direction string `json:"Direction" validate:"required" example:"inbound"` // inbound or outbound + IPProtocol string `json:"IPProtocol" validate:"required" example:"TCP"` // TCP, UDP, ICMP, ALL + FromPort string `json:"FromPort" validate:"required" example:"22"` // TCP, UDP: 1~65535, ICMP, ALL: -1 + ToPort string `json:"ToPort" validate:"required" example:"22"` // TCP, UDP: 1~65535, ICMP, ALL: -1 + CIDR string `json:"CIDR,omitempty" validate:"omitempty" example:"0.0.0.0/0"` // if not specified, defaults to 0.0.0.0/0 } type SecurityInfo struct { - IId IID // {NameId, SystemId} + IId IID `json:"IId" validate:"required"` // {NameId, SystemId} - VpcIID IID // {NameId, SystemId} - //Direction string // @todo userd?? - SecurityRules *[]SecurityRuleInfo + VpcIID IID `json:"VpcIID" validate:"required"` // {NameId, SystemId} + + SecurityRules *[]SecurityRuleInfo `json:"SecurityRules" validate:"required" description:"A list of security rules applied to this security group"` - TagList []KeyValue - KeyValueList []KeyValue + TagList []KeyValue `json:"TagList,omitempty" validate:"omitempty" description:"A list of tags associated with this security group"` + KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty" description:"Additional key-value pairs associated with this security group"` } type SecurityHandler interface { diff --git a/cloud-control-manager/cloud-driver/interfaces/resources/VPCHandler.go b/cloud-control-manager/cloud-driver/interfaces/resources/VPCHandler.go index 8a88fe27b..3d5285b91 100644 --- a/cloud-control-manager/cloud-driver/interfaces/resources/VPCHandler.go +++ b/cloud-control-manager/cloud-driver/interfaces/resources/VPCHandler.go @@ -21,21 +21,21 @@ type VPCReqInfo struct { } type VPCInfo struct { - IId IID // {NameId, SystemId} - IPv4_CIDR string - SubnetInfoList []SubnetInfo + IId IID `json:"IId" validate:"required"` // {NameId, SystemId} + IPv4_CIDR string `json:"IPv4_CIDR" validate:"required" example:"10.0.0.0/16" description:"The IPv4 CIDR block for the VPC"` + SubnetInfoList []SubnetInfo `json:"SubnetInfoList" validate:"required" description:"A list of subnet information associated with this VPC"` - TagList []KeyValue - KeyValueList []KeyValue + TagList []KeyValue `json:"TagList,omitempty" validate:"omitempty" description:"A list of tags associated with this VPC"` + KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty" description:"Additional key-value pairs associated with this VPC"` } type SubnetInfo struct { - IId IID // {NameId, SystemId} - Zone string // Target Zone Name - IPv4_CIDR string + IId IID `json:"IId" validate:"required"` // {NameId, SystemId} + Zone string `json:"Zone" validate:"required" example:"us-east-1a"` + IPv4_CIDR string `json:"IPv4_CIDR" validate:"required" example:"10.0.8.0/22" description:"The IPv4 CIDR block for the subnet"` - TagList []KeyValue - KeyValueList []KeyValue + TagList []KeyValue `json:"TagList,omitempty" validate:"omitempty" description:"A list of tags associated with this subnet"` + KeyValueList []KeyValue `json:"KeyValueList,omitempty" validate:"omitempty" description:"Additional key-value pairs associated with this subnet"` } type VPCHandler interface { diff --git a/go.mod b/go.mod index 8f672745c..52300f60d 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,6 @@ require ( github.com/IBM/vpc-go-sdk v0.8.0 github.com/IBM/vpc-go-sdk/0.23.0 v0.23.0 github.com/Microsoft/go-winio v0.5.2 // indirect - github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 github.com/aliyun/alibaba-cloud-sdk-go v1.62.684 github.com/aws/aws-sdk-go v1.39.4 github.com/bramvdbogaerde/go-scp v1.0.0 @@ -38,8 +37,7 @@ require ( github.com/snowzach/rotatefilehook v0.0.0-20220211133110-53752135082d github.com/spf13/cobra v1.2.1 github.com/spf13/viper v1.8.1 - github.com/swaggo/echo-swagger v1.1.0 - github.com/swaggo/swag v1.7.0 + github.com/swaggo/swag v1.16.3 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/clb v1.0.415 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/common v1.0.964 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cvm v1.0.493 @@ -78,6 +76,7 @@ require ( github.com/hashicorp/go-version v1.6.0 github.com/jeremywohl/flatten v1.0.1 github.com/labstack/echo/v4 v4.9.0 + github.com/swaggo/echo-swagger v1.4.1 github.com/tencentcloud/tencentcloud-sdk-go-intl-en v3.0.531+incompatible github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cbs v1.0.492 github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/tag v1.0.964 @@ -102,6 +101,7 @@ require ( github.com/containerd/log v0.1.0 // indirect github.com/distribution/reference v0.6.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/ghodss/yaml v1.0.0 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/golang-jwt/jwt/v5 v5.2.1 // indirect github.com/google/s2a-go v0.1.7 // indirect @@ -112,6 +112,7 @@ require ( github.com/mattn/go-sqlite3 v1.14.22 // indirect github.com/moby/docker-image-spec v1.3.1 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect + github.com/swaggo/files/v2 v2.0.0 // indirect github.com/tidwall/pretty v1.2.0 // indirect github.com/tjfoc/gmsm v1.4.1 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect @@ -137,9 +138,9 @@ require ( github.com/go-logr/logr v1.4.2 // indirect github.com/go-openapi/errors v0.20.2 // indirect github.com/go-openapi/jsonpointer v0.19.5 // indirect - github.com/go-openapi/jsonreference v0.19.5 // indirect - github.com/go-openapi/spec v0.20.0 // indirect - github.com/go-openapi/swag v0.19.12 // indirect + github.com/go-openapi/jsonreference v0.19.6 // indirect + github.com/go-openapi/spec v0.20.4 // indirect + github.com/go-openapi/swag v0.19.15 // indirect github.com/go-playground/locales v0.14.0 // indirect github.com/go-playground/universal-translator v0.18.0 // indirect github.com/golang-jwt/jwt v3.2.2+incompatible // indirect @@ -163,7 +164,7 @@ require ( github.com/labstack/gommon v0.3.1 // indirect github.com/leodido/go-urn v1.2.1 // indirect github.com/magiconair/properties v1.8.5 // indirect - github.com/mailru/easyjson v0.7.6 // indirect + github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect @@ -185,7 +186,6 @@ require ( github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect github.com/subosito/gotenv v1.2.0 // indirect - github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14 // indirect github.com/uber/jaeger-lib v2.4.1+incompatible // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/fasttemplate v1.2.1 // indirect @@ -210,7 +210,7 @@ require ( k8s.io/klog/v2 v2.30.0 // indirect k8s.io/utils v0.0.0-20210930125809-cb0fa318a74b // indirect sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // indirect - sigs.k8s.io/yaml v1.2.0 // indirect + sigs.k8s.io/yaml v1.3.0 // indirect ) retract ( diff --git a/go.sum b/go.sum index 0e6c64e5f..fe306c026 100644 --- a/go.sum +++ b/go.sum @@ -109,7 +109,6 @@ github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafoB+tBA3gMyHYHrpOtNuDiK/uB5uXxq5wM= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -200,7 +199,6 @@ github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo= github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= -github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/creack/pty v1.1.11/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -238,6 +236,7 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= +github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= @@ -263,20 +262,17 @@ github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34 github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/jsonreference v0.19.3/go.mod h1:rjx6GuL8TTa9VaixXglHmQmIL98+wF9xc8zWvFonSJ8= -github.com/go-openapi/jsonreference v0.19.4/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= -github.com/go-openapi/jsonreference v0.19.5 h1:1WJP/wi4OjB4iV8KVbH73rQaoialJrqv8gitZLxGLtM= -github.com/go-openapi/jsonreference v0.19.5/go.mod h1:RdybgQwPxbL4UEjuAruzK1x3nE69AqPYEJeo/TWfEeg= -github.com/go-openapi/spec v0.19.14/go.mod h1:gwrgJS15eCUgjLpMjBJmbZezCsw88LmgeEip0M63doA= -github.com/go-openapi/spec v0.20.0 h1:HGLc8AJ7ynOxwv0Lq4TsnwLsWMawHAYiJIFzbcML86I= -github.com/go-openapi/spec v0.20.0/go.mod h1:+81FIL1JwC5P3/Iuuozq3pPE9dXdIEGxFutcFKaVbmU= +github.com/go-openapi/jsonreference v0.19.6 h1:UBIxjkht+AWIgYzCDSv2GN+E/togfwXUJFRTWhl2Jjs= +github.com/go-openapi/jsonreference v0.19.6/go.mod h1:diGHMEHg2IqXZGKxqyvWdfWU/aim5Dprw5bqpKkTvns= +github.com/go-openapi/spec v0.20.4 h1:O8hJrt0UMnhHcluhIdUgCLRWyM2x7QkBXRvOs7m+O1M= +github.com/go-openapi/spec v0.20.4/go.mod h1:faYFR1CvsJZ0mNsmsphTMSoRrNV3TEDoAM7FOEWeq8I= github.com/go-openapi/strfmt v0.20.1/go.mod h1:43urheQI9dNtE5lTZQfuFJvjYJKPrxicATpEfZwHUNk= github.com/go-openapi/strfmt v0.21.1/go.mod h1:I/XVKeLc5+MM5oPNN7P6urMOpuLXEcNrCX/rPGuWb0k= github.com/go-openapi/strfmt v0.21.3 h1:xwhj5X6CjXEZZHMWy1zKJxvW9AfHC9pkyUjLvHtKG7o= github.com/go-openapi/strfmt v0.21.3/go.mod h1:k+RzNO0Da+k3FrrynSNN8F7n/peCmQQqbbXjtDfvmGg= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/go-openapi/swag v0.19.11/go.mod h1:Uc0gKkdR+ojzsEpjh39QChyu92vPgIr72POcgHMAgSY= -github.com/go-openapi/swag v0.19.12 h1:Bc0bnY2c3AoF7Gc+IMIAQQsD8fLHjHpc19wXvYuayQI= -github.com/go-openapi/swag v0.19.12/go.mod h1:eFdyEBkTdoAf/9RXBvj4cr1nH7GD8Kzo5HTt47gr72M= +github.com/go-openapi/swag v0.19.15 h1:D2NRCBzS9/pEY3gP9Nl8aDqGUcPFrwG2p+CNFrLyrCM= +github.com/go-openapi/swag v0.19.15/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= @@ -317,7 +313,6 @@ github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= github.com/golang-jwt/jwt/v4 v4.0.0 h1:RAqyYixv1p7uEnocuy8P1nru5wprCh/MH2BIlW5z5/o= @@ -520,10 +515,8 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/labstack/echo/v4 v4.0.0/go.mod h1:tZv7nai5buKSg5h/8E6zz4LsD/Dqh9/91Mvs7Z5Zyno= github.com/labstack/echo/v4 v4.9.0 h1:wPOF1CE6gvt/kmbMR4dGzWvHMPT+sAEUJOwOTtvITVY= github.com/labstack/echo/v4 v4.9.0/go.mod h1:xkCDAdFCIf8jsFQ5NnbK7oqaF/yU1A1X20Ltm0OvSks= -github.com/labstack/gommon v0.2.8/go.mod h1:/tj9csK2iPSBvn+3NLM9e52usepMtrd5ilFYA+wQNJ4= github.com/labstack/gommon v0.3.1 h1:OomWaJXm7xR6L1HmEtGyQf26TEn7V6X88mktX9kee9o= github.com/labstack/gommon v0.3.1/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= @@ -533,18 +526,16 @@ github.com/magiconair/properties v1.8.5 h1:b6kJs+EmPFMYGkow9GiUyCyOvIwYetYJ3fSaW github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.7.6 h1:8yTIVnZgCoiM1TgqoeTl+LfU5Jg6/xL3QhGQnimLYnA= github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE= github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.0/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= @@ -715,12 +706,12 @@ github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsT github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= -github.com/swaggo/echo-swagger v1.1.0 h1:P46vSnGTjCo4PCDnztbyyiJ9csTt8/GvwL6UIhr4zEM= -github.com/swaggo/echo-swagger v1.1.0/go.mod h1:JaipWDPqOBMwM40W6qz0o07lnPOxrhDkpjA2OaqfzL8= -github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14 h1:PyYN9JH5jY9j6av01SpfRMb+1DWg/i3MbGOKPxJ2wjM= -github.com/swaggo/files v0.0.0-20190704085106-630677cd5c14/go.mod h1:gxQT6pBGRuIGunNf/+tSOB5OHvguWi8Tbt82WOkf35E= -github.com/swaggo/swag v1.7.0 h1:5bCA/MTLQoIqDXXyHfOpMeDvL9j68OY/udlK4pQoo4E= -github.com/swaggo/swag v1.7.0/go.mod h1:BdPIL73gvS9NBsdi7M1JOxLvlbfvNRaBP8m6WT6Aajo= +github.com/swaggo/echo-swagger v1.4.1 h1:Yf0uPaJWp1uRtDloZALyLnvdBeoEL5Kc7DtnjzO/TUk= +github.com/swaggo/echo-swagger v1.4.1/go.mod h1:C8bSi+9yH2FLZsnhqMZLIZddpUxZdBYuNHbtaS1Hljc= +github.com/swaggo/files/v2 v2.0.0 h1:hmAt8Dkynw7Ssz46F6pn8ok6YmGZqHSVLZ+HQM7i0kw= +github.com/swaggo/files/v2 v2.0.0/go.mod h1:24kk2Y9NYEJ5lHuCra6iVwkMjIekMCaFq/0JQj66kyM= +github.com/swaggo/swag v1.16.3 h1:PnCYjPCah8FK4I26l2F/KQ4yz3sILcVUN3cTlBFA9Pg= +github.com/swaggo/swag v1.16.3/go.mod h1:DImHIuOFXKpMFAQjcC7FG4m3Dg4+QuUgUzJmKjI/gRk= github.com/tencentcloud/tencentcloud-sdk-go-intl-en v3.0.531+incompatible h1:LEXOEMQ6CcllV1S7UVETOiPQVIK3/i/eaCinbghFZuo= github.com/tencentcloud/tencentcloud-sdk-go-intl-en v3.0.531+incompatible/go.mod h1:72Wo6Gt6F8d8V+njrAmduVoT9QjPwCyXktpqCWr7PUc= github.com/tencentcloud/tencentcloud-sdk-go/tencentcloud/cbs v1.0.492 h1:TJ08B6Kf1j5jwbm7BjdQWjBOOPFuNuK9aSF0iMnfjmE= @@ -748,10 +739,8 @@ github.com/uber/jaeger-client-go v2.30.0+incompatible h1:D6wyKGCecFaSRUpo8lCVbaO github.com/uber/jaeger-client-go v2.30.0+incompatible/go.mod h1:WVhlPFC8FDjOFMMWRy2pZqQJSXxYSwNYOkTr/Z6d3Kk= github.com/uber/jaeger-lib v2.4.1+incompatible h1:td4jdvLcExb4cBISKIpHuGoVXh+dVKhn2Um6rjCsSsg= github.com/uber/jaeger-lib v2.4.1+incompatible/go.mod h1:ComeNDZlWwrWnDv8aPp0Ba6+uUTzImX/AauajbLI56U= -github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasttemplate v0.0.0-20170224212429-dcecefd839c4/go.mod h1:50wTf68f99/Zt14pr046Tgt3Lp2vLyFZKzbFXTOabXw= github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/xdg-go/pbkdf2 v1.0.0/go.mod h1:jrpuAogTd400dnrH08LKmI/xc1MbPOebTwRqcT5RDeI= @@ -810,7 +799,6 @@ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= -golang.org/x/crypto v0.0.0-20190130090550-b01c7a725664/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190422162423-af44ce270edf/go.mod h1:WFFai1msRO1wXaEeE5yQxYXgSfI8pQAWXbQop6sCtWE= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -920,6 +908,7 @@ golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210421230115-4e50805a0758/go.mod h1:72T/g9IO56b78aLF+1Kcs5dz7/ng1VjMUvfKvpfy+jM= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -971,9 +960,7 @@ golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181026203630-95b1ffbd15a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190129075346-302c3dd5f1cc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190403152447-81d4e9dc473e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1024,6 +1011,7 @@ golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210525143221-35b2ab0089ea/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1134,9 +1122,7 @@ golang.org/x/tools v0.0.0-20200804011535-6c149bb5ef0d/go.mod h1:njjCfa9FT2d7l9Bc golang.org/x/tools v0.0.0-20200825202427-b303f430e36d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= golang.org/x/tools v0.0.0-20200904185747-39188db58858/go.mod h1:Cj7w3i3Rnn0Xh82ur9kSqwfTHTeVxaDqrfMjpcNT6bE= golang.org/x/tools v0.0.0-20201110124207-079ba7bd75cd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201120155355-20be4ac4bd6e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201201161351-ac6f37ff4c2a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.0.0-20201207182000-5679438983bd/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201208233053-a543418bbed2/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210105154028-b0ab187a4818/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= @@ -1347,5 +1333,6 @@ rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= sigs.k8s.io/structured-merge-diff/v4 v4.0.2/go.mod h1:bJZC9H9iH24zzfZ/41RGcq60oK1F7G282QMXDPYydCw= sigs.k8s.io/structured-merge-diff/v4 v4.1.2 h1:Hr/htKFmJEbtMgS/UD0N+gtgctAqz81t3nu+sPzynno= sigs.k8s.io/structured-merge-diff/v4 v4.1.2/go.mod h1:j/nl6xW8vLS49O8YvXW1ocPhZawJtm+Yrr7PPRQ0Vg4= -sigs.k8s.io/yaml v1.2.0 h1:kr/MCeFWJWTwyaHoR9c8EjH9OumOmoF9YGiZd7lFm/Q= sigs.k8s.io/yaml v1.2.0/go.mod h1:yfXDCHCao9+ENCvLSE62v9VSji2MKu5jeNfTrofGhJc= +sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= +sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=