Class: Interferon::HostSources::AwsDynamo
- Inherits:
-
Object
- Object
- Interferon::HostSources::AwsDynamo
- Defined in:
- lib/interferon/host_sources/aws_dynamo.rb
Instance Method Summary collapse
-
#initialize(options) ⇒ AwsDynamo
constructor
A new instance of AwsDynamo.
- #list_hosts ⇒ Object
Constructor Details
#initialize(options) ⇒ AwsDynamo
Returns a new instance of AwsDynamo.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/interferon/host_sources/aws_dynamo.rb', line 5 def initialize() missing = %w(access_key_id secret_access_key).reject { |r| .key?(r) } AWS.config(access_key_id: ['access_key_id'], secret_access_key: ['secret_access_key']) if missing.empty? # initialize a list of regions to check @regions = if ['regions'] && !['regions'].empty? ['regions'] else AWS.regions.map(&:name) end end |
Instance Method Details
#list_hosts ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/interferon/host_sources/aws_dynamo.rb', line 19 def list_hosts hosts = [] @regions.each do |region| client = AWS::DynamoDB.new(region: region) AWS.memoize do client.tables.each do |table| hosts << { source: 'aws_dynamo', region: region, table_name: table.name, read_capacity: table.read_capacity_units, write_capacity: table.write_capacity_units, # dynamodb does not support tagging owners: [], owner_groups: [], } end end end hosts end |