Class: Awful::Kinesis

Inherits:
Cli show all
Defined in:
lib/awful/kinesis.rb

Constant Summary collapse

COLORS =
{
  ACTIVE:   :green,
  DELETING: :red,
}

Instance Method Summary collapse

Methods inherited from Cli

#initialize

Constructor Details

This class inherits a constructor from Awful::Cli

Instance Method Details

#dump(name) ⇒ Object



59
60
61
62
63
# File 'lib/awful/kinesis.rb', line 59

def dump(name)
  kinesis.describe_stream(stream_name: name).stream_description.output do |stream|
    puts YAML.dump(stringify_keys(stream.to_hash))
  end
end

#lsObject



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/awful/kinesis.rb', line 42

def ls
  paginate_streams(:stream_names) do |start|
    kinesis.list_streams(exclusive_start_stream_name: start)
  end.output do |streams|
    if options[:long]
      print_table streams.map { |name|
        s = kinesis.describe_stream(stream_name: name).stream_description
        op = s.has_more_shards ? '>' : ''
        [s.stream_name, op + s.shards.count.to_s, color(s.stream_status), s.encryption_type, s.retention_period_hours.to_s + 'h', s.stream_creation_timestamp]
      }
    else
      puts streams
    end
  end
end