Class: Deltacloud::Drivers::Azure::AzureDriver

Inherits:
BaseDriver
  • Object
show all
Defined in:
lib/deltacloud/drivers/azure/azure_driver.rb

Instance Method Summary collapse

Methods inherited from BaseDriver

#blob, #bucket, #catched_exceptions_list, #create_blob, #create_instance, declare_feature, define_hardware_profile, define_instance_states, #delete_blob, feature, feature_decl_for, feature_decls, #features, features, #filter_hardware_profiles, #filter_on, #find_hardware_profile, #hardware_profile, hardware_profiles, #hardware_profiles, #has_collection?, #image, #images, #instance, #instance_actions_for, instance_state_machine, #instance_state_machine, #instances, #realm, #realms, #reboot_instance, #safely, #start_instance, #stop_instance, #storage_snapshot, #storage_snapshots, #storage_volume, #storage_volumes

Instance Method Details

#blob_data(credentials, bucket_id, blob_id, opts) {|WAZ::Blobs::Container.find(bucket_id)[blob_id].value| ... } ⇒ Object

Yields:

  • (WAZ::Blobs::Container.find(bucket_id)[blob_id].value)


84
85
86
87
88
# File 'lib/deltacloud/drivers/azure/azure_driver.rb', line 84

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 –



71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/deltacloud/drivers/azure/azure_driver.rb', line 71

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 –



34
35
36
37
38
39
40
41
42
43
# File 'lib/deltacloud/drivers/azure/azure_driver.rb', line 34

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_bucket(credentials, name, opts) ⇒ Object

– Create bucket –



48
49
50
51
52
53
54
55
56
# File 'lib/deltacloud/drivers/azure/azure_driver.rb', line 48

def create_bucket(credentials, name, opts)
  bucket = nil
  azure_connect(credentials)
  safely do
    waz_container = WAZ::Blobs::Container.create(name)
    bucket = convert_container(waz_container)
  end
  bucket
end

#delete_bucket(credentials, name, opts) ⇒ Object

– Delete bucket –



61
62
63
64
65
66
# File 'lib/deltacloud/drivers/azure/azure_driver.rb', line 61

def delete_bucket(credentials, name, opts)
  azure_connect(credentials)
  safely do
    WAZ::Blobs::Container.find(name).destroy!
  end
end

#supported_collectionsObject



28
29
# File 'lib/deltacloud/drivers/azure/azure_driver.rb', line 28

def supported_collections; [:buckets]
end