diff --git a/internal/auth/base.go b/internal/auth/base.go index 77a809c..0814c17 100644 --- a/internal/auth/base.go +++ b/internal/auth/base.go @@ -261,7 +261,6 @@ func GetNRDMS(params *models.ProviderConfig) (*nrdbc.NRDBController, error) { if err != nil { return nil, err } - NRDBC, err = nrdbc.New(ncpmgdb.New(ncpnrdb, params.DatabaseName)) if err != nil { return nil, err diff --git a/models/basicTask.go b/models/basicTask.go index 4be2655..0c01fb2 100644 --- a/models/basicTask.go +++ b/models/basicTask.go @@ -54,7 +54,7 @@ type Schedule struct { } type GenarateTask struct { - Task + Task `json:"inline"` TargetPoint GenTaskTarget `json:"targetPoint"` } diff --git a/models/genDataParams.go b/models/genDataParams.go index 9a11d1a..1fd9d15 100644 --- a/models/genDataParams.go +++ b/models/genDataParams.go @@ -30,7 +30,7 @@ type GenDataParams struct { type GenFileParams struct { Directory string `json:"Directory,omitempty" swaggerignore:"true"` - DummyPath string `json:"dummyPath,omitempty" swaggerignore:"true"` + DummyPath string `json:"path,omitempty" swaggerignore:"true"` FileFormatParams FileSizeParams } diff --git a/pkg/rdbms/mysql/mysql.go b/pkg/rdbms/mysql/mysql.go index 74a7743..23f39cc 100644 --- a/pkg/rdbms/mysql/mysql.go +++ b/pkg/rdbms/mysql/mysql.go @@ -74,7 +74,7 @@ func (d *MysqlDBMS) Exec(query string) error { if err != nil { log.Error().Err(err).Str("query", query).Msg("Failed to execute SQL query") } - log.Info().Str("query", query).Msg("SQL query executed successfully") + log.Debug().Str("query", query).Msg("SQL query executed successfully") return err } @@ -106,13 +106,16 @@ func (d *MysqlDBMS) DeleteDB(dbName string) error { func (d *MysqlDBMS) ListDB(dst *[]string) error { rows, err := d.db.Query("SHOW DATABASES") if err != nil { + log.Error().Err(err).Msgf("SQL query executed failed %v", rows) return err } + defer rows.Close() for rows.Next() { var dbName string if err := rows.Scan(&dbName); err != nil { + log.Error().Err(err).Msgf("SQL query executed failed %v", rows) return err } @@ -127,6 +130,7 @@ func (d *MysqlDBMS) ListDB(dst *[]string) error { func (d *MysqlDBMS) ListTable(dbName string, dst *[]string) error { _, err := d.db.Exec(fmt.Sprintf("USE %s;", dbName)) if err != nil { + log.Error().Err(err).Msgf("SQL query executed failed") return err } @@ -150,6 +154,7 @@ func (d *MysqlDBMS) ListTable(dbName string, dst *[]string) error { func (d *MysqlDBMS) ShowCreateDBSql(dbName string, dbCreateSql *string) error { err := d.db.QueryRow(fmt.Sprintf("SHOW CREATE DATABASE %s;", dbName)).Scan(&dbName, dbCreateSql) if err != nil { + log.Error().Err(err).Msgf("SQL query executed failed") return err } @@ -173,9 +178,11 @@ func (d *MysqlDBMS) ShowCreateDBSql(dbName string, dbCreateSql *string) error { // Get table create sql func (d *MysqlDBMS) ShowCreateTableSql(dbName, tableName string, tableCreateSql *string) error { if err := d.Exec(fmt.Sprintf("USE %s;", dbName)); err != nil { + log.Error().Err(err).Msgf("SQL query executed failed") return err } if err := d.db.QueryRow(fmt.Sprintf("SHOW CREATE TABLE %s;", tableName)).Scan(&tableName, tableCreateSql); err != nil { + log.Error().Err(err).Msgf("SQL query executed failed") return err } *tableCreateSql = removeSequenceOption(*tableCreateSql) @@ -188,6 +195,7 @@ func (d *MysqlDBMS) ShowCreateTableSql(dbName, tableName string, tableCreateSql func (d *MysqlDBMS) GetInsert(dbName, tableName string, insertSql *[]string) error { colRows, err := d.db.Query("SELECT COLUMN_NAME FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ?", dbName, tableName) if err != nil { + log.Error().Err(err).Msgf("SQL query executed failed") return err } defer colRows.Close() @@ -196,6 +204,7 @@ func (d *MysqlDBMS) GetInsert(dbName, tableName string, insertSql *[]string) err for colRows.Next() { var columnName string if err := colRows.Scan(&columnName); err != nil { + log.Error().Err(err).Msgf("SQL query executed failed") return err } columns = append(columns, columnName) @@ -210,6 +219,7 @@ func (d *MysqlDBMS) GetInsert(dbName, tableName string, insertSql *[]string) err selectQuery := "SELECT " + strings.Join(escapedColumns, ", ") + " FROM " + tableName selRows, err := d.db.Query(selectQuery) if err != nil { + log.Error().Err(err).Msgf("SQL query executed failed") return err } defer selRows.Close() @@ -225,7 +235,7 @@ func (d *MysqlDBMS) GetInsert(dbName, tableName string, insertSql *[]string) err err := selRows.Scan(valuePtrs...) if err != nil { - + log.Error().Err(err).Msgf("SQL query executed failed") return err } diff --git a/service/rdbc/rdbc.go b/service/rdbc/rdbc.go index 2da9c9b..b72c55d 100644 --- a/service/rdbc/rdbc.go +++ b/service/rdbc/rdbc.go @@ -79,7 +79,7 @@ func New(rdb RDBMS, opts ...Option) (*RDBController, error) { func (rdb *RDBController) ListDB(dst *[]string) error { err := rdb.client.ListDB(dst) if err != nil { - log.Info().Msgf("RDB", *dst) + log.Error().Err(err).Msgf("RDB %v", *dst) return err } return nil diff --git a/web/js/scripts.js b/web/js/scripts.js index b8e41c7..e0759b3 100644 --- a/web/js/scripts.js +++ b/web/js/scripts.js @@ -32,9 +32,56 @@ window.addEventListener('DOMContentLoaded', event => { if (document.getElementById('backForm')) { backUpFormSubmit(); } + if (document.getElementById('restoreForm')) { + RestoreFormSubmit(); + } }); +function convertCheckboxParams(obj) { + for (const key in obj) { + if (obj.hasOwnProperty(key)) { + if (obj[key] === "on") { + obj[key] = true; + } else if (obj[key] === "off") { + obj[key] = false; + } else if (typeof obj[key] === "object" && !Array.isArray(obj[key])) { + convertCheckboxParams(obj[key]); + } + } + } + return obj; +} + +function formDataToObject(formData) { + const data = {}; + formData.forEach((value, key) => { + const match = key.match(/(\w+)\[(\w+)\]/); + if (match) { + const objName = match[1]; + const paramName = match[2]; + if (!data[objName]) { + data[objName] = {}; + } + data[objName][paramName] = value; + } else { + data[key] = value; + } + }); + return data; + } + + function getInputValue(id) { + const element = document.getElementById(id); + if (!element) { + // console.warn(`Element with id '${id}' not found.`); + return null; + } + + const value = element.value.trim(); + return value !== "" ? value : null; + } + function generateFormSubmit() { const form = document.getElementById('genForm'); @@ -45,41 +92,52 @@ function generateFormSubmit() { resultCollpase(); const payload = new FormData(form); - let jsonData = JSON.stringify(Object.fromEntries(payload)); - console.log(jsonData); + let jsonData = Object.fromEntries(payload); + jsonData=convertCheckboxParams(jsonData) + jsonData.targetPoint = { + ...jsonData + }; + console.log(jsonData) + jsonData.targetPoint.provider = document.getElementById('provider').value; + const target = document.getElementById('genTarget').value; - const target= document.getElementById('genTarget').value; + if ( (jsonData.targetPoint.provider =="ncp") && (jsonData.targetPoint.endpoint =="") ) { + jsonData.targetPoint.endpoint ="https://kr.object.ncloudstorage.com" + } const url = "/generate/" + target; - console.log(url); - let req; - if (target == "gcp" || target == "firestore") { - req = { method: 'POST', body: payload }; - } else { - req = { method: 'POST', body: jsonData }; - } + + req = { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(jsonData) + }; fetch(url, req) .then(response => { + if (!response.ok) { + throw new Error('Network response was not ok'); + } return response.json(); }) .then(json => { const resultText = document.getElementById('resultText'); resultText.value = json.Result; console.log(json); - console.log("generate done."); + console.log("Generate done."); }) .catch(reason => { - console.log(reason); - alert(reason); + console.error("Error during generate:", reason); + alert(reason.message || reason); }) .finally(() => { loadingButtonOff(); }); - console.log("generate progressing..."); - + console.log("Generate progressing..."); }); } @@ -92,19 +150,39 @@ function migrationFormSubmit() { resultCollpase(); const payload = new FormData(form); + let jsonData= formDataToObject(payload) + console.log(jsonData) const dest = document.getElementById('migDest').value; const source = document.getElementById('migSource').value; + jsonData.targetPoint.provider = getInputValue('targetPoint[provider]'); + jsonData.sourcePoint.provider = getInputValue('sourcePoint[provider]'); + + let url = "/migration/" + source; if (source != dest) { url = url + "/" + dest; } + if ( (jsonData.targetPoint.provider =="ncp") && (jsonData.targetPoint.endpoint =="") ) { + jsonData.targetPoint.endpoint ="https://kr.object.ncloudstorage.com" + } + if ( (jsonData.sourcePoint.provider =="ncp") && (jsonData.sourcePoint.endpoint =="") ) { + jsonData.sourcePoint.endpoint ="https://kr.object.ncloudstorage.com" + } + console.log(url); - fetch(url, { + let req; + + req = { method: 'POST', - body: payload - }) + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(jsonData) + }; + + fetch(url, req) .then(response => { return response.json(); }) @@ -135,16 +213,32 @@ function backUpFormSubmit() { resultCollpase(); const payload = new FormData(form); - const dest = document.getElementById('backDest').value; - const source = document.getElementById('backSource').value; - let url = "/backup/" + source; + var service = document.getElementById('srcService').value; + let url = "/backup/" + service; console.log(url); - fetch(url, { + + let jsonData= formDataToObject(payload) + console.log(jsonData) + + + if ( (jsonData.targetPoint.provider =="ncp") && (jsonData.targetPoint.endpoint =="") ) { + jsonData.targetPoint.endpoint ="https://kr.object.ncloudstorage.com" + } + if ( (jsonData.sourcePoint.provider =="ncp") && (jsonData.sourcePoint.endpoint =="") ) { + jsonData.sourcePoint.endpoint ="https://kr.object.ncloudstorage.com" + } + + let req= { method: 'POST', - body: payload - }) + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(jsonData) + }; + + fetch(url, req ) .then(response => { return response.json(); }) @@ -166,6 +260,63 @@ function backUpFormSubmit() { }); } +function RestoreFormSubmit() { + const form = document.getElementById('restoreForm'); + + form.addEventListener('submit', (e) => { + e.preventDefault(); + loadingButtonOn(); + resultCollpase(); + + const payload = new FormData(form); + + var service = document.getElementById('srcService').value; + let url = "/restore/" + service; + console.log(url); + + + let jsonData= formDataToObject(payload) + console.log(jsonData) + + + if ( (jsonData.targetPoint.provider =="ncp") && (jsonData.targetPoint.endpoint =="") ) { + jsonData.targetPoint.endpoint ="https://kr.object.ncloudstorage.com" + } + if ( (jsonData.sourcePoint.provider =="ncp") && (jsonData.sourcePoint.endpoint =="") ) { + jsonData.sourcePoint.endpoint ="https://kr.object.ncloudstorage.com" + } + + let req= { + method: 'POST', + headers: { + 'Content-Type': 'application/json' + }, + body: JSON.stringify(jsonData) + }; + + fetch(url, req ) + .then(response => { + return response.json(); + }) + .then(json => { + const resultText = document.getElementById('resultText'); + resultText.value = json.Result; + console.log(json); + console.log("restore done."); + }) + .catch(reason => { + console.log(reason); + alert(reason); + }) + .finally(() => { + loadingButtonOff(); + }); + + console.log("restore progressing..."); + }); +} + + function loadingButtonOn() { let btn = document.getElementById('submitBtn'); btn.disabled = true; diff --git a/web/templates/back-backup.html b/web/templates/back-backup.html index 000a8e4..a07a7a4 100644 --- a/web/templates/back-backup.html +++ b/web/templates/back-backup.html @@ -10,48 +10,291 @@

백업

Back Up
-
+
+ +
+ + +
+
+ +
+ + +
+ +
+ + +
+
+
+ + + + +
- - + + + +
-
- -
- - + -
- -
- - + -
- -
- - + - + + + + + + + + + +
-
\ No newline at end of file +
+ + \ No newline at end of file diff --git a/web/templates/content.html b/web/templates/content.html index 91647a6..7811656 100644 --- a/web/templates/content.html +++ b/web/templates/content.html @@ -5,6 +5,11 @@ {{ template "main.html" }} {{ end }} + + {{ if eq .Content "dashboard" }} + {{ template "dash-board.html" . }} + {{ end }} + {{ if eq .Content "Generate-Linux" }} @@ -47,6 +52,11 @@ {{ if eq .Content "Backup" }} {{ template "back-backup.html" . }} {{ end }} + + + {{ if eq .Content "Restore" }} + {{ template "res-restore.html" . }} + {{ end }} @@ -158,11 +168,7 @@ {{ template "mig-mongodbToFirestore.html" . }} {{ end }} - - {{ if eq .Content "BackUp" }} - {{ template "back-backup.html" . }} - {{ end }} - + {{ if ne .Content "main" }} {{ template "result.html" . }} {{ end }} diff --git a/web/templates/dash-board.html b/web/templates/dash-board.html new file mode 100644 index 0000000..bdfbdb2 --- /dev/null +++ b/web/templates/dash-board.html @@ -0,0 +1,405 @@ + + + + + 서비스 상태 + + + + + + +
+ +
+
+
+ + +
+
+
+ + +
+ +
+
+
+ AWS +
+
+

활성화된 서비스 개수: 0

+

이번 달 청구 비용: ₩0

+
+
+
+ + +
+
+
+ GCP +
+
+

활성화된 서비스 개수: 0

+

이번 달 청구 비용: ₩0

+
+
+
+ + +
+
+
+ NCP +
+
+

활성화된 서비스 개수: 0

+

이번 달 청구 비용: ₩0

+
+
+
+
+ + +
+ +
+ + + +
+
+
+
+ AWS 데일리 로그 +
+
+ +
    + +
+
+
+
+
+ + +
+
+
+
+ GCP 데일리 로그 +
+
+ +
    + +
+
+
+
+
+ + +
+
+
+
+ NCP 데일리 로그 +
+
+ +
    + +
+
+
+
+
+ + + + +
+ + + + + + + + diff --git a/web/templates/gen-dynamodb.html b/web/templates/gen-dynamodb.html index 9779982..d45fbbb 100644 --- a/web/templates/gen-dynamodb.html +++ b/web/templates/gen-dynamodb.html @@ -29,8 +29,14 @@

데이터 생성 DynamoDB

-
+ +
+ + +
+
+ +
diff --git a/web/templates/gen-firestore.html b/web/templates/gen-firestore.html index f526b9f..257674e 100644 --- a/web/templates/gen-firestore.html +++ b/web/templates/gen-firestore.html @@ -26,8 +26,21 @@

데이터 생성 Firestore

- -
+
+ +
+ + +
+
+
+ +
+ + +
+
+ +
diff --git a/web/templates/gen-gcp.html b/web/templates/gen-gcp.html index 2c5558c..0bdc397 100644 --- a/web/templates/gen-gcp.html +++ b/web/templates/gen-gcp.html @@ -26,7 +26,14 @@

데이터 생성 GCP

-
+
+ +
+ + +
+
+
@@ -51,6 +58,7 @@

데이터 생성 GCP

+
diff --git a/web/templates/gen-linux.html b/web/templates/gen-linux.html index 9717da4..eaf5aca 100644 --- a/web/templates/gen-linux.html +++ b/web/templates/gen-linux.html @@ -21,7 +21,7 @@

데이터 생성 Linux

- +
diff --git a/web/templates/gen-mongodb.html b/web/templates/gen-mongodb.html index 26f4fef..9703000 100644 --- a/web/templates/gen-mongodb.html +++ b/web/templates/gen-mongodb.html @@ -57,6 +57,7 @@

데이터 생성 MongoDB

+ diff --git a/web/templates/gen-ncp.html b/web/templates/gen-ncp.html index 0971530..3c7ff70 100644 --- a/web/templates/gen-ncp.html +++ b/web/templates/gen-ncp.html @@ -26,8 +26,14 @@

데이터 생성 NCP

-
+ +
+ + +
+
+
- +
@@ -63,6 +69,7 @@

데이터 생성 NCP

+ diff --git a/web/templates/gen-s3.html b/web/templates/gen-s3.html index 4ed5115..9d35adc 100644 --- a/web/templates/gen-s3.html +++ b/web/templates/gen-s3.html @@ -26,8 +26,15 @@

데이터 생성 S3

-
+ +
+ + +
+
+ +
@@ -54,7 +61,8 @@

데이터 생성 S3

{{ template "gen-data.html" . }} - + +
diff --git a/web/templates/index.html b/web/templates/index.html index a4bddd4..7ab5d49 100644 --- a/web/templates/index.html +++ b/web/templates/index.html @@ -16,7 +16,7 @@ --> -
데이터 생성
+
Generate
+ +
Restore
+ + + + + diff --git a/web/templates/mig-dynamodbToFirestore.html b/web/templates/mig-dynamodbToFirestore.html index 6b538d5..eff0e78 100644 --- a/web/templates/mig-dynamodbToFirestore.html +++ b/web/templates/mig-dynamodbToFirestore.html @@ -13,12 +13,14 @@

마이그레이션 DynamoDB

+ +
- {{ range $index, $value := .AWSRegions }} @@ -27,8 +29,15 @@

마이그레이션 DynamoDB

-
+ +
+ + +
+
+ +
- {{ range $index, $value := .GCPRegions }} @@ -57,8 +66,15 @@

마이그레이션 DynamoDB

+
+ +
+ + +
+
-
+ diff --git a/web/templates/mig-dynamodbToMongodb.html b/web/templates/mig-dynamodbToMongodb.html index e46b7c9..fd093af 100644 --- a/web/templates/mig-dynamodbToMongodb.html +++ b/web/templates/mig-dynamodbToMongodb.html @@ -13,12 +13,13 @@

마이그레이션 DynamoDB

- + +
- {{ range $index, $value := .Regions }} @@ -27,8 +28,15 @@

마이그레이션 DynamoDB

-
+ +
+ + +
+
+ + +
+ +
+ + +
+
+ +
- +
@@ -57,7 +74,7 @@

마이그레이션 DynamoDB

- +
@@ -65,7 +82,7 @@

마이그레이션 DynamoDB

- +
@@ -73,7 +90,7 @@

마이그레이션 DynamoDB

- +
@@ -81,7 +98,7 @@

마이그레이션 DynamoDB

- +
diff --git a/web/templates/mig-firestoreToDynamodb.html b/web/templates/mig-firestoreToDynamodb.html index da3d886..db18493 100644 --- a/web/templates/mig-firestoreToDynamodb.html +++ b/web/templates/mig-firestoreToDynamodb.html @@ -13,12 +13,14 @@

마이그레이션 Firestore

+ +
- {{ range $index, $value := .GCPRegions }} @@ -27,8 +29,14 @@

마이그레이션 Firestore

- -
+
+ +
+ + +
+
+
- {{ range $index, $value := .AWSRegions }} @@ -54,8 +62,14 @@

마이그레이션 Firestore

-
+ +
+ + +
+
+ diff --git a/web/templates/mig-firestoreToMongodb.html b/web/templates/mig-firestoreToMongodb.html index 8a3ff76..9193804 100644 --- a/web/templates/mig-firestoreToMongodb.html +++ b/web/templates/mig-firestoreToMongodb.html @@ -13,12 +13,13 @@

마이그레이션 Firestore

- + +
- {{ range $index, $value := .Regions }} @@ -27,8 +28,14 @@

마이그레이션 Firestore

- -
+
+ +
+ + +
+
+
- +
@@ -54,7 +61,7 @@

마이그레이션 Firestore

- +
@@ -62,7 +69,7 @@

마이그레이션 Firestore

- +
@@ -70,7 +77,7 @@

마이그레이션 Firestore

- +
@@ -78,7 +85,7 @@

마이그레이션 Firestore

- +
diff --git a/web/templates/mig-gcpToLinux.html b/web/templates/mig-gcpToLinux.html index fe0b8d7..98aa22b 100644 --- a/web/templates/mig-gcpToLinux.html +++ b/web/templates/mig-gcpToLinux.html @@ -13,12 +13,14 @@

마이그레이션 Google Cloud Storage

+ +
- {{ range $index, $value := .Regions }} @@ -27,8 +29,17 @@

마이그레이션 Google Cloud Storage

+ +
+ +
+ + +
+
+ -
+
- +
@@ -55,7 +66,7 @@

마이그레이션 Google Cloud Storage

- +
diff --git a/web/templates/mig-gcpToNcp.html b/web/templates/mig-gcpToNcp.html index 6bb7769..1470ca6 100644 --- a/web/templates/mig-gcpToNcp.html +++ b/web/templates/mig-gcpToNcp.html @@ -13,12 +13,13 @@

마이그레이션 Google Cloud Storage

- + +
- {{ range $index, $value := .GCPRegions }} @@ -27,7 +28,17 @@

마이그레이션 Google Cloud Storage

+
+ +
+ + +
+
+ + +
- +
@@ -53,7 +64,7 @@

마이그레이션 Google Cloud Storage

- {{ range $index, $value := .NCPRegions }} @@ -62,8 +73,17 @@

마이그레이션 Google Cloud Storage

-
+ +
+ + +
+
+ + + +
- +
@@ -90,7 +110,7 @@

마이그레이션 Google Cloud Storage

- +
diff --git a/web/templates/mig-gcpToS3.html b/web/templates/mig-gcpToS3.html index d429da4..f01a640 100644 --- a/web/templates/mig-gcpToS3.html +++ b/web/templates/mig-gcpToS3.html @@ -12,13 +12,15 @@

마이그레이션 Google Cloud Storage

- + + +
- {{ range $index, $value := .GCPRegions }} @@ -27,8 +29,17 @@

마이그레이션 Google Cloud Storage

+
+ +
+ + +
+
+ -
+ +
- +
@@ -53,7 +64,7 @@

마이그레이션 Google Cloud Storage

- {{ range $index, $value := .AWSRegions }} @@ -62,8 +73,15 @@

마이그레이션 Google Cloud Storage

-
+ +
+ + +
+
+ +
- +
diff --git a/web/templates/mig-linuxToGcp.html b/web/templates/mig-linuxToGcp.html index 2a888ad..930015b 100644 --- a/web/templates/mig-linuxToGcp.html +++ b/web/templates/mig-linuxToGcp.html @@ -13,6 +13,7 @@

마이그레이션 Linux

+
@@ -20,7 +21,7 @@

마이그레이션 Linux

- +
@@ -30,7 +31,7 @@

마이그레이션 Linux

- {{ range $index, $value := .Regions }} @@ -39,24 +40,34 @@

마이그레이션 Linux

+ +
+ +
+ + +
+
+ -
+ -
+ +
- +
diff --git a/web/templates/mig-linuxToNcp.html b/web/templates/mig-linuxToNcp.html index 5fd4170..bcad335 100644 --- a/web/templates/mig-linuxToNcp.html +++ b/web/templates/mig-linuxToNcp.html @@ -13,6 +13,7 @@

마이그레이션 Linux

+
@@ -20,7 +21,7 @@

마이그레이션 Linux

- +
@@ -30,7 +31,7 @@

마이그레이션 Linux

- {{ range $index, $value := .Regions }} @@ -39,7 +40,14 @@

마이그레이션 Linux

- +
+ +
+ + +
+
+
- +
@@ -67,7 +75,7 @@

마이그레이션 Linux

- +
diff --git a/web/templates/mig-linuxToS3.html b/web/templates/mig-linuxToS3.html index 1845bbf..2d74922 100644 --- a/web/templates/mig-linuxToS3.html +++ b/web/templates/mig-linuxToS3.html @@ -12,15 +12,15 @@

마이그레이션 Linux

- - + +
- +
@@ -30,7 +30,7 @@

마이그레이션 Linux

- {{ range $index, $value := .Regions }} @@ -41,6 +41,14 @@

마이그레이션 Linux

+ +
+ + +
+
+ +
- +
diff --git a/web/templates/mig-mongodbToDynamodb.html b/web/templates/mig-mongodbToDynamodb.html index 2b83775..03e5674 100644 --- a/web/templates/mig-mongodbToDynamodb.html +++ b/web/templates/mig-mongodbToDynamodb.html @@ -13,13 +13,15 @@

마이그레이션 MongoDB

+ +
- +
@@ -27,7 +29,7 @@

마이그레이션 MongoDB

- +
@@ -35,7 +37,7 @@

마이그레이션 MongoDB

- +
@@ -43,7 +45,7 @@

마이그레이션 MongoDB

- +
@@ -51,7 +53,7 @@

마이그레이션 MongoDB

- +
@@ -60,7 +62,7 @@

마이그레이션 MongoDB

- {{ range $index, $value := .Regions }} @@ -69,8 +71,14 @@

마이그레이션 MongoDB

-
+ +
+ + +
+
+ diff --git a/web/templates/mig-mongodbToFirestore.html b/web/templates/mig-mongodbToFirestore.html index 0d57c47..0effe13 100644 --- a/web/templates/mig-mongodbToFirestore.html +++ b/web/templates/mig-mongodbToFirestore.html @@ -13,13 +13,14 @@

마이그레이션 MongoDB

- + +
- +
@@ -27,7 +28,7 @@

마이그레이션 MongoDB

- +
@@ -35,7 +36,7 @@

마이그레이션 MongoDB

- +
@@ -43,7 +44,7 @@

마이그레이션 MongoDB

- +
@@ -51,16 +52,15 @@

마이그레이션 MongoDB

- +
-
- {{ range $index, $value := .Regions }} @@ -69,8 +69,14 @@

마이그레이션 MongoDB

- -
+
+ +
+ + +
+
+ diff --git a/web/templates/mig-mysql.html b/web/templates/mig-mysql.html index 723125a..fb96d48 100644 --- a/web/templates/mig-mysql.html +++ b/web/templates/mig-mysql.html @@ -30,7 +30,7 @@

마이그레이션 MySQL

- +
@@ -38,7 +38,7 @@

마이그레이션 MySQL

- +
@@ -46,7 +46,7 @@

마이그레이션 MySQL

- +
@@ -54,7 +54,7 @@

마이그레이션 MySQL

- +
@@ -74,7 +74,7 @@

마이그레이션 MySQL

- +
@@ -82,7 +82,7 @@

마이그레이션 MySQL

- +
@@ -90,7 +90,7 @@

마이그레이션 MySQL

- +
@@ -98,7 +98,7 @@

마이그레이션 MySQL

- +
diff --git a/web/templates/mig-ncpToGcp.html b/web/templates/mig-ncpToGcp.html index b8a4a2b..f43278b 100644 --- a/web/templates/mig-ncpToGcp.html +++ b/web/templates/mig-ncpToGcp.html @@ -13,12 +13,14 @@

마이그레이션 Naver Object Storage

+ +
- {{ range $index, $value := .NCPRegions }} @@ -27,7 +29,14 @@

마이그레이션 Naver Object Storage

- +
+ +
+ + +
+
+
- +
@@ -55,7 +64,7 @@

마이그레이션 Naver Object Storage

- +
@@ -64,7 +73,7 @@

마이그레이션 Naver Object Storage

- {{ range $index, $value := .GCPRegions }} @@ -73,8 +82,15 @@

마이그레이션 Naver Object Storage

+
+ +
+ + +
+
-
+
- +
diff --git a/web/templates/mig-ncpToLinux.html b/web/templates/mig-ncpToLinux.html index d1c8e54..299d617 100644 --- a/web/templates/mig-ncpToLinux.html +++ b/web/templates/mig-ncpToLinux.html @@ -13,12 +13,13 @@

마이그레이션 Naver Object Storage

+
- {{ range $index, $value := .Regions }} @@ -27,8 +28,16 @@

마이그레이션 Naver Object Storage

-
+ +
+ + +
+
+ + +
- +
@@ -55,7 +64,7 @@

마이그레이션 Naver Object Storage

- +
@@ -66,7 +75,7 @@

마이그레이션 Naver Object Storage

- +
diff --git a/web/templates/mig-ncpToS3.html b/web/templates/mig-ncpToS3.html index dac6096..c361e46 100644 --- a/web/templates/mig-ncpToS3.html +++ b/web/templates/mig-ncpToS3.html @@ -12,13 +12,15 @@

마이그레이션 Naver Object Storage

- + + +
- {{ range $index, $value := .NCPRegions }} @@ -27,8 +29,16 @@

마이그레이션 Naver Object Storage

-
+ +
+ + +
+
+ + +
- +
@@ -55,7 +65,7 @@

마이그레이션 Naver Object Storage

- +
@@ -64,7 +74,7 @@

마이그레이션 Naver Object Storage

- {{ range $index, $value := .AWSRegions }} @@ -73,8 +83,15 @@

마이그레이션 Naver Object Storage

-
+ +
+ + +
+
+ +
- +
diff --git a/web/templates/mig-s3ToGcp.html b/web/templates/mig-s3ToGcp.html index 607cbf2..cba316f 100644 --- a/web/templates/mig-s3ToGcp.html +++ b/web/templates/mig-s3ToGcp.html @@ -11,14 +11,16 @@

마이그레이션 AWS S3

- + + +
- {{ range $index, $value := .AWSRegions }} @@ -29,6 +31,15 @@

마이그레이션 AWS S3

+ +
+ + +
+
+ + +
- +
@@ -56,7 +67,7 @@

마이그레이션 AWS S3

- {{ range $index, $value := .GCPRegions }} @@ -65,8 +76,16 @@

마이그레이션 AWS S3

+
+ +
+ + +
+
+ -
+
- +
diff --git a/web/templates/mig-s3ToLinux.html b/web/templates/mig-s3ToLinux.html index a5e14f2..6ba8fd9 100644 --- a/web/templates/mig-s3ToLinux.html +++ b/web/templates/mig-s3ToLinux.html @@ -11,14 +11,15 @@

마이그레이션 AWS S3

- + +
- {{ range $index, $value := .Regions }} @@ -27,8 +28,17 @@

마이그레이션 AWS S3

- +
+ +
+ + +
+
+ + +
- +
@@ -58,7 +68,7 @@

마이그레이션 AWS S3

- +
diff --git a/web/templates/mig-s3ToNcp.html b/web/templates/mig-s3ToNcp.html index a61d8d7..b43e074 100644 --- a/web/templates/mig-s3ToNcp.html +++ b/web/templates/mig-s3ToNcp.html @@ -11,14 +11,16 @@

마이그레이션 AWS S3

- + - + + +
- {{ range $index, $value := .AWSRegions }} @@ -27,27 +29,19 @@

마이그레이션 AWS S3

-
- +
- - + +
-
- -
- - -
-
- +
@@ -67,6 +61,13 @@

마이그레이션 AWS S3

+ +
+ + +
+
+
- +
@@ -93,7 +94,7 @@

마이그레이션 AWS S3

- +
diff --git a/web/templates/res-restore.html b/web/templates/res-restore.html new file mode 100644 index 0000000..3b6afda --- /dev/null +++ b/web/templates/res-restore.html @@ -0,0 +1,300 @@ +

복구

+ + +
+
+ + Restore +
+
+ + + + + +
+ +
+ + +
+
+ +
+ + +
+ +
+ + +
+
+
+ + + + + + +
+ + + + +
+ + + + + + + + + + + + + + + + + + +
+
+ + \ No newline at end of file diff --git a/web/templates/task.html b/web/templates/task.html new file mode 100644 index 0000000..1b52eb6 --- /dev/null +++ b/web/templates/task.html @@ -0,0 +1,84 @@ +

백업

+ + +
+
+ + Back Up +
+
+ +
+ + + + + +
+ + +
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ +
+ +
+ + +
+
+ + +
+
+
+ +
+
+ + +
+ +

+ + +
+
+ +
\ No newline at end of file diff --git a/websrc/controllers/backupHandlers.go b/websrc/controllers/backupHandlers.go index 9e48e3a..bc51955 100644 --- a/websrc/controllers/backupHandlers.go +++ b/websrc/controllers/backupHandlers.go @@ -33,7 +33,7 @@ import ( // // @Summary Export data from objectstorage // @Description Export data from a objectstorage to files. -// @Tags [Data Export], [Object Storage] +// @Tags [Data Backup], [Object Storage] // @Accept json // @Produce json // @Param RequestBody body models.BackupTask true "Parameters required for backup" @@ -72,7 +72,7 @@ func BackupOSPostHandler(ctx echo.Context) error { // // @Summary Export data from MySQL // @Description Export data from a MySQL database to SQL files. -// @Tags [Data Export], [RDBMS] +// @Tags [Data Backup], [RDBMS] // @Accept json // @Produce json // @Param RequestBody body models.BackupTask true "Parameters required for backup" @@ -160,7 +160,7 @@ func BackupRDBPostHandler(ctx echo.Context) error { // // @Summary Export data from MySQL // @Description Export data from a MySQL database to SQL files. -// @Tags [Data Export], [RDBMS] +// @Tags [Data Backup], [RDBMS] // @Accept json // @Produce json // @Param RequestBody body models.BackupTask true "Parameters required for backup" @@ -177,33 +177,37 @@ func BackupNRDBPostHandler(ctx echo.Context) error { params := models.BackupTask{} if !getDataWithReBind(logger, start, ctx, ¶ms) { + errorMsg := fmt.Sprintf("err getDataWithReBind: %v", params) return ctx.JSON(http.StatusOK, models.BasicResponse{ Result: logstrings.String(), - Error: nil, + Error: &errorMsg, }) } - + logger.Debug().Msgf("%+v", params) NRDBC, err = auth.GetNRDMS(¶ms.SourcePoint) if err != nil { + errorMsg := fmt.Sprintf("err provider: %v", err) return ctx.JSON(http.StatusInternalServerError, models.BasicResponse{ Result: logstrings.String(), - Error: nil, + Error: &errorMsg, }) } err = os.MkdirAll(params.TargetPoint.Path, 0755) if err != nil { + errorMsg := fmt.Sprintf("err Mkdir: %v", err) return ctx.JSON(http.StatusInternalServerError, models.BasicResponse{ Result: logstrings.String(), - Error: nil, + Error: &errorMsg, }) } tableList, err := NRDBC.ListTables() if err != nil { + errorMsg := fmt.Sprintf("err Get ListTables: %v", err) return ctx.JSON(http.StatusInternalServerError, models.BasicResponse{ Result: logstrings.String(), - Error: nil, + Error: &errorMsg, }) } diff --git a/websrc/controllers/gendata.go b/websrc/controllers/gendata.go index 90524c4..6b90580 100644 --- a/websrc/controllers/gendata.go +++ b/websrc/controllers/gendata.go @@ -16,8 +16,10 @@ limitations under the License. package controllers import ( + "reflect" "strconv" + "github.com/cloud-barista/mc-data-manager/models" "github.com/cloud-barista/mc-data-manager/pkg/dummy/semistructured" "github.com/cloud-barista/mc-data-manager/pkg/dummy/structured" "github.com/cloud-barista/mc-data-manager/pkg/dummy/unstructured" @@ -26,9 +28,13 @@ import ( ) func genData(params GenFileParams, logger *zerolog.Logger) error { - logger.Info().Msg("Let's generate") - if params.CheckSQL { + // if !hasAnyTrue(params.FileFormatParams) { + // err := errors.New("no file format selected") + // logger.Error().Err(err).Msg("At least one file format must be selected") + // return err + // } + if cast.ToBool(params.CheckSQL) { logger.Info().Msg("Start creating SQL dummy") sql, _ := strconv.Atoi(params.SizeSQL) if err := structured.GenerateRandomSQL(params.DummyPath, sql); err != nil { @@ -48,7 +54,7 @@ func genData(params GenFileParams, logger *zerolog.Logger) error { logger.Info().Msg("Successfully generated CSV dummy") } - if params.CheckTXT { + if cast.ToBool(params.CheckTXT) { logger.Info().Msg("Start creating TXT dummy") txt, _ := strconv.Atoi(params.SizeTXT) if err := unstructured.GenerateRandomTXT(params.DummyPath, txt); err != nil { @@ -58,7 +64,7 @@ func genData(params GenFileParams, logger *zerolog.Logger) error { logger.Info().Msg("Successfully generated TXT dummy") } - if params.CheckPNG { + if cast.ToBool(params.CheckPNG) { logger.Info().Msg("Start creating PNG dummy") png, _ := strconv.Atoi(params.SizePNG) if err := unstructured.GenerateRandomPNGImage(params.DummyPath, png); err != nil { @@ -68,7 +74,7 @@ func genData(params GenFileParams, logger *zerolog.Logger) error { logger.Info().Msg("Successfully generated PNG dummy") } - if params.CheckGIF { + if cast.ToBool(params.CheckGIF) { logger.Info().Msg("Start creating GIF dummy") gif, _ := strconv.Atoi(params.SizeGIF) if err := unstructured.GenerateRandomGIF(params.DummyPath, gif); err != nil { @@ -78,7 +84,7 @@ func genData(params GenFileParams, logger *zerolog.Logger) error { logger.Info().Msg("Successfully generated GIF dummy") } - if params.CheckZIP { + if cast.ToBool(params.CheckZIP) { logger.Info().Msg("Start creating a pile of ZIP files that compress TXT") zip, _ := strconv.Atoi(params.SizeZIP) if err := unstructured.GenerateRandomZIP(params.DummyPath, zip); err != nil { @@ -88,7 +94,7 @@ func genData(params GenFileParams, logger *zerolog.Logger) error { logger.Info().Msg("Successfully created ZIP file dummy compressed TXT") } - if params.CheckJSON { + if cast.ToBool(params.CheckJSON) { logger.Info().Msg("Start creating JSON dummy") json, _ := strconv.Atoi(params.SizeJSON) if err := semistructured.GenerateRandomJSON(params.DummyPath, json); err != nil { @@ -98,7 +104,7 @@ func genData(params GenFileParams, logger *zerolog.Logger) error { logger.Info().Msg("Successfully generated JSON dummy") } - if params.CheckXML { + if cast.ToBool(params.CheckXML) { logger.Info().Msg("Start creating XML dummy") xml, _ := strconv.Atoi(params.SizeXML) if err := semistructured.GenerateRandomXML(params.DummyPath, xml); err != nil { @@ -108,7 +114,7 @@ func genData(params GenFileParams, logger *zerolog.Logger) error { logger.Info().Msg("Successfully generated XML dummy") } - if params.CheckServerJSON { + if cast.ToBool(params.CheckServerJSON) { logger.Info().Msg("Start creating JSON dummy") json, _ := strconv.Atoi(params.SizeServerJSON) if err := semistructured.GenerateRandomJSONWithServer(params.DummyPath, json); err != nil { @@ -118,7 +124,7 @@ func genData(params GenFileParams, logger *zerolog.Logger) error { logger.Info().Msg("Successfully generated JSON dummy") } - if params.CheckServerSQL { + if cast.ToBool(params.CheckServerSQL) { logger.Info().Msg("Start creating SQL dummy") sql, _ := strconv.Atoi(params.SizeServerSQL) if err := structured.GenerateRandomSQLWithServer(params.DummyPath, sql); err != nil { @@ -130,3 +136,13 @@ func genData(params GenFileParams, logger *zerolog.Logger) error { return nil } +func hasAnyTrue(fileFormatParams models.FileFormatParams) bool { + v := reflect.ValueOf(fileFormatParams) + for i := 0; i < v.NumField(); i++ { + field := v.Field(i) + if field.Kind() == reflect.Bool && field.Bool() { + return true + } + } + return false +} diff --git a/websrc/controllers/generateHandlers.go b/websrc/controllers/generateHandlers.go index ad7fa64..11ff778 100644 --- a/websrc/controllers/generateHandlers.go +++ b/websrc/controllers/generateHandlers.go @@ -27,6 +27,7 @@ import ( // GenerateLinuxPostHandler godoc // +// @ID GenerateLinuxPostHandler // @Summary Generate test data on on-premise Linux // @Description Generate test data on on-premise Linux. // @Tags [Test Data Generation] @@ -51,7 +52,7 @@ func GenerateLinuxPostHandler(ctx echo.Context) error { } params := GenarateTask{} - if !getDataWithBind(logger, start, ctx, ¶ms) { + if !getDataWithReBind(logger, start, ctx, ¶ms) { return ctx.JSON(http.StatusInternalServerError, models.BasicResponse{ Result: logstrings.String(), Error: nil, @@ -64,7 +65,6 @@ func GenerateLinuxPostHandler(ctx echo.Context) error { Error: nil, }) } - jobEnd(logger, "Successfully creating a dummy with Linux", start) return ctx.JSON(http.StatusOK, models.BasicResponse{ Result: logstrings.String(), @@ -74,6 +74,7 @@ func GenerateLinuxPostHandler(ctx echo.Context) error { // GenerateWindowsPostHandler godoc // +// @ID GenerateWindowsPostHandler // @Summary Generate test data on on-premise Windows // @Description Generate test data on on-premise Windows. // @Tags [Test Data Generation] @@ -99,7 +100,7 @@ func GenerateWindowsPostHandler(ctx echo.Context) error { } params := GenarateTask{} - if !getDataWithBind(logger, start, ctx, ¶ms) { + if !getDataWithReBind(logger, start, ctx, ¶ms) { return ctx.JSON(http.StatusInternalServerError, models.BasicResponse{ Result: logstrings.String(), Error: nil, @@ -128,6 +129,7 @@ type GenerateS3PostHandlerResponseBody struct { // GenerateS3PostHandler godoc // +// @ID GenerateS3PostHandler // @Summary Generate test data on AWS S3 // @Description Generate test data on AWS S3. // @Tags [Test Data Generation], [Object Storage] @@ -144,7 +146,7 @@ func GenerateS3PostHandler(ctx echo.Context) error { logger, logstrings := pageLogInit("genS3", "Create dummy data and import to s3", start) params := GenarateTask{} - if !getDataWithBind(logger, start, ctx, ¶ms) { + if !getDataWithReBind(logger, start, ctx, ¶ms) { return ctx.JSON(http.StatusInternalServerError, models.BasicResponse{ Result: logstrings.String(), Error: nil, @@ -169,6 +171,7 @@ func GenerateS3PostHandler(ctx echo.Context) error { }) } + logger.Info().Msgf("ProviderConfig %+v", params.TargetPoint.ProviderConfig) awsOSC := getS3OSC(logger, start, "gen", params.TargetPoint.ProviderConfig) if awsOSC == nil { return ctx.JSON(http.StatusInternalServerError, models.BasicResponse{ @@ -195,6 +198,7 @@ func GenerateS3PostHandler(ctx echo.Context) error { // GenerateGCPPostHandler godoc // +// @ID GenerateGCPPostHandler // @Summary Generate test data on GCP Cloud Storage // @Description Generate test data on GCP Cloud Storage. // @Tags [Test Data Generation], [Object Storage] @@ -261,6 +265,7 @@ func GenerateGCPPostHandler(ctx echo.Context) error { // GenerateNCPPostHandler godoc // +// @ID GenerateNCPPostHandler // @Summary Generate test data on NCP Object Storage // @Description Generate test data on NCP Object Storage. // @Tags [Test Data Generation], [Object Storage] @@ -327,6 +332,7 @@ func GenerateNCPPostHandler(ctx echo.Context) error { // GenerateMySQLPostHandler godoc // +// @ID GenerateMySQLPostHandler // @Summary Generate test data on MySQL // @Description Generate test data on MySQL. // @Tags [Test Data Generation], [RDBMS] @@ -426,6 +432,7 @@ func GenerateMySQLPostHandler(ctx echo.Context) error { // GenerateDynamoDBPostHandler godoc // +// @ID GenerateDynamoDBPostHandler // @Summary Generate test data on AWS DynamoDB // @Description Generate test data on AWS DynamoDB. // @Tags [Test Data Generation], [NRDBMS] @@ -500,6 +507,7 @@ func GenerateDynamoDBPostHandler(ctx echo.Context) error { // GenerateFirestorePostHandler godoc // +// @ID GenerateFirestorePostHandler // @Summary Generate test data on GCP Firestore // @Description Generate test data on GCP Firestore. // @Tags [Test Data Generation], [NRDBMS] @@ -575,6 +583,7 @@ func GenerateFirestorePostHandler(ctx echo.Context) error { // GenerateMongoDBPostHandler godoc // +// @ID GenerateMongoDBPostHandler // @Summary Generate test data on NCP MongoDB // @Description Generate test data on NCP MongoDB. // @Tags [Test Data Generation], [NRDBMS] diff --git a/websrc/controllers/migrationGCPHandlers.go b/websrc/controllers/migrationGCPHandlers.go index 95e0c08..4efa2af 100644 --- a/websrc/controllers/migrationGCPHandlers.go +++ b/websrc/controllers/migrationGCPHandlers.go @@ -25,6 +25,7 @@ import ( // MigrationGCPToLinuxPostHandler godoc // +// @ID MigrationGCPToLinuxPostHandler // @Summary Migrate data from GCP to Linux // @Description Migrate data stored in GCP Cloud Storage to a Linux-based system. // @Tags [Data Migration] @@ -80,6 +81,7 @@ func MigrationGCPToLinuxPostHandler(ctx echo.Context) error { // MigrationGCPToWindowsPostHandler godoc // +// @ID MigrationGCPToWindowsPostHandler // @Summary Migrate data from GCP to Windows // @Description Migrate data stored in GCP Cloud Storage to a Windows-based system. // @Tags [Data Migration] @@ -135,6 +137,7 @@ func MigrationGCPToWindowsPostHandler(ctx echo.Context) error { // MigrationGCPToS3PostHandler godoc // +// @ID MigrationGCPToS3PostHandler // @Summary Migrate data from GCP to AWS S3 // @Description Migrate data stored in GCP Cloud Storage to AWS S3. // @Tags [Data Migration], [Object Storage] @@ -195,6 +198,7 @@ func MigrationGCPToS3PostHandler(ctx echo.Context) error { // MigrationGCPToNCPPostHandler godoc // +// @ID MigrationGCPToNCPPostHandler // @Summary Migrate data from GCP to NCP Object Storage // @Description Migrate data stored in GCP Cloud Storage to NCP Object Storage. // @Tags [Data Migration], [Object Storage] diff --git a/websrc/controllers/migrationHandlers.go b/websrc/controllers/migrationHandlers.go index f509e8f..702c62e 100644 --- a/websrc/controllers/migrationHandlers.go +++ b/websrc/controllers/migrationHandlers.go @@ -25,6 +25,7 @@ import ( // MigrationLinuxToS3PostHandler godoc // +// @ID MigrationLinuxToS3PostHandler // @Summary Migrate data from Linux to AWS S3 // @Description Migrate data stored in a Linux-based system to AWS S3. // @Tags [Data Migration] @@ -48,13 +49,13 @@ func MigrationLinuxToS3PostHandler(ctx echo.Context) error { } params := MigrateTask{} - if !getDataWithBind(logger, start, ctx, ¶ms) { + if !getDataWithReBind(logger, start, ctx, ¶ms) { return ctx.JSON(http.StatusInternalServerError, models.BasicResponse{ Result: logstrings.String(), Error: nil, }) } - + logger.Debug().Msgf("%v", params) awsOSC := getS3OSC(logger, start, "mig", params.TargetPoint) if awsOSC == nil { return ctx.JSON(http.StatusInternalServerError, models.BasicResponse{ @@ -80,6 +81,7 @@ func MigrationLinuxToS3PostHandler(ctx echo.Context) error { // MigrationLinuxToGCPPostHandler godoc // +// @ID MigrationLinuxToGCPPostHandler // @Summary Migrate data from Linux to GCP Cloud Storage // @Description Migrate data stored in a Linux-based system to GCP Cloud Storage. // @Tags [Data Migration] @@ -139,6 +141,7 @@ func MigrationLinuxToGCPPostHandler(ctx echo.Context) error { // MigrationLinuxToNCPPostHandler godoc // +// @ID MigrationLinuxToNCPPostHandler // @Summary Migrate data from Linux to NCP Object Storage // @Description Migrate data stored in a Linux-based system to NCP Object Storage. // @Tags [Data Migration] @@ -196,6 +199,7 @@ func MigrationLinuxToNCPPostHandler(ctx echo.Context) error { // MigrationWindowsToS3PostHandler godoc // +// @ID MigrationWindowsToS3PostHandler // @Summary Migrate data from Windows to AWS S3 // @Description Migrate data stored in a Windows-based system to AWS S3. // @Tags [Data Migration] @@ -256,6 +260,7 @@ func MigrationWindowsToS3PostHandler(ctx echo.Context) error { // MigrationWindowsToGCPPostHandler godoc // +// @ID MigrationWindowsToGCPPostHandler // @Summary Migrate data from Windows to GCP Cloud Storage // @Description Migrate data stored in a Windows-based system to GCP Cloud Storage. // @Tags [Data Migration] @@ -311,6 +316,7 @@ func MigrationWindowsToGCPPostHandler(ctx echo.Context) error { // MigrationWindowsToNCPPostHandler godoc // +// @ID MigrationWindowsToNCPPostHandler // @Summary Migrate data from Windows to NCP Object Storage // @Description Migrate data stored in a Windows-based system to NCP Object Storage. // @Tags [Data Migration] @@ -367,6 +373,7 @@ func MigrationWindowsToNCPPostHandler(ctx echo.Context) error { // MigrationMySQLPostHandler godoc // +// @ID MigrationMySQLPostHandler // @Summary Migrate data from MySQL to MySQL // @Description Migrate data from one MySQL database to another MySQL database. // @Tags [Data Migration], [RDBMS] diff --git a/websrc/controllers/migrationNCPHandlers.go b/websrc/controllers/migrationNCPHandlers.go index 73a3625..f7952cc 100644 --- a/websrc/controllers/migrationNCPHandlers.go +++ b/websrc/controllers/migrationNCPHandlers.go @@ -25,6 +25,7 @@ import ( // MigrationNCPToLinuxPostHandler godoc // +// @ID MigrationNCPToLinuxPostHandler // @Summary Migrate data from NCP to Linux // @Description Migrate data stored in NCP Object Storage to a Linux-based system. // @Tags [Data Migration] @@ -80,6 +81,7 @@ func MigrationNCPToLinuxPostHandler(ctx echo.Context) error { // MigrationNCPToWindowsPostHandler godoc // +// @ID MigrationNCPToWindowsPostHandler // @Summary Migrate data from NCP to Windows // @Description Migrate data stored in NCP Object Storage to a Windows-based system. // @Tags [Data Migration] @@ -136,6 +138,7 @@ func MigrationNCPToWindowsPostHandler(ctx echo.Context) error { // MigrationNCPToS3PostHandler godoc // +// @ID MigrationNCPToS3PostHandler // @Summary Migrate data from NCP to AWS S3 // @Description Migrate data stored in NCP Object Storage to AWS S3. // @Tags [Data Migration], [Object Storage] @@ -197,6 +200,7 @@ func MigrationNCPToS3PostHandler(ctx echo.Context) error { // MigrationNCPToGCPPostHandler godoc // +// @ID MigrationNCPToGCPPostHandler // @Summary Migrate data from NCP to GCP Cloud Storage // @Description Migrate data stored in NCP Object Storage to GCP Cloud Storage. // @Tags [Data Migration], [Object Storage] diff --git a/websrc/controllers/migrationNoSqlHandlers.go b/websrc/controllers/migrationNoSqlHandlers.go index fb8d3dd..7bdb184 100644 --- a/websrc/controllers/migrationNoSqlHandlers.go +++ b/websrc/controllers/migrationNoSqlHandlers.go @@ -24,6 +24,7 @@ import ( ) // MigrationDynamoDBToFirestorePostHandler godoc +// @ID MigrationDynamoDBToFirestorePostHandler // @Summary Migrate data from DynamoDB to Firestore // @Description Migrate data stored in AWS DynamoDB to Google Cloud Firestore. // @Tags [Data Migration], [NRDBMS] @@ -83,6 +84,7 @@ func MigrationDynamoDBToFirestorePostHandler(ctx echo.Context) error { } // MigrationDynamoDBToMongoDBPostHandler godoc +// @ID MigrationDynamoDBToMongoDBPostHandler // @Summary Migrate data from DynamoDB to MongoDB // @Description Migrate data stored in AWS DynamoDB to Naver Cloud MongoDB. // @Tags [Data Migration], [NRDBMS] @@ -142,6 +144,7 @@ func MigrationDynamoDBToMongoDBPostHandler(ctx echo.Context) error { } // MigrationFirestoreToDynamoDBPostHandler godoc +// @ID MigrationFirestoreToDynamoDBPostHandler // @Summary Migrate data from Firestore to DynamoDB // @Description Migrate data stored in Google Cloud Firestore to AWS DynamoDB. // @Tags [Data Migration], [NRDBMS] @@ -201,6 +204,7 @@ func MigrationFirestoreToDynamoDBPostHandler(ctx echo.Context) error { } // MigrationFirestoreToMongoDBPostHandler godoc +// @ID MigrationFirestoreToMongoDBPostHandler // @Summary Migrate data from Firestore to MongoDB // @Description Migrate data stored in Google Cloud Firestore to Naver Cloud MongoDB. // @Tags [Data Migration], [NRDBMS] @@ -260,6 +264,7 @@ func MigrationFirestoreToMongoDBPostHandler(ctx echo.Context) error { } // MigrationMongoDBToDynamoDBPostHandler godoc +// @ID MigrationMongoDBToDynamoDBPostHandler // @Summary Migrate data from MongoDB to DynamoDB // @Description Migrate data stored in Naver Cloud MongoDB to AWS DynamoDB. // @Tags [Data Migration], [NRDBMS] @@ -319,6 +324,7 @@ func MigrationMongoDBToDynamoDBPostHandler(ctx echo.Context) error { } // MigrationMongoDBToFirestorePostHandler godoc +// @ID MigrationMongoDBToFirestorePostHandler // @Summary Migrate data from MongoDB to Firestore // @Description Migrate data stored in Naver Cloud MongoDB to Google Cloud Firestore. // @Tags [Data Migration], [NRDBMS] diff --git a/websrc/controllers/migrationS3Handlers.go b/websrc/controllers/migrationS3Handlers.go index df375b7..cd9b0db 100644 --- a/websrc/controllers/migrationS3Handlers.go +++ b/websrc/controllers/migrationS3Handlers.go @@ -24,6 +24,7 @@ import ( ) // MigrationS3ToLinuxPostHandler godoc +// @ID MigrationS3ToLinuxPostHandler // @Summary Migrate data from AWS S3 to Linux // @Description Migrate data stored in AWS S3 to a Linux-based system. // @Tags [Data Migration] @@ -78,6 +79,7 @@ func MigrationS3ToLinuxPostHandler(ctx echo.Context) error { } // MigrationS3ToWindowsPostHandler godoc +// @ID MigrationS3ToWindowsPostHandler // @Summary Migrate data from AWS S3 to Windows // @Description Migrate data stored in AWS S3 to a Windows-based system. // @Tags [Data Migration] @@ -133,6 +135,7 @@ func MigrationS3ToWindowsPostHandler(ctx echo.Context) error { } // MigrationS3ToGCPPostHandler godoc +// @ID MigrationS3ToGCPPostHandler // @Summary Migrate data from AWS S3 to GCP // @Description Migrate data stored in AWS S3 to Google Cloud Storage. // @Tags [Data Migration], [Object Storage] @@ -193,6 +196,7 @@ func MigrationS3ToGCPPostHandler(ctx echo.Context) error { } // MigrationS3ToNCPPostHandler godoc +// @ID MigrationS3ToNCPPostHandler // @Summary Migrate data from AWS S3 to NCP // @Description Migrate data stored in AWS S3 to Naver Cloud Object Storage. // @Tags [Data Migration], [Object Storage] diff --git a/websrc/controllers/pageHandlers.go b/websrc/controllers/pageHandlers.go index 489531a..6f020a5 100644 --- a/websrc/controllers/pageHandlers.go +++ b/websrc/controllers/pageHandlers.go @@ -33,6 +33,22 @@ func MainGetHandler(ctx echo.Context) error { }) } +/////////////////////////////////////////////////////////////////////////////////////////////// +// Page handlers related to Dashboard data + +func DashBoardHandler(ctx echo.Context) error { + logger := getLogger("dashboard") + logger.Info().Msg("dashboard get page accessed") + return ctx.Render(http.StatusOK, "index.html", models.BasicPageResponse{ + Content: "dashboard", + AWSRegions: GetAWSRegions(), + GCPRegions: GetGCPRegions(), + NCPRegions: GetNCPRegions(), + OS: runtime.GOOS, + Error: nil, + }) +} + /////////////////////////////////////////////////////////////////////////////////////////////// // Page handlers related to generate data @@ -147,14 +163,32 @@ func BackupHandler(ctx echo.Context) error { logger := getLogger("backup") logger.Info().Msg("backup get page accessed") return ctx.Render(http.StatusOK, "index.html", models.BasicPageResponse{ - Content: "Backup", - Regions: GetAWSRegions(), - OS: runtime.GOOS, - Error: nil, + Content: "Backup", + AWSRegions: GetAWSRegions(), + GCPRegions: GetGCPRegions(), + NCPRegions: GetNCPRegions(), + OS: runtime.GOOS, + Error: nil, }) } /////////////////////////////////////////////////////////////////////////////////////////////// +// Page handlers related to backup data + +func RestoreHandler(ctx echo.Context) error { + logger := getLogger("restore") + logger.Info().Msg("restore get page accessed") + return ctx.Render(http.StatusOK, "index.html", models.BasicPageResponse{ + Content: "Restore", + AWSRegions: GetAWSRegions(), + GCPRegions: GetGCPRegions(), + NCPRegions: GetNCPRegions(), + OS: runtime.GOOS, + Error: nil, + }) +} + +/////////////////////////////////////////////////////////////////////////////////////////// // Page handlers related to migration data // linux to object storage diff --git a/websrc/controllers/publicfunc.go b/websrc/controllers/publicfunc.go index 46a8853..2d5e03e 100644 --- a/websrc/controllers/publicfunc.go +++ b/websrc/controllers/publicfunc.go @@ -51,7 +51,7 @@ import ( ) func getLogger(jobName string) *zerolog.Logger { - logger := log.With().Str("jobName", jobName).Logger() + logger := log.With().Str("serviceType", jobName).Str("taskType", jobName).Logger() return &logger } @@ -61,8 +61,6 @@ func pageLogInit(pageName, pageInfo string, startTime time.Time) (*zerolog.Logge logger.Info().Msgf("%s post page accessed", pageName) - logger.Output(io.MultiWriter(logger, &logstrings)) - logger.Info().Msg(pageInfo) logger.Info().Str("start time", startTime.Format("2006-01-02T15:04:05-07:00")).Msg("") @@ -595,7 +593,7 @@ func getDataWithBind(logger *zerolog.Logger, startTime time.Time, ctx echo.Conte if err := ctx.Bind(params); err != nil { end := time.Now() logger.Error().Msg("Failed to bind form data") - logger.Error().Interface("params", ctx.Request().Body).Msg("") + logger.Error().Msgf("params : %+v", ctx.Request().Body) logger.Error().Str("End time", end.Format("2006-01-02T15:04:05-07:00")).Msg("") logger.Error().Str("Elapsed time", end.Sub(startTime).String()).Msg("") return false diff --git a/websrc/controllers/restoreHandlers.go b/websrc/controllers/restoreHandlers.go index 0eb33f6..d73d778 100644 --- a/websrc/controllers/restoreHandlers.go +++ b/websrc/controllers/restoreHandlers.go @@ -34,9 +34,10 @@ import ( // RestoreOSPostHandler godoc // +// @ID RestoreOSPostHandler // @Summary Import data from objectstorage // @Description Import data from a objectstorage to files. -// @Tags [Data Import], [Object Storage] +// @Tags [Data Restore], [Object Storage] // @Accept json // @Produce json // @Param RequestBody body models.RestoreTask true "Parameters required for Restore" @@ -71,11 +72,12 @@ func RestoreOSPostHandler(ctx echo.Context) error { } } -// RestoreMySQLPostHandler godoc +// RestoreRDBPostHandler godoc // +// @ID RestoreRDBPostHandler // @Summary Import data from MySQL // @Description Import data from a MySQL database to SQL files. -// @Tags [Data Import], [RDBMS] +// @Tags [Data Restore], [RDBMS] // @Accept json // @Produce json // @Param RequestBody body models.RestoreTask true "Parameters required for Restore" @@ -158,11 +160,12 @@ func RestoreRDBPostHandler(ctx echo.Context) error { } -// RestoreMySQLPostHandler godoc +// RestoreNRDBPostHandler godoc // +// @ID RestoreNRDBPostHandler // @Summary Import data from MySQL // @Description Import data from a MySQL database to SQL files. -// @Tags [Data Import], [RDBMS] +// @Tags [Data Restore], [RDBMS] // @Accept json // @Produce json // @Param RequestBody body models.RestoreTask true "Parameters required for Restore" diff --git a/websrc/controllers/taskHandlers.go b/websrc/controllers/taskHandlers.go index 6e773aa..91dddc9 100644 --- a/websrc/controllers/taskHandlers.go +++ b/websrc/controllers/taskHandlers.go @@ -31,6 +31,7 @@ type TaskController struct { // GetAllTasksHandler godoc // +// @ID GetAllTasksHandler // @Summary Get all Tasks // @Description Retrieve a list of all Tasks in the system. // @Tags [Task] @@ -56,6 +57,7 @@ func (tc *TaskController) GetAllTasksHandler(ctx echo.Context) error { // CreateTaskHandler godoc // +// @ID CreateTaskHandler // @Summary Create a new Task // @Description Create a new Task and store it in the system. // @Tags [Task] @@ -94,9 +96,11 @@ func (tc *TaskController) CreateTaskHandler(ctx echo.Context) error { // GetTaskHandler godoc // +// @ID GetTaskHandler // @Summary Get a Task by ID // @Description Get the details of a Task using its ID. // @Tags [Task] +// @Accept json // @Produce json // @Param id path string true "Task ID" // @Success 200 {object} models.Task "Successfully retrieved a Task" @@ -121,6 +125,7 @@ func (tc *TaskController) GetTaskHandler(ctx echo.Context) error { // UpdateTaskHandler godoc // +// @ID UpdateTaskHandler // @Summary Update an existing Task // @Description Update the details of an existing Task using its ID. // @Tags [Task] @@ -162,6 +167,7 @@ func (tc *TaskController) UpdateTaskHandler(ctx echo.Context) error { // DeleteTaskHandler godoc // +// @ID DeleteTaskHandler // @Summary Delete a Task // @Description Delete an existing Task using its ID. // @Tags [Task] diff --git a/websrc/docs/docs.go b/websrc/docs/docs.go index c334046..c4a0d53 100644 --- a/websrc/docs/docs.go +++ b/websrc/docs/docs.go @@ -160,6 +160,7 @@ const docTemplate = `{ "[Object Storage]" ], "summary": "Generate test data on AWS S3", + "operationId": "GenerateS3PostHandler", "parameters": [ { "description": "Parameters required to generate test data", @@ -207,6 +208,7 @@ const docTemplate = `{ "[NRDBMS]" ], "summary": "Generate test data on AWS DynamoDB", + "operationId": "GenerateDynamoDBPostHandler", "parameters": [ { "description": "Parameters required to generate test data", @@ -254,6 +256,7 @@ const docTemplate = `{ "[NRDBMS]" ], "summary": "Generate test data on GCP Firestore", + "operationId": "GenerateFirestorePostHandler", "parameters": [ { "description": "Parameters required to generate test data", @@ -301,6 +304,7 @@ const docTemplate = `{ "[Object Storage]" ], "summary": "Generate test data on GCP Cloud Storage", + "operationId": "GenerateGCPPostHandler", "parameters": [ { "description": "Parameters required to generate test data", @@ -341,6 +345,7 @@ const docTemplate = `{ "[Test Data Generation]" ], "summary": "Generate test data on on-premise Linux", + "operationId": "GenerateLinuxPostHandler", "parameters": [ { "description": "Parameters required to generate test data", @@ -388,6 +393,7 @@ const docTemplate = `{ "[NRDBMS]" ], "summary": "Generate test data on NCP MongoDB", + "operationId": "GenerateMongoDBPostHandler", "parameters": [ { "description": "Parameters required to generate test data", @@ -435,6 +441,7 @@ const docTemplate = `{ "[RDBMS]" ], "summary": "Generate test data on MySQL", + "operationId": "GenerateMySQLPostHandler", "parameters": [ { "description": "Parameters required to generate test data", @@ -482,6 +489,7 @@ const docTemplate = `{ "[Object Storage]" ], "summary": "Generate test data on NCP Object Storage", + "operationId": "GenerateNCPPostHandler", "parameters": [ { "description": "Parameters required to generate test data", @@ -528,6 +536,7 @@ const docTemplate = `{ "[Test Data Generation]" ], "summary": "Generate test data on on-premise Windows", + "operationId": "GenerateWindowsPostHandler", "parameters": [ { "description": "Parameters required to generate test data", @@ -575,6 +584,7 @@ const docTemplate = `{ "[Object Storage]" ], "summary": "Migrate data from AWS S3 to GCP", + "operationId": "MigrationS3ToGCPPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -615,6 +625,7 @@ const docTemplate = `{ "[Data Migration]" ], "summary": "Migrate data from AWS S3 to Linux", + "operationId": "MigrationS3ToLinuxPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -662,6 +673,7 @@ const docTemplate = `{ "[Object Storage]" ], "summary": "Migrate data from AWS S3 to NCP", + "operationId": "MigrationS3ToNCPPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -702,6 +714,7 @@ const docTemplate = `{ "[Data Migration]" ], "summary": "Migrate data from AWS S3 to Windows", + "operationId": "MigrationS3ToWindowsPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -749,6 +762,7 @@ const docTemplate = `{ "[NRDBMS]" ], "summary": "Migrate data from DynamoDB to Firestore", + "operationId": "MigrationDynamoDBToFirestorePostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -790,6 +804,7 @@ const docTemplate = `{ "[NRDBMS]" ], "summary": "Migrate data from DynamoDB to MongoDB", + "operationId": "MigrationDynamoDBToMongoDBPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -831,6 +846,7 @@ const docTemplate = `{ "[NRDBMS]" ], "summary": "Migrate data from Firestore to DynamoDB", + "operationId": "MigrationFirestoreToDynamoDBPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -872,6 +888,7 @@ const docTemplate = `{ "[NRDBMS]" ], "summary": "Migrate data from Firestore to MongoDB", + "operationId": "MigrationFirestoreToMongoDBPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -913,6 +930,7 @@ const docTemplate = `{ "[Object Storage]" ], "summary": "Migrate data from GCP to AWS S3", + "operationId": "MigrationGCPToS3PostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -953,6 +971,7 @@ const docTemplate = `{ "[Data Migration]" ], "summary": "Migrate data from GCP to Linux", + "operationId": "MigrationGCPToLinuxPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1000,6 +1019,7 @@ const docTemplate = `{ "[Object Storage]" ], "summary": "Migrate data from GCP to NCP Object Storage", + "operationId": "MigrationGCPToNCPPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1040,6 +1060,7 @@ const docTemplate = `{ "[Data Migration]" ], "summary": "Migrate data from GCP to Windows", + "operationId": "MigrationGCPToWindowsPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1086,6 +1107,7 @@ const docTemplate = `{ "[Data Migration]" ], "summary": "Migrate data from Linux to AWS S3", + "operationId": "MigrationLinuxToS3PostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1132,6 +1154,7 @@ const docTemplate = `{ "[Data Migration]" ], "summary": "Migrate data from Linux to GCP Cloud Storage", + "operationId": "MigrationLinuxToGCPPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1178,6 +1201,7 @@ const docTemplate = `{ "[Data Migration]" ], "summary": "Migrate data from Linux to NCP Object Storage", + "operationId": "MigrationLinuxToNCPPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1225,6 +1249,7 @@ const docTemplate = `{ "[NRDBMS]" ], "summary": "Migrate data from MongoDB to DynamoDB", + "operationId": "MigrationMongoDBToDynamoDBPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1266,6 +1291,7 @@ const docTemplate = `{ "[NRDBMS]" ], "summary": "Migrate data from MongoDB to Firestore", + "operationId": "MigrationMongoDBToFirestorePostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1307,6 +1333,7 @@ const docTemplate = `{ "[RDBMS]" ], "summary": "Migrate data from MySQL to MySQL", + "operationId": "MigrationMySQLPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1348,6 +1375,7 @@ const docTemplate = `{ "[Object Storage]" ], "summary": "Migrate data from NCP to AWS S3", + "operationId": "MigrationNCPToS3PostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1389,6 +1417,7 @@ const docTemplate = `{ "[Object Storage]" ], "summary": "Migrate data from NCP to GCP Cloud Storage", + "operationId": "MigrationNCPToGCPPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1435,6 +1464,7 @@ const docTemplate = `{ "[Data Migration]" ], "summary": "Migrate data from NCP to Linux", + "operationId": "MigrationNCPToLinuxPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1481,6 +1511,7 @@ const docTemplate = `{ "[Data Migration]" ], "summary": "Migrate data from NCP to Windows", + "operationId": "MigrationNCPToWindowsPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1527,6 +1558,7 @@ const docTemplate = `{ "[Data Migration]" ], "summary": "Migrate data from Windows to AWS S3", + "operationId": "MigrationWindowsToS3PostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1573,6 +1605,7 @@ const docTemplate = `{ "[Data Migration]" ], "summary": "Migrate data from Windows to GCP Cloud Storage", + "operationId": "MigrationWindowsToGCPPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1619,6 +1652,7 @@ const docTemplate = `{ "[Data Migration]" ], "summary": "Migrate data from Windows to NCP Object Storage", + "operationId": "MigrationWindowsToNCPPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1666,6 +1700,7 @@ const docTemplate = `{ "[RDBMS]" ], "summary": "Import data from MySQL", + "operationId": "RestoreNRDBPostHandler", "parameters": [ { "description": "Parameters required for Restore", @@ -1707,6 +1742,7 @@ const docTemplate = `{ "[Object Storage]" ], "summary": "Import data from objectstorage", + "operationId": "RestoreOSPostHandler", "parameters": [ { "description": "Parameters required for Restore", @@ -1748,6 +1784,7 @@ const docTemplate = `{ "[RDBMS]" ], "summary": "Import data from MySQL", + "operationId": "RestoreRDBPostHandler", "parameters": [ { "description": "Parameters required for Restore", @@ -1785,6 +1822,7 @@ const docTemplate = `{ "[Task]" ], "summary": "Get all Tasks", + "operationId": "GetAllTasksHandler", "responses": { "200": { "description": "Successfully retrieved all Tasks", @@ -1815,6 +1853,7 @@ const docTemplate = `{ "[Task]" ], "summary": "Create a new Task", + "operationId": "CreateTaskHandler", "parameters": [ { "description": "Parameters required for creating a Task", @@ -1845,6 +1884,9 @@ const docTemplate = `{ "/task/{id}": { "get": { "description": "Get the details of a Task using its ID.", + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], @@ -1852,6 +1894,7 @@ const docTemplate = `{ "[Task]" ], "summary": "Get a Task by ID", + "operationId": "GetTaskHandler", "parameters": [ { "type": "string", @@ -1888,6 +1931,7 @@ const docTemplate = `{ "[Task]" ], "summary": "Update an existing Task", + "operationId": "UpdateTaskHandler", "parameters": [ { "type": "string", @@ -1936,6 +1980,7 @@ const docTemplate = `{ "[Task]" ], "summary": "Delete a Task", + "operationId": "DeleteTaskHandler", "parameters": [ { "type": "string", @@ -1966,14 +2011,8 @@ const docTemplate = `{ "controllers.GenarateTask": { "type": "object", "properties": { - "operationId": { - "type": "string" - }, - "tag": { - "type": "array", - "items": { - "type": "string" - } + "inline": { + "$ref": "#/definitions/models.Task" }, "targetPoint": { "$ref": "#/definitions/models.GenTaskTarget" diff --git a/websrc/docs/swagger.json b/websrc/docs/swagger.json index eb82245..d4c6b64 100644 --- a/websrc/docs/swagger.json +++ b/websrc/docs/swagger.json @@ -153,6 +153,7 @@ "[Object Storage]" ], "summary": "Generate test data on AWS S3", + "operationId": "GenerateS3PostHandler", "parameters": [ { "description": "Parameters required to generate test data", @@ -200,6 +201,7 @@ "[NRDBMS]" ], "summary": "Generate test data on AWS DynamoDB", + "operationId": "GenerateDynamoDBPostHandler", "parameters": [ { "description": "Parameters required to generate test data", @@ -247,6 +249,7 @@ "[NRDBMS]" ], "summary": "Generate test data on GCP Firestore", + "operationId": "GenerateFirestorePostHandler", "parameters": [ { "description": "Parameters required to generate test data", @@ -294,6 +297,7 @@ "[Object Storage]" ], "summary": "Generate test data on GCP Cloud Storage", + "operationId": "GenerateGCPPostHandler", "parameters": [ { "description": "Parameters required to generate test data", @@ -334,6 +338,7 @@ "[Test Data Generation]" ], "summary": "Generate test data on on-premise Linux", + "operationId": "GenerateLinuxPostHandler", "parameters": [ { "description": "Parameters required to generate test data", @@ -381,6 +386,7 @@ "[NRDBMS]" ], "summary": "Generate test data on NCP MongoDB", + "operationId": "GenerateMongoDBPostHandler", "parameters": [ { "description": "Parameters required to generate test data", @@ -428,6 +434,7 @@ "[RDBMS]" ], "summary": "Generate test data on MySQL", + "operationId": "GenerateMySQLPostHandler", "parameters": [ { "description": "Parameters required to generate test data", @@ -475,6 +482,7 @@ "[Object Storage]" ], "summary": "Generate test data on NCP Object Storage", + "operationId": "GenerateNCPPostHandler", "parameters": [ { "description": "Parameters required to generate test data", @@ -521,6 +529,7 @@ "[Test Data Generation]" ], "summary": "Generate test data on on-premise Windows", + "operationId": "GenerateWindowsPostHandler", "parameters": [ { "description": "Parameters required to generate test data", @@ -568,6 +577,7 @@ "[Object Storage]" ], "summary": "Migrate data from AWS S3 to GCP", + "operationId": "MigrationS3ToGCPPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -608,6 +618,7 @@ "[Data Migration]" ], "summary": "Migrate data from AWS S3 to Linux", + "operationId": "MigrationS3ToLinuxPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -655,6 +666,7 @@ "[Object Storage]" ], "summary": "Migrate data from AWS S3 to NCP", + "operationId": "MigrationS3ToNCPPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -695,6 +707,7 @@ "[Data Migration]" ], "summary": "Migrate data from AWS S3 to Windows", + "operationId": "MigrationS3ToWindowsPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -742,6 +755,7 @@ "[NRDBMS]" ], "summary": "Migrate data from DynamoDB to Firestore", + "operationId": "MigrationDynamoDBToFirestorePostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -783,6 +797,7 @@ "[NRDBMS]" ], "summary": "Migrate data from DynamoDB to MongoDB", + "operationId": "MigrationDynamoDBToMongoDBPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -824,6 +839,7 @@ "[NRDBMS]" ], "summary": "Migrate data from Firestore to DynamoDB", + "operationId": "MigrationFirestoreToDynamoDBPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -865,6 +881,7 @@ "[NRDBMS]" ], "summary": "Migrate data from Firestore to MongoDB", + "operationId": "MigrationFirestoreToMongoDBPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -906,6 +923,7 @@ "[Object Storage]" ], "summary": "Migrate data from GCP to AWS S3", + "operationId": "MigrationGCPToS3PostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -946,6 +964,7 @@ "[Data Migration]" ], "summary": "Migrate data from GCP to Linux", + "operationId": "MigrationGCPToLinuxPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -993,6 +1012,7 @@ "[Object Storage]" ], "summary": "Migrate data from GCP to NCP Object Storage", + "operationId": "MigrationGCPToNCPPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1033,6 +1053,7 @@ "[Data Migration]" ], "summary": "Migrate data from GCP to Windows", + "operationId": "MigrationGCPToWindowsPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1079,6 +1100,7 @@ "[Data Migration]" ], "summary": "Migrate data from Linux to AWS S3", + "operationId": "MigrationLinuxToS3PostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1125,6 +1147,7 @@ "[Data Migration]" ], "summary": "Migrate data from Linux to GCP Cloud Storage", + "operationId": "MigrationLinuxToGCPPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1171,6 +1194,7 @@ "[Data Migration]" ], "summary": "Migrate data from Linux to NCP Object Storage", + "operationId": "MigrationLinuxToNCPPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1218,6 +1242,7 @@ "[NRDBMS]" ], "summary": "Migrate data from MongoDB to DynamoDB", + "operationId": "MigrationMongoDBToDynamoDBPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1259,6 +1284,7 @@ "[NRDBMS]" ], "summary": "Migrate data from MongoDB to Firestore", + "operationId": "MigrationMongoDBToFirestorePostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1300,6 +1326,7 @@ "[RDBMS]" ], "summary": "Migrate data from MySQL to MySQL", + "operationId": "MigrationMySQLPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1341,6 +1368,7 @@ "[Object Storage]" ], "summary": "Migrate data from NCP to AWS S3", + "operationId": "MigrationNCPToS3PostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1382,6 +1410,7 @@ "[Object Storage]" ], "summary": "Migrate data from NCP to GCP Cloud Storage", + "operationId": "MigrationNCPToGCPPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1428,6 +1457,7 @@ "[Data Migration]" ], "summary": "Migrate data from NCP to Linux", + "operationId": "MigrationNCPToLinuxPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1474,6 +1504,7 @@ "[Data Migration]" ], "summary": "Migrate data from NCP to Windows", + "operationId": "MigrationNCPToWindowsPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1520,6 +1551,7 @@ "[Data Migration]" ], "summary": "Migrate data from Windows to AWS S3", + "operationId": "MigrationWindowsToS3PostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1566,6 +1598,7 @@ "[Data Migration]" ], "summary": "Migrate data from Windows to GCP Cloud Storage", + "operationId": "MigrationWindowsToGCPPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1612,6 +1645,7 @@ "[Data Migration]" ], "summary": "Migrate data from Windows to NCP Object Storage", + "operationId": "MigrationWindowsToNCPPostHandler", "parameters": [ { "description": "Parameters required for migration", @@ -1659,6 +1693,7 @@ "[RDBMS]" ], "summary": "Import data from MySQL", + "operationId": "RestoreNRDBPostHandler", "parameters": [ { "description": "Parameters required for Restore", @@ -1700,6 +1735,7 @@ "[Object Storage]" ], "summary": "Import data from objectstorage", + "operationId": "RestoreOSPostHandler", "parameters": [ { "description": "Parameters required for Restore", @@ -1741,6 +1777,7 @@ "[RDBMS]" ], "summary": "Import data from MySQL", + "operationId": "RestoreRDBPostHandler", "parameters": [ { "description": "Parameters required for Restore", @@ -1778,6 +1815,7 @@ "[Task]" ], "summary": "Get all Tasks", + "operationId": "GetAllTasksHandler", "responses": { "200": { "description": "Successfully retrieved all Tasks", @@ -1808,6 +1846,7 @@ "[Task]" ], "summary": "Create a new Task", + "operationId": "CreateTaskHandler", "parameters": [ { "description": "Parameters required for creating a Task", @@ -1838,6 +1877,9 @@ "/task/{id}": { "get": { "description": "Get the details of a Task using its ID.", + "consumes": [ + "application/json" + ], "produces": [ "application/json" ], @@ -1845,6 +1887,7 @@ "[Task]" ], "summary": "Get a Task by ID", + "operationId": "GetTaskHandler", "parameters": [ { "type": "string", @@ -1881,6 +1924,7 @@ "[Task]" ], "summary": "Update an existing Task", + "operationId": "UpdateTaskHandler", "parameters": [ { "type": "string", @@ -1929,6 +1973,7 @@ "[Task]" ], "summary": "Delete a Task", + "operationId": "DeleteTaskHandler", "parameters": [ { "type": "string", @@ -1959,14 +2004,8 @@ "controllers.GenarateTask": { "type": "object", "properties": { - "operationId": { - "type": "string" - }, - "tag": { - "type": "array", - "items": { - "type": "string" - } + "inline": { + "$ref": "#/definitions/models.Task" }, "targetPoint": { "$ref": "#/definitions/models.GenTaskTarget" diff --git a/websrc/docs/swagger.yaml b/websrc/docs/swagger.yaml index 87543fa..cb8b7ca 100644 --- a/websrc/docs/swagger.yaml +++ b/websrc/docs/swagger.yaml @@ -2,12 +2,8 @@ basePath: / definitions: controllers.GenarateTask: properties: - operationId: - type: string - tag: - items: - type: string - type: array + inline: + $ref: '#/definitions/models.Task' targetPoint: $ref: '#/definitions/models.GenTaskTarget' type: object @@ -296,6 +292,7 @@ paths: consumes: - application/json description: Generate test data on AWS S3. + operationId: GenerateS3PostHandler parameters: - description: Parameters required to generate test data in: body @@ -327,6 +324,7 @@ paths: consumes: - application/json description: Generate test data on AWS DynamoDB. + operationId: GenerateDynamoDBPostHandler parameters: - description: Parameters required to generate test data in: body @@ -358,6 +356,7 @@ paths: consumes: - application/json description: Generate test data on GCP Firestore. + operationId: GenerateFirestorePostHandler parameters: - description: Parameters required to generate test data in: body @@ -389,6 +388,7 @@ paths: consumes: - application/json description: Generate test data on GCP Cloud Storage. + operationId: GenerateGCPPostHandler parameters: - description: Parameters required to generate test data in: body @@ -416,6 +416,7 @@ paths: consumes: - application/json description: Generate test data on on-premise Linux. + operationId: GenerateLinuxPostHandler parameters: - description: Parameters required to generate test data in: body @@ -446,6 +447,7 @@ paths: consumes: - application/json description: Generate test data on NCP MongoDB. + operationId: GenerateMongoDBPostHandler parameters: - description: Parameters required to generate test data in: body @@ -477,6 +479,7 @@ paths: consumes: - application/json description: Generate test data on MySQL. + operationId: GenerateMySQLPostHandler parameters: - description: Parameters required to generate test data in: body @@ -508,6 +511,7 @@ paths: consumes: - application/json description: Generate test data on NCP Object Storage. + operationId: GenerateNCPPostHandler parameters: - description: Parameters required to generate test data in: body @@ -539,6 +543,7 @@ paths: consumes: - application/json description: Generate test data on on-premise Windows. + operationId: GenerateWindowsPostHandler parameters: - description: Parameters required to generate test data in: body @@ -569,6 +574,7 @@ paths: consumes: - application/json description: Migrate data stored in AWS S3 to Google Cloud Storage. + operationId: MigrationS3ToGCPPostHandler parameters: - description: Parameters required for migration in: body @@ -596,6 +602,7 @@ paths: consumes: - application/json description: Migrate data stored in AWS S3 to a Linux-based system. + operationId: MigrationS3ToLinuxPostHandler parameters: - description: Parameters required for migration in: body @@ -626,6 +633,7 @@ paths: consumes: - application/json description: Migrate data stored in AWS S3 to Naver Cloud Object Storage. + operationId: MigrationS3ToNCPPostHandler parameters: - description: Parameters required for migration in: body @@ -653,6 +661,7 @@ paths: consumes: - application/json description: Migrate data stored in AWS S3 to a Windows-based system. + operationId: MigrationS3ToWindowsPostHandler parameters: - description: Parameters required for migration in: body @@ -683,6 +692,7 @@ paths: consumes: - application/json description: Migrate data stored in AWS DynamoDB to Google Cloud Firestore. + operationId: MigrationDynamoDBToFirestorePostHandler parameters: - description: Parameters required for migration in: body @@ -710,6 +720,7 @@ paths: consumes: - application/json description: Migrate data stored in AWS DynamoDB to Naver Cloud MongoDB. + operationId: MigrationDynamoDBToMongoDBPostHandler parameters: - description: Parameters required for migration in: body @@ -737,6 +748,7 @@ paths: consumes: - application/json description: Migrate data stored in Google Cloud Firestore to AWS DynamoDB. + operationId: MigrationFirestoreToDynamoDBPostHandler parameters: - description: Parameters required for migration in: body @@ -764,6 +776,7 @@ paths: consumes: - application/json description: Migrate data stored in Google Cloud Firestore to Naver Cloud MongoDB. + operationId: MigrationFirestoreToMongoDBPostHandler parameters: - description: Parameters required for migration in: body @@ -791,6 +804,7 @@ paths: consumes: - application/json description: Migrate data stored in GCP Cloud Storage to AWS S3. + operationId: MigrationGCPToS3PostHandler parameters: - description: Parameters required for migration in: body @@ -818,6 +832,7 @@ paths: consumes: - application/json description: Migrate data stored in GCP Cloud Storage to a Linux-based system. + operationId: MigrationGCPToLinuxPostHandler parameters: - description: Parameters required for migration in: body @@ -848,6 +863,7 @@ paths: consumes: - application/json description: Migrate data stored in GCP Cloud Storage to NCP Object Storage. + operationId: MigrationGCPToNCPPostHandler parameters: - description: Parameters required for migration in: body @@ -875,6 +891,7 @@ paths: consumes: - application/json description: Migrate data stored in GCP Cloud Storage to a Windows-based system. + operationId: MigrationGCPToWindowsPostHandler parameters: - description: Parameters required for migration in: body @@ -905,6 +922,7 @@ paths: consumes: - application/json description: Migrate data stored in a Linux-based system to AWS S3. + operationId: MigrationLinuxToS3PostHandler parameters: - description: Parameters required for migration in: body @@ -935,6 +953,7 @@ paths: consumes: - application/json description: Migrate data stored in a Linux-based system to GCP Cloud Storage. + operationId: MigrationLinuxToGCPPostHandler parameters: - description: Parameters required for migration in: body @@ -965,6 +984,7 @@ paths: consumes: - application/json description: Migrate data stored in a Linux-based system to NCP Object Storage. + operationId: MigrationLinuxToNCPPostHandler parameters: - description: Parameters required for migration in: body @@ -995,6 +1015,7 @@ paths: consumes: - application/json description: Migrate data stored in Naver Cloud MongoDB to AWS DynamoDB. + operationId: MigrationMongoDBToDynamoDBPostHandler parameters: - description: Parameters required for migration in: body @@ -1022,6 +1043,7 @@ paths: consumes: - application/json description: Migrate data stored in Naver Cloud MongoDB to Google Cloud Firestore. + operationId: MigrationMongoDBToFirestorePostHandler parameters: - description: Parameters required for migration in: body @@ -1049,6 +1071,7 @@ paths: consumes: - application/json description: Migrate data from one MySQL database to another MySQL database. + operationId: MigrationMySQLPostHandler parameters: - description: Parameters required for migration in: body @@ -1076,6 +1099,7 @@ paths: consumes: - application/json description: Migrate data stored in NCP Object Storage to AWS S3. + operationId: MigrationNCPToS3PostHandler parameters: - description: Parameters required for migration in: body @@ -1103,6 +1127,7 @@ paths: consumes: - application/json description: Migrate data stored in NCP Object Storage to GCP Cloud Storage. + operationId: MigrationNCPToGCPPostHandler parameters: - description: Parameters required for migration in: body @@ -1134,6 +1159,7 @@ paths: consumes: - application/json description: Migrate data stored in NCP Object Storage to a Linux-based system. + operationId: MigrationNCPToLinuxPostHandler parameters: - description: Parameters required for migration in: body @@ -1164,6 +1190,7 @@ paths: consumes: - application/json description: Migrate data stored in NCP Object Storage to a Windows-based system. + operationId: MigrationNCPToWindowsPostHandler parameters: - description: Parameters required for migration in: body @@ -1194,6 +1221,7 @@ paths: consumes: - application/json description: Migrate data stored in a Windows-based system to AWS S3. + operationId: MigrationWindowsToS3PostHandler parameters: - description: Parameters required for migration in: body @@ -1224,6 +1252,7 @@ paths: consumes: - application/json description: Migrate data stored in a Windows-based system to GCP Cloud Storage. + operationId: MigrationWindowsToGCPPostHandler parameters: - description: Parameters required for migration in: body @@ -1254,6 +1283,7 @@ paths: consumes: - application/json description: Migrate data stored in a Windows-based system to NCP Object Storage. + operationId: MigrationWindowsToNCPPostHandler parameters: - description: Parameters required for migration in: body @@ -1284,6 +1314,7 @@ paths: consumes: - application/json description: Import data from a MySQL database to SQL files. + operationId: RestoreNRDBPostHandler parameters: - description: Parameters required for Restore in: body @@ -1311,6 +1342,7 @@ paths: consumes: - application/json description: Import data from a objectstorage to files. + operationId: RestoreOSPostHandler parameters: - description: Parameters required for Restore in: body @@ -1338,6 +1370,7 @@ paths: consumes: - application/json description: Import data from a MySQL database to SQL files. + operationId: RestoreRDBPostHandler parameters: - description: Parameters required for Restore in: body @@ -1363,6 +1396,7 @@ paths: /task: get: description: Retrieve a list of all Tasks in the system. + operationId: GetAllTasksHandler produces: - application/json responses: @@ -1383,6 +1417,7 @@ paths: consumes: - application/json description: Create a new Task and store it in the system. + operationId: CreateTaskHandler parameters: - description: Parameters required for creating a Task in: body @@ -1407,6 +1442,7 @@ paths: /task/{id}: delete: description: Delete an existing Task using its ID. + operationId: DeleteTaskHandler parameters: - description: Task ID in: path @@ -1428,7 +1464,10 @@ paths: tags: - '[Task]' get: + consumes: + - application/json description: Get the details of a Task using its ID. + operationId: GetTaskHandler parameters: - description: Task ID in: path @@ -1453,6 +1492,7 @@ paths: consumes: - application/json description: Update the details of an existing Task using its ID. + operationId: UpdateTaskHandler parameters: - description: Task ID in: path diff --git a/websrc/routes/restoreRoutes.go b/websrc/routes/restoreRoutes.go index 1bc2b84..df17432 100644 --- a/websrc/routes/restoreRoutes.go +++ b/websrc/routes/restoreRoutes.go @@ -33,7 +33,7 @@ func RestoreRoutes(g *echo.Group) { } func RestoreRoot(g *echo.Group) { - // g.GET("", controllers.RestoreHandler) + g.GET("", controllers.RestoreHandler) } func RestoreObjectStorage(g *echo.Group) { diff --git a/websrc/routes/taskRoutes.go b/websrc/routes/taskRoutes.go index 6e986ca..9562f82 100644 --- a/websrc/routes/taskRoutes.go +++ b/websrc/routes/taskRoutes.go @@ -37,4 +37,5 @@ func TaskRoot(g *echo.Group, scheduleManager *task.FileScheduleManager) { g.POST("", taskController.CreateTaskHandler) // Create a new task g.PUT("/:id", taskController.UpdateTaskHandler) // Update an existing task by ID or OperationID g.DELETE("/:id", taskController.DeleteTaskHandler) // Delete a task by ID or OperationID + g.GET("/dash", controllers.DashBoardHandler) }