-
Notifications
You must be signed in to change notification settings - Fork 1
/
plan.go
50 lines (36 loc) · 1.37 KB
/
plan.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package mcis
import (
"context"
gc "github.com/cloud-barista/poc-cicd-tumblebug/src/api/grpc/common"
"github.com/cloud-barista/poc-cicd-tumblebug/src/api/grpc/logger"
pb "github.com/cloud-barista/poc-cicd-tumblebug/src/api/grpc/protobuf/cbtumblebug"
"github.com/cloud-barista/poc-cicd-tumblebug/src/core/mcis"
)
// ===== [ Constants and Variables ] =====
// ===== [ Types ] =====
// ===== [ Implementations ] =====
// RecommendVM - MCIS VM 추천
func (s *MCISService) RecommendVM(ctx context.Context, req *pb.McisRecommendVmCreateRequest) (*pb.ListTbSpecInfoResponse, error) {
logger := logger.NewLogger()
logger.Debug("calling MCISService.RecommendVM()")
// GRPC 메시지에서 MCIS 객체로 복사
var mcisObj mcis.DeploymentPlan
err := gc.CopySrcToDest(&req.Item, &mcisObj)
if err != nil {
return nil, gc.ConvGrpcStatusErr(err, "", "MCISService.RecommendVM()")
}
content, err := mcis.RecommendVm(req.NsId, mcisObj)
if err != nil {
return nil, gc.ConvGrpcStatusErr(err, "", "MCISService.RecommendVM()")
}
// MCIS 객체에서 GRPC 메시지로 복사
var grpcObj []*pb.TbSpecInfo
err = gc.CopySrcToDest(&content, &grpcObj)
if err != nil {
return nil, gc.ConvGrpcStatusErr(err, "", "MCISService.RecommendVM()")
}
resp := &pb.ListTbSpecInfoResponse{Items: grpcObj}
return resp, nil
}
// ===== [ Private Functions ] =====
// ===== [ Public Functions ] =====