Jon Perritt | 376dfce | 2016-02-28 23:39:09 -0600 | [diff] [blame] | 1 | package openstack |
| 2 | |
| 3 | import ( |
| 4 | "fmt" |
| 5 | |
| 6 | "github.com/gophercloud/gophercloud" |
| 7 | tokens2 "github.com/gophercloud/gophercloud/openstack/identity/v2/tokens" |
| 8 | tokens3 "github.com/gophercloud/gophercloud/openstack/identity/v3/tokens" |
| 9 | ) |
| 10 | |
| 11 | // ErrEndpointNotFound is the error when no suitable endpoint can be found |
| 12 | // in the user's catalog |
Jon Perritt | a33da23 | 2016-03-02 04:43:08 -0600 | [diff] [blame] | 13 | type ErrEndpointNotFound struct{ gophercloud.BaseError } |
Jon Perritt | 376dfce | 2016-02-28 23:39:09 -0600 | [diff] [blame] | 14 | |
| 15 | func (e ErrEndpointNotFound) Error() string { |
| 16 | return "No suitable endpoint could be found in the service catalog." |
| 17 | } |
| 18 | |
| 19 | // ErrInvalidAvailabilityProvided is the error when an invalid endpoint |
| 20 | // availability is provided |
Jon Perritt | a33da23 | 2016-03-02 04:43:08 -0600 | [diff] [blame] | 21 | type ErrInvalidAvailabilityProvided struct{ gophercloud.ErrInvalidInput } |
Jon Perritt | 376dfce | 2016-02-28 23:39:09 -0600 | [diff] [blame] | 22 | |
| 23 | func (e ErrInvalidAvailabilityProvided) Error() string { |
Jon Perritt | a33da23 | 2016-03-02 04:43:08 -0600 | [diff] [blame] | 24 | return fmt.Sprintf("Unexpected availability in endpoint query: %s", e.Value) |
Jon Perritt | 376dfce | 2016-02-28 23:39:09 -0600 | [diff] [blame] | 25 | } |
| 26 | |
| 27 | // ErrMultipleMatchingEndpointsV2 is the error when more than one endpoint |
| 28 | // for the given options is found in the v2 catalog |
| 29 | type ErrMultipleMatchingEndpointsV2 struct { |
Jon Perritt | a33da23 | 2016-03-02 04:43:08 -0600 | [diff] [blame] | 30 | gophercloud.BaseError |
Jon Perritt | 376dfce | 2016-02-28 23:39:09 -0600 | [diff] [blame] | 31 | Endpoints []tokens2.Endpoint |
| 32 | } |
| 33 | |
| 34 | func (e *ErrMultipleMatchingEndpointsV2) Error() string { |
| 35 | return fmt.Sprintf("Discovered %d matching endpoints: %#v", len(e.Endpoints), e.Endpoints) |
| 36 | } |
| 37 | |
| 38 | // ErrMultipleMatchingEndpointsV3 is the error when more than one endpoint |
| 39 | // for the given options is found in the v3 catalog |
| 40 | type ErrMultipleMatchingEndpointsV3 struct { |
Jon Perritt | a33da23 | 2016-03-02 04:43:08 -0600 | [diff] [blame] | 41 | gophercloud.BaseError |
Jon Perritt | 376dfce | 2016-02-28 23:39:09 -0600 | [diff] [blame] | 42 | Endpoints []tokens3.Endpoint |
| 43 | } |
| 44 | |
| 45 | func (e *ErrMultipleMatchingEndpointsV3) Error() string { |
| 46 | return fmt.Sprintf("Discovered %d matching endpoints: %#v", len(e.Endpoints), e.Endpoints) |
| 47 | } |
| 48 | |
| 49 | // ErrNoAuthURL is the error when the OS_AUTH_URL environment variable is not |
| 50 | // found |
Jon Perritt | a33da23 | 2016-03-02 04:43:08 -0600 | [diff] [blame] | 51 | type ErrNoAuthURL struct{ gophercloud.ErrInvalidInput } |
Jon Perritt | 376dfce | 2016-02-28 23:39:09 -0600 | [diff] [blame] | 52 | |
| 53 | func (e *ErrNoAuthURL) Error() string { |
| 54 | return "Environment variable OS_AUTH_URL needs to be set." |
| 55 | } |
| 56 | |
| 57 | // ErrNoUsername is the error when the OS_USERNAME environment variable is not |
| 58 | // found |
Jon Perritt | a33da23 | 2016-03-02 04:43:08 -0600 | [diff] [blame] | 59 | type ErrNoUsername struct{ gophercloud.ErrInvalidInput } |
Jon Perritt | 376dfce | 2016-02-28 23:39:09 -0600 | [diff] [blame] | 60 | |
| 61 | func (e *ErrNoUsername) Error() string { |
| 62 | return "Environment variable OS_USERNAME needs to be set." |
| 63 | } |
| 64 | |
| 65 | // ErrNoPassword is the error when the OS_PASSWORD environment variable is not |
| 66 | // found |
Jon Perritt | a33da23 | 2016-03-02 04:43:08 -0600 | [diff] [blame] | 67 | type ErrNoPassword struct{ gophercloud.ErrInvalidInput } |
Jon Perritt | 376dfce | 2016-02-28 23:39:09 -0600 | [diff] [blame] | 68 | |
| 69 | func (e *ErrNoPassword) Error() string { |
| 70 | return "Environment variable OS_PASSWORD needs to be set." |
| 71 | } |