eye-s3 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 30b56144e82786fa946982a3671d0e714dbeb1d2
4
+ data.tar.gz: 6c8fbd4170ff33990909d04205614097011801de
5
+ SHA512:
6
+ metadata.gz: 29ac58399d2a4e67eade9dd9dc6d0086f44331533e75eb94423d43880e64160852d2295b4eb4971b71731bca6cc8915360110f40d8af505630554eabfafc4212
7
+ data.tar.gz: 465f2e4e2e272364e775a7d515cd23d92319057875ab6c41233243cb4d27d4d8eb3635e0e933aa50c0888e217ed51b141f471beef730f1490bd9a8b6c4770241
data/.gitignore ADDED
@@ -0,0 +1,50 @@
1
+ *.gem
2
+ *.rbc
3
+ /.config
4
+ /coverage/
5
+ /InstalledFiles
6
+ /pkg/
7
+ /spec/reports/
8
+ /spec/examples.txt
9
+ /test/tmp/
10
+ /test/version_tmp/
11
+ /tmp/
12
+
13
+ # Used by dotenv library to load environment variables.
14
+ # .env
15
+
16
+ ## Specific to RubyMotion:
17
+ .dat*
18
+ .repl_history
19
+ build/
20
+ *.bridgesupport
21
+ build-iPhoneOS/
22
+ build-iPhoneSimulator/
23
+
24
+ ## Specific to RubyMotion (use of CocoaPods):
25
+ #
26
+ # We recommend against adding the Pods directory to your .gitignore. However
27
+ # you should judge for yourself, the pros and cons are mentioned at:
28
+ # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
29
+ #
30
+ # vendor/Pods/
31
+
32
+ ## Documentation cache and generated files:
33
+ /.yardoc/
34
+ /_yardoc/
35
+ /doc/
36
+ /rdoc/
37
+
38
+ ## Environment normalization:
39
+ /.bundle/
40
+ /vendor/bundle
41
+ /lib/bundler/man/
42
+
43
+ # for a library or gem, you might want to ignore these files since the code is
44
+ # intended to run in multiple environments; otherwise, check them in:
45
+ # Gemfile.lock
46
+ # .ruby-version
47
+ # .ruby-gemset
48
+
49
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
50
+ .rvmrc
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in eye-s3.gemspec
4
+ gemspec
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Ricardo Mota
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,55 @@
1
+ # Eye::S3
2
+ <!-- TODO: add gem version and link -->
3
+ <!-- [![Gem Version]()]() -->
4
+
5
+ A notifier plugin for [eye](https://github.com/kostya/eye) to send state changes to AWS S3
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'eye'
13
+ gem 'eye-s3
14
+ ```
15
+
16
+ And then execute:
17
+
18
+ $ bundle
19
+
20
+ Or install it yourself as:
21
+
22
+ $ gem install eye-s3
23
+
24
+ ## Usage
25
+
26
+ S3 notifier takes the following parameters:
27
+
28
+ - `bucket_name` - **required**, a string with the S3 bucket name
29
+ - `region` - optional, the AWS region for the `S3::Client`, uses `us-east-1` by default
30
+
31
+ Declare inside eye config like this:
32
+
33
+ ```ruby
34
+ require 'eye/notify/eye_s3'
35
+
36
+ Eye.config do
37
+ eye_s3 bucket_name: 'your-bucket-name'
38
+ end
39
+ ```
40
+
41
+ ### Authentication
42
+
43
+ EyeS3 notifier assumes the runtime environment is already configured to use the
44
+ AWS SDK for ruby, for more info on how to do it check the
45
+ [official documentation.](https://docs.aws.amazon.com/sdk-for-ruby/v3/developer-guide/setup-config.html)
46
+
47
+ It also assumes the client has the correct permissions to put objects on the correspondent S3 bucket.
48
+
49
+ ## Contributing
50
+
51
+ 1. Fork it ( https://github.com/ricardosllm/eye-s3/fork )
52
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
53
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
54
+ 4. Push to the branch (`git push origin my-new-feature`)
55
+ 5. Create a new Pull Request
data/eye-s3.gemspec ADDED
@@ -0,0 +1,26 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'eye/notify/eye_s3/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "eye-s3"
8
+ spec.version = Eye::Notify::EyeS3::VERSION
9
+ spec.authors = ["Ricardo Mota"]
10
+ spec.email = ["ricardo@mota.cloud"]
11
+ spec.summary = %q{eye state change events to s3 JSON object}
12
+ spec.description = %q{eye to s3 object}
13
+ spec.homepage = "https://github.com/ricardosllm/eye-s3"
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.7"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+
24
+ spec.add_runtime_dependency "aws-sdk", "~> 3.0"
25
+ spec.add_runtime_dependency "eye", ">= 0.9"
26
+ end
@@ -0,0 +1,10 @@
1
+ module Eye
2
+ class Notify
3
+ # to satisfy gem packaking
4
+ class Eye::Notify::Custom < Eye::Notify; end
5
+
6
+ class EyeS3 < Eye::Notify::Custom
7
+ VERSION = '0.0.1'
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,63 @@
1
+ require 'eye'
2
+ require 'eye/notify/eye_s3/version'
3
+ require 'aws-sdk'
4
+
5
+ module Eye
6
+ class Notify
7
+ class EyeS3 < Eye::Notify::Custom
8
+
9
+ # Eye.config do
10
+ # s3 bucket_name: 'your-bucket-name'
11
+ # end
12
+
13
+ param :bucket_name, String, true
14
+ param :region, String, false, 'us-east-1'
15
+ param :key, String, false, default_object_key
16
+
17
+ def execute
18
+ Aws::S3::Object.new(options).put object
19
+ end
20
+
21
+ private
22
+
23
+ def options
24
+ {
25
+ bucket_name: bucket_name,
26
+ key: key,
27
+ client: client
28
+ }
29
+ end
30
+
31
+ def object
32
+ {
33
+ acl: 'authenticated-read',
34
+ content_type: 'application/json',
35
+ body: body,
36
+ }
37
+ end
38
+
39
+ def client
40
+ Aws::S3::Client.new(region: region)
41
+ end
42
+
43
+ def body
44
+ JSON.generate event
45
+ end
46
+
47
+ def event
48
+ {
49
+ host: msg_host,
50
+ timestamp: msg_at,
51
+ message: msg_message,
52
+ name: msg_name,
53
+ level: msg_level
54
+ }
55
+ end
56
+
57
+ def default_object_key
58
+ now = Time.now
59
+ [now.year, now.month, now.day, "#{now.to_i}_#{msg_host}.json"].join '/'
60
+ end
61
+ end
62
+ end
63
+ end
metadata ADDED
@@ -0,0 +1,107 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: eye-s3
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Ricardo Mota
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-01-22 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: '1.7'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: aws-sdk
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ~>
46
+ - !ruby/object:Gem::Version
47
+ version: '3.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ~>
53
+ - !ruby/object:Gem::Version
54
+ version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: eye
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0.9'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - '>='
67
+ - !ruby/object:Gem::Version
68
+ version: '0.9'
69
+ description: eye to s3 object
70
+ email:
71
+ - ricardo@mota.cloud
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - .gitignore
77
+ - Gemfile
78
+ - LICENSE
79
+ - README.md
80
+ - eye-s3.gemspec
81
+ - lib/eye/notify/eye_s3.rb
82
+ - lib/eye/notify/eye_s3/version.rb
83
+ homepage: https://github.com/ricardosllm/eye-s3
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - '>='
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.0.14.1
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: eye state change events to s3 JSON object
107
+ test_files: []