blob: df410b1c6114553a647d5b15ad887f7748083176 [file] [log] [blame]
Jon Perritt376dfce2016-02-28 23:39:09 -06001package openstack
2
3import (
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 Perritta33da232016-03-02 04:43:08 -060013type ErrEndpointNotFound struct{ gophercloud.BaseError }
Jon Perritt376dfce2016-02-28 23:39:09 -060014
15func (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 Perritta33da232016-03-02 04:43:08 -060021type ErrInvalidAvailabilityProvided struct{ gophercloud.ErrInvalidInput }
Jon Perritt376dfce2016-02-28 23:39:09 -060022
23func (e ErrInvalidAvailabilityProvided) Error() string {
Jon Perritta33da232016-03-02 04:43:08 -060024 return fmt.Sprintf("Unexpected availability in endpoint query: %s", e.Value)
Jon Perritt376dfce2016-02-28 23:39:09 -060025}
26
27// ErrMultipleMatchingEndpointsV2 is the error when more than one endpoint
28// for the given options is found in the v2 catalog
29type ErrMultipleMatchingEndpointsV2 struct {
Jon Perritta33da232016-03-02 04:43:08 -060030 gophercloud.BaseError
Jon Perritt376dfce2016-02-28 23:39:09 -060031 Endpoints []tokens2.Endpoint
32}
33
jrperritt29ae6b32016-04-13 12:59:37 -050034func (e ErrMultipleMatchingEndpointsV2) Error() string {
Jon Perritt376dfce2016-02-28 23:39:09 -060035 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
40type ErrMultipleMatchingEndpointsV3 struct {
Jon Perritta33da232016-03-02 04:43:08 -060041 gophercloud.BaseError
Jon Perritt376dfce2016-02-28 23:39:09 -060042 Endpoints []tokens3.Endpoint
43}
44
jrperritt29ae6b32016-04-13 12:59:37 -050045func (e ErrMultipleMatchingEndpointsV3) Error() string {
Jon Perritt376dfce2016-02-28 23:39:09 -060046 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 Perritta33da232016-03-02 04:43:08 -060051type ErrNoAuthURL struct{ gophercloud.ErrInvalidInput }
Jon Perritt376dfce2016-02-28 23:39:09 -060052
jrperritt29ae6b32016-04-13 12:59:37 -050053func (e ErrNoAuthURL) Error() string {
Jon Perritt376dfce2016-02-28 23:39:09 -060054 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 Perritta33da232016-03-02 04:43:08 -060059type ErrNoUsername struct{ gophercloud.ErrInvalidInput }
Jon Perritt376dfce2016-02-28 23:39:09 -060060
jrperritt29ae6b32016-04-13 12:59:37 -050061func (e ErrNoUsername) Error() string {
Jon Perritt376dfce2016-02-28 23:39:09 -060062 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 Perritta33da232016-03-02 04:43:08 -060067type ErrNoPassword struct{ gophercloud.ErrInvalidInput }
Jon Perritt376dfce2016-02-28 23:39:09 -060068
jrperritt29ae6b32016-04-13 12:59:37 -050069func (e ErrNoPassword) Error() string {
Jon Perritt376dfce2016-02-28 23:39:09 -060070 return "Environment variable OS_PASSWORD needs to be set."
71}