func main() { args, err := parseArgs(os.Args) if err != nil { log.Fatal(err) } director := director.NewDirector(args.Target, args.RootCAPath, args.ClientName, args.ClientSecret) prettyStatus, _ := json.MarshalIndent(director.Status(), "", " ") fmt.Printf("The director status: '%s'\n", prettyStatus) prettyLogin, _ := json.MarshalIndent(director.Login(), "", " ") fmt.Printf("The director login: '******'\n", prettyLogin) prettyDeployments, _ := json.MarshalIndent(director.Deployments(), "", " ") fmt.Printf("The director deployments: '%s'\n", prettyDeployments) prettyTasks, _ := json.MarshalIndent(director.Tasks(), "", " ") fmt.Printf("The director tasks: '%s'\n", prettyTasks) }
func main() { args, err := parseArgs(os.Args) if err != nil { log.Fatal(err) } director := director.NewDirector(args.Target, args.RootCAPath, args.ClientName, args.ClientSecret) ticker := time.NewTicker(30 * time.Second) quitChannel := make(chan struct{}) defer close(quitChannel) for { fmt.Println("Waiting for a channel signal...") select { case <-ticker.C: fmt.Println("received ticker signal") deployments := director.Deployments() mongo.PushData(args.MongoDBAddress, args.MongoDBUser, args.MongoDBPassword, args.MongoDBName, &mongo.DeploymentInfo{director.Status().UUID, deployments}) fmt.Printf("Here is the current list of deployments: '%s'", deployments) case <-quitChannel: fmt.Println("received quit signal") ticker.Stop() return } } }