Class: Azure::Storage::Common::Client
- Inherits:
-
Object
- Object
- Azure::Storage::Common::Client
- Defined in:
- lib/azure/storage/common/client.rb
Instance Attribute Summary
Attributes included from ClientOptions
#ca_file, #ssl_max_version, #ssl_min_version, #ssl_version
Attributes included from Configurable
#signer, #storage_access_key, #storage_account_name, #storage_blob_host, #storage_blob_host_secondary, #storage_connection_string, #storage_file_host, #storage_file_host_secondary, #storage_queue_host, #storage_queue_host_secondary, #storage_sas_token, #storage_table_host, #storage_table_host_secondary
Class Method Summary collapse
-
.create(options = {}, &block) ⇒ Azure::Storage::Common::Client
Public: Creates an instance of [Azure::Storage::Common::Client].
-
.create_development(proxy_uri = nil, &block) ⇒ Azure::Storage::Common::Client
Public: Creates an instance of [Azure::Storage::Common::Client] with Storage Emulator.
-
.create_from_connection_string(connection_string, &block) ⇒ Azure::Storage::Common::Client
Public: Creates an instance of [Azure::Storage::Common::Client] from Environment Variables.
-
.create_from_env(&block) ⇒ Azure::Storage::Client
Public: Creates an instance of [Azure::Storage::Common::Client] from Environment Variables.
Instance Method Summary collapse
-
#initialize(options = {}, &block) ⇒ Azure::Storage::Common::Client
constructor
Public: Creates an instance of [Azure::Storage::Common::Client].
Methods included from Azure::Storage::Common::Core::HttpClient
Methods included from ClientOptions
connection_string_mapping, env_vars_mapping, #options, #reset!, #same_options?, valid_options
Methods included from Configurable
#config, #configure, keys, #reset_config!
Constructor Details
#initialize(options = {}, &block) ⇒ Azure::Storage::Common::Client
Public: Creates an instance of [Azure::Storage::Common::Client]
Attributes
-
options
- Hash. Optional parameters.
Options
Accepted key/value pairs in options parameter are:
-
:use_development_storage
- TrueClass|FalseClass. Whether to use storage emulator. -
:development_storage_proxy_uri
- String. Used with:use_development_storage
if emulator is hosted other than localhost. -
:storage_connection_string
- String. The storage connection string. -
:storage_account_name
- String. The name of the storage account. -
:storage_access_key
- Base64 String. The access key of the storage account. -
:storage_sas_token
- String. The signed access signature for the storage account or one of its service. -
:storage_blob_host
- String. Specified Blob serivce endpoint or hostname -
:storage_table_host
- String. Specified Table serivce endpoint or hostname -
:storage_queue_host
- String. Specified Queue serivce endpoint or hostname -
:storage_dns_suffix
- String. The suffix of a regional Storage Serivce, to -
:default_endpoints_protocol
- String. http or https -
:use_path_style_uri
- String. Whether use path style URI for specified endpoints -
:ca_file
- String. File path of the CA file if having issue with SSL -
:user_agent_prefix
- String. The user agent prefix that can identify the application calls the library
The valid set of options include:
-
Storage Emulator:
:use_development_storage
required,:development_storage_proxy_uri
optionally -
Storage account name and key:
:storage_account_name
and:storage_access_key
required, set:storage_dns_suffix
necessarily -
Storage account name and SAS token:
:storage_account_name
and:storage_sas_token
required, set:storage_dns_suffix
necessarily -
Specified hosts and SAS token: At least one of the service host and SAS token. It’s up to user to ensure the SAS token is suitable for the serivce
-
Anonymous Blob: only
:storage_blob_host
, if it is to only access blobs within a container
Additional notes:
-
Specified hosts can be set when use account name with access key or sas token
-
:default_endpoints_protocol
can be set if the scheme is not specified in hosts -
Storage emulator always use path style URI
-
:ca_file
is independent.
When empty options are given, it will try to read settings from Environment Variables. Refer to [Azure::Storage::Common::ClientOptions.env_vars_mapping] for the mapping relationship
74 75 76 77 78 79 80 81 |
# File 'lib/azure/storage/common/client.rb', line 74 def initialize( = {}, &block) if .is_a?(Hash) && .has_key?(:user_agent_prefix) Azure::Storage::Common::Service::StorageService.user_agent_prefix = [:user_agent_prefix] .delete :user_agent_prefix end Azure::Storage::Common::Service::StorageService.register_request_callback(&block) if block_given? reset!() end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Azure::Storage::Common::ClientOptions
Class Method Details
.create(options = {}, &block) ⇒ Azure::Storage::Common::Client
Public: Creates an instance of [Azure::Storage::Common::Client]
Attributes
-
options
- Hash. Optional parameters.
Options
Accepted key/value pairs in options parameter are:
-
:use_development_storage
- TrueClass|FalseClass. Whether to use storage emulator. -
:development_storage_proxy_uri
- String. Used with:use_development_storage
if emulator is hosted other than localhost. -
:storage_account_name
- String. The name of the storage account. -
:storage_access_key
- Base64 String. The access key of the storage account. -
:storage_sas_token
- String. The signed access signature for the storage account or one of its service. -
:storage_blob_host
- String. Specified Blob service endpoint or hostname -
:storage_table_host
- String. Specified Table service endpoint or hostname -
:storage_queue_host
- String. Specified Queue service endpoint or hostname -
:storage_dns_suffix
- String. The suffix of a regional Storage Service, to -
:default_endpoints_protocol
- String. http or https -
:use_path_style_uri
- String. Whether use path style URI for specified endpoints -
:ca_file
- String. File path of the CA file if having issue with SSL -
:ssl_version
- Symbol. The ssl version to be used, sample: :TLSv1_1, :TLSv1_2, for the details, see github.com/ruby/openssl/blob/master/lib/openssl/ssl.rb -
:ssl_min_version
- Symbol. The min ssl version supported, only supported in Ruby 2.5+ -
:ssl_max_version
- Symbol. The max ssl version supported, only supported in Ruby 2.5+ -
:user_agent_prefix
- String. The user agent prefix that can identify the application calls the library
The valid set of options include:
-
Storage Emulator:
:use_development_storage
required,:development_storage_proxy_uri
optionally -
Storage account name and key:
:storage_account_name
and:storage_access_key
required, set:storage_dns_suffix
necessarily -
Storage account name and SAS token:
:storage_account_name
and:storage_sas_token
required, set:storage_dns_suffix
necessarily -
Specified hosts and SAS token: At least one of the service host and SAS token. It’s up to user to ensure the SAS token is suitable for the serivce
-
Anonymous Blob: only
:storage_blob_host
, if it is to only access blobs within a container
Additional notes:
-
Specified hosts can be set when use account name with access key or sas token
-
:default_endpoints_protocol
can be set if the scheme is not specified in hosts -
Storage emulator always use path style URI
-
:ca_file
is independent.
When empty options are given, it will try to read settings from Environment Variables. Refer to [Azure::Storage::Common::ClientOptions.env_vars_mapping] for the mapping relationship
127 128 129 |
# File 'lib/azure/storage/common/client.rb', line 127 def create( = {}, &block) client = Client.new(, &block) end |
.create_development(proxy_uri = nil, &block) ⇒ Azure::Storage::Common::Client
Public: Creates an instance of [Azure::Storage::Common::Client] with Storage Emulator
Attributes
-
proxy_uri
- String. Used with:use_development_storage
if emulator is hosted other than localhost.
138 139 140 141 |
# File 'lib/azure/storage/common/client.rb', line 138 def create_development(proxy_uri = nil, &block) proxy_uri ||= StorageServiceClientConstants::DEV_STORE_URI client = create(use_development_storage: true, development_storage_proxy_uri: proxy_uri, &block) end |
.create_from_connection_string(connection_string, &block) ⇒ Azure::Storage::Common::Client
Public: Creates an instance of [Azure::Storage::Common::Client] from Environment Variables
Attributes
-
connection_string
- String. Please refer to azure.microsoft.com/en-us/documentation/articles/storage-configure-connection-string/.
157 158 159 |
# File 'lib/azure/storage/common/client.rb', line 157 def create_from_connection_string(connection_string, &block) client = Client.new(connection_string, &block) end |
.create_from_env(&block) ⇒ Azure::Storage::Client
Public: Creates an instance of [Azure::Storage::Common::Client] from Environment Variables
146 147 148 |
# File 'lib/azure/storage/common/client.rb', line 146 def create_from_env(&block) client = create(&block) end |