tokens

package
v0.2.0-rc3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 1, 2015 License: Apache-2.0, Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package tokens provides information and interaction with the token API resource for the OpenStack Identity service. For more information, see: http://developer.openstack.org/api-ref-identity-v2.html#identity-auth-v2

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrUserIDProvided is returned if you attempt to authenticate with a UserID.
	ErrUserIDProvided = unacceptedAttributeErr("UserID")

	// ErrAPIKeyProvided is returned if you attempt to authenticate with an APIKey.
	ErrAPIKeyProvided = unacceptedAttributeErr("APIKey")

	// ErrDomainIDProvided is returned if you attempt to authenticate with a DomainID.
	ErrDomainIDProvided = unacceptedAttributeErr("DomainID")

	// ErrDomainNameProvided is returned if you attempt to authenticate with a DomainName.
	ErrDomainNameProvided = unacceptedAttributeErr("DomainName")

	// ErrUsernameRequired is returned if you attempt ot authenticate without a Username.
	ErrUsernameRequired = errors.New("You must supply a Username in your AuthOptions.")

	// ErrPasswordRequired is returned if you don't provide a password.
	ErrPasswordRequired = errors.New("Please supply a Password in your AuthOptions.")
)

Functions

func CreateURL

func CreateURL(client *gophercloud.ServiceClient) string

CreateURL generates the URL used to create new Tokens.

Types

type AuthOptions

type AuthOptions struct {
	gophercloud.AuthOptions
}

AuthOptions wraps a gophercloud AuthOptions in order to adhere to the AuthOptionsBuilder interface.

func WrapOptions

func WrapOptions(original gophercloud.AuthOptions) AuthOptions

WrapOptions embeds a root AuthOptions struct in a package-specific one.

func (AuthOptions) ToTokenCreateMap

func (auth AuthOptions) ToTokenCreateMap() (map[string]interface{}, error)

ToTokenCreateMap converts AuthOptions into nested maps that can be serialized into a JSON request.

type AuthOptionsBuilder

type AuthOptionsBuilder interface {

	// ToTokenCreateMap assembles the Create request body, returning an error if parameters are
	// missing or inconsistent.
	ToTokenCreateMap() (map[string]interface{}, error)
}

AuthOptionsBuilder describes any argument that may be passed to the Create call.

type CatalogEntry

type CatalogEntry struct {
	// Name will contain the provider-specified name for the service.
	Name string `mapstructure:"name"`

	// Type will contain a type string if OpenStack defines a type for the service.
	// Otherwise, for provider-specific services, the provider may assign their own type strings.
	Type string `mapstructure:"type"`

	// Endpoints will let the caller iterate over all the different endpoints that may exist for
	// the service.
	Endpoints []Endpoint `mapstructure:"endpoints"`
}

CatalogEntry provides a type-safe interface to an Identity API V2 service catalog listing. Each class of service, such as cloud DNS or block storage services, will have a single CatalogEntry representing it.

Note: when looking for the desired service, try, whenever possible, to key off the type field. Otherwise, you'll tie the representation of the service to a specific provider.

type CreateResult

type CreateResult struct {
	gophercloud.Result
}

CreateResult defers the interpretation of a created token. Use ExtractToken() to interpret it as a Token, or ExtractServiceCatalog() to interpret it as a service catalog.

func Create

Create authenticates to the identity service and attempts to acquire a Token. If successful, the CreateResult Generally, rather than interact with this call directly, end users should call openstack.AuthenticatedClient(), which abstracts all of the gory details about navigating service catalogs and such.

func (CreateResult) ExtractServiceCatalog

func (result CreateResult) ExtractServiceCatalog() (*ServiceCatalog, error)

ExtractServiceCatalog returns the ServiceCatalog that was generated along with the user's Token.

func (CreateResult) ExtractToken

func (result CreateResult) ExtractToken() (*Token, error)

ExtractToken returns the just-created Token from a CreateResult.

type Endpoint

type Endpoint struct {
	TenantID    string `mapstructure:"tenantId"`
	PublicURL   string `mapstructure:"publicURL"`
	InternalURL string `mapstructure:"internalURL"`
	AdminURL    string `mapstructure:"adminURL"`
	Region      string `mapstructure:"region"`
	VersionID   string `mapstructure:"versionId"`
	VersionInfo string `mapstructure:"versionInfo"`
	VersionList string `mapstructure:"versionList"`
}

Endpoint represents a single API endpoint offered by a service. It provides the public and internal URLs, if supported, along with a region specifier, again if provided. The significance of the Region field will depend upon your provider.

In addition, the interface offered by the service will have version information associated with it through the VersionId, VersionInfo, and VersionList fields, if provided or supported.

In all cases, fields which aren't supported by the provider and service combined will assume a zero-value ("").

type ServiceCatalog

type ServiceCatalog struct {
	Entries []CatalogEntry
}

ServiceCatalog provides a view into the service catalog from a previous, successful authentication.

type Token

type Token struct {
	// ID provides the primary means of identifying a user to the OpenStack API.
	// OpenStack defines this field as an opaque value, so do not depend on its content.
	// It is safe, however, to compare for equality.
	ID string

	// ExpiresAt provides a timestamp in ISO 8601 format, indicating when the authentication token becomes invalid.
	// After this point in time, future API requests made using this authentication token will respond with errors.
	// Either the caller will need to reauthenticate manually, or more preferably, the caller should exploit automatic re-authentication.
	// See the AuthOptions structure for more details.
	ExpiresAt time.Time

	// Tenant provides information about the tenant to which this token grants access.
	Tenant tenants.Tenant
}

Token provides only the most basic information related to an authentication token.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL