Samuel A. Falvo II | 1d3fa66 | 2013-06-25 15:29:32 -0700 | [diff] [blame^] | 1 | package main |
| 2 | |
| 3 | import ( |
| 4 | "os" |
| 5 | "fmt" |
| 6 | "github.com/rackspace/gophercloud" |
| 7 | ) |
| 8 | |
| 9 | func 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 | } |