Class OpenStack::Swift::Connection
In: lib/openstack/swift/connection.rb
Parent: Object

Methods

Attributes

connection  [RW] 

Public Class methods

Public Instance methods

Returns true if the authentication was successful and returns false otherwise.

  cf.authok?
  => true

The total size in bytes under this connection

Returns an OpenStack::Swift::Container object that can be manipulated easily. Throws a OpenStack::Exception::ItemNotFound if the container doesn‘t exist.

   container = cf.container('test')
   container.count
   => 2
   container = cf.container("no_such_container")
   => OpenStack::Exception::ItemNotFound: The resource could not be found

Returns true if the requested container exists and returns false otherwise.

  cf.container_exists?('good_container')
  => true

  cf.container_exists?('bad_container')
  => false

Gathers a list of the containers that exist for the account and returns the list of container names as an array. If no containers exist, an empty array is returned.

If you supply the optional limit and marker parameters, the call will return the number of containers specified in limit, starting after the object named in marker.

  cf.containers
  => ["backup", "Books", "cftest", "test", "video", "webpics"]

  cf.containers(2,'cftest')
  => ["test", "video"]

Retrieves a list of containers on the account along with their sizes (in bytes) and counts of the objects held within them. If no containers exist, an empty hash is returned.

If you supply the optional limit and marker parameters, the call will return the number of containers specified in limit, starting after the object named in marker.

  cf.containers_detail
  => { "container1" => { :bytes => "36543", :count => "146" },
       "container2" => { :bytes => "105943", :count => "25" } }

The total number of containers under this connection

Creates a new container and returns the OpenStack::Swift::Container object.

"/" is not valid in a container name. The container name is limited to 256 characters or less.

  container = cf.create_container('new_container')
  container.name
  => "new_container"

  container = cf.create_container('bad/name')
  => OpenStack::Exception::InvalidArgument: Container name cannot contain '/'

Deletes a container from the account. Throws a OpenStack::Exception::ResourceStateConflict if the container still contains objects. Throws a OpenStack::Exception::ItemNotFound if the container doesn‘t exist.

  cf.delete_container('new_container')
  => true

  cf.delete_container('video')
  => OpenStack::Exception::ResourceStateConflict: The container: "video" is not empty. There was a conflict with the state of the resource

  cf.delete_container('nonexistent')
  => OpenStack::Exception::ItemNotFound: The container: "nonexistant" does not exist. The resource could not be found
get_container(name)

Alias for container

Sets instance variables for the bytes of storage used for this account/connection, as well as the number of containers stored under the account. Returns a hash with :bytes and :count keys, and also sets the instance variables.

  cf.get_info
  => {:count=>8, :bytes=>42438527}
  cf.bytes
  => 42438527

Hostname of the storage server

list_containers(limit = nil, marker = nil)

Alias for containers

list_containers_info(limit = nil, marker = nil)

Alias for containers_detail

[Validate]