Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v2.2.0
type Client struct { // Token is the authentication token for querying an OpenStack API. Token string // URL is the public URL for an OpenStack project. URL string // HTTPClient is the client used for launching HTTP requests. HTTPClient *http.Client // contains filtered or unexported fields }
Client is a struct containing an authentication token and an HTTP client for HTTP requests. It can also have a public URL for an specific OpenStack project or service. "authMetadata" is an unexported attribute used to validate the current token or to renew it against Keystone when it is expired.
func (*Client) IsTokenValid ¶ added in v2.2.0
IsTokenValid checks if a authentication token is valid
type KeystoneAuthRequest ¶ added in v2.2.0
type KeystoneAuthRequest struct { // AuthURL is the Keystone URL. AuthURL string `json:"-"` // HTTPClientTimeout is the HTTP client for querying the OpenStack service API. HTTPClientTimeout time.Duration `json:"-"` // Properties contains the authentication metadata to build the body of a token request. Properties *authProps `json:"auth"` }
KeystoneAuthRequest contains all the necessary metadata for building an authentication request for Keystone, the official OpenStack Identity Provider.
func NewAppCredentialsAuth ¶
func NewAppCredentialsAuth(authURL string, id string, secret string, httpTimeout int) (*KeystoneAuthRequest, error)
NewAppCredentialsAuth creates a struct containing metadata for authentication using the application credentials method
func NewPasswordAuth ¶
func NewPasswordAuth(authURL string, userID string, userPassword string, projectID string, httpTimeout int) (*KeystoneAuthRequest, error)
NewPasswordAuth creates a struct containing metadata for authentication using the password method
func (*KeystoneAuthRequest) RequestClient ¶ added in v2.2.0
func (keystone *KeystoneAuthRequest) RequestClient(ctx context.Context, projectProps ...string) (Client, error)
RequestClient returns a Client containing an HTTP client and a token. If an OpenStack project name is provided as first parameter, it will try to retrieve its API URL using the current credentials. If an OpenStack region or availability zone is provided as second parameter, it will retrieve the service API URL for that region. Otherwise, if the service API URL was found, it retrieves the first public URL for that service.