aws-sdk-dynamodbstreams-event-parser 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +19 -0
- data/README.md +35 -0
- data/Rakefile +4 -0
- data/aws-sdk-dynamodbstreams-event-parser.gemspec +30 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/aws-sdk-dynamodbstreams-event-parser.rb +1 -0
- data/lib/aws/dynamodbstreams/event_parser.rb +54 -0
- metadata +70 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 353ef8f3cd053fb290e42726f806d72dbb2ac66d1fe086983c913835ebaca7b1
|
4
|
+
data.tar.gz: 206d44a6835a4edf43418f4242883687b226ee04b3389fc32f791b1a4f2e01db
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6b5423068d18c904b2863be504ec904c9554bd7cfbf02a53550d274af6d878e2d62ce88ba1ff8312cb8e35b0b4f7a86f9a44954649af17476f452a1d1fd6e652
|
7
|
+
data.tar.gz: 62cfba71306ab4760d8f4b6dd28ab135554c463dd5c8e0ff130bc841316ae93dbf9dc3773ae77df659a5712f5cc086af7597426621a23b1c602523236bda379c
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
aws-sdk-dynamodbstreams-event-parser (1.0.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
rake (13.0.3)
|
10
|
+
|
11
|
+
PLATFORMS
|
12
|
+
x86_64-darwin-20
|
13
|
+
|
14
|
+
DEPENDENCIES
|
15
|
+
aws-sdk-dynamodbstreams-event-parser!
|
16
|
+
rake (~> 13.0)
|
17
|
+
|
18
|
+
BUNDLED WITH
|
19
|
+
2.2.3
|
data/README.md
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Aws::Sdk::Dynamodbstreams::EventParser
|
2
|
+
|
3
|
+
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/aws/sdk/dynamodbstreams/event_parser`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
+
|
5
|
+
TODO: Delete this and the text above, and describe your gem
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'aws-sdk-dynamodbstreams-event_parser'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle install
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install aws-sdk-dynamodbstreams-event_parser
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
TODO: Write usage instructions here
|
26
|
+
|
27
|
+
## Development
|
28
|
+
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
+
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
+
|
33
|
+
## Contributing
|
34
|
+
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/aws-sdk-dynamodbstreams-event_parser.
|
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "aws-sdk-dynamodbstreams-event-parser"
|
5
|
+
spec.version = '1.0.0'
|
6
|
+
spec.authors = ["Julien D."]
|
7
|
+
spec.email = ["julien@pocketsizesun.com"]
|
8
|
+
|
9
|
+
spec.summary = "DynamoDB Streams event parser"
|
10
|
+
spec.description = "DynamoDB Streams event parser"
|
11
|
+
spec.homepage = "https://github.com/pocketsizesun/aws-sdk-dynamodbstreams-event-parser-ruby"
|
12
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
13
|
+
|
14
|
+
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
15
|
+
|
16
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
17
|
+
spec.metadata["source_code_uri"] = "https://github.com/pocketsizesun/aws-sdk-dynamodbstreams-event-parser-ruby"
|
18
|
+
spec.metadata["changelog_uri"] = "https://github.com/pocketsizesun/aws-sdk-dynamodbstreams-event-parser-ruby"
|
19
|
+
|
20
|
+
# Specify which files should be added to the gem when it is released.
|
21
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
22
|
+
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
23
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{\A(?:test|spec|features)/}) }
|
24
|
+
end
|
25
|
+
spec.bindir = "exe"
|
26
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_dependency 'aws-sdk-dynamodb-attribute-deserializer', '~> 1.0'
|
30
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require "bundler/setup"
|
5
|
+
require "aws/sdk/dynamodbstreams/event_parser"
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require "irb"
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'aws/dynamodbstreams/event_parser'
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'aws-sdk-dynamodb-attribute-deserializer'
|
4
|
+
|
5
|
+
module Aws
|
6
|
+
module DynamoDBStreams
|
7
|
+
class EventParser
|
8
|
+
EventStruct = Struct.new(
|
9
|
+
:event_id, :event_name, :event_version, :event_source, :event_source_arn,
|
10
|
+
:aws_region, :dynamodb, :user_identity
|
11
|
+
)
|
12
|
+
|
13
|
+
StreamRecordStruct = Struct.new(
|
14
|
+
:approximate_creation_date_time,
|
15
|
+
:keys,
|
16
|
+
:new_image,
|
17
|
+
:old_image,
|
18
|
+
:sequence_number,
|
19
|
+
:size_bytes,
|
20
|
+
:stream_view_type
|
21
|
+
)
|
22
|
+
|
23
|
+
def initialize
|
24
|
+
@deserializer = Aws::DynamoDB::AttributeDeserializer.new
|
25
|
+
end
|
26
|
+
|
27
|
+
def from(hash)
|
28
|
+
EventStruct.new(
|
29
|
+
hash['eventID'],
|
30
|
+
hash['eventName'],
|
31
|
+
hash['eventVersion'],
|
32
|
+
hash['eventSource'],
|
33
|
+
hash['eventSourceARN'],
|
34
|
+
hash['awsRegion'],
|
35
|
+
StreamRecordStruct.new(
|
36
|
+
hash['dynamodb']['ApproximateCreationDateTime'],
|
37
|
+
@deserializer.call(hash['dynamodb']['Keys']),
|
38
|
+
@deserializer.call(hash['dynamodb']['NewImage']),
|
39
|
+
@deserializer.call(hash['dynamodb']['OldImage']),
|
40
|
+
hash['dynamodb']['SequenceNumber'],
|
41
|
+
hash['dynamodb']['SizeBytes'],
|
42
|
+
hash['dynamodb']['StreamViewType']
|
43
|
+
),
|
44
|
+
hash['userIdentity']
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
def parse(json)
|
49
|
+
data = JSON.parse(json)
|
50
|
+
from(data)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
metadata
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: aws-sdk-dynamodbstreams-event-parser
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Julien D.
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-01-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: aws-sdk-dynamodb-attribute-deserializer
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.0'
|
27
|
+
description: DynamoDB Streams event parser
|
28
|
+
email:
|
29
|
+
- julien@pocketsizesun.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- Gemfile
|
36
|
+
- Gemfile.lock
|
37
|
+
- README.md
|
38
|
+
- Rakefile
|
39
|
+
- aws-sdk-dynamodbstreams-event-parser.gemspec
|
40
|
+
- bin/console
|
41
|
+
- bin/setup
|
42
|
+
- lib/aws-sdk-dynamodbstreams-event-parser.rb
|
43
|
+
- lib/aws/dynamodbstreams/event_parser.rb
|
44
|
+
homepage: https://github.com/pocketsizesun/aws-sdk-dynamodbstreams-event-parser-ruby
|
45
|
+
licenses: []
|
46
|
+
metadata:
|
47
|
+
allowed_push_host: https://rubygems.org
|
48
|
+
homepage_uri: https://github.com/pocketsizesun/aws-sdk-dynamodbstreams-event-parser-ruby
|
49
|
+
source_code_uri: https://github.com/pocketsizesun/aws-sdk-dynamodbstreams-event-parser-ruby
|
50
|
+
changelog_uri: https://github.com/pocketsizesun/aws-sdk-dynamodbstreams-event-parser-ruby
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: 2.3.0
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubygems_version: 3.2.3
|
67
|
+
signing_key:
|
68
|
+
specification_version: 4
|
69
|
+
summary: DynamoDB Streams event parser
|
70
|
+
test_files: []
|