Skip to content

Commit

Permalink
Tidy comments in 'api/rest/server/mcis'
Browse files Browse the repository at this point in the history
  • Loading branch information
jihoon-seo committed May 2, 2022
1 parent e222bf2 commit c5f555e
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 51 deletions.
7 changes: 0 additions & 7 deletions src/api/rest/server/mcis/manageInfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -163,7 +161,6 @@ func RestGetAllMcis(c echo.Context) error {
}
content := RestGetAllMcisResponse{}
content.Mcis = result
//common.PrintJsonPretty(content)
return c.JSON(http.StatusOK, &content)
}

Expand Down Expand Up @@ -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)
Expand All @@ -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)

}
Expand Down
66 changes: 34 additions & 32 deletions src/api/rest/server/mcis/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
*/
1 change: 0 additions & 1 deletion src/api/rest/server/mcis/orchestration.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions src/api/rest/server/mcis/provisioning.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
1 change: 0 additions & 1 deletion src/api/rest/server/mcis/recommendation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions src/api/rest/server/mcis/remoteCommand.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions src/api/rest/server/mcis/utility.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand All @@ -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)
}

Expand Down

0 comments on commit c5f555e

Please sign in to comment.