func SignUp() error { fmt.Print("Email: ") var email string _, err := fmt.Scanln(&email) if err != nil { return errgo.Mask(err) } password, err := term.Password("Password: "******"Password validation: ") if err != nil { return errgo.Mask(err) } if password != password_confirmation { return errgo.New("passwords don't match") } c := config.ScalingoUnauthenticatedClient() err = c.SignUp(email, password) if err != nil { return errgo.Mask(err) } fmt.Println("A confirmation email has been sent to", email) return nil }
func Plans(addon string) error { c := config.ScalingoUnauthenticatedClient() plans, err := c.AddonProviderPlansList(addon) if err != nil { return errgo.Mask(err, errgo.Any) } t := tablewriter.NewWriter(os.Stdout) t.SetHeader([]string{"ID", "Name", "Description"}) for _, plan := range plans { t.Append([]string{plan.Name, plan.DisplayName, plan.ShortDescription}) } t.Render() return nil }
func loginWithApiKey(apiKey string) error { c := config.ScalingoUnauthenticatedClient() c.APIToken = apiKey user, err := c.Self() if err != nil { return errgo.Mask(err) } fmt.Printf("Hello %s, nice to see you!\n", user.Username) user.AuthenticationToken = apiKey err = config.Authenticator.StoreAuth(user) if err != nil { return errgo.Mask(err) } return nil }