class LogStash::Outputs::Application_insights::Client
Public Class Methods
new( storage_account_name, force = nil )
click to toggle source
# File lib/logstash/outputs/application_insights/client.rb, line 27 def initialize ( storage_account_name, force = nil ) @storage_account_name = storage_account_name @storage_account = Clients.instance.active_storage_account( storage_account_name, force ) @tuple = @storage_account[:clients_Q].pop ( @current_storage_account_key_index, @current_azure_storage_auth_sas, @current_azure_storage_client) = @tuple if @current_storage_account_key_index != @storage_account[:valid_index] @current_storage_account_key_index = @storage_account[:valid_index] set_current_storage_account_client @tuple = [ @current_storage_account_key_index, @current_azure_storage_auth_sas, @current_azure_storage_client ] end @storage_account_key_index = @current_storage_account_key_index end
Public Instance Methods
blobClient()
click to toggle source
# File lib/logstash/outputs/application_insights/client.rb, line 56 def blobClient raise UnexpectedBranchError, "client already disposed" unless @tuple @last_client_type = :blobClient # breaking change after azure-storage 0.10.1 # @current_azure_storage_client.blobClient @current_azure_storage_client.blob_client end
dispose( io_failed_reason = nil )
click to toggle source
# File lib/logstash/outputs/application_insights/client.rb, line 41 def dispose ( io_failed_reason = nil ) if @tuple if @current_storage_account_key_index == @storage_account_key_index @storage_account[:clients_Q] << @tuple else @storage_account[:valid_index] = @current_storage_account_key_index @storage_account[:clients_Q] << [ @current_storage_account_key_index, @current_azure_storage_auth_sas, @current_azure_storage_client ] end @tuple = nil Clients.instance.failed_storage_account( @storage_account_name, io_failed_reason ) if io_failed_reason && :blobClient == @last_client_type end nil end
notifyClient()
click to toggle source
# File lib/logstash/outputs/application_insights/client.rb, line 72 def notifyClient raise UnexpectedBranchError, "client already disposed" unless @tuple @last_client_type = :notifyClient @current_azure_storage_client end
storage_auth_sas()
click to toggle source
# File lib/logstash/outputs/application_insights/client.rb, line 78 def storage_auth_sas raise UnexpectedBranchError, "client already disposed" unless @tuple @current_azure_storage_auth_sas end
switch_storage_account_key!()
click to toggle source
# File lib/logstash/outputs/application_insights/client.rb, line 84 def switch_storage_account_key! raise UnexpectedBranchError, "client already disposed" unless @tuple @current_storage_account_key_index = ( @current_storage_account_key_index + 1 ) % @storage_account[:keys].length if @current_storage_account_key_index == @storage_account_key_index rollback_storage_account_key false else set_current_storage_account_client true end end
tableClient()
click to toggle source
# File lib/logstash/outputs/application_insights/client.rb, line 64 def tableClient raise UnexpectedBranchError, "client already disposed" unless @tuple @last_client_type = :blobClient # breaking change after azure-storage 0.10.1 # @current_azure_storage_client.tableClient @current_azure_storage_client.table_client end
Private Instance Methods
rollback_storage_account_key()
click to toggle source
# File lib/logstash/outputs/application_insights/client.rb, line 98 def rollback_storage_account_key raise UnexpectedBranchError, "client already disposed" unless @tuple ( @current_storage_account_key_index, @current_azure_storage_auth_sas, @current_azure_storage_client) = @tuple end
set_current_storage_account_client()
click to toggle source
# File lib/logstash/outputs/application_insights/client.rb, line 103 def set_current_storage_account_client configuration = Config.current storage_access_key = @storage_account[:keys][@current_storage_account_key_index] options = { :storage_account_name => @storage_account_name, :storage_access_key => storage_access_key, :storage_blob_host => "https://#{@storage_account_name}.#{:blob}.#{configuration[:azure_storage_host_suffix]}", :storage_table_host => "https://#{@storage_account_name}.#{:table}.#{configuration[:azure_storage_host_suffix]}" } options[:ca_file] = configuration[:ca_file] unless configuration[:ca_file].empty? @current_azure_storage_client = Azure::Storage::Client.new( options ) # breaking change after azure-storage 0.10.1 # @current_azure_storage_auth_sas = Azure::Storage::Auth::SharedAccessSignature.new( @storage_account_name, storage_access_key ) @current_azure_storage_auth_sas = Azure::Storage::Core::Auth::SharedAccessSignature.new( @storage_account_name, storage_access_key ) end