awful 0.0.30 → 0.0.31

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: de50bfb59c215fedd6732d5db9d20ababda674c4
4
- data.tar.gz: fee0153a6bbc75fa1982ce51c3bc9411c7346da2
3
+ metadata.gz: bbe1497a5f0f84bd7637aa0dbefe0115668b7029
4
+ data.tar.gz: fea6faf2ff7bf3de90b84c3e59631dec65b3ae7a
5
5
  SHA512:
6
- metadata.gz: ff2e36715ba4dcd740de1a62314caf8dbe5e9a5df943bcb429711e87491485ae6293d83409a6c011c244cd4f8163519bd48b1b6a3feb18541522b9995b4d8086
7
- data.tar.gz: e5bb40be4a4a6bbcb247735764c1b934bfaec3b0634debf8e8eda1a853e250c8047a528c9e172986c121147e8f2746a30b27db93aa379de62a8b43be13cd473a
6
+ metadata.gz: 68f828906138251218538356adc2051824a7b4c37fbb90bad8a6eedb5971de97cc6efdd74e6f364edf6dda08686629d1f14930490143b80683c2e006564f690b
7
+ data.tar.gz: 47dab358de2361b5b0d8bb083aa25c0a4b52f280963f5001c8ce1943fdc79604b21777ad29c7f8708740ebdad43d8ad0e3edbe842aebb20ddbc596cbc0c0c942
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.add_development_dependency "bundler", "~> 1.7"
22
22
  spec.add_development_dependency "rake"
23
23
 
24
- spec.add_dependency('aws-sdk', '~> 2')
24
+ spec.add_dependency('aws-sdk', '>= 2.1.12')
25
25
  spec.add_dependency('thor')
26
26
  spec.add_dependency('dotenv')
27
27
  end
@@ -51,6 +51,10 @@ module Awful
51
51
  @dynamodb_simple ||= Aws::DynamoDB::Client.new(options)
52
52
  end
53
53
 
54
+ def dynamodb_streams
55
+ @dynamodb_streams ||= Aws::DynamoDBStreams::Client.new
56
+ end
57
+
54
58
  def s3
55
59
  @s3 ||= Aws::S3::Client.new
56
60
  end
@@ -0,0 +1,56 @@
1
+ module Awful
2
+
3
+ class DynamoDBStreams < Cli
4
+
5
+ desc 'ls [PATTERN]', 'list dynamodb streams [matching PATTERN]'
6
+ method_option :long, aliases: '-l', default: false, desc: 'Long listing'
7
+ def ls(table_name = nil, exclusive_start_stream_arn = nil)
8
+ opts = {
9
+ table_name: table_name,
10
+ exclusive_start_stream_arn: exclusive_start_stream_arn
11
+ }.reject{ |_,v| v.nil? }
12
+
13
+ r = dynamodb_streams.list_streams(opts)
14
+
15
+ streams = r.streams.tap do |list|
16
+ if options[:long]
17
+ print_table list.map{ |s| [s.stream_arn, s.table_name, s.stream_label] }
18
+ else
19
+ puts list.map(&:stream_arn)
20
+ end
21
+ end
22
+
23
+ ## recurse if there is more data to fetch
24
+ if r.last_evaluated_stream_arn
25
+ streams += ls(table_name, r.last_evaluated_stream_arn)
26
+ end
27
+
28
+ streams
29
+ end
30
+
31
+ desc 'dump ARN', 'describe the stream with ARN as yaml'
32
+ def dump(arn)
33
+ dynamodb_streams.describe_stream(stream_arn: arn).stream_description.tap do |stream|
34
+ puts YAML.dump(stringify_keys(stream.to_hash))
35
+ end
36
+ end
37
+
38
+ desc 'shards ARN', 'list shards for stream with ARN'
39
+ def shards(arn)
40
+ dynamodb_streams.describe_stream(stream_arn: arn).stream_description.shards.tap do |shards|
41
+ puts shards.map(&:shard_id)
42
+ end
43
+ end
44
+
45
+ desc 'get_records ARN SHARD_ID', 'get records for given stream and shard'
46
+ def get_records(arn, shard_id)
47
+ iterator = dynamodb_streams.get_shard_iterator(stream_arn: arn, shard_id: shard_id, shard_iterator_type: 'TRIM_HORIZON').shard_iterator
48
+
49
+ dynamodb_streams.get_records(shard_iterator: iterator).records.tap do |records|
50
+ print_table records.map { |r| [r.event_id, r.event_name, r.dynamodb.sequence_number, r.dynamodb.size_bytes] }
51
+ end
52
+ end
53
+
54
+ end
55
+
56
+ end
@@ -1,3 +1,3 @@
1
1
  module Awful
2
- VERSION = "0.0.30"
2
+ VERSION = "0.0.31"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: awful
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.30
4
+ version: 0.0.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ric Lister
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: aws-sdk
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
- version: '2'
47
+ version: 2.1.12
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
- version: '2'
54
+ version: 2.1.12
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: thor
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -124,6 +124,7 @@ files:
124
124
  - lib/awful/auto_scaling.rb
125
125
  - lib/awful/datapipeline.rb
126
126
  - lib/awful/dynamodb.rb
127
+ - lib/awful/dynamodb_streams.rb
127
128
  - lib/awful/ec2.rb
128
129
  - lib/awful/elb.rb
129
130
  - lib/awful/launch_config.rb