Class: LogStash::Outputs::Application_insights::Client
- Inherits:
-
Object
- Object
- LogStash::Outputs::Application_insights::Client
- Defined in:
- lib/logstash/outputs/application_insights/client.rb
Instance Method Summary collapse
- #blobClient ⇒ Object
- #dispose(io_failed_reason = nil) ⇒ Object
-
#initialize(storage_account_name, force = nil) ⇒ Client
constructor
A new instance of Client.
- #notifyClient ⇒ Object
- #storage_auth_sas ⇒ Object
- #switch_storage_account_key! ⇒ Object
- #tableClient ⇒ Object
Constructor Details
#initialize(storage_account_name, force = nil) ⇒ Client
Returns a new instance of Client.
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# 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 |
Instance Method Details
#blobClient ⇒ Object
56 57 58 59 60 61 62 |
# 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) ⇒ Object
41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# 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 ⇒ Object
72 73 74 75 76 |
# 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 ⇒ Object
78 79 80 81 |
# 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! ⇒ Object
84 85 86 87 88 89 90 91 92 93 94 |
# 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 ⇒ Object
64 65 66 67 68 69 70 |
# 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 |