github.com/opentelekomcloud/gophertelekomcloud@v0.9.3/openstack/errors.go (about)

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