Joe Topjian | 7a0f3e5 | 2016-08-22 20:26:34 -0600 | [diff] [blame] | 1 | package swauth |
| 2 | |
| 3 | import ( |
| 4 | "github.com/gophercloud/gophercloud" |
| 5 | ) |
| 6 | |
| 7 | // GetAuthResult temporarily contains the response from a Swauth |
| 8 | // authentication call. |
| 9 | type GetAuthResult struct { |
| 10 | gophercloud.HeaderResult |
| 11 | } |
| 12 | |
| 13 | // AuthResult contains the authentication information from a Swauth |
| 14 | // authentication request. |
| 15 | type AuthResult struct { |
| 16 | Token string `json:"X-Auth-Token"` |
| 17 | StorageURL string `json:"X-Storage-Url"` |
| 18 | CDNURL string `json:"X-CDN-Management-Url"` |
| 19 | } |
| 20 | |
| 21 | // Extract is a method that attempts to interpret any Swauth authentication |
| 22 | // response as a AuthResult struct. |
| 23 | func (r GetAuthResult) Extract() (*AuthResult, error) { |
| 24 | var s *AuthResult |
| 25 | err := r.ExtractInto(&s) |
| 26 | return s, err |
| 27 | } |