Class: Deltacloud::Drivers::Azure::AzureDriver
- Inherits:
-
BaseDriver
- Object
- BaseDriver
- Deltacloud::Drivers::Azure::AzureDriver
- Defined in:
- lib/deltacloud/drivers/azure/azure_driver.rb
Constant Summary
Constants inherited from BaseDriver
BaseDriver::MEMBER_SHOW_METHODS
Instance Method Summary collapse
- #blob_data(credentials, bucket_id, blob_id, opts) {|WAZ::Blobs::Container.find(bucket_id)[blob_id].value| ... } ⇒ Object
-
#blobs(credentials, opts) ⇒ Object
– Blobs –.
-
#buckets(credentials, opts) ⇒ Object
– Buckets –.
-
#create_blob(credentials, bucket_id, blob_id, blob_data, opts = nil) ⇒ Object
– Create Blob –.
-
#create_bucket(credentials, name, opts) ⇒ Object
– Create bucket –.
-
#delete_blob(credentials, bucket_id, blob_id, opts = nil) ⇒ Object
– Delete Blob –.
-
#delete_bucket(credentials, name, opts) ⇒ Object
– Delete bucket –.
- #supported_collections ⇒ Object
Methods inherited from BaseDriver
#blob, #bucket, #catched_exceptions_list, declare_feature, define_hardware_profile, define_instance_states, feature, feature_decl_for, feature_decls, #features, features, #features_for_operation, #filter_hardware_profiles, #filter_on, #find_hardware_profile, #hardware_profile, #hardware_profiles, hardware_profiles, #has_capability?, #has_collection?, #image, #instance, #instance_actions_for, #instance_state_machine, instance_state_machine, #key, #realm, #safely, #storage_snapshot, #storage_volume
Instance Method Details
#blob_data(credentials, bucket_id, blob_id, opts) {|WAZ::Blobs::Container.find(bucket_id)[blob_id].value| ... } ⇒ Object
88 89 90 91 92 |
# File 'lib/deltacloud/drivers/azure/azure_driver.rb', line 88 def blob_data(credentials, bucket_id, blob_id, opts) azure_connect(credentials) # WAZ get blob data methods cant accept blocks for 'streaming'... FIXME yield WAZ::Blobs::Container.find(bucket_id)[blob_id].value end |
#blobs(credentials, opts) ⇒ Object
– Blobs –
75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/deltacloud/drivers/azure/azure_driver.rb', line 75 def blobs(credentials, opts) blob_list = [] azure_connect(credentials) safely do the_bucket = WAZ::Blobs::Container.find(opts['bucket']) the_bucket.blobs.each do |waz_blob| blob_list << convert_blob(waz_blob) end end blob_list = filter_on(blob_list, :id, opts) blob_list end |
#buckets(credentials, opts) ⇒ Object
– Buckets –
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/deltacloud/drivers/azure/azure_driver.rb', line 35 def buckets(credentials, opts) buckets = [] azure_connect(credentials) safely do WAZ::Blobs::Container.list.each do |waz_container| buckets << convert_container(waz_container) end end buckets = filter_on(buckets, :id, opts) end |
#create_blob(credentials, bucket_id, blob_id, blob_data, opts = nil) ⇒ Object
– Create Blob –
97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/deltacloud/drivers/azure/azure_driver.rb', line 97 def create_blob(credentials, bucket_id, blob_id, blob_data, opts=nil) azure_connect(credentials) #get a handle to the bucket in order to put there the_bucket = WAZ::Blobs::Container.find(bucket_id) the_bucket.store(blob_id, blob_data[:tempfile], blob_data[:type]) Blob.new( { :id => blob_id, :bucket => bucket_id, :content_lengh => blob_data[:tempfile].length, :content_type => blob_data[:type], :last_modified => '' } ) end |
#create_bucket(credentials, name, opts) ⇒ Object
– Create bucket –
49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/deltacloud/drivers/azure/azure_driver.rb', line 49 def create_bucket(credentials, name, opts) #for whatever reason, bucket names MUST be lowercase... #http://msdn.microsoft.com/en-us/library/dd135715.aspx name.downcase! bucket = nil azure_connect(credentials) safely do waz_container = WAZ::Blobs::Container.create(name) bucket = convert_container(waz_container) end bucket end |
#delete_blob(credentials, bucket_id, blob_id, opts = nil) ⇒ Object
– Delete Blob –
113 114 115 116 117 118 119 |
# File 'lib/deltacloud/drivers/azure/azure_driver.rb', line 113 def delete_blob(credentials, bucket_id, blob_id, opts=nil) azure_connect(credentials) #get a handle to bucket and blob, and destroy! the_bucket = WAZ::Blobs::Container.find(bucket_id) the_blob = the_bucket[blob_id] the_blob.destroy! end |
#delete_bucket(credentials, name, opts) ⇒ Object
– Delete bucket –
65 66 67 68 69 70 |
# File 'lib/deltacloud/drivers/azure/azure_driver.rb', line 65 def delete_bucket(credentials, name, opts) azure_connect(credentials) safely do WAZ::Blobs::Container.find(name).destroy! end end |
#supported_collections ⇒ Object
29 30 |
# File 'lib/deltacloud/drivers/azure/azure_driver.rb', line 29 def supported_collections; [:buckets] end |