Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package token providers functions for initial http request body before request cloud.
Index ¶
- type TokenIdOptions
 - type TokenOptions
 - func (opts TokenOptions) CanReauth() bool
 - func (opts TokenOptions) GetDomainId() string
 - func (opts TokenOptions) GetIdentityEndpoint() string
 - func (opts TokenOptions) GetProjectId() string
 - func (opts TokenOptions) ToTokenV2CreateMap() (map[string]interface{}, error)
 - func (opts *TokenOptions) ToTokenV3CreateMap(scope map[string]interface{}) (map[string]interface{}, error)
 - func (opts *TokenOptions) ToTokenV3ScopeMap() (map[string]interface{}, error)
 
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TokenIdOptions ¶
type TokenIdOptions 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.
	//
	// The IdentityEndpoint is typically referred to as the "auth_url" or
	// "OS_AUTH_URL" in the information provided by the cloud operator.
	IdentityEndpoint string `json:"-" required:"true"`
	// AuthToken allows users to authenticate (possibly as another user) with an
	// authentication token ID.
	AuthToken string `json:"-"`
	// user project id
	ProjectID string
	DomainID string `json:"-" required:"true"`
}
    TokenIdOptions presents the required information for token ID auth
func (TokenIdOptions) GetDomainId ¶
func (opts TokenIdOptions) GetDomainId() string
GetDomainId,Implements the method of AuthOptionsProvider
func (TokenIdOptions) GetIdentityEndpoint ¶
func (opts TokenIdOptions) GetIdentityEndpoint() string
GetIdentityEndpoint,Implements the method of AuthOptionsProvider
func (TokenIdOptions) GetProjectId ¶
func (opts TokenIdOptions) GetProjectId() string
GetProjectId, Implements the method of AuthOptionsProvider
type TokenOptions ¶
type TokenOptions 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.
	//
	// The IdentityEndpoint is typically referred to as the "auth_url" or
	// "OS_AUTH_URL" in the information provided by the cloud operator.
	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:"-"`
	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:"-"`
	DomainName string `json:"name,omitempty"`
	// The TenantID and TenantName fields are optional for the Identity V2 API.
	// The same fields are known as project_id and project_name in the Identity
	// V3 API, but are collected as TenantID and TenantName here in both cases.
	// Some providers allow you to specify a TenantName instead of the TenantId.
	// Some require both. Your provider's authentication policies will determine
	// how these fields influence authentication.
	// If DomainID or DomainName are provided, they will also apply to TenantName.
	// It is not currently possible to authenticate with Username and a Domain
	// and scope to a Project in a different Domain by using TenantName. To
	// accomplish that, the ProjectID will need to be provided as the TenantID
	// option.
	TenantID   string `json:"tenantId,omitempty"`
	TenantName string `json:"tenantName,omitempty"`
	ProjectID   string `json:"project_id,omitempty"`
	ProjectName string `json:"project_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.
	//
	// NOTE: The reauth function will try to re-authenticate endlessly if left
	// unchecked. The way to limit the number of attempts is to provide a custom
	// HTTP client to the provider client and provide a transport that implements
	// the RoundTripper interface and stores the number of failed retries. For an
	// example of this, see here:
	// https://github.com/rackspace/rack/blob/1.0.0/auth/clients.go#L311
	AllowReauth bool `json:"-"`
	// TokenID allows users to authenticate (possibly as another user) with an
	// authentication token ID.
	TokenID string `json:"-"`
}
    AuthOptions stores information needed to authenticate to an OpenStack Cloud. You can populate one manually, or use a provider's AuthOptionsFromEnv() function to read relevant information from the standard environment variables. Pass one to a provider's AuthenticatedClient function to authenticate and obtain a ProviderClient representing an active session on that provider.
Its fields are the union of those recognized by each identity implementation and provider.
An example of manually providing authentication information:
opts := gophercloud.AuthOptions{
  IdentityEndpoint: "https://openstack.example.com:5000/v2.0",
  Username: "{username}",
  Password: "{password}",
  TenantID: "{tenant_id}",
}
provider, err := openstack.AuthenticatedClient(opts)
An example of using AuthOptionsFromEnv(), where the environment variables can be read from a file, such as a standard openrc file:
opts, err := openstack.AuthOptionsFromEnv() provider, err := openstack.AuthenticatedClient(opts)
func (TokenOptions) CanReauth ¶
func (opts TokenOptions) CanReauth() bool
func (TokenOptions) GetDomainId ¶
func (opts TokenOptions) GetDomainId() string
func (TokenOptions) GetIdentityEndpoint ¶
func (opts TokenOptions) GetIdentityEndpoint() string
Implements the method of AuthOptionsProvider
func (TokenOptions) GetProjectId ¶
func (opts TokenOptions) GetProjectId() string
func (TokenOptions) ToTokenV2CreateMap ¶
func (opts TokenOptions) ToTokenV2CreateMap() (map[string]interface{}, error)
ToTokenV2CreateMap allows TokenOptions to satisfy the AuthOptionsBuilder interface in the v2 tokens package
func (*TokenOptions) ToTokenV3CreateMap ¶
func (opts *TokenOptions) ToTokenV3CreateMap(scope map[string]interface{}) (map[string]interface{}, error)
func (*TokenOptions) ToTokenV3ScopeMap ¶
func (opts *TokenOptions) ToTokenV3ScopeMap() (map[string]interface{}, error)