blob: 643ad48f5f5fe6616e28afd25e3fc678c521cc0b [file] [log] [blame]
Samuel A. Falvo II1d3fa662013-06-25 15:29:32 -07001package main
2
3import (
4 "os"
5 "fmt"
6 "github.com/rackspace/gophercloud"
7)
8
9func main() {
10 provider := os.Getenv("SDK_PROVIDER")
11 username := os.Getenv("SDK_USERNAME")
12 password := os.Getenv("SDK_PASSWORD")
13
14 if (provider == "") || (username == "") || (password == "") {
15 fmt.Fprintf(os.Stderr, "One or more of the following environment variables aren't set:\n")
16 fmt.Fprintf(os.Stderr, " SDK_PROVIDER=\"%s\"\n", provider)
17 fmt.Fprintf(os.Stderr, " SDK_USERNAME=\"%s\"\n", username)
18 fmt.Fprintf(os.Stderr, " SDK_PASSWORD=\"%s\"\n", password)
19 os.Exit(1)
20 }
21
22 _, err := gophercloud.Authenticate(
23 provider,
24 gophercloud.AuthOptions{
25 Username: username,
26 Password: password,
27 },
28 )
29 if err != nil {
30 panic(err)
31 }
32}