-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
72 lines (63 loc) · 2.3 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package main
import (
"flag"
"fmt"
"github.com/uug-ai/cli/actions"
)
func main() {
fmt.Println(`
_ _ _ _ _____ _____ _ _
| | | | | | |/ ____| / ____(_) |
| | | | | | | | __ | | _| |
| | | | | | | | |_ | | | | | |
| |__| | |__| | |__| | | |____| | |
\____/ \____/ \_____| \_____|_|_|
`)
// Define command-line arguments
action := flag.String("action", "", "Action to take")
mongodbURI := flag.String("mongodb-uri", "", "MongoDB URI")
mongodbHost := flag.String("mongodb-host", "", "MongoDB Host")
mongodbPort := flag.String("mongodb-port", "", "MongoDB Port")
mongodbSourceDatabase := flag.String("mongodb-source-database", "", "MongoDB Source Database")
mongodbDestinationDatabase := flag.String("mongodb-destination-database", "", "MongoDB Destination Database")
mongodbDatabaseCredentials := flag.String("mongodb-database-credentials", "", "MongoDB Database Credentials")
mongodbUsername := flag.String("mongodb-username", "", "MongoDB Username")
mongodbPassword := flag.String("mongodb-password", "", "MongoDB Password")
queueName := flag.String("queue", "", "The queue used to transfer the data")
username := flag.String("username", "", "Username")
startTimestamp := flag.Int64("start-timestamp", 0, "Start Timestamp")
endTimestamp := flag.Int64("end-timestamp", 0, "End Timestamp")
timezone := flag.String("timezone", "", "Timezone")
mode := flag.String("mode", "dry-run", "Mode")
pipeline := flag.String("pipeline", "monitor,sequence", "Provide the pipeline to execute")
batchSize := flag.Int("batch-size", 10, "Batch Size")
batchDelay := flag.Int("batch-delay", 1000, "Batch Delay in milliseconds")
flag.Parse()
// If a step is provided, execute it directly
switch *action {
case "vault-to-hub-migration":
fmt.Println("Starting Vault to Hub migration...")
actions.VaultToHubMigration(*mode,
*mongodbURI,
*mongodbHost,
*mongodbPort,
*mongodbSourceDatabase,
*mongodbDestinationDatabase,
*mongodbDatabaseCredentials,
*mongodbUsername,
*mongodbPassword,
*queueName,
*username,
*startTimestamp,
*endTimestamp,
*timezone,
*pipeline,
*batchSize,
*batchDelay,
)
default:
fmt.Println("Please provide a valid action.")
fmt.Println("Available actions:")
fmt.Println(" -action vault-to-hub-migration")
}
}