Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve structures and scripts for model management and synchronization #79

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ clean:
prod:
cd cmd/cm-beetle && $(MAKE) prod

source-model:
cd pkg/api/rest/model && $(MAKE) source-model
onprem-model:
cd pkg/api/rest/model && $(MAKE) onprem-model

swag swagger:
cd pkg/ && $(MAKE) swag
24 changes: 12 additions & 12 deletions pkg/api/rest/controller/migration.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"net/http"
"time"

"github.com/cloud-barista/cm-beetle/pkg/api/rest/model"
cloudmodel "github.com/cloud-barista/cm-beetle/pkg/api/rest/model/cloud/infra"
"github.com/cloud-barista/cm-beetle/pkg/core/common"
"github.com/go-resty/resty/v2"
"github.com/labstack/echo/v4"
Expand All @@ -33,11 +33,11 @@ type MigrateInfraRequest struct {
// [NOTE] Failed to embed the struct in CB-Tumblebug as follows:
// mcis.TbMcisDynamicReq

model.TbMcisDynamicReq
cloudmodel.TbMcisDynamicReq
}

type MigrateInfraResponse struct {
model.TbMcisInfo
cloudmodel.TbMcisInfo
}

// MigrateInfra godoc
Expand Down Expand Up @@ -83,7 +83,7 @@ func MigrateInfra(c echo.Context) error {

}

func createVMInfra(nsId string, infraModel *model.TbMcisDynamicReq) (model.TbMcisInfo, error) {
func createVMInfra(nsId string, infraModel *cloudmodel.TbMcisDynamicReq) (cloudmodel.TbMcisInfo, error) {

client := resty.New()
client.SetBasicAuth("default", "default")
Expand All @@ -98,7 +98,7 @@ func createVMInfra(nsId string, infraModel *model.TbMcisDynamicReq) (model.TbMci
requestBody := *infraModel

// Set response body
responseBody := model.TbMcisInfo{}
responseBody := cloudmodel.TbMcisInfo{}

client.SetTimeout(5 * time.Minute)

Expand All @@ -115,7 +115,7 @@ func createVMInfra(nsId string, infraModel *model.TbMcisDynamicReq) (model.TbMci

if err != nil {
// common.CBLog.Error(err)
return model.TbMcisInfo{}, err
return cloudmodel.TbMcisInfo{}, err
}

return responseBody, nil
Expand All @@ -124,11 +124,11 @@ func createVMInfra(nsId string, infraModel *model.TbMcisDynamicReq) (model.TbMci
////////////////////////

type MigrateNetworkRequest struct {
model.DummyNetwork
cloudmodel.DummyNetwork
}

type MigrateNetworkResponse struct {
model.DummyNetwork
cloudmodel.DummyNetwork
}

// MigrateNetwork godoc
Expand Down Expand Up @@ -182,11 +182,11 @@ func MigrateNetwork(c echo.Context) error {
////////////////////////

type MigrateStorageRequest struct {
model.DummyStorage
cloudmodel.DummyStorage
}

type MigrateStorageResponse struct {
model.DummyStorage
cloudmodel.DummyStorage
}

// MigrateStorage godoc
Expand Down Expand Up @@ -240,11 +240,11 @@ func MigrateStorage(c echo.Context) error {
////////////////////////

type MigrateInstanceRequest struct {
model.DummyInstance
cloudmodel.DummyInstance
}

type MigrateInstanceResponse struct {
model.DummyInstance
cloudmodel.DummyInstance
}

// MigrateInstance godoc
Expand Down
6 changes: 3 additions & 3 deletions pkg/api/rest/controller/recommendation.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ package controller
import (
"net/http"

"github.com/cloud-barista/cm-beetle/pkg/api/rest/model"
"github.com/cloud-barista/cm-beetle/pkg/api/rest/model/source/infra"
"github.com/cloud-barista/cm-beetle/pkg/api/rest/model/cloud/infra"
"github.com/cloud-barista/cm-beetle/pkg/api/rest/model/onprem/infra"
"github.com/cloud-barista/cm-beetle/pkg/core/common"
"github.com/cloud-barista/cm-beetle/pkg/core/recommendation"
"github.com/labstack/echo/v4"
Expand All @@ -41,7 +41,7 @@ type RecommendInfraRequest struct {
}

type RecommendInfraResponse struct {
model.TbMcisDynamicReq
cloudmodel.TbMcisDynamicReq
}

// RecommendInfra godoc
Expand Down
Loading