Class: AzureClient::Client
- Inherits:
-
Object
- Object
- AzureClient::Client
- Defined in:
- lib/azure_client/client.rb
Instance Method Summary collapse
- #get_container(name, retry_policy = ExponentialRetryPolicy.new(5,1,2)) ⇒ Object
- #get_queue(name, retry_policy = ExponentialRetryPolicy.new(5,1,2)) ⇒ Object
- #get_table(name, retry_policy = ExponentialRetryPolicy.new(2,1,2)) ⇒ Object
-
#initialize(account_name, access_key) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(account_name, access_key) ⇒ Client
Returns a new instance of Client.
4 5 6 7 8 9 |
# File 'lib/azure_client/client.rb', line 4 def initialize(account_name, access_key) Azure.configure do |config| config.storage_account_name = account_name config.storage_access_key = access_key end end |
Instance Method Details
#get_container(name, retry_policy = ExponentialRetryPolicy.new(5,1,2)) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/azure_client/client.rb', line 16 def get_container(name, retry_policy = ExponentialRetryPolicy.new(5,1,2)) if !(blob_service.list_containers.map {|container| container.name}.include?(name)) blob_service.create_container(name) end return Container.new(name, blob_service, retry_policy) end |
#get_queue(name, retry_policy = ExponentialRetryPolicy.new(5,1,2)) ⇒ Object
11 12 13 14 |
# File 'lib/azure_client/client.rb', line 11 def get_queue(name, retry_policy = ExponentialRetryPolicy.new(5,1,2)) queue_service.create_queue(name) return Queue.new(name, queue_service, retry_policy) end |
#get_table(name, retry_policy = ExponentialRetryPolicy.new(2,1,2)) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/azure_client/client.rb', line 23 def get_table(name, retry_policy = ExponentialRetryPolicy.new(2,1,2)) if !(table_service.query_tables.map {|hash| hash[:properties]["TableName"]}.include?(name)) table_service.create_table(name) end return Table.new(name, table_service, retry_policy) end |