// Set up global connection to the cluster func connect(endpoint, username, apiKey string) { // Connect to Carina var err error carinaClient, err = libcarina.NewClusterClient(endpoint, username, apiKey) loggedInFlag = true if err != nil { log.Fatal("Cannot create cluster client: ", err) } }
// Auth does the authentication func (carina *Command) Auth(pc *kingpin.ParseContext) (err error) { if carina.Username == "" || carina.APIKey == "" { // Backwards compatibility for prior releases, to be deprecated // Check on RACKSPACE_USERNAME if os.Getenv(rackspaceUserNameEnvVar) != "" && os.Getenv(rackspaceAPIKeyEnvVar) != "" { fmt.Fprintf(os.Stderr, "Warning: use of %s and %s environment variables is deprecated.\n", rackspaceUserNameEnvVar, rackspaceAPIKeyEnvVar) fmt.Fprintf(os.Stderr, "Please use %s and %s instead.\n", UserNameEnvVar, APIKeyEnvVar) carina.Username = os.Getenv(rackspaceUserNameEnvVar) carina.APIKey = os.Getenv(rackspaceAPIKeyEnvVar) } } carina.ClusterClient, err = libcarina.NewClusterClient(carina.Endpoint, carina.Username, carina.APIKey) return err }