Module: Azure::Storage::Common::Configurable
- Included in:
- Client
- Defined in:
- lib/azure/storage/common/configurable.rb
Overview
The Azure::Storage::Common::Configurable module provides basic configuration for Azure storage activities.
Instance Attribute Summary collapse
-
#signer ⇒ Object
readonly
Returns the value of attribute signer.
-
#storage_access_key ⇒ Object
Returns the value of attribute storage_access_key.
-
#storage_account_name ⇒ String
Azure Storage account name.
-
#storage_blob_host(isSecondary = false) ⇒ String
Storage blob host.
-
#storage_blob_host_secondary ⇒ Object
writeonly
Sets the attribute storage_blob_host_secondary.
-
#storage_connection_string ⇒ String
Azure Storage connection string.
-
#storage_file_host(isSecondary = false) ⇒ String
Storage file host.
-
#storage_file_host_secondary ⇒ Object
writeonly
Sets the attribute storage_file_host_secondary.
-
#storage_queue_host(isSecondary = false) ⇒ String
Storage queue host.
-
#storage_queue_host_secondary ⇒ Object
writeonly
Sets the attribute storage_queue_host_secondary.
-
#storage_sas_token ⇒ Object
Returns the value of attribute storage_sas_token.
-
#storage_table_host(isSecondary = false) ⇒ String
Storage table host.
-
#storage_table_host_secondary ⇒ Object
writeonly
Sets the attribute storage_table_host_secondary.
Class Method Summary collapse
-
.keys ⇒ Array
List of configurable keys for Client.
Instance Method Summary collapse
- #config ⇒ Object
-
#configure {|_self| ... } ⇒ Object
Set configuration options using a block.
-
#reset_config!(options = {}) ⇒ Object
(also: #setup)
Reset configuration options to default values.
Instance Attribute Details
#signer ⇒ Object (readonly)
Returns the value of attribute signer.
69 70 71 |
# File 'lib/azure/storage/common/configurable.rb', line 69 def signer @signer end |
#storage_access_key ⇒ Object
Returns the value of attribute storage_access_key.
55 56 57 |
# File 'lib/azure/storage/common/configurable.rb', line 55 def storage_access_key @storage_access_key end |
#storage_account_name ⇒ String
Returns Azure Storage account name.
55 56 57 58 |
# File 'lib/azure/storage/common/configurable.rb', line 55 attr_accessor :storage_access_key, :storage_account_name, :storage_connection_string, :storage_sas_token |
#storage_blob_host(isSecondary = false) ⇒ String
Storage blob host
55 56 57 58 |
# File 'lib/azure/storage/common/configurable.rb', line 55 attr_accessor :storage_access_key, :storage_account_name, :storage_connection_string, :storage_sas_token |
#storage_blob_host_secondary=(value) ⇒ Object (writeonly)
Sets the attribute storage_blob_host_secondary
60 61 62 |
# File 'lib/azure/storage/common/configurable.rb', line 60 def storage_blob_host_secondary=(value) @storage_blob_host_secondary = value end |
#storage_connection_string ⇒ String
Returns Azure Storage connection string.
55 56 57 58 |
# File 'lib/azure/storage/common/configurable.rb', line 55 attr_accessor :storage_access_key, :storage_account_name, :storage_connection_string, :storage_sas_token |
#storage_file_host(isSecondary = false) ⇒ String
Storage file host
153 154 155 156 157 158 159 |
# File 'lib/azure/storage/common/configurable.rb', line 153 def storage_file_host(isSecondary = false) if isSecondary @storage_file_host_secondary || default_host(:file, true) else @storage_file_host || default_host(:file, false) end end |
#storage_file_host_secondary=(value) ⇒ Object (writeonly)
Sets the attribute storage_file_host_secondary
60 61 62 |
# File 'lib/azure/storage/common/configurable.rb', line 60 def storage_file_host_secondary=(value) @storage_file_host_secondary = value end |
#storage_queue_host(isSecondary = false) ⇒ String
Storage queue host
55 56 57 58 |
# File 'lib/azure/storage/common/configurable.rb', line 55 attr_accessor :storage_access_key, :storage_account_name, :storage_connection_string, :storage_sas_token |
#storage_queue_host_secondary=(value) ⇒ Object (writeonly)
Sets the attribute storage_queue_host_secondary
60 61 62 |
# File 'lib/azure/storage/common/configurable.rb', line 60 def storage_queue_host_secondary=(value) @storage_queue_host_secondary = value end |
#storage_sas_token ⇒ Object
Returns the value of attribute storage_sas_token.
55 56 57 |
# File 'lib/azure/storage/common/configurable.rb', line 55 def storage_sas_token @storage_sas_token end |
#storage_table_host(isSecondary = false) ⇒ String
Storage table host
55 56 57 58 |
# File 'lib/azure/storage/common/configurable.rb', line 55 attr_accessor :storage_access_key, :storage_account_name, :storage_connection_string, :storage_sas_token |
#storage_table_host_secondary=(value) ⇒ Object (writeonly)
Sets the attribute storage_table_host_secondary
60 61 62 |
# File 'lib/azure/storage/common/configurable.rb', line 60 def storage_table_host_secondary=(value) @storage_table_host_secondary = value end |
Class Method Details
.keys ⇒ Array
List of configurable keys for Client
74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/azure/storage/common/configurable.rb', line 74 def keys @keys ||= [ :storage_access_key, :storage_account_name, :storage_connection_string, :storage_sas_token, :storage_table_host, :storage_blob_host, :storage_queue_host, :storage_file_host, :signer ] end |
Instance Method Details
#config ⇒ Object
94 95 96 |
# File 'lib/azure/storage/common/configurable.rb', line 94 def config self end |
#configure {|_self| ... } ⇒ Object
Set configuration options using a block
90 91 92 |
# File 'lib/azure/storage/common/configurable.rb', line 90 def configure yield self end |
#reset_config!(options = {}) ⇒ Object Also known as: setup
Reset configuration options to default values
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/azure/storage/common/configurable.rb', line 99 def reset_config!( = {}) Azure::Storage::Common::Configurable.keys.each do |key| value = if self == Azure::Storage::Common Azure::Storage::Common::Default.[key] else self.send(key) end instance_variable_set(:"@#{key}", .fetch(key, value)) # Set the secondary endpoint if the primary one is given if key.to_s.include? "host" instance_variable_set(:"@#{key}_secondary", secondary_endpoint(.fetch(key, value))) end end self.send(:reset_agents!) if self.respond_to?(:reset_agents!) setup_signer_for_service([:api_version]) self end |