in internal/cmd/integrations/apply.go [355:400]
func processConnectors(connectorsFolder string, grantPermission bool, createSecret bool, wait bool) (err error) {
var stat fs.FileInfo
rJSONFiles := regexp.MustCompile(`(\S*)\.json`)
if stat, err = os.Stat(connectorsFolder); err == nil && stat.IsDir() {
// create any connectors
err = filepath.Walk(connectorsFolder, func(path string, info os.FileInfo, err error) error {
if err != nil {
return err
}
if !info.IsDir() {
connectionFile := filepath.Base(path)
if rJSONFiles.MatchString(connectionFile) {
clilog.Info.Printf("Found configuration for connection: %s\n", connectionFile)
_, err = connections.Get(getFilenameWithoutExtension(connectionFile), "", true, false)
// create the connection only if the connection is not found
if err != nil {
connectionBytes, err := utils.ReadFile(path)
if err != nil {
return err
}
clilog.Info.Printf("Creating connector: %s\n", connectionFile)
if _, err = connections.Create(getFilenameWithoutExtension(connectionFile),
connectionBytes,
serviceAccountName,
serviceAccountProject,
encryptionKey,
grantPermission,
createSecret,
wait); err != nil {
return err
}
} else {
clilog.Info.Printf("Connector %s already exists\n", connectionFile)
}
}
}
return nil
})
if err != nil {
return err
}
}
return nil
}