Skip to content

Commit

Permalink
update : specifiic-params
Browse files Browse the repository at this point in the history
  • Loading branch information
heedaeshin committed Aug 22, 2024
1 parent c376b8a commit 9550ad6
Show file tree
Hide file tree
Showing 7 changed files with 457 additions and 958 deletions.
2 changes: 1 addition & 1 deletion websrc/controllers/gendata.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ type GenDataParams struct {
DatabaseName string `json:"databaseName" form:"databaseName"`

GCPCredential *multipart.FileHeader `form:"gcpCredential" swaggerignore:"true"`
ProjectID string `json:"projectId" form:"projectid"`
ProjectID string `json:"projectid" form:"projectid"`
}

func genData(params GenDataParams, logger *logrus.Logger) error {
Expand Down
3 changes: 2 additions & 1 deletion websrc/controllers/migrationNCPHandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ import (
// @Tags [Data Migration]
// @Accept json
// @Produce json
// @Param RequestBody body MigrationForm true "Parameters required for migration"
// @Param LinuxMigrationParams body LinuxMigrationParams true "Parameters required for Linux migration"
// @Param NCPMigrationParams body NCPMigrationParams true "Parameters required for NCP migration"
// @Success 200 {object} models.BasicResponse "Successfully migrated data"
// @Failure 400 {object} models.BasicResponse "Invalid Request"
// @Failure 500 {object} models.BasicResponse "Internal Server Error"
Expand Down
19 changes: 12 additions & 7 deletions websrc/controllers/migrationNoSqlHandlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ import (
// @Tags [Data Migration]
// @Accept multipart/form-data
// @Produce json
// @Param RequestBody formData MigrationForm true "Parameters required for migration"
// @Param AWSMigrationParams body AWSMigrationParams true "Parameters required for Linux migration"
// @Param GCPMigrationParams body GCPMigrationParams true "Parameters required for GCP 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 @@ -99,8 +100,8 @@ func MigrationDynamoDBToFirestorePostHandler(ctx echo.Context) error {
// @Tags [Data Migration]
// @Accept json
// @Produce json
// @Param RequestBody body MigrationForm true "Parameters required for migration"
// @Param gcpCredential formData file true "Parameters required to generate test data"
// @Param AWSMigrationParams body AWSMigrationParams true "Parameters required for AWS migration"
// @Param NCPMigrationParams body NCPMigrationParams true "Parameters required for NCP migration"
// @Success 200 {object} models.BasicResponse "Successfully migrated data"
// @Failure 500 {object} models.BasicResponse "Internal Server Error"
// @Router /migration/dynamodb/mongodb [post]
Expand Down Expand Up @@ -158,7 +159,8 @@ func MigrationDynamoDBToMongoDBPostHandler(ctx echo.Context) error {
// @Tags [Data Migration]
// @Accept multipart/form-data
// @Produce json
// @Param RequestBody formData MigrationForm true "Parameters required for migration"
// @Param GCPMigrationParams body GCPMigrationParams true "Parameters required for GCP migration"
// @Param AWSMigrationParams body AWSMigrationParams true "Parameters required for AWS 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 @@ -227,7 +229,8 @@ func MigrationFirestoreToDynamoDBPostHandler(ctx echo.Context) error {
// @Tags [Data Migration]
// @Accept multipart/form-data
// @Produce json
// @Param RequestBody formData MigrationForm true "Parameters required for migration"
// @Param GCPMigrationParams body GCPMigrationParams true "Parameters required for GCP migration"
// @Param NCPMigrationParams body NCPMigrationParams true "Parameters required for NCP 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 @@ -296,7 +299,8 @@ func MigrationFirestoreToMongoDBPostHandler(ctx echo.Context) error {
// @Tags [Data Migration]
// @Accept json
// @Produce json
// @Param RequestBody body MigrationForm true "Parameters required for migration"
// @Param NCPMigrationParams body NCPMigrationParams true "Parameters required for NCP migration"
// @Param AWSMigrationParams body AWSMigrationParams true "Parameters required for AWS migration"
// @Success 200 {object} models.BasicResponse "Successfully migrated data"
// @Failure 500 {object} models.BasicResponse "Internal Server Error"
// @Router /mongodb/dynamodb [post]
Expand Down Expand Up @@ -355,7 +359,8 @@ func MigrationMongoDBToDynamoDBPostHandler(ctx echo.Context) error {
// @Tags [Data Migration]
// @Accept multipart/form-data
// @Produce json
// @Param RequestBody formData MigrationForm true "Parameters required for migration"
// @Param NCPMigrationParams body NCPMigrationParams true "Parameters required for NCP migration"
// @Param GCPMigrationParams body GCPMigrationParams true "Parameters required for GCP 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
30 changes: 29 additions & 1 deletion websrc/controllers/migrationStructs.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import "mime/multipart"
// MigrationForm represents the form data required for migration processes.
// @Description MigrationForm contains all the necessary fields for migrating data between different services.
type MigrationForm struct {
Path string `form:"path"`
Path string `form:"path" json:"path"`

AWSRegion string `form:"awsRegion" json:"awsRegion"`
AWSAccessKey string `form:"awsAccessKey" json:"awsAccessKey"`
Expand All @@ -44,13 +44,41 @@ type MigrationForm struct {
MongoPassword string `form:"password" json:"password"`
MongoDBName string `form:"databaseName" json:"databaseName"`
}

type LinuxMigrationParams struct {
Path string `form:"path" json:"path"`
}

type AWSMigrationParams struct {
AWSRegion string `form:"awsRegion" json:"awsRegion"`
AWSAccessKey string `form:"awsAccessKey" json:"awsAccessKey"`
AWSSecretKey string `form:"awsSecretKey" json:"awsSecretKey"`
AWSBucket string `form:"awsBucket" json:"awsBucket"`
}

type GCPMigrationParams struct {
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"`
}

type NCPMigrationParams struct {
NCPRegion string `form:"ncpRegion" json:"ncpRegion"`
NCPAccessKey string `form:"ncpAccessKey" json:"ncpAccessKey"`
NCPSecretKey string `form:"ncpSecretKey" json:"ncpSecretKey"`
NCPEndPoint string `form:"ncpEndpoint" json:"ncpEndpoint"`
NCPBucket string `form:"ncpBucket" json:"ncpBucket"`
}

type MongoMigrationParams struct {
MongoHost string `form:"host" json:"host"`
MongoPort string `form:"port" json:"port"`
MongoUsername string `form:"username" json:"username"`
MongoPassword string `form:"password" json:"password"`
MongoDBName string `form:"databaseName" json:"databaseName"`
}

type MigrationMySQLParams struct {
Source MySQLParams
Dest MySQLParams
Expand Down
Loading

0 comments on commit 9550ad6

Please sign in to comment.