From c5f555e2bf0c3b3641d95cc97a17c586b95b1346 Mon Sep 17 00:00:00 2001 From: Jihoon Seo Date: Mon, 2 May 2022 17:20:03 +0900 Subject: [PATCH] Tidy comments in 'api/rest/server/mcis' --- src/api/rest/server/mcis/manageInfo.go | 7 --- src/api/rest/server/mcis/network.go | 66 +++++++++++----------- src/api/rest/server/mcis/orchestration.go | 1 - src/api/rest/server/mcis/provisioning.go | 4 -- src/api/rest/server/mcis/recommendation.go | 1 - src/api/rest/server/mcis/remoteCommand.go | 2 - src/api/rest/server/mcis/utility.go | 4 -- 7 files changed, 34 insertions(+), 51 deletions(-) diff --git a/src/api/rest/server/mcis/manageInfo.go b/src/api/rest/server/mcis/manageInfo.go index 03075f427..1fbd84522 100644 --- a/src/api/rest/server/mcis/manageInfo.go +++ b/src/api/rest/server/mcis/manageInfo.go @@ -141,7 +141,6 @@ func RestGetAllMcis(c echo.Context) error { } content := RestGetAllMcisStatusResponse{} content.Mcis = result - //common.PrintJsonPretty(content) return c.JSON(http.StatusOK, &content) } else if option == "simple" { // MCIS in simple (without VM information) @@ -152,7 +151,6 @@ func RestGetAllMcis(c echo.Context) error { } content := RestGetAllMcisResponse{} content.Mcis = result - //common.PrintJsonPretty(content) return c.JSON(http.StatusOK, &content) } else { // MCIS in detail (with status information) @@ -163,7 +161,6 @@ func RestGetAllMcis(c echo.Context) error { } content := RestGetAllMcisResponse{} content.Mcis = result - //common.PrintJsonPretty(content) return c.JSON(http.StatusOK, &content) } @@ -274,7 +271,6 @@ func RestGetMcisVm(c echo.Context) error { return c.JSON(http.StatusInternalServerError, &mapA) } - //fmt.Printf("%+v\n", *result) common.PrintJsonPretty(*result) return c.JSON(http.StatusOK, result) @@ -287,11 +283,8 @@ func RestGetMcisVm(c echo.Context) error { return c.JSON(http.StatusNotFound, &mapA) } - //fmt.Printf("%+v\n", *result) common.PrintJsonPretty(*result) - //return by string - //return c.String(http.StatusOK, keyValue.Value) return c.JSON(http.StatusOK, result) } diff --git a/src/api/rest/server/mcis/network.go b/src/api/rest/server/mcis/network.go index a02129a66..286e064f3 100644 --- a/src/api/rest/server/mcis/network.go +++ b/src/api/rest/server/mcis/network.go @@ -63,35 +63,37 @@ func RestPostConfigureCloudAdaptiveNetworkToMcis(c echo.Context) error { return c.JSON(http.StatusOK, contents) } -// // RestGetMonitorData godoc -// // @Summary Get monitoring data of specified MCIS for specified monitoring metric (cpu, memory, disk, network) -// // @Description Get monitoring data of specified MCIS for specified monitoring metric (cpu, memory, disk, network) -// // @Tags [Infra service] MCIS Resource monitor (for developer) -// // @Accept json -// // @Produce json -// // @Param nsId path string true "Namespace ID" default(ns01) -// // @Param mcisId path string true "MCIS ID" default(mcis01) -// // @Param metric path string true "Metric type: cpu, memory, disk, network" -// // @Success 200 {object} mcis.MonResultSimpleResponse -// // @Failure 404 {object} common.SimpleMsg -// // @Failure 500 {object} common.SimpleMsg -// // @Router /ns/{nsId}/monitoring/mcis/{mcisId}/metric/{metric} [get] -// func RestGetMonitorData(c echo.Context) error { - -// nsId := c.Param("nsId") -// mcisId := c.Param("mcisId") -// metric := c.Param("metric") - -// req := &mcis.McisCmdReq{} -// if err := c.Bind(req); err != nil { -// return err -// } - -// content, err := mcis.GetMonitoringData(nsId, mcisId, metric) -// if err != nil { -// common.CBLog.Error(err) -// return err -// } - -// return c.JSON(http.StatusOK, content) -// } +/* +// RestGetMonitorData godoc +// @Summary Get monitoring data of specified MCIS for specified monitoring metric (cpu, memory, disk, network) +// @Description Get monitoring data of specified MCIS for specified monitoring metric (cpu, memory, disk, network) +// @Tags [Infra service] MCIS Resource monitor (for developer) +// @Accept json +// @Produce json +// @Param nsId path string true "Namespace ID" default(ns01) +// @Param mcisId path string true "MCIS ID" default(mcis01) +// @Param metric path string true "Metric type: cpu, memory, disk, network" +// @Success 200 {object} mcis.MonResultSimpleResponse +// @Failure 404 {object} common.SimpleMsg +// @Failure 500 {object} common.SimpleMsg +// @Router /ns/{nsId}/monitoring/mcis/{mcisId}/metric/{metric} [get] +func RestGetMonitorData(c echo.Context) error { + + nsId := c.Param("nsId") + mcisId := c.Param("mcisId") + metric := c.Param("metric") + + req := &mcis.McisCmdReq{} + if err := c.Bind(req); err != nil { + return err + } + + content, err := mcis.GetMonitoringData(nsId, mcisId, metric) + if err != nil { + common.CBLog.Error(err) + return err + } + + return c.JSON(http.StatusOK, content) +} +*/ diff --git a/src/api/rest/server/mcis/orchestration.go b/src/api/rest/server/mcis/orchestration.go index 36043c66b..93ab9f7ff 100644 --- a/src/api/rest/server/mcis/orchestration.go +++ b/src/api/rest/server/mcis/orchestration.go @@ -119,7 +119,6 @@ func RestGetAllMcisPolicy(c echo.Context) error { content := RestGetAllMcisPolicyResponse{} content.McisPolicy = result - //fmt.Printf("content %+v\n", content) common.PrintJsonPretty(content) return c.JSON(http.StatusOK, &content) diff --git a/src/api/rest/server/mcis/provisioning.go b/src/api/rest/server/mcis/provisioning.go index 4d28a9791..15d30dd17 100644 --- a/src/api/rest/server/mcis/provisioning.go +++ b/src/api/rest/server/mcis/provisioning.go @@ -50,7 +50,6 @@ func RestPostMcis(c echo.Context) error { return c.JSON(http.StatusInternalServerError, &mapA) } - //fmt.Printf("%+v\n", *result) common.PrintJsonPretty(*result) return c.JSON(http.StatusCreated, result) @@ -84,7 +83,6 @@ func RestPostRegisterCSPNativeVM(c echo.Context) error { return c.JSON(http.StatusInternalServerError, &mapA) } - //fmt.Printf("%+v\n", *result) common.PrintJsonPretty(*result) return c.JSON(http.StatusCreated, result) @@ -117,7 +115,6 @@ func RestPostMcisDynamic(c echo.Context) error { return c.JSON(http.StatusInternalServerError, &mapA) } - //fmt.Printf("%+v\n", *result) common.PrintJsonPretty(*result) return c.JSON(http.StatusCreated, result) @@ -147,7 +144,6 @@ func RestPostMcisDynamicCheckRequest(c echo.Context) error { return c.JSON(http.StatusInternalServerError, &mapA) } - //fmt.Printf("%+v\n", *result) common.PrintJsonPretty(*result) return c.JSON(http.StatusOK, result) diff --git a/src/api/rest/server/mcis/recommendation.go b/src/api/rest/server/mcis/recommendation.go index 3f83b37f8..741493ee9 100644 --- a/src/api/rest/server/mcis/recommendation.go +++ b/src/api/rest/server/mcis/recommendation.go @@ -93,7 +93,6 @@ func RestPostMcisRecommend(c echo.Context) error { content.PlacementAlgo = req.PlacementAlgo content.PlacementParam = req.PlacementParam - //fmt.Printf("%+v\n", content) common.PrintJsonPretty(content) return c.JSON(http.StatusCreated, content) diff --git a/src/api/rest/server/mcis/remoteCommand.go b/src/api/rest/server/mcis/remoteCommand.go index 0a7266a30..186058507 100644 --- a/src/api/rest/server/mcis/remoteCommand.go +++ b/src/api/rest/server/mcis/remoteCommand.go @@ -111,10 +111,8 @@ func RestPostCmdMcis(c echo.Context) error { resultTmp.VmIp = v.VmIp resultTmp.Result = v.Result content.ResultArray = append(content.ResultArray, resultTmp) - //fmt.Println("result from goroutin " + v) } - //fmt.Printf("%+v\n", content) common.PrintJsonPretty(content) return c.JSON(http.StatusOK, content) diff --git a/src/api/rest/server/mcis/utility.go b/src/api/rest/server/mcis/utility.go index 8cb69e4a3..335288b34 100644 --- a/src/api/rest/server/mcis/utility.go +++ b/src/api/rest/server/mcis/utility.go @@ -37,8 +37,6 @@ func RestCheckMcis(c echo.Context) error { if err != nil { common.CBLog.Error(err) - //mapA := map[string]string{"message": err.Error()} - //return c.JSON(http.StatusFailedDependency, &mapA) return c.JSON(http.StatusNotFound, &content) } @@ -61,8 +59,6 @@ func RestCheckVm(c echo.Context) error { if err != nil { common.CBLog.Error(err) - //mapA := map[string]string{"message": err.Error()} - //return c.JSON(http.StatusFailedDependency, &mapA) return c.JSON(http.StatusNotFound, &content) }