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-v3.html#tokens-v3
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Validate ¶
func Validate(c *gophercloud.ServiceClient, token string) (bool, error)
Validate determines if a specified token is valid or not.
Types ¶
type AuthOptions ¶
type AuthOptions struct { // IdentityEndpoint specifies the HTTP endpoint that is required to work with // the Identity API of the appropriate version. While it's ultimately needed by // all of the identity services, it will often be populated by a provider-level // function. IdentityEndpoint string `json:"-"` // Username is required if using Identity V2 API. Consult with your provider's // control panel to discover your account's username. In Identity V3, either // UserID or a combination of Username and DomainID or DomainName are needed. Username string `json:"username,omitempty"` UserID string `json:"id,omitempty"` Password string `json:"password,omitempty"` // At most one of DomainID and DomainName must be provided if using Username // with Identity V3. Otherwise, either are optional. DomainID string `json:"id,omitempty"` DomainName string `json:"name,omitempty"` // AllowReauth should be set to true if you grant permission for Gophercloud to // cache your credentials in memory, and to allow Gophercloud to attempt to // re-authenticate automatically if/when your token expires. If you set it to // false, it will not cache these settings, but re-authentication will not be // possible. This setting defaults to false. AllowReauth bool `json:"-"` // TokenID allows users to authenticate (possibly as another user) with an // authentication token ID. TokenID string `json:"-"` Scope Scope `json:"-"` }
func (*AuthOptions) CanReauth ¶
func (opts *AuthOptions) CanReauth() bool
func (*AuthOptions) ToTokenV3CreateMap ¶
func (opts *AuthOptions) ToTokenV3CreateMap(scope map[string]interface{}) (map[string]interface{}, error)
func (*AuthOptions) ToTokenV3ScopeMap ¶
func (opts *AuthOptions) ToTokenV3ScopeMap() (map[string]interface{}, error)
type AuthOptionsBuilder ¶
type AuthOptionsBuilder interface { // ToTokenV3CreateMap assembles the Create request body, returning an error if parameters are // missing or inconsistent. ToTokenV3CreateMap(map[string]interface{}) (map[string]interface{}, error) ToTokenV3ScopeMap() (map[string]interface{}, error) CanReauth() bool }
AuthOptionsBuilder describes any argument that may be passed to the Create call.
type CatalogEntry ¶
type CatalogEntry struct { // Service ID ID string `json:"id"` // Name will contain the provider-specified name for the service. Name string `json:"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 `json:"type"` // Endpoints will let the caller iterate over all the different endpoints that may exist for // the service. Endpoints []Endpoint `json:"endpoints"` }
CatalogEntry provides a type-safe interface to an Identity API V3 service catalog listing. Each class of service, such as cloud DNS or block storage services, could have multiple CatalogEntry representing it (one by interface type, e.g public, admin or internal).
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 {
// contains filtered or unexported fields
}
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 ¶
func Create(c *gophercloud.ServiceClient, opts AuthOptionsBuilder) (r CreateResult)
Create authenticates and either generates a new token, or changes the Scope of an existing token.
func (CreateResult) Extract ¶
Extract is a shortcut for ExtractToken. This function is deprecated and still present for backward compatibility.
func (CreateResult) ExtractServiceCatalog ¶
func (r CreateResult) ExtractServiceCatalog() (*ServiceCatalog, error)
ExtractServiceCatalog returns the ServiceCatalog that was generated along with the user's Token.
func (CreateResult) ExtractToken ¶
ExtractToken interprets a commonResult as a Token.
type Endpoint ¶
type Endpoint struct { ID string `json:"id"` Region string `json:"region"` Interface string `json:"interface"` URL string `json:"url"` }
Endpoint represents a single API endpoint offered by a service. It matches either a public, internal or admin URL. If supported, it contains a region specifier, again if provided. The significance of the Region field will depend upon your provider.
type GetResult ¶
type GetResult struct {
// contains filtered or unexported fields
}
GetResult is the deferred response from a Get call.
func Get ¶
func Get(c *gophercloud.ServiceClient, token string) (r GetResult)
Get validates and retrieves information about another token.
func (GetResult) Extract ¶
Extract is a shortcut for ExtractToken. This function is deprecated and still present for backward compatibility.
func (GetResult) ExtractToken ¶
ExtractToken interprets a commonResult as a Token.
type RevokeResult ¶
type RevokeResult struct {
// contains filtered or unexported fields
}
RevokeResult is the deferred response from a Revoke call.
func Revoke ¶
func Revoke(c *gophercloud.ServiceClient, token string) (r RevokeResult)
Revoke immediately makes specified token invalid.
func (RevokeResult) Extract ¶
Extract is a shortcut for ExtractToken. This function is deprecated and still present for backward compatibility.
func (RevokeResult) ExtractToken ¶
ExtractToken interprets a commonResult as a Token.
type Scope ¶
type Scope struct { ProjectID string `json:"scope.project.id,omitempty" not:"ProjectName,DomainID,DomainName"` ProjectName string `json:"scope.project.name,omitempty"` DomainID string `json:"scope.project.id,omitempty" not:"ProjectName,ProjectID,DomainName"` DomainName string `json:"scope.project.id,omitempty"` }
Scope allows a created token to be limited to a specific domain or project.
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 is the issued token. ID string `json:"id"` // ExpiresAt is the timestamp at which this token will no longer be accepted. ExpiresAt gophercloud.JSONRFC3339Milli `json:"expires_at"` }
Token is a string that grants a user access to a controlled set of services in an OpenStack provider. Each Token is valid for a set length of time.