cdncontainers

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Overview

Package cdncontainers provides information and interaction with the CDN Container API resource for the Rackspace Cloud Files service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractNames

func ExtractNames(page pagination.Page) ([]string, error)

ExtractNames interprets a page of List results when just the container names are requested.

func List

List is a function that retrieves containers associated with the account as well as account metadata. It returns a pager which can be iterated with the EachPage function.

Types

type EnableHeader added in v0.2.0

type EnableHeader struct {
	CDNIosURI       string    `mapstructure:"X-Cdn-Ios-Uri"`
	CDNSslURI       string    `mapstructure:"X-Cdn-Ssl-Uri"`
	CDNStreamingURI string    `mapstructure:"X-Cdn-Streaming-Uri"`
	CDNUri          string    `mapstructure:"X-Cdn-Uri"`
	ContentLength   int       `mapstructure:"Content-Length"`
	ContentType     string    `mapstructure:"Content-Type"`
	Date            time.Time `mapstructure:"-"`
	TransID         string    `mapstructure:"X-Trans-Id"`
}

EnableHeader represents the headers returned in the response from an Enable request.

type EnableOpts

type EnableOpts struct {
	// CDNEnabled indicates whether or not the container is CDN enabled. Set to
	// `true` to enable the container. Note that changing this setting from true
	// to false will disable the container in the CDN but only after the TTL has
	// expired.
	CDNEnabled bool `h:"X-Cdn-Enabled"`
	// TTL is the time-to-live for the container (in seconds).
	TTL int `h:"X-Ttl"`
}

EnableOpts is a structure that holds options for enabling a CDN container.

func (EnableOpts) ToCDNContainerEnableMap

func (opts EnableOpts) ToCDNContainerEnableMap() (map[string]string, error)

ToCDNContainerEnableMap formats an EnableOpts into a map of headers.

type EnableOptsBuilder

type EnableOptsBuilder interface {
	ToCDNContainerEnableMap() (map[string]string, error)
}

EnableOptsBuilder allows extensions to add additional parameters to the Enable request.

type EnableResult

type EnableResult struct {
	gophercloud.HeaderResult
}

EnableResult represents the result of an Enable operation.

func Enable

func Enable(c *gophercloud.ServiceClient, containerName string, opts EnableOptsBuilder) EnableResult

Enable is a function that enables/disables a CDN container.

func (EnableResult) Extract added in v0.2.0

func (er EnableResult) Extract() (EnableHeader, error)

Extract will return extract an EnableHeader from the response to an Enable request. To obtain a map of headers, call the ExtractHeader method on the EnableResult.

type GetHeader added in v0.2.0

type GetHeader struct {
	CDNEnabled      bool      `mapstructure:"X-Cdn-Enabled"`
	CDNIosURI       string    `mapstructure:"X-Cdn-Ios-Uri"`
	CDNSslURI       string    `mapstructure:"X-Cdn-Ssl-Uri"`
	CDNStreamingURI string    `mapstructure:"X-Cdn-Streaming-Uri"`
	CDNUri          string    `mapstructure:"X-Cdn-Uri"`
	ContentLength   int       `mapstructure:"Content-Length"`
	ContentType     string    `mapstructure:"Content-Type"`
	Date            time.Time `mapstructure:"-"`
	LogRetention    bool      `mapstructure:"X-Log-Retention"`
	TransID         string    `mapstructure:"X-Trans-Id"`
	TTL             int       `mapstructure:"X-Ttl"`
}

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

type GetResult added in v0.2.0

type GetResult struct {
	gophercloud.HeaderResult
}

GetResult represents the result of a Get operation.

func Get

func Get(c *gophercloud.ServiceClient, containerName string) GetResult

Get is a function that retrieves the metadata of a container. To extract just the custom metadata, pass the GetResult response to the ExtractMetadata function.

func (GetResult) Extract added in v0.2.0

func (gr GetResult) Extract() (GetHeader, error)

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

func (GetResult) ExtractMetadata added in v0.2.0

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

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

type ListOpts

type ListOpts struct {
	EndMarker string `q:"end_marker"`
	Format    string `q:"format"`
	Limit     int    `q:"limit"`
	Marker    string `q:"marker"`
}

ListOpts are options for listing Rackspace CDN containers.

func (ListOpts) ToContainerListParams

func (opts ListOpts) ToContainerListParams() (bool, string, error)

ToContainerListParams formats a ListOpts into a query string and boolean representing whether to list complete information for each container.

type State added in v0.2.0

type State *bool

State is the state of an option. It is a pointer to a boolean to enable checking for a zero-value of nil instead of false, which is a valid option.

var (

	// Enabled is used for a true value for options in request bodies.
	Enabled State = &iTrue
	// Disabled is used for a false value for options in request bodies.
	Disabled State = &iFalse
)

type UpdateHeader added in v0.2.0

type UpdateHeader struct {
	CDNIosURI       string    `mapstructure:"X-Cdn-Ios-Uri"`
	CDNSslURI       string    `mapstructure:"X-Cdn-Ssl-Uri"`
	CDNStreamingURI string    `mapstructure:"X-Cdn-Streaming-Uri"`
	CDNUri          string    `mapstructure:"X-Cdn-Uri"`
	ContentLength   int       `mapstructure:"Content-Length"`
	ContentType     string    `mapstructure:"Content-Type"`
	Date            time.Time `mapstructure:"-"`
	TransID         string    `mapstructure:"X-Trans-Id"`
}

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

type UpdateOpts

type UpdateOpts struct {
	// Whether or not to CDN-enable a container. Prefer using XCDNEnabled, which
	// is of type *bool underneath.
	// TODO v2.0: change type to Enabled/Disabled (*bool)
	CDNEnabled bool `h:"X-Cdn-Enabled"`
	// Whether or not to enable log retention. Prefer using XLogRetention, which
	// is of type *bool underneath.
	// TODO v2.0: change type to Enabled/Disabled (*bool)
	LogRetention  bool `h:"X-Log-Retention"`
	XCDNEnabled   *bool
	XLogRetention *bool
	TTL           int `h:"X-Ttl"`
}

UpdateOpts is a structure that holds parameters for updating, creating, or deleting a container's metadata.

func (UpdateOpts) ToContainerUpdateMap

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

ToContainerUpdateMap formats a CreateOpts into a map of headers.

type UpdateOptsBuilder added in v0.2.0

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

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

type UpdateResult added in v0.2.0

type UpdateResult struct {
	gophercloud.HeaderResult
}

UpdateResult represents the result of an update operation. To extract the the headers from the HTTP response, you can invoke the 'ExtractHeader' method on the result struct.

func Update

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

Update is a function that creates, updates, or deletes a container's metadata.

func (UpdateResult) Extract added in v0.2.0

func (ur UpdateResult) Extract() (UpdateHeader, error)

Extract will return a struct of headers returned from a call to Update. To obtain a map of headers, call the ExtractHeader method on the UpdateResult.

Jump to

Keyboard shortcuts

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