Documentation ¶
Overview ¶
Package common provides interfaces and ability to allow getting tokens and service urls independent of the auth version.
Index ¶
- type AuthenticationParameters
- type Authenticator
- type SimpleAuthenticator
- func (a *SimpleAuthenticator) Function() requester.SendRequestFunction
- func (a SimpleAuthenticator) GetServiceURL(serviceType string, version string) (string, error)
- func (a SimpleAuthenticator) GetToken() (string, error)
- func (a *SimpleAuthenticator) SetFunction(requestFunction requester.SendRequestFunction)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthenticationParameters ¶
type AuthenticationParameters struct { AuthURL string TenantID string TenantName string Username string Password string Region string CACert string AuthToken string }
AuthenticationParameters has all the parameters that are standard env vars for open stack using the python client.
func FromEnvVars ¶
func FromEnvVars() (AuthenticationParameters, error)
FromEnvVars will read the authURL, TenantID, TenantName Username, password and region from standard openstack env variables and create a new set of authentication parameters.
type Authenticator ¶
type Authenticator interface { // GetToken returns a string that can be used as the X-Auth-Token for openstack requests or an error. GetToken() (string, error) // GetServiceURL searches the service catalog and version endpoints if needed to // find a service endpoint specified. If nothing is found an error should be // returned. GetServiceURL(serviceType string, version string) (string, error) }
Authenticator gives the ability to authenticate and get information from the service catalog in a version independent way.
type SimpleAuthenticator ¶
type SimpleAuthenticator struct { Token string ServiceURL string Error error // contains filtered or unexported fields }
SimpleAuthenticator is an authenticator for scenarios where hardcoded token and service url are used. Useful for testing scenarios.
func NewSimpleAuthenticator ¶
func NewSimpleAuthenticator(token, serviceURL string) SimpleAuthenticator
NewSimpleAuthenticator creates a new authenticator with no errors.
func (*SimpleAuthenticator) Function ¶
func (a *SimpleAuthenticator) Function() requester.SendRequestFunction
Function will retrieve a function that can make a request.
func (SimpleAuthenticator) GetServiceURL ¶
func (a SimpleAuthenticator) GetServiceURL(serviceType string, version string) (string, error)
GetServiceURL returns the Token string and error in the struct.
func (SimpleAuthenticator) GetToken ¶
func (a SimpleAuthenticator) GetToken() (string, error)
GetToken returns the Token string and error in the struct.
func (*SimpleAuthenticator) SetFunction ¶
func (a *SimpleAuthenticator) SetFunction(requestFunction requester.SendRequestFunction)
SetFunction will set the Function used to make requests.