logstash-codec-protobuf 1.2.8-jruby

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +45 -0
  3. data/CONTRIBUTORS +12 -0
  4. data/DEVELOPER.md +2 -0
  5. data/Gemfile +11 -0
  6. data/LICENSE +202 -0
  7. data/NOTICE.TXT +4 -0
  8. data/README.md +184 -0
  9. data/docs/index.asciidoc +241 -0
  10. data/google-protobuf-lib-update.md +57 -0
  11. data/lib/logstash/codecs/protobuf.rb +735 -0
  12. data/logstash-codec-protobuf.gemspec +28 -0
  13. data/spec/codecs/pb2_spec.rb +236 -0
  14. data/spec/codecs/pb3_decode_spec.rb +445 -0
  15. data/spec/codecs/pb3_encode_spec.rb +243 -0
  16. data/spec/helpers/pb2/ColourTestcase.pb.rb +35 -0
  17. data/spec/helpers/pb2/ColourTestcase.proto +24 -0
  18. data/spec/helpers/pb2/event.pb.rb +19 -0
  19. data/spec/helpers/pb2/event.proto +12 -0
  20. data/spec/helpers/pb2/header/header.pb.rb +16 -0
  21. data/spec/helpers/pb2/header/header.proto +8 -0
  22. data/spec/helpers/pb2/human.pb.rb +26 -0
  23. data/spec/helpers/pb2/unicorn.pb.rb +19 -0
  24. data/spec/helpers/pb2/unicorn_event.pb.rb +24 -0
  25. data/spec/helpers/pb3/FantasyHorse_pb.rb +44 -0
  26. data/spec/helpers/pb3/ProbeResult_pb.rb +26 -0
  27. data/spec/helpers/pb3/dnsmessage_pb.rb +82 -0
  28. data/spec/helpers/pb3/events.proto3 +10 -0
  29. data/spec/helpers/pb3/events_pb.rb +17 -0
  30. data/spec/helpers/pb3/header/header.proto3 +7 -0
  31. data/spec/helpers/pb3/header/header_pb.rb +12 -0
  32. data/spec/helpers/pb3/integertest_pb.rb +20 -0
  33. data/spec/helpers/pb3/messageA.proto3 +12 -0
  34. data/spec/helpers/pb3/messageA_pb.rb +16 -0
  35. data/spec/helpers/pb3/messageB.proto3 +12 -0
  36. data/spec/helpers/pb3/messageB_pb.rb +16 -0
  37. data/spec/helpers/pb3/rum2_pb.rb +87 -0
  38. data/spec/helpers/pb3/rum3_pb.rb +87 -0
  39. data/spec/helpers/pb3/rum_pb.rb +87 -0
  40. data/spec/helpers/pb3/unicorn.proto3 +31 -0
  41. data/spec/helpers/pb3/unicorn_pb.rb +31 -0
  42. metadata +177 -0
@@ -0,0 +1,243 @@
1
+ # encoding: utf-8
2
+ require "logstash/devutils/rspec/spec_helper"
3
+ require "logstash/codecs/protobuf"
4
+ require "logstash/event"
5
+
6
+ require 'google/protobuf' # for protobuf3
7
+
8
+ # absolute path to the protobuf helpers directory
9
+ pb_include_path = File.expand_path(".") + "/spec/helpers"
10
+
11
+ describe LogStash::Codecs::Protobuf do
12
+
13
+ context "#encodePB3-a" do
14
+
15
+ #### Test case 1: encode simple protobuf ####################################################################################################################
16
+
17
+ require_relative '../helpers/pb3/unicorn_pb.rb'
18
+
19
+ subject do
20
+ next LogStash::Codecs::Protobuf.new("class_name" => "Unicorn", "include_path" => [pb_include_path + '/pb3/unicorn_pb.rb'], "protobuf_version" => 3)
21
+ end
22
+
23
+ event1 = LogStash::Event.new("name" => "Pinkie", "age" => 18, "is_pegasus" => false, "favourite_numbers" => [1,2,3], "fur_colour" => Colour::PINK, "favourite_colours" => [1,5] )
24
+
25
+ it "should return protobuf encoded data for testcase 1" do
26
+
27
+ subject.on_event do |event, data|
28
+ expect(data).to be_a(String)
29
+
30
+ pb_builder = Google::Protobuf::DescriptorPool.generated_pool.lookup("Unicorn").msgclass
31
+ decoded_data = pb_builder.decode(data)
32
+ expect(decoded_data.name ).to eq(event.get("name") )
33
+ expect(decoded_data.age ).to eq(event.get("age") )
34
+ expect(decoded_data.is_pegasus ).to eq(event.get("is_pegasus") )
35
+ expect(decoded_data.fur_colour ).to eq(:PINK)
36
+ expect(decoded_data.favourite_numbers ).to eq(event.get("favourite_numbers") )
37
+ expect(decoded_data.favourite_colours ).to eq([:BLUE,:WHITE] )
38
+ end # subject.on_event
39
+
40
+ subject.encode(event1)
41
+ end # it
42
+
43
+ end # context
44
+
45
+ context "#encodePB3-b" do
46
+
47
+ #### Test case 2: encode nested protobuf ####################################################################################################################
48
+
49
+ require_relative '../helpers/pb3/unicorn_pb.rb'
50
+
51
+ subject do
52
+ next LogStash::Codecs::Protobuf.new("class_name" => "Unicorn", "include_path" => [pb_include_path + '/pb3/unicorn_pb.rb'], "protobuf_version" => 3)
53
+ end
54
+
55
+ event = LogStash::Event.new("name" => "Horst", "age" => 23, "is_pegasus" => true, "mother" => \
56
+ {"name" => "Mom", "age" => 47}, "father" => {"name"=> "Daddy", "age"=> 50, "fur_colour" => 3 } # 3 == SILVER
57
+ )
58
+
59
+ it "should return protobuf encoded data for testcase 2" do
60
+
61
+ subject.on_event do |event, data|
62
+ expect(data).to be_a(String)
63
+
64
+ pb_builder = Google::Protobuf::DescriptorPool.generated_pool.lookup("Unicorn").msgclass
65
+ decoded_data = pb_builder.decode(data)
66
+
67
+ expect(decoded_data.name ).to eq(event.get("name") )
68
+ expect(decoded_data.age ).to eq(event.get("age") )
69
+ expect(decoded_data.is_pegasus ).to eq(event.get("is_pegasus") )
70
+ expect(decoded_data.mother.name ).to eq(event.get("mother")["name"] )
71
+ expect(decoded_data.mother.age ).to eq(event.get("mother")["age"] )
72
+ expect(decoded_data.father.name ).to eq(event.get("father")["name"] )
73
+ expect(decoded_data.father.age ).to eq(event.get("father")["age"] )
74
+ expect(decoded_data.father.fur_colour ).to eq(:SILVER)
75
+
76
+
77
+ end # subject4.on_event
78
+ subject.encode(event)
79
+ end # it
80
+
81
+ end # context #encodePB3
82
+
83
+ context "encodePB3-c" do
84
+
85
+ #### Test case 3: encode nested protobuf ####################################################################################################################
86
+
87
+
88
+ subject do
89
+ next LogStash::Codecs::Protobuf.new("class_name" => "something.rum_akamai.ProtoAkamaiRum", "include_path" => [pb_include_path + '/pb3/rum_pb.rb' ], "protobuf_version" => 3)
90
+ end
91
+
92
+ event = LogStash::Event.new(
93
+ "user_agent"=>{"os"=>"Android OS", "family"=>"Chrome Mobile", "major"=>74, "mobile"=>"1", "minor"=>0, "manufacturer"=>"Samsung", "osversion"=>"8",
94
+ "model"=>"Galaxy S7 Edge", "type"=>"Mobile",
95
+ "raw"=>"Mozilla/5.0 (Linux; Android 8.0.0; SM-G935F) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Mobile Safari/537.36"},
96
+ "dom"=>{"script"=>65, "ln"=>2063, "ext"=>47}, "page_group"=>"SEO-Pages",
97
+ "active_ctests"=>["1443703219", "47121", "47048", "46906"], "timestamp"=>"1559566982508",
98
+ "geo"=>{"isp"=>"Telecom Italia Mobile", "lat"=>45.4643, "postalcode"=>"20123", "netspeed"=>"Cellular", "rg"=>"MI", "cc"=>"IT",
99
+ "organisation"=>"Telecom Italia Mobile", "ovr"=>false, "city"=>"Milan", "lon"=>9.1895},
100
+ "header"=>{"sender_id"=>"0"}, "domain"=>"something.com", "url"=>"https://www.something.it/",
101
+ "timers"=>{"tti"=>4544, "ttvr"=>3657, "fcp"=>2683, "ttfi"=>4280, "fid"=>31, "longtasks"=>2519, "t_resp"=>1748}
102
+ )
103
+
104
+ it "should return protobuf encoded data for testcase 3" do
105
+
106
+ subject.on_event do |event, data|
107
+ expect(data).to be_a(String)
108
+
109
+ pb_builder = Google::Protobuf::DescriptorPool.generated_pool.lookup("something.rum_akamai.ProtoAkamaiRum").msgclass
110
+ decoded_data = pb_builder.decode(data)
111
+
112
+ expect(decoded_data.domain ).to eq(event.get("domain") )
113
+ expect(decoded_data.dom.ext ).to eq(event.get("dom")["ext"] )
114
+ expect(decoded_data.user_agent.type ).to eq(event.get("user_agent")["type"] )
115
+ expect(decoded_data.geo.rg ).to eq(event.get("geo")["rg"] )
116
+
117
+
118
+ end # subject4.on_event
119
+ subject.encode(event)
120
+ end # it
121
+ end # context #encodePB3-c
122
+
123
+
124
+ context "encodePB3-d" do
125
+
126
+ #### Test case 3: autoconvert data types ####################################################################################################################
127
+
128
+
129
+ subject do
130
+ next LogStash::Codecs::Protobuf.new("class_name" => "something.rum_akamai.ProtoAkamai2Rum",
131
+ "pb3_encoder_autoconvert_types" => true,
132
+ "include_path" => [pb_include_path + '/pb3/rum2_pb.rb' ], "protobuf_version" => 3)
133
+ end
134
+
135
+ event = LogStash::Event.new(
136
+
137
+ # major should autoconvert to float
138
+ "user_agent"=>{"minor"=>0,"major"=>"74"},
139
+
140
+ # ext should autoconvert to int. script being empty should be ignored.
141
+ "dom"=>{"script"=>nil, "ln"=>2063, "ext"=>47.0},
142
+
143
+ # ovr should autoconvert to Boolean
144
+ "geo"=>{"ovr"=>"false"},
145
+
146
+ # sender_id should autoconvert to string
147
+ "header"=>{"sender_id"=>1},
148
+ "domain" => "www",
149
+
150
+ # should autoconvert to string
151
+ "http_referer" => 1234,
152
+ )
153
+
154
+
155
+ it "should fix datatypes to match the protobuf definition" do
156
+
157
+ subject.on_event do |event, data|
158
+ expect(data).to be_a(String)
159
+
160
+ pb_builder = Google::Protobuf::DescriptorPool.generated_pool.lookup("something.rum_akamai.ProtoAkamai2Rum").msgclass
161
+ decoded_data = pb_builder.decode(data)
162
+ expect(decoded_data.domain ).to eq(event.get("domain") )
163
+ expect(decoded_data.user_agent.major).to eq(74)
164
+ expect(decoded_data.dom.ext).to eq(47)
165
+ expect(decoded_data.geo.ovr).to eq(false)
166
+ expect(decoded_data.header.sender_id).to eq("1")
167
+ expect(decoded_data.http_referer).to eq("1234")
168
+
169
+ end
170
+ subject.encode(event)
171
+ end # it
172
+
173
+ end # context #encodePB3-d
174
+
175
+
176
+ context "encodePB3-e" do
177
+
178
+ #### Test case 4: handle nil data ####################################################################################################################
179
+
180
+
181
+
182
+ subject do
183
+ next LogStash::Codecs::Protobuf.new("class_name" => "something.rum_akamai.ProtoAkamai3Rum",
184
+ "pb3_encoder_autoconvert_types" => false,
185
+ "include_path" => [pb_include_path + '/pb3/rum3_pb.rb' ], "protobuf_version" => 3)
186
+ end
187
+
188
+ event = LogStash::Event.new(
189
+ "domain" => nil,
190
+ "header" => {"sender_id" => "23"},
191
+ "geo"=>{"organisation"=>"Jio", "rg"=>"DL", "netspeed"=>nil, "city"=>nil, "cc"=>"IN", "ovr"=>false, "postalcode"=>"110012", "isp"=>"Jio"}
192
+ )
193
+
194
+ it "should ignore empty fields" do
195
+
196
+ subject.on_event do |event, data|
197
+ expect(data).to be_a(String)
198
+
199
+ pb_builder = Google::Protobuf::DescriptorPool.generated_pool.lookup("something.rum_akamai.ProtoAkamai3Rum").msgclass
200
+ decoded_data = pb_builder.decode(data)
201
+ expect(decoded_data.geo.organisation ).to eq(event.get("geo")["organisation"])
202
+ expect(decoded_data.geo.ovr ).to eq(event.get("geo")["ovr"])
203
+ expect(decoded_data.geo.postalcode ).to eq(event.get("geo")["postalcode"])
204
+ expect(decoded_data.header.sender_id ).to eq(event.get("header")['sender_id'] )
205
+
206
+ end
207
+ subject.encode(event)
208
+ end # it
209
+
210
+ end # context #encodePB3-e
211
+
212
+
213
+
214
+ context "encodePB3-f" do
215
+
216
+ #### Test case 5: handle additional fields (discard event without crashing pipeline) ####################################################################################################################
217
+
218
+ subject do
219
+ next LogStash::Codecs::Protobuf.new("class_name" => "something.rum_akamai.ProtoAkamai3Rum",
220
+ "pb3_encoder_autoconvert_types" => false,
221
+ "include_path" => [pb_include_path + '/pb3/rum3_pb.rb' ], "protobuf_version" => 3)
222
+ end
223
+
224
+ event = LogStash::Event.new(
225
+ "domain" => nil, "bot" => "This field does not exist in the protobuf definition",
226
+ "header" => {"sender_id" => "23"},
227
+ "geo"=>{"organisation"=>"Jio", "rg"=>"DL", "netspeed"=>nil, "city"=>nil, "cc"=>"IN", "ovr"=>false, "postalcode"=>"110012", "isp"=>"Jio"}
228
+ )
229
+
230
+ it "should not return data" do
231
+
232
+ subject.on_event do |event, data|
233
+ expect("the on_event method should not be called").to eq("so this code should never be reached")
234
+ end
235
+ subject.encode(event)
236
+ end # it
237
+
238
+ end # context #encodePB3-f
239
+
240
+
241
+
242
+
243
+ end # describe
@@ -0,0 +1,35 @@
1
+ #!/usr/bin/env ruby
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+
4
+ require 'protocol_buffers'
5
+
6
+ # forward declarations
7
+ class ColourProtoTest < ::ProtocolBuffers::Message; end
8
+
9
+ class ColourProtoTest < ::ProtocolBuffers::Message
10
+ # forward declarations
11
+
12
+ # enums
13
+ module Colour
14
+ include ::ProtocolBuffers::Enum
15
+
16
+ set_fully_qualified_name "ColourProtoTest.Colour"
17
+
18
+ BLACK = 0
19
+ BLUE = 1
20
+ WHITE = 2
21
+ GREEN = 3
22
+ RED = 4
23
+ YELLOW = 5
24
+ AQUA = 6
25
+ end
26
+
27
+ set_fully_qualified_name "ColourProtoTest"
28
+
29
+ repeated ::ColourProtoTest::Colour, :favourite_colours, 1
30
+ repeated :bool, :booleantest, 2
31
+ optional ::ColourProtoTest::Colour, :least_liked, 3
32
+ optional :string, :timestamp, 4
33
+ optional :string, :version, 5
34
+ end
35
+
@@ -0,0 +1,24 @@
1
+
2
+
3
+ message ColourProtoTest {
4
+
5
+ enum Colour {
6
+ BLACK = 0;
7
+ BLUE = 1;
8
+ WHITE = 2;
9
+ GREEN = 3;
10
+ RED = 4;
11
+ YELLOW = 5;
12
+ AQUA = 6;
13
+
14
+ }
15
+
16
+ // most liked colours; test enums in arrays.
17
+ repeated Colour favourite_colours = 1;
18
+
19
+ // why not also test booleans in arrays while we're at it.
20
+ repeated bool booleantest = 2;
21
+
22
+ // least liked colour
23
+ optional Colour least_liked = 3;
24
+ }
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+
4
+ require 'protocol_buffers'
5
+
6
+ begin; require 'header/header.pb'; rescue LoadError; end
7
+
8
+ module Logging
9
+ # forward declarations
10
+ class Event < ::ProtocolBuffers::Message; end
11
+
12
+ class Event < ::ProtocolBuffers::Message
13
+ set_fully_qualified_name "Logging.Event"
14
+
15
+ optional :string, :name, 1
16
+ optional ::Grpc::Header, :header, 2
17
+ end
18
+
19
+ end
@@ -0,0 +1,12 @@
1
+ syntax = "proto2";
2
+
3
+ // Compile: ruby-protoc spec/helpers/*proto
4
+
5
+ package Logging;
6
+
7
+ import "header/header.proto";
8
+
9
+ message Event {
10
+ optional string name = 1;
11
+ optional grpc.Header header = 2;
12
+ }
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env ruby
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+
4
+ require 'protocol_buffers'
5
+
6
+ module Grpc
7
+ # forward declarations
8
+ class Header < ::ProtocolBuffers::Message; end
9
+
10
+ class Header < ::ProtocolBuffers::Message
11
+ set_fully_qualified_name "grpc.Header"
12
+
13
+ optional :string, :protocol, 1
14
+ end
15
+
16
+ end
@@ -0,0 +1,8 @@
1
+ syntax = "proto2";
2
+
3
+ // Compile: ruby-protoc spec/helpers/*proto
4
+ package grpc;
5
+
6
+ message Header {
7
+ optional string protocol = 1;
8
+ }
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env ruby
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+
4
+ require 'protocol_buffers'
5
+
6
+ module Animal
7
+ # forward declarations
8
+ class Human < ::ProtocolBuffers::Message; end
9
+
10
+ class Human < ::ProtocolBuffers::Message
11
+ set_fully_qualified_name "animal.Human"
12
+
13
+ optional :string, :first_name, 1
14
+ repeated :string, :middle_names, 2
15
+ optional :string, :last_name, 3
16
+ optional ::Animal::Human, :mother, 4
17
+ optional ::Animal::Human, :father, 5
18
+ optional :string, :path, 6
19
+ optional :string, :version, 7
20
+ optional :string, :timestamp, 8
21
+ optional :string, :email, 9
22
+ optional :bool, :vegetarian, 10
23
+ optional :int32, :age, 11
24
+ end
25
+
26
+ end
@@ -0,0 +1,19 @@
1
+ #!/usr/bin/env ruby
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+
4
+ require 'protocol_buffers'
5
+
6
+ module Animal
7
+ # forward declarations
8
+ class Unicorn < ::ProtocolBuffers::Message; end
9
+
10
+ class Unicorn < ::ProtocolBuffers::Message
11
+ set_fully_qualified_name "animal.Unicorn"
12
+
13
+ optional :string, :colour, 1
14
+ optional :int32, :horn_length, 2
15
+ optional :int32, :last_seen, 3
16
+ optional :bool, :has_wings, 4
17
+ end
18
+
19
+ end
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env ruby
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+
4
+ require 'protocol_buffers'
5
+
6
+ module Animal
7
+ # forward declarations
8
+ class UnicornEvent < ::ProtocolBuffers::Message; end
9
+
10
+ class UnicornEvent < ::ProtocolBuffers::Message
11
+ set_fully_qualified_name "animal.UnicornEvent"
12
+
13
+ optional :string, :colour, 1
14
+ optional :int32, :horn_length, 2
15
+ optional :int32, :last_seen, 3
16
+ optional :string, :timestamp, 4
17
+ optional :string, :host, 5
18
+ optional :string, :path, 6
19
+ optional :string, :version, 7
20
+ optional :bool, :has_wings, 8
21
+
22
+ end
23
+
24
+ end
@@ -0,0 +1,44 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+
3
+ begin; require 'google/protobuf'; rescue LoadError; end
4
+
5
+ Google::Protobuf::DescriptorPool.generated_pool.build do
6
+ add_message "FantasyHorse" do
7
+ optional :name, :string, 1
8
+ oneof :horse_type do
9
+ optional :unicorn, :message, 2, "FantasyUnicorn"
10
+ optional :pegasus, :message, 3, "FantasyPegasus"
11
+ end
12
+ optional :tail, :message, 4, "FantasyHorseTail"
13
+ end
14
+ add_message "FantasyUnicorn" do
15
+ optional :horn_length, :int32, 1
16
+ optional :horn_colour, :string, 2
17
+ end
18
+ add_message "FantasyPegasus" do
19
+ optional :wings_length, :int32, 1
20
+ optional :wings_width, :int32, 2
21
+ optional :wings_feathers, :string, 3
22
+ end
23
+ add_message "FantasyHorseTail" do
24
+ optional :tail_length, :int32, 1
25
+ oneof :hair_type do
26
+ optional :braided, :message, 2, "BraidedHorseTail"
27
+ optional :natural, :message, 3, "NaturalHorseTail"
28
+ end
29
+ end
30
+ add_message "BraidedHorseTail" do
31
+ optional :braiding_style, :string, 1
32
+ optional :braid_thickness, :int32, 2
33
+ end
34
+ add_message "NaturalHorseTail" do
35
+ optional :wavyness, :string, 1
36
+ end
37
+ end
38
+
39
+ FantasyHorse = Google::Protobuf::DescriptorPool.generated_pool.lookup("FantasyHorse").msgclass
40
+ FantasyUnicorn = Google::Protobuf::DescriptorPool.generated_pool.lookup("FantasyUnicorn").msgclass
41
+ FantasyPegasus = Google::Protobuf::DescriptorPool.generated_pool.lookup("FantasyPegasus").msgclass
42
+ FantasyHorseTail = Google::Protobuf::DescriptorPool.generated_pool.lookup("FantasyHorseTail").msgclass
43
+ BraidedHorseTail = Google::Protobuf::DescriptorPool.generated_pool.lookup("BraidedHorseTail").msgclass
44
+ NaturalHorseTail = Google::Protobuf::DescriptorPool.generated_pool.lookup("NaturalHorseTail").msgclass
@@ -0,0 +1,26 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: results.proto
3
+
4
+ require 'google/protobuf'
5
+
6
+ Google::Protobuf::DescriptorPool.generated_pool.build do
7
+ add_message "ProbeResult" do
8
+ optional :UUID, :string, 1
9
+ optional :TaskPingIPv4Result, :message, 2, "PingIPv4Result"
10
+ end
11
+ add_message "PingIPv4Result" do
12
+ optional :status, :enum, 2, "PingIPv4Result.Status"
13
+ optional :latency, :double, 3
14
+ optional :ip, :string, 4
15
+ optional :probe_ip, :string, 5
16
+ optional :geolocation, :string, 6
17
+ end
18
+ add_enum "PingIPv4Result.Status" do
19
+ value :OK, 0
20
+ value :ERROR, 1
21
+ end
22
+ end
23
+
24
+ ProbeResult = Google::Protobuf::DescriptorPool.generated_pool.lookup("ProbeResult").msgclass
25
+ PingIPv4Result = Google::Protobuf::DescriptorPool.generated_pool.lookup("PingIPv4Result").msgclass
26
+ PingIPv4Result::Status = Google::Protobuf::DescriptorPool.generated_pool.lookup("PingIPv4Result.Status").enummodule
@@ -0,0 +1,82 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: dnsmessage.proto3
3
+
4
+ require 'google/protobuf'
5
+
6
+ Google::Protobuf::DescriptorPool.generated_pool.build do
7
+ add_message "PBDNSMessage" do
8
+ optional :type, :enum, 1, "PBDNSMessage.Type"
9
+ optional :messageId, :bytes, 2
10
+ optional :serverIdentity, :bytes, 3
11
+ optional :socketFamily, :enum, 4, "PBDNSMessage.SocketFamily"
12
+ optional :socketProtocol, :enum, 5, "PBDNSMessage.SocketProtocol"
13
+ optional :from, :bytes, 6
14
+ optional :to, :bytes, 7
15
+ optional :inBytes, :uint64, 8
16
+ optional :timeSec, :uint32, 9
17
+ optional :timeUsec, :uint32, 10
18
+ optional :id, :uint32, 11
19
+ optional :question, :message, 12, "PBDNSMessage.DNSQuestion"
20
+ optional :response, :message, 13, "PBDNSMessage.DNSResponse"
21
+ optional :originalRequestorSubnet, :bytes, 14
22
+ optional :requestorId, :string, 15
23
+ optional :initialRequestId, :bytes, 16
24
+ optional :deviceId, :bytes, 17
25
+ end
26
+ add_message "PBDNSMessage.DNSQuestion" do
27
+ optional :qName, :string, 1
28
+ optional :qType, :uint32, 2
29
+ optional :qClass, :uint32, 3
30
+ end
31
+ add_message "PBDNSMessage.DNSResponse" do
32
+ optional :rcode, :uint32, 1
33
+ repeated :rrs, :message, 2, "PBDNSMessage.DNSResponse.DNSRR"
34
+ optional :appliedPolicy, :string, 3
35
+ repeated :tags, :string, 4
36
+ optional :queryTimeSec, :uint32, 5
37
+ optional :queryTimeUsec, :uint32, 6
38
+ optional :appliedPolicyType, :enum, 7, "PBDNSMessage.PolicyType"
39
+ end
40
+ add_message "PBDNSMessage.DNSResponse.DNSRR" do
41
+ optional :name, :string, 1
42
+ optional :type, :uint32, 2
43
+ optional :class, :uint32, 3
44
+ optional :ttl, :uint32, 4
45
+ optional :rdata, :bytes, 5
46
+ end
47
+ add_enum "PBDNSMessage.Type" do
48
+ value :Dummy0, 0
49
+ value :DNSQueryType, 1
50
+ value :DNSResponseType, 2
51
+ value :DNSOutgoingQueryType, 3
52
+ value :DNSIncomingResponseType, 4
53
+ end
54
+ add_enum "PBDNSMessage.SocketFamily" do
55
+ value :Dummy1, 0
56
+ value :INET, 1
57
+ value :INET6, 2
58
+ end
59
+ add_enum "PBDNSMessage.SocketProtocol" do
60
+ value :Dummy2, 0
61
+ value :UDP, 1
62
+ value :TCP, 2
63
+ end
64
+ add_enum "PBDNSMessage.PolicyType" do
65
+ value :Dummy3, 0
66
+ value :UNKNOWN, 1
67
+ value :QNAME, 2
68
+ value :CLIENTIP, 3
69
+ value :RESPONSEIP, 4
70
+ value :NSDNAME, 5
71
+ value :NSIP, 6
72
+ end
73
+ end
74
+
75
+ PBDNSMessage = Google::Protobuf::DescriptorPool.generated_pool.lookup("PBDNSMessage").msgclass
76
+ PBDNSMessage::DNSQuestion = Google::Protobuf::DescriptorPool.generated_pool.lookup("PBDNSMessage.DNSQuestion").msgclass
77
+ PBDNSMessage::DNSResponse = Google::Protobuf::DescriptorPool.generated_pool.lookup("PBDNSMessage.DNSResponse").msgclass
78
+ PBDNSMessage::DNSResponse::DNSRR = Google::Protobuf::DescriptorPool.generated_pool.lookup("PBDNSMessage.DNSResponse.DNSRR").msgclass
79
+ PBDNSMessage::Type = Google::Protobuf::DescriptorPool.generated_pool.lookup("PBDNSMessage.Type").enummodule
80
+ PBDNSMessage::SocketFamily = Google::Protobuf::DescriptorPool.generated_pool.lookup("PBDNSMessage.SocketFamily").enummodule
81
+ PBDNSMessage::SocketProtocol = Google::Protobuf::DescriptorPool.generated_pool.lookup("PBDNSMessage.SocketProtocol").enummodule
82
+ PBDNSMessage::PolicyType = Google::Protobuf::DescriptorPool.generated_pool.lookup("PBDNSMessage.PolicyType").enummodule
@@ -0,0 +1,10 @@
1
+ syntax = "proto3";
2
+
3
+ message Event {
4
+ string id = 1;
5
+ string msg = 2;
6
+ }
7
+
8
+ message Events {
9
+ repeated Event events = 1;
10
+ }
@@ -0,0 +1,17 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: events.proto3
3
+
4
+ require 'google/protobuf'
5
+
6
+ Google::Protobuf::DescriptorPool.generated_pool.build do
7
+ add_message "RepeatedEvent" do
8
+ optional :id, :string, 1
9
+ optional :msg, :string, 2
10
+ end
11
+ add_message "RepeatedEvents" do
12
+ repeated :repeated_events, :message, 1, "RepeatedEvent"
13
+ end
14
+ end
15
+
16
+ Event = Google::Protobuf::DescriptorPool.generated_pool.lookup("RepeatedEvent").msgclass
17
+ Events = Google::Protobuf::DescriptorPool.generated_pool.lookup("RepeatedEvents").msgclass
@@ -0,0 +1,7 @@
1
+ syntax = "proto3";
2
+
3
+ // Compile: protoc --ruby_out=. spec/helpers/*proto3
4
+
5
+ message Header {
6
+ map<string, string> name = 3;
7
+ }
@@ -0,0 +1,12 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: header/header.proto3
3
+
4
+ require 'google/protobuf'
5
+
6
+ Google::Protobuf::DescriptorPool.generated_pool.build do
7
+ add_message "Header" do
8
+ map :name, :string, :string, 3
9
+ end
10
+ end
11
+
12
+ Header = Google::Protobuf::DescriptorPool.generated_pool.lookup("Header").msgclass
@@ -0,0 +1,20 @@
1
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
2
+ # source: TestMessage.proto3
3
+
4
+ require 'google/protobuf'
5
+
6
+ Google::Protobuf::DescriptorPool.generated_pool.build do
7
+ add_message "com.foo.bar.IntegerTestMessage" do
8
+ optional :response_time, :int64, 1
9
+ end
10
+ end
11
+
12
+ module Com
13
+ module Bla
14
+ module Bla
15
+ module Bla
16
+ TestMessage = Google::Protobuf::DescriptorPool.generated_pool.lookup("com.foo.bar.IntegerTestMessage").msgclass
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,12 @@
1
+ syntax = "proto3";
2
+
3
+ // Compile: protoc --ruby_out=. spec/helpers/*proto3
4
+
5
+ package A;
6
+
7
+ import "header/header.proto3";
8
+
9
+ message MessageA {
10
+ string name = 1;
11
+ Header header = 2;
12
+ }