Class: DeltacloudVM::Client::Bucket

Inherits:
Base
  • Object
show all
Includes:
Methods::Blob, Methods::Bucket
Defined in:
lib/deltacloud_vm/client/models/bucket.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#description, #name, #obj_id, #url

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Methods::Blob

#blob, #create_blob, #destroy_blob

Methods included from Methods::Bucket

#bucket, #buckets, #create_bucket, #destroy_bucket

Methods inherited from Base

#client, #connection, convert, #entrypoint, from_collection, #id, #initialize, #original_body, #to_s, #update_instance_variables!, validate_attrs!

Methods included from Helpers::XmlHelper

#extract_xml_body

Methods included from Methods::Api

#api_uri, #current_driver, #current_provider, #feature?, #features, #must_support!, #path, #support?, #supported_collections, #version

Methods included from Helpers::Model

#error, #from_collection, #from_resource, #model

Constructor Details

This class inherits a constructor from DeltacloudVM::Client::Base

Instance Attribute Details

#blob_idsObject (readonly)

Returns the value of attribute blob_ids.



27
28
29
# File 'lib/deltacloud_vm/client/models/bucket.rb', line 27

def blob_ids
  @blob_ids
end

#sizeObject (readonly)

Custom attributes:



26
27
28
# File 'lib/deltacloud_vm/client/models/bucket.rb', line 26

def size
  @size
end

Class Method Details

.parse(xml_body) ⇒ Object

Parse the Bucket entity from XML body

  • xml_body -> DeltacloudVM API XML representation of the bucket



58
59
60
61
62
63
# File 'lib/deltacloud_vm/client/models/bucket.rb', line 58

def self.parse(xml_body)
  {
    :size => xml_body.text_at(:size),
    :blob_ids => xml_body.xpath('blob').map { |b| b['id'] }
  }
end

Instance Method Details

#add_blob(blob_name, blob_data, blob_create_opts = {}) ⇒ Object

Add a new blob to the bucket. See: methods/blob.rb create_blob



43
44
45
# File 'lib/deltacloud_vm/client/models/bucket.rb', line 43

def add_blob(blob_name, blob_data, blob_create_opts={})
  create_blob(_id, blob_name, blob_data, create_opts)
end

#blobs(bucket_id = nil) ⇒ Object

All blobs associated with the current bucket The ‘bucket_id’ should not be set in this case.



36
37
38
# File 'lib/deltacloud_vm/client/models/bucket.rb', line 36

def blobs(bucket_id=nil)
  super(_id)
end

#remove_blob(blob_id) ⇒ Object

Remove a blob from the bucket See: methods/blob.rb destroy_blob



50
51
52
# File 'lib/deltacloud_vm/client/models/bucket.rb', line 50

def remove_blob(blob_id)
  destroy_blob(_id, blob_id)
end