gophercloud: Index | Files | Directories

package swauth

import ""

Package swauth implements Swift's built-in authentication.

Example to Authenticate with swauth

authOpts := swauth.AuthOpts{
	User: "project:user",
	Key:  "password",

swiftClient, err := swauth.NewObjectStorageV1(providerClient, authOpts)
if err != nil {


Package Files

doc.go requests.go results.go urls.go

func NewObjectStorageV1 Uses

func NewObjectStorageV1(pc *gophercloud.ProviderClient, authOpts AuthOpts) (*gophercloud.ServiceClient, error)

NewObjectStorageV1 creates a Swauth-authenticated *gophercloud.ServiceClient client that can issue ObjectStorage-based API calls.

type AuthOpts Uses

type AuthOpts struct {
    // User is an Swauth-based username in username:tenant format.
    User string `h:"X-Auth-User" required:"true"`

    // Key is a secret/password to authenticate the User with.
    Key string `h:"X-Auth-Key" required:"true"`

AuthOpts specifies an authentication request.

func (AuthOpts) ToAuthOptsMap Uses

func (opts AuthOpts) ToAuthOptsMap() (map[string]string, error)

ToAuthOptsMap formats an AuthOpts structure into a request body.

type AuthOptsBuilder Uses

type AuthOptsBuilder interface {
    ToAuthOptsMap() (map[string]string, error)

AuthOptsBuilder describes struct types that can be accepted by the Auth call.

type AuthResult Uses

type AuthResult struct {
    Token      string `json:"X-Auth-Token"`
    StorageURL string `json:"X-Storage-Url"`
    CDNURL     string `json:"X-CDN-Management-Url"`

AuthResult contains the authentication information from a Swauth authentication request.

type GetAuthResult Uses

type GetAuthResult struct {

GetAuthResult contains the response from the Auth request. Call its Extract method to interpret it as an AuthResult.

func Auth Uses

func Auth(c *gophercloud.ProviderClient, opts AuthOptsBuilder) (r GetAuthResult)

Auth performs an authentication request for a Swauth-based user.

func (GetAuthResult) Extract Uses

func (r GetAuthResult) Extract() (*AuthResult, error)

Extract is a method that attempts to interpret any Swauth authentication response as a AuthResult struct.


testingswauth unit tests

Package swauth imports 1 packages (graph) and is imported by 12 packages. Updated 2018-05-02. Refresh now. Tools for package owners.