-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathaccount.go
46 lines (39 loc) · 1.24 KB
/
account.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
package main
import (
log "github.com/sirupsen/logrus"
"github.com/urfave/cli/v2"
"os"
)
func migrateAccountLevelEntities(*cli.Context) error {
log.Info("Migrating all account level entities like secret managers, secrets, connectors.")
promptConfirm := PromptDefaultInputs()
// Based on the scopes of entities determine the destination details
promptConfirm = PromptOrgAndProject([]string{migrationReq.SecretScope, migrationReq.ConnectorScope}) || promptConfirm
logMigrationDetails()
// We confirm if they wish to proceed or not
if promptConfirm {
confirm := ConfirmInput("Do you wish to proceed importing all secret managers, secrets & connectors?")
if !confirm {
os.Exit(1)
}
}
// Create Secret Managers
log.Info("Importing all secret managers from CG to NG...")
CreateEntities(getReqBody(SecretManager, Filter{
Type: All,
}))
log.Info("Imported all secret managers.")
// Create Secrets
log.Info("Importing all secrets from CG to NG...")
CreateEntities(getReqBody(Secret, Filter{
Type: All,
}))
log.Info("Imported all secrets.")
// Create Connectors
log.Info("Importing all connectors from CG to NG....")
CreateEntities(getReqBody(Connector, Filter{
Type: All,
}))
log.Info("Imported all connectors.")
return nil
}