Class: LogStash::Outputs::Application_insights::Test_storage

Inherits:
Blob
  • Object
show all
Defined in:
lib/logstash/outputs/application_insights/test_storage.rb

Constant Summary

Constants inherited from Blob

Blob::CREATE_EXIST_ERRORS

Instance Attribute Summary

Attributes inherited from Blob

#last_io_exception

Instance Method Summary collapse

Methods inherited from Blob

close, #create_container_exist_recovery, #create_exist_recovery, #create_table_exist_recovery, #state_table_delete, #state_table_insert, #state_table_query, #state_table_update, stopped?, #update_commited_or_uncommited_list

Methods inherited from Context

#clear_context, #context_to_table_entity, #context_to_tuple, #table_entity_to_context, #table_entity_to_tuple, #tuple_to_context

Constructor Details

#initialize(storage_account_name) ⇒ Test_storage

Returns a new instance of Test_storage.



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/logstash/outputs/application_insights/test_storage.rb', line 25

def initialize (  )
  # super first parameter must be nil. blob first parameter is channel, otherwise it will pass storage_account_name as channel
  super( nil )
  @storage_account_name = 
  @test_storage_container = @configuration[:test_storage_container]
  @test_storage_table = @configuration[:test_storage_table]
  @action = :test_storage
  @base_info = "#{@action} #{@storage_account_name}"
  @recoverable = [ :invalid_storage_key, :container_exist, :create_container, :table_exist, :create_table ]
  @force_client = true # to enable get a client even if all storage_accounts marked dead
end

Instance Method Details

#testObject



37
38
39
# File 'lib/logstash/outputs/application_insights/test_storage.rb', line 37

def test
  test_container
end

#test_containerObject



41
42
43
44
45
46
47
48
49
# File 'lib/logstash/outputs/application_insights/test_storage.rb', line 41

def test_container
  @max_tries = 1
  @info = "#{@base_info} - create #{@test_storage_container} container"
  storage_io_block {
    if @recovery.nil? || :invalid_storage_key == @recovery
      @client.blobClient.create_container( @test_storage_container ) unless @configuration[:disable_blob_upload]
    end
  }
end

#test_tableObject



51
52
53
54
55
56
57
58
59
# File 'lib/logstash/outputs/application_insights/test_storage.rb', line 51

def test_table
  @max_tries = 1
  @info = "#{@base_info} - create #{@test_storage_table} table"
  storage_io_block {
    if @recovery.nil? || :invalid_storage_key == @recovery
      @client.tableClient.create_table( @test_storage_table ) unless @configuration[:disable_blob_upload]
    end
  }
end