logstash-output-stride 0.7.2

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
+ SHA256:
3
+ metadata.gz: 186e97b91144405a0dc76ebc3ce41bdfb5932f9218af02df9cde57564407019b
4
+ data.tar.gz: 1a6d4b757eb29a166b769576b42e1d0f8095c57a5d14f542d8d2aa03c41cc8fc
5
+ SHA512:
6
+ metadata.gz: d0d71da7cd4615a311c2dbe4720a60f4ac16a32acdecd278b334514cc695be9a78e98361759b0f2b61084b31f97bc7b2d53a98f0613a1bd1569d70206508bb4b
7
+ data.tar.gz: 652a3295c0c10d2381d7b50b07ea12501ec1b77a9145438ef755120324edef8ddf929553fec32b5cd39d7b5e0d2112d430f9eb4e0cf42fd1174543a5de126189
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'http://production.cf.rubygems.org'
2
+
3
+ gemspec
4
+
5
+ logstash_path = ENV["LOGSTASH_PATH"] || "../../logstash"
6
+ use_logstash_source = ENV["LOGSTASH_SOURCE"] && ENV["LOGSTASH_SOURCE"].to_s == "1"
7
+
8
+ if Dir.exist?(logstash_path) && use_logstash_source
9
+ gem 'logstash-core', :path => "#{logstash_path}/logstash-core"
10
+ gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api"
11
+ end
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2012-2018 Elasticsearch <http://www.elastic.co>
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
data/NOTICE.TXT ADDED
@@ -0,0 +1,5 @@
1
+ Elasticsearch
2
+ Copyright 2012-2015 Elasticsearch
3
+
4
+ This product includes software developed by The Apache Software
5
+ Foundation (http://www.apache.org/).
@@ -0,0 +1,57 @@
1
+ # encoding: utf-8
2
+ require "logstash/outputs/base"
3
+ require "logstash/namespace"
4
+ require 'net/http'
5
+ require 'uri'
6
+
7
+ # An example output that does nothing.
8
+ class LogStash::Outputs::Stride < LogStash::Outputs::Base
9
+
10
+ config_name "stride"
11
+ config :access_token, :validate => :string, :required => true
12
+ config :cloud_id, :validate => :string, :required => true
13
+ config :conversation_id, :validate => :string, :required => true
14
+ config :message, :validate => :string, :default => "%{Message}"
15
+ config :host, :validate => :string, :default => "%{host}"
16
+ config :type, :validate => :string, :default => "%{type}"
17
+
18
+ public
19
+ def register
20
+ end # def register
21
+
22
+ public
23
+ def receive(event)
24
+ access_token = event.sprintf(@access_token)
25
+ cloud_id = event.sprintf(@cloud_id)
26
+ conversation_id = event.sprintf(@conversation_id)
27
+ host = event.sprintf(@host)
28
+ type = event.sprintf(@type)
29
+ message = event.sprintf(@message)
30
+
31
+ post_message(access_token,cloud_id,conversation_id,host,type,message)
32
+ rescue Exception => e
33
+ puts e.message
34
+ end
35
+
36
+ public
37
+ def post_message(access_token,cloud_id,conversation_id,host,type,message)
38
+ message = %Q|#{type} : #{message}| if type
39
+ message = %Q|#{host} : #{message}| if host
40
+ puts "Type : #{type}, Host : #{host}"
41
+ uri = URI.parse("https://api.atlassian.com/site/#{cloud_id}/conversation/#{conversation_id}/message")
42
+ request = Net::HTTP::Post.new(uri)
43
+ request.content_type = "application/json"
44
+ request["Authorization"] = "Bearer #{access_token}"
45
+ request.body = '{"version":1,"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"'+message+'"}]}]}'
46
+
47
+ req_options = {
48
+ use_ssl: uri.scheme == "https",
49
+ }
50
+
51
+ response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|
52
+ http.request(request)
53
+ end
54
+
55
+ end
56
+
57
+ end # class LogStash::Outputs::Stride
@@ -0,0 +1,25 @@
1
+ Gem::Specification.new do |s|
2
+ s.name = 'logstash-output-stride'
3
+ s.version = '0.7.2'
4
+ s.licenses = ['Apache-2.0']
5
+ s.summary = "This logstash ouput plugin allows posting messages to stride rooms"
6
+ s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
7
+ s.authors = ["Vishnu Prasanth"]
8
+ s.email = "vishnu@ontash.net"
9
+ s.homepage = "http://www.ontash.net"
10
+ s.require_paths = ["lib"]
11
+
12
+ # Files
13
+ s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
14
+ # Tests
15
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
16
+
17
+ # Special flag to let us know this is actually a logstash plugin
18
+ s.metadata = { "logstash_plugin" => "true", "logstash_group" => "output" }
19
+
20
+ # Gem dependencies
21
+ #
22
+ s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0", "<= 2.99"
23
+ s.add_runtime_dependency "logstash-codec-plain", '~> 3.0', '>= 3.0.6'
24
+ s.add_development_dependency 'logstash-devutils', '~> 1.3', '>= 1.3.6'
25
+ end
@@ -0,0 +1,19 @@
1
+ # encoding: utf-8
2
+ require "logstash/devutils/rspec/spec_helper"
3
+ require "logstash/outputs/stride"
4
+ require "logstash/codecs/plain"
5
+ require "logstash/event"
6
+
7
+ describe LogStash::Outputs::Stride do
8
+ let(:sample_event) { LogStash::Event.new }
9
+ let(:output) { LogStash::Outputs::Stride.new }
10
+
11
+ before do
12
+ output.register
13
+ end
14
+
15
+ describe "receive message" do
16
+ subject { output.receive(sample_event) }
17
+ end
18
+ end
19
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: logstash-output-stride
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.2
5
+ platform: ruby
6
+ authors:
7
+ - Vishnu Prasanth
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-05-14 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - "~>"
17
+ - !ruby/object:Gem::Version
18
+ version: '2.0'
19
+ - - "<="
20
+ - !ruby/object:Gem::Version
21
+ version: '2.99'
22
+ name: logstash-core-plugin-api
23
+ prerelease: false
24
+ type: :runtime
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '2.0'
30
+ - - "<="
31
+ - !ruby/object:Gem::Version
32
+ version: '2.99'
33
+ - !ruby/object:Gem::Dependency
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - "~>"
37
+ - !ruby/object:Gem::Version
38
+ version: '3.0'
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: 3.0.6
42
+ name: logstash-codec-plain
43
+ prerelease: false
44
+ type: :runtime
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '3.0'
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: 3.0.6
53
+ - !ruby/object:Gem::Dependency
54
+ requirement: !ruby/object:Gem::Requirement
55
+ requirements:
56
+ - - "~>"
57
+ - !ruby/object:Gem::Version
58
+ version: '1.3'
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: 1.3.6
62
+ name: logstash-devutils
63
+ prerelease: false
64
+ type: :development
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: '1.3'
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: 1.3.6
73
+ description: This gem is a Logstash plugin required to be installed on top of the
74
+ Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
75
+ gem is not a stand-alone program
76
+ email: vishnu@ontash.net
77
+ executables: []
78
+ extensions: []
79
+ extra_rdoc_files: []
80
+ files:
81
+ - Gemfile
82
+ - LICENSE
83
+ - NOTICE.TXT
84
+ - lib/logstash/outputs/stride.rb
85
+ - logstash-output-stride.gemspec
86
+ - spec/outputs/stride_spec.rb
87
+ homepage: http://www.ontash.net
88
+ licenses:
89
+ - Apache-2.0
90
+ metadata:
91
+ logstash_plugin: 'true'
92
+ logstash_group: output
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ requirements:
99
+ - - ">="
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ required_rubygems_version: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ">="
105
+ - !ruby/object:Gem::Version
106
+ version: '0'
107
+ requirements: []
108
+ rubyforge_project:
109
+ rubygems_version: 2.6.13
110
+ signing_key:
111
+ specification_version: 4
112
+ summary: This logstash ouput plugin allows posting messages to stride rooms
113
+ test_files:
114
+ - spec/outputs/stride_spec.rb