Skip to content

Commit

Permalink
Merge pull request #22 from cloud-barista/feature/update-mig-structure
Browse files Browse the repository at this point in the history
update : gcp structure
  • Loading branch information
heedaeshin authored Aug 22, 2024
2 parents d8b9a48 + cf052c3 commit 1740fb7
Show file tree
Hide file tree
Showing 12 changed files with 3,667 additions and 355 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default:
# cc:
# cd cmd/cm-beetle && $(MAKE)
run:
./mc-data-manager server
./mc-data-manager server -I 0.0.0.0/0 -P 80
# runwithport:
# cd cmd/cm-beetle && $(MAKE) runwithport --port=$(PORT)
clean:
Expand Down
4 changes: 2 additions & 2 deletions websrc/controllers/generateHandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ func GenerateS3PostHandler(ctx echo.Context) error {
// @Tags [Test Data Generation]
// @Accept multipart/form-data
// @Produce json
// @Param RequestBody body GenDataParams true "Parameters required to generate test data"
// @Param RequestBody formData GenDataParams true "Parameters required to generate test data"
// @Param gcpCredential formData file true "Parameters required to generate test data"
// @Success 200 {object} models.BasicResponse "Successfully generated test data"
// @Failure 500 {object} models.BasicResponse "Internal Server Error"
Expand Down Expand Up @@ -483,7 +483,7 @@ func GenerateDynamoDBPostHandler(ctx echo.Context) error {
// @Tags [Test Data Generation]
// @Accept multipart/form-data
// @Produce json
// @Param RequestBody body GenDataParams true "Parameters required to generate test data"
// @Param RequestBody formData GenDataParams true "Parameters required to generate test data"
// @Param gcpCredential formData file true "Parameters required to generate test data"
// @Success 200 {object} models.BasicResponse "Successfully generated test data"
// @Failure 500 {object} models.BasicResponse "Internal Server Error"
Expand Down
8 changes: 4 additions & 4 deletions websrc/controllers/migrationGCPHandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (
// @Tags [Data Migration]
// @Accept multipart/form-data
// @Produce json
// @Param RequestBody body MigrationForm true "Parameters required for migration"
// @Param RequestBody formData MigrationForm true "Parameters required for migration"
// @Param gcpCredential formData file true "Parameters required to generate test data"
// @Success 200 {object} models.BasicResponse "Successfully migrated data"
// @Failure 400 {object} models.BasicResponse "Invalid Request"
Expand Down Expand Up @@ -97,7 +97,7 @@ func MigrationGCPToLinuxPostHandler(ctx echo.Context) error {
// @Tags [Data Migration]
// @Accept multipart/form-data
// @Produce json
// @Param RequestBody body MigrationForm true "Parameters required for migration"
// @Param RequestBody formData MigrationForm true "Parameters required for migration"
// @Param gcpCredential formData file true "Parameters required to generate test data"
// @Success 200 {object} models.BasicResponse "Successfully migrated data"
// @Failure 400 {object} models.BasicResponse "Invalid Request"
Expand Down Expand Up @@ -163,7 +163,7 @@ func MigrationGCPToWindowsPostHandler(ctx echo.Context) error {
// @Tags [Data Migration]
// @Accept multipart/form-data
// @Produce json
// @Param RequestBody body MigrationForm true "Parameters required for migration"
// @Param RequestBody formData MigrationForm true "Parameters required for migration"
// @Param gcpCredential formData file true "Parameters required to generate test data"
// @Success 200 {object} models.BasicResponse "Successfully migrated data"
// @Failure 500 {object} models.BasicResponse "Internal Server Error"
Expand Down Expand Up @@ -234,7 +234,7 @@ func MigrationGCPToS3PostHandler(ctx echo.Context) error {
// @Tags [Data Migration]
// @Accept multipart/form-data
// @Produce json
// @Param RequestBody body MigrationForm true "Parameters required for migration"
// @Param RequestBody formData MigrationForm true "Parameters required for migration"
// @Param gcpCredential formData file true "Parameters required to generate test data"
// @Success 200 {object} models.BasicResponse "Successfully migrated data"
// @Failure 500 {object} models.BasicResponse "Internal Server Error"
Expand Down
4 changes: 2 additions & 2 deletions websrc/controllers/migrationHandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func MigrationLinuxToS3PostHandler(ctx echo.Context) error {
// @Tags [Data Migration]
// @Accept multipart/form-data
// @Produce json
// @Param RequestBody body MigrationForm true "Parameters required for migration"
// @Param RequestBody formData MigrationForm true "Parameters required for migration"
// @Param gcpCredential formData file true "Parameters required to generate test data"
// @Success 200 {object} models.BasicResponse "Successfully migrated data"
// @Failure 400 {object} models.BasicResponse "Invalid Request"
Expand Down Expand Up @@ -273,7 +273,7 @@ func MigrationWindowsToS3PostHandler(ctx echo.Context) error {
// @Tags [Data Migration]
// @Accept multipart/form-data
// @Produce json
// @Param RequestBody body MigrationForm true "Parameters required for migration"
// @Param RequestBody formData MigrationForm true "Parameters required for migration"
// @Param gcpCredential formData file true "Parameters required to generate test data"
// @Success 200 {object} models.BasicResponse "Successfully migrated data"
// @Failure 400 {object} models.BasicResponse "Invalid Request"
Expand Down
4 changes: 2 additions & 2 deletions websrc/controllers/migrationNCPHandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ func MigrationNCPToS3PostHandler(ctx echo.Context) error {
// @Tags [Data Migration]
// @Accept multipart/form-data
// @Produce json
// @Param RequestBody body MigrationForm true "Parameters required for migration"
// @Param gcpCredential formData file true "Parameters required to generate test data"
// @Param RequestBody formData MigrationForm true "Parameters required for migration"
// @Param gcpCredential formData file true "Parameters required to generate test data"
// @Success 200 {object} models.BasicResponse "Successfully migrated data"
// @Failure 500 {object} models.BasicResponse "Internal Server Error"
// @Router /ncp/gcp [post]
Expand Down
14 changes: 7 additions & 7 deletions websrc/controllers/migrationNoSqlHandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
// @Tags [Data Migration]
// @Accept multipart/form-data
// @Produce json
// @Param RequestBody body MigrationForm true "Parameters required for migration"
// @Param RequestBody formData MigrationForm true "Parameters required for migration"
// @Param gcpCredential formData file true "Parameters required to generate test data"
// @Success 200 {object} models.BasicResponse "Successfully migrated data"
// @Failure 500 {object} models.BasicResponse "Internal Server Error"
Expand Down Expand Up @@ -156,9 +156,9 @@ func MigrationDynamoDBToMongoDBPostHandler(ctx echo.Context) error {
// @Summary Migrate data from Firestore to DynamoDB
// @Description Migrate data stored in Google Cloud Firestore to AWS DynamoDB.
// @Tags [Data Migration]
// @Accept json
// @Accept multipart/form-data
// @Produce json
// @Param RequestBody body MigrationForm true "Parameters required for migration"
// @Param RequestBody formData MigrationForm true "Parameters required for migration"
// @Param gcpCredential formData file true "Parameters required to generate test data"
// @Success 200 {object} models.BasicResponse "Successfully migrated data"
// @Failure 500 {object} models.BasicResponse "Internal Server Error"
Expand Down Expand Up @@ -225,9 +225,9 @@ func MigrationFirestoreToDynamoDBPostHandler(ctx echo.Context) error {
// @Summary Migrate data from Firestore to MongoDB
// @Description Migrate data stored in Google Cloud Firestore to Naver Cloud MongoDB.
// @Tags [Data Migration]
// @Accept json
// @Accept multipart/form-data
// @Produce json
// @Param RequestBody body MigrationForm true "Parameters required for migration"
// @Param RequestBody formData MigrationForm true "Parameters required for migration"
// @Param gcpCredential formData file true "Parameters required to generate test data"
// @Success 200 {object} models.BasicResponse "Successfully migrated data"
// @Failure 500 {object} models.BasicResponse "Internal Server Error"
Expand Down Expand Up @@ -353,9 +353,9 @@ func MigrationMongoDBToDynamoDBPostHandler(ctx echo.Context) error {
// @Summary Migrate data from MongoDB to Firestore
// @Description Migrate data stored in Naver Cloud MongoDB to Google Cloud Firestore.
// @Tags [Data Migration]
// @Accept json
// @Accept multipart/form-data
// @Produce json
// @Param RequestBody body MigrationForm true "Parameters required for migration"
// @Param RequestBody formData MigrationForm true "Parameters required for migration"
// @Param gcpCredential formData file true "Parameters required to generate test data"
// @Success 200 {object} models.BasicResponse "Successfully migrated data"
// @Failure 500 {object} models.BasicResponse "Internal Server Error"
Expand Down
2 changes: 1 addition & 1 deletion websrc/controllers/migrationS3Handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func MigrationS3ToWindowsPostHandler(ctx echo.Context) error {
// @Tags [Data Migration]
// @Accept multipart/form-data
// @Produce json
// @Param RequestBody body MigrationForm true "Parameters required for migration"
// @Param RequestBody formData MigrationForm true "Parameters required for migration"
// @Param gcpCredential formData file true "Parameters required to generate test data"
// @Success 200 {object} models.BasicResponse "Successfully migrated data"
// @Failure 500 {object} models.BasicResponse "Internal Server Error"
Expand Down
5 changes: 4 additions & 1 deletion websrc/controllers/migrationStructs.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ type MigrationForm struct {
AWSSecretKey string `form:"awsSecretKey"`
AWSBucket string `form:"awsBucket"`

GCPParams GCPMigrationParams `json:"gcpParams"`
ProjectID string `form:"projectid" json:"projectid"`
GCPRegion string `form:"gcpRegion" json:"gcpRegion"`
GCPBucket string `form:"gcpBucket" json:"gcpBucket"`
GCPCredential *multipart.FileHeader `form:"gcpCredential" json:"-" swaggerignore:"true"`

NCPRegion string `form:"ncpRegion"`
NCPAccessKey string `form:"ncpAccessKey"`
Expand Down
6 changes: 3 additions & 3 deletions websrc/controllers/publicfunc.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func getGCPCOSC(logger *logrus.Logger, startTime time.Time, jobType string, para
if jobType == "gen" {
gcpOSC, err = osc.New(gcpfs.New(gc, gparam.ProjectID, gparam.Bucket, gparam.Region), osc.WithLogger(logger))
} else {
gcpOSC, err = osc.New(gcpfs.New(gc, mparam.GCPParams.ProjectID, mparam.GCPParams.GCPBucket, mparam.GCPParams.GCPRegion), osc.WithLogger(logger))
gcpOSC, err = osc.New(gcpfs.New(gc, mparam.ProjectID, mparam.GCPBucket, mparam.GCPRegion), osc.WithLogger(logger))
}
if err != nil {
end := time.Now()
Expand Down Expand Up @@ -328,7 +328,7 @@ func getFirestoreNRDBC(logger *logrus.Logger, startTime time.Time, jobType strin
if jobType == "gen" {
fc, err = config.NewFireStoreClient(credFileName, gparam.ProjectID)
} else {
fc, err = config.NewFireStoreClient(credFileName, mparam.GCPParams.ProjectID)
fc, err = config.NewFireStoreClient(credFileName, mparam.ProjectID)
}
if err != nil {
end := time.Now()
Expand All @@ -342,7 +342,7 @@ func getFirestoreNRDBC(logger *logrus.Logger, startTime time.Time, jobType strin
if jobType == "gen" {
NRDBC, err = nrdbc.New(gcpfsdb.New(fc, gparam.Region), nrdbc.WithLogger(logger))
} else {
NRDBC, err = nrdbc.New(gcpfsdb.New(fc, mparam.GCPParams.GCPRegion), nrdbc.WithLogger(logger))
NRDBC, err = nrdbc.New(gcpfsdb.New(fc, mparam.GCPRegion), nrdbc.WithLogger(logger))
}
if err != nil {
end := time.Now()
Expand Down
Loading

0 comments on commit 1740fb7

Please sign in to comment.