gophercloud: github.com/gophercloud/gophercloud/openstack/objectstorage/v1/accounts Index | Files | Directories

package accounts

import "github.com/gophercloud/gophercloud/openstack/objectstorage/v1/accounts"

Package accounts contains functionality for working with Object Storage account resources. An account is the top-level resource the object storage hierarchy: containers belong to accounts, objects belong to containers.

Another way of thinking of an account is like a namespace for all your resources. It is synonymous with a project or tenant in other OpenStack services.

Example to Get an Account

account, err := accounts.Get(objectStorageClient, nil).Extract()
fmt.Printf("%+v\n", account)

Example to Update an Account

metadata := map[string]string{
	"some": "metadata",
}

updateOpts := accounts.UpdateOpts{
	Metadata: metadata,
}

updateResult, err := accounts.Update(objectStorageClient, updateOpts).Extract()
fmt.Printf("%+v\n", updateResult)

Index

Package Files

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

type GetHeader Uses

type GetHeader struct {
    BytesUsed      int64     `json:"-"`
    QuotaBytes     *int64    `json:"-"`
    ContainerCount int64     `json:"-"`
    ContentLength  int64     `json:"-"`
    ObjectCount    int64     `json:"-"`
    ContentType    string    `json:"Content-Type"`
    TransID        string    `json:"X-Trans-Id"`
    TempURLKey     string    `json:"X-Account-Meta-Temp-URL-Key"`
    TempURLKey2    string    `json:"X-Account-Meta-Temp-URL-Key-2"`
    Date           time.Time `json:"-"`
}

GetHeader represents the headers returned in the response from a Get request.

func (*GetHeader) UnmarshalJSON Uses

func (r *GetHeader) UnmarshalJSON(b []byte) error

type GetOpts Uses

type GetOpts struct {
    Newest bool `h:"X-Newest"`
}

GetOpts is a structure that contains parameters for getting an account's metadata.

func (GetOpts) ToAccountGetMap Uses

func (opts GetOpts) ToAccountGetMap() (map[string]string, error)

ToAccountGetMap formats a GetOpts into a map[string]string of headers.

type GetOptsBuilder Uses

type GetOptsBuilder interface {
    ToAccountGetMap() (map[string]string, error)
}

GetOptsBuilder allows extensions to add additional headers to the Get request.

type GetResult Uses

type GetResult struct {
    gophercloud.HeaderResult
}

GetResult is returned from a call to the Get function.

func Get Uses

func Get(c *gophercloud.ServiceClient, opts GetOptsBuilder) (r GetResult)

Get is a function that retrieves an account's metadata. To extract just the custom metadata, call the ExtractMetadata method on the GetResult. To extract all the headers that are returned (including the metadata), call the Extract method on the GetResult.

func (GetResult) Extract Uses

func (r GetResult) Extract() (*GetHeader, error)

Extract will return a struct of headers returned from a call to Get.

func (GetResult) ExtractMetadata Uses

func (r GetResult) ExtractMetadata() (map[string]string, error)

ExtractMetadata is a function that takes a GetResult (of type *http.Response) and returns the custom metatdata associated with the account.

type UpdateHeader Uses

type UpdateHeader struct {
    ContentLength int64     `json:"-"`
    ContentType   string    `json:"Content-Type"`
    TransID       string    `json:"X-Trans-Id"`
    Date          time.Time `json:"-"`
}

UpdateHeader represents the headers returned in the response from an Update request.

func (*UpdateHeader) UnmarshalJSON Uses

func (r *UpdateHeader) UnmarshalJSON(b []byte) error

type UpdateOpts Uses

type UpdateOpts struct {
    Metadata          map[string]string
    ContentType       string `h:"Content-Type"`
    DetectContentType bool   `h:"X-Detect-Content-Type"`
    TempURLKey        string `h:"X-Account-Meta-Temp-URL-Key"`
    TempURLKey2       string `h:"X-Account-Meta-Temp-URL-Key-2"`
}

UpdateOpts is a structure that contains parameters for updating, creating, or deleting an account's metadata.

func (UpdateOpts) ToAccountUpdateMap Uses

func (opts UpdateOpts) ToAccountUpdateMap() (map[string]string, error)

ToAccountUpdateMap formats an UpdateOpts into a map[string]string of headers.

type UpdateOptsBuilder Uses

type UpdateOptsBuilder interface {
    ToAccountUpdateMap() (map[string]string, error)
}

UpdateOptsBuilder allows extensions to add additional headers to the Update request.

type UpdateResult Uses

type UpdateResult struct {
    gophercloud.HeaderResult
}

UpdateResult is returned from a call to the Update function.

func Update Uses

func Update(c *gophercloud.ServiceClient, opts UpdateOptsBuilder) (r UpdateResult)

Update is a function that creates, updates, or deletes an account's metadata. To extract the headers returned, call the Extract method on the UpdateResult.

func (UpdateResult) Extract Uses

func (r UpdateResult) Extract() (*UpdateHeader, error)

Extract will return a struct of headers returned from a call to Get. To obtain a map of headers, call the Extract method on the GetResult.

Directories

PathSynopsis
testingaccounts unit tests

Package accounts imports 5 packages (graph) and is imported by 1 packages. Updated 2019-08-02. Refresh now. Tools for package owners.