aliyun_sls_sdk 0.0.4 → 0.0.5

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: cc07413c32c73b456a587f6e989ba703a730f364
4
- data.tar.gz: 31314032b496372b15a7071efcd7163cf868862a
3
+ metadata.gz: 3a5379de759aaffcc2806796c3ac6352cea1baac
4
+ data.tar.gz: 15cd324d103afaf804110ef26c4789ebe3cd7993
5
5
  SHA512:
6
- metadata.gz: a74d8f5aae9cb3bba763b5de1a1ec67719c5e069c197df420f9856e455fcfa426d458ed106d3df28987ef2bfd9e59575656fd7b8fe6c9f73c06c918fe628eb9d
7
- data.tar.gz: 878dd8a3b97c27749169afc86e22e23e812dc72585360cdc62eb1f095b462a009fc323f50d79c538e32b7ac7916316f2d8f3620d21b928ecfa9748638d56df6f
6
+ metadata.gz: 783c03b3c249d078068076784ee53939147e70abd1734f97e2ffd26ac71880ed607ccc7354908d71730d2714d3fae6b66468e9b63aa4aaec9f1854d34af27ff6
7
+ data.tar.gz: 131b92443f4108ea49a3abf69f49876a1194e2c1b253707f47f5b579bc1db34576c5bf1c72cb65bc4902df5b253dfdafcf4cfbff3bd9aedda735e0a4b456207f
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
 
20
20
  spec.add_development_dependency "bundler", "~> 1.3"
21
21
  spec.add_development_dependency "rake", "~> 0"
22
- spec.add_dependency "google-protobuf", "~>3.2"
22
+ spec.add_dependency "beefcake", "~> 0"
23
23
  spec.add_dependency "file-tail", "~> 0"
24
24
  spec.add_dependency "ruby-hmac", "~> 0"
25
25
  spec.add_dependency "addressable", "~> 0"
@@ -1,13 +1,20 @@
1
1
  require File.join(File.dirname(__FILE__), 'aliyun_sls_sdk', 'version.rb')
2
+ require File.join(File.dirname(__FILE__), 'aliyun_sls_sdk', 'protobuf.rb')
2
3
  require File.join(File.dirname(__FILE__), 'aliyun_sls_sdk', 'connection.rb')
3
- require File.join(File.dirname(__FILE__), 'aliyun_sls_sdk', 'sls_message_types_pb.rb')
4
4
 
5
5
  module AliyunSlsSdk
6
- class PostBodyInvalid < RuntimeError; end
7
- class SLSInvalidTimestamp < RuntimeError; end
8
- class SLSInvalidEncoding < RuntimeError; end
9
- class SLSInvalidKey < RuntimeError; end
10
- class PostBodyTooLarge < RuntimeError; end
11
- class PostBodyUncompressError < RuntimeError; end
12
- class SLSLogStoreNotExist < RuntimeError; end
6
+ class PostBodyInvalid < RuntimeError;
7
+ end
8
+ class SLSInvalidTimestamp < RuntimeError;
9
+ end
10
+ class SLSInvalidEncoding < RuntimeError;
11
+ end
12
+ class SLSInvalidKey < RuntimeError;
13
+ end
14
+ class PostBodyTooLarge < RuntimeError;
15
+ end
16
+ class PostBodyUncompressError < RuntimeError;
17
+ end
18
+ class SLSLogStoreNotExist < RuntimeError;
19
+ end
13
20
  end
@@ -6,221 +6,222 @@ require "time"
6
6
  require "net/http/persistent"
7
7
 
8
8
  module AliyunSlsSdk
9
- class Connection
10
-
11
- def initialize(project, region_endpoint, access_key_secret, aliyun_access_key, opts={})
12
- default_headers = {
13
- "x-sls-apiversion" => "0.4.0",
14
- "x-sls-signaturemethod" => "hmac-sha1"
15
- }
16
- @headers = default_headers.update opts
17
- @aliyun_access_key = aliyun_access_key
18
- @access_key_secret = access_key_secret
19
- @host = "#{project}.#{region_endpoint}"
20
- @http = Net::HTTP::Persistent.new
21
- # @http.debug_output = $stdout
22
- end
9
+ class Connection
10
+
11
+ def initialize(project, region_endpoint, aliyun_access_key_id, aliyun_access_key_secret, opts={})
12
+ default_headers = {
13
+ "x-sls-apiversion" => "0.4.0",
14
+ "x-sls-signaturemethod" => "hmac-sha1"
15
+ }
16
+ @headers = default_headers.update opts
17
+ @aliyun_access_key_id = aliyun_access_key_id
18
+ @aliyun_access_key_secret = aliyun_access_key_secret
19
+ @host = "#{project}.#{region_endpoint}"
20
+ @http = Net::HTTP::Persistent.new
21
+ # @http.debug_output = $stdout
22
+ end
23
23
 
24
- # http://docs.aliyun.com/#/pub/sls/api/apilist&PutLogs
25
- def puts_logs(logstorename, content)
26
- # 压缩content数据
27
- compressed = Zlib::Deflate.deflate(LogGroup.encode(content))
28
- headers = compact_headers(content, compressed)
29
- headers["Authorization"] = signature("POST", logstorename, headers, content, {})
30
-
31
- post_uri = URI "http://#{@host}/logstores/#{logstorename}"
32
- post = Net::HTTP::Post.new(post_uri.request_uri, headers)
33
- post.body = compressed
34
- response = @http.request post_uri, post
35
- parse_response(response)
36
- end
24
+ # http://docs.aliyun.com/#/pub/sls/api/apilist&PutLogs
25
+ def puts_logs(logstorename, content, ssl_verify = false)
26
+ # 压缩content数据
27
+ compressed = Zlib::Deflate.deflate(content.encode.to_s)
28
+ headers = compact_headers(content, compressed)
29
+ headers["Authorization"] = signature("POST", logstorename, headers, content, {})
30
+ scheme = ssl_verify ? "https" : "http"
31
+
32
+ post_uri = URI "#{scheme}://#{@host}/logstores/#{logstorename}"
33
+ post = Net::HTTP::Post.new(post_uri.request_uri, headers)
34
+ post.body = compressed
35
+ response = @http.request post_uri, post
36
+ parse_response(response)
37
+ end
37
38
 
38
- # http://docs.aliyun.com/#/pub/sls/api/apilist&ListLogstores
39
- def list_logstores
40
- headers = compact_headers(nil, nil)
41
- headers["Authorization"] = signature("GET", nil, headers, nil, {})
39
+ # http://docs.aliyun.com/#/pub/sls/api/apilist&ListLogstores
40
+ def list_logstores(ssl_verify = false)
41
+ headers = compact_headers(nil, nil)
42
+ headers["Authorization"] = signature("GET", nil, headers, nil, {})
43
+
44
+ scheme = ssl_verify ? "https" : "http"
45
+ get_uri = URI "#{scheme}://#{@host}/logstores"
46
+ headers["Referer"] = get_uri.to_s
47
+ get = Net::HTTP::Get.new(get_uri.request_uri, headers)
48
+ response = @http.request get_uri, get
49
+ parse_response(response)
50
+ end
42
51
 
43
- get_uri = URI "http://#{@host}/logstores"
44
- headers["Referer"] = get_uri.to_s
45
- get = Net::HTTP::Get.new(get_uri.request_uri, headers)
46
- response = @http.request get_uri, get
47
- parse_response(response)
48
- end
52
+ # http://docs.aliyun.com/#/pub/sls/api/apilist&GetLogs
53
+ def get_logs(logstorename, ssl_verify=false, opts={})
54
+ default_opts = {
55
+ :type => "log",
56
+ :from => Time.now.to_i - 60*5, #默认是五分钟前
57
+ :to => Time.now.to_i,
58
+ # :line => 100,
59
+ # :offset => 0,
60
+ :reverse => false
61
+ }
62
+ opts = default_opts.update opts
63
+ headers = compact_headers(nil, nil)
64
+ headers["Authorization"] = signature("GET", logstorename, headers, nil, opts)
65
+ scheme = ssl_verify ? "https" : "http"
66
+ get_uri = Addressable::URI.parse("#{scheme}://#{@host}/logstores/#{logstorename}")
67
+ headers["Referer"] = get_uri.to_s
68
+ get_uri.query_values = opts
69
+ get = Net::HTTP::Get.new(get_uri.request_uri, headers)
70
+ response = @http.request get_uri, get
71
+ parse_response(response)
72
+ end
49
73
 
50
- # http://docs.aliyun.com/#/pub/sls/api/apilist&GetLogs
51
- def get_logs(logstorename, opts={})
52
- default_opts = {
53
- :type => "log",
54
- :from => Time.now.to_i - 60*5,#默认是五分钟前
55
- :to => Time.now.to_i,
56
- # :line => 100,
57
- # :offset => 0,
58
- :reverse => false
59
- }
60
- opts = default_opts.update opts
61
- headers = compact_headers(nil, nil)
62
- headers["Authorization"] = signature("GET", logstorename, headers, nil, opts)
63
- get_uri = Addressable::URI.parse("http://#{@host}/logstores/#{logstorename}")
64
- headers["Referer"] = get_uri.to_s
65
- get_uri.query_values = opts
66
- puts get_uri.to_s
67
- get = Net::HTTP::Get.new(get_uri.request_uri, headers)
68
- response = @http.request get_uri, get
69
- parse_response(response)
70
- end
74
+ # http://docs.aliyun.com/#/pub/sls/api/apilist&ListTopics
75
+ def list_topics(logstorename, ssl_verify=false, opts={})
76
+ default_opts = {
77
+ :type => "topic",
78
+ :line => 100,
79
+ :toke => ""
80
+ }
81
+ opts = default_opts.update opts
82
+ headers = compact_headers(nil, nil)
83
+ headers["Authorization"] = signature("GET", logstorename, headers, nil, opts)
84
+ scheme = ssl_verify ? "https" : "http"
85
+ get_uri = Addressable::URI.parse("#{scheme}://#{@host}/logstores/#{logstorename}")
86
+ headers["Referer"] = get_uri.to_s
87
+ get_uri.query_values = opts
88
+ get = Net::HTTP::Get.new(get_uri.request_uri, headers)
89
+ response = @http.request get_uri, get
90
+ parse_response(response)
91
+ end
71
92
 
72
- # http://docs.aliyun.com/#/pub/sls/api/apilist&ListTopics
73
- def list_topics(logstorename, opts={})
74
- default_opts = {
75
- :type => "topic",
76
- :line => 100,
77
- :toke => ""
78
- }
79
- opts = default_opts.update opts
80
- headers = compact_headers(nil, nil)
81
- headers["Authorization"] = signature("GET", logstorename, headers, nil, opts)
82
-
83
- get_uri = Addressable::URI.parse("http://#{@host}/logstores/#{logstorename}")
84
- headers["Referer"] = get_uri.to_s
85
- get_uri.query_values = opts
86
- puts headers
87
- puts get_uri.to_s
88
- get = Net::HTTP::Get.new(get_uri.request_uri, headers)
89
- response = @http.request get_uri, get
90
- parse_response(response)
91
- end
93
+ # http://docs.aliyun.com/#/pub/sls/api/apilist&GetHistograms
94
+ def get_histograms(logstorename, ssl_verify=false, opts={})
95
+ default_opts = {
96
+ :type => "histogram",
97
+ :from => Time.now.to_i - 60*5, #默认是五分钟前
98
+ :to => Time.now.to_i,
99
+ :topic => "",
100
+ :query => "",
101
+ }
102
+ opts = default_opts.update opts
103
+ headers = compact_headers(nil, nil)
104
+ headers["Authorization"] = signature("GET", logstorename, headers, nil, opts)
105
+ scheme = ssl_verify ? "https" : "http"
106
+ get_uri = Addressable::URI.parse("#{scheme}://#{@host}/logstores/#{logstorename}")
107
+ headers["Referer"] = get_uri.to_s
108
+ get_uri.query_values = opts
109
+ get = Net::HTTP::Get.new(get_uri.request_uri, headers)
110
+ response = @http.request get_uri, get
111
+ parse_response(response)
112
+ end
92
113
 
93
- # http://docs.aliyun.com/#/pub/sls/api/apilist&GetHistograms
94
- def get_histograms(logstorename, opts={})
95
- default_opts = {
96
- :type => "histogram",
97
- :from => Time.now.to_i - 60*5,#默认是五分钟前
98
- :to => Time.now.to_i,
99
- :topic => "",
100
- :query => "",
101
- }
102
- opts = default_opts.update opts
103
- headers = compact_headers(nil, nil)
104
- headers["Authorization"] = signature("GET", logstorename, headers, nil, opts)
105
-
106
- get_uri = Addressable::URI.parse("http://#{@host}/logstores/#{logstorename}")
107
- headers["Referer"] = get_uri.to_s
108
- get_uri.query_values = opts
109
- get = Net::HTTP::Get.new(get_uri.request_uri, headers)
110
- response = @http.request get_uri, get
111
- parse_response(response)
112
- end
114
+ private
113
115
 
114
- private
116
+ def string_to_sign(verb, logstorename, headers, content, query={})
117
+ if content
118
+ string_to_sign_with_content(verb, logstorename, headers, query)
119
+ else
120
+ string_to_sign_without_content(verb, logstorename, headers, query)
121
+ end
122
+ end
115
123
 
116
- def string_to_sign(verb, logstorename, headers, content, query={})
117
- if content
118
- string_to_sign_with_content(verb, logstorename, headers, query)
119
- else
120
- string_to_sign_without_content(verb, logstorename, headers, query)
121
- end
122
- end
124
+ def string_to_sign_with_content(verb, logstorename, headers, query={})
123
125
 
124
- def string_to_sign_with_content(verb, logstorename, headers, query={})
125
- <<-DOC
126
- #{verb}
127
- #{headers['Content-MD5']}
128
- #{headers['Content-Type']}
129
- #{headers['Date']}
130
- #{canonicalized_sls_headers(headers)}
131
- #{canonicalized_resource(logstorename, query)}
132
- DOC
133
- end
126
+ <<~DOC
127
+ #{verb}
128
+ #{headers['Content-MD5']}
129
+ #{headers['Content-Type']}
130
+ #{headers['Date']}
131
+ #{canonicalized_sls_headers(headers)}
132
+ #{canonicalized_resource(logstorename, query)}
133
+ DOC
134
+ end
134
135
 
135
- def string_to_sign_without_content(verb, logstorename, headers, query={})
136
- <<-DOC
137
- #{verb}
136
+ def string_to_sign_without_content(verb, logstorename, headers, query={})
137
+ <<~DOC
138
+ #{verb}
138
139
 
139
140
 
140
- #{headers['Date']}
141
- #{canonicalized_sls_headers(headers)}
142
- #{canonicalized_resource(logstorename, query)}
143
- DOC
144
- end
141
+ #{headers['Date']}
142
+ #{canonicalized_sls_headers(headers)}
143
+ #{canonicalized_resource(logstorename, query)}
144
+ DOC
145
+ end
145
146
 
146
- # “CanonicalizedSLSHeaders”的构造方式如下:
147
- # 1. 将所有以“x-sls-”为前缀的HTTP请求头的名字转换成小写字母;
148
- # 2. 将上一步得到的所有SLS自定义请求头按照字典序进行升序排序;
149
- # 3. 删除请求头和内容之间分隔符两端出现的任何空格;
150
- # 4. 将所有的头和内容用\n分隔符组合成最后的CanonicalizedSLSHeader;
151
- def canonicalized_sls_headers(headers)
152
- h = {}
153
- headers.each { |k, v|
154
- if k =~ /x-sls-.*/
155
- h[k.downcase] = v
156
- end
157
- }
158
- h.keys.sort.map { |e|
159
- h[e]
160
- "#{e}:#{h[e].gsub(/^\s+/,'')}"
161
- }.join($/)
147
+ # “CanonicalizedSLSHeaders”的构造方式如下:
148
+ # 1. 将所有以“x-sls-”为前缀的HTTP请求头的名字转换成小写字母;
149
+ # 2. 将上一步得到的所有SLS自定义请求头按照字典序进行升序排序;
150
+ # 3. 删除请求头和内容之间分隔符两端出现的任何空格;
151
+ # 4. 将所有的头和内容用\n分隔符组合成最后的CanonicalizedSLSHeader;
152
+ def canonicalized_sls_headers(headers)
153
+ h = {}
154
+ headers.each { |k, v|
155
+ if k =~ /x-sls-.*/
156
+ h[k.downcase] = v
162
157
  end
158
+ }
159
+ h.keys.sort.map { |e|
160
+ h[e]
161
+ "#{e}:#{h[e].gsub(/^\s+/, '')}"
162
+ }.join($/)
163
+ end
163
164
 
164
- # “CanonicalizedResource”的构造方式如下:
165
- # 1. 将CanonicalizedResource设置为空字符串("");
166
- # 2. 放入要访问的SLS资源:"/logstores/logstorename"(无logstorename则不填);
167
- # 3. 如请求包含查询字符串(QUERY_STRING),则在CanonicalizedResource字符串尾部添加“?”和查询字符串。
168
- def canonicalized_resource(logstorename, query={})
169
- u = logstorename ? Addressable::URI.parse("/logstores/#{logstorename}") : Addressable::URI.parse("/logstores")
170
- if query.size != 0
171
- # 不能对请求的URL参数做URLEncode编码
172
- q_str = query.keys.sort.map { |e|
173
- "#{e}=#{query[e]}"
174
- }.join('&')
175
- "#{u}?#{q_str}"
176
- else
177
- u.to_s
178
- end
179
- end
165
+ # “CanonicalizedResource”的构造方式如下:
166
+ # 1. 将CanonicalizedResource设置为空字符串("");
167
+ # 2. 放入要访问的SLS资源:"/logstores/logstorename"(无logstorename则不填);
168
+ # 3. 如请求包含查询字符串(QUERY_STRING),则在CanonicalizedResource字符串尾部添加“?”和查询字符串。
169
+ def canonicalized_resource(logstorename, query={})
170
+ u = logstorename ? Addressable::URI.parse("/logstores/#{logstorename}") : Addressable::URI.parse("/logstores")
171
+ if query.size != 0
172
+ # 不能对请求的URL参数做URLEncode编码
173
+ q_str = query.keys.sort.map { |e|
174
+ "#{e}=#{query[e]}"
175
+ }.join('&')
176
+ "#{u}?#{q_str}"
177
+ else
178
+ u.to_s
179
+ end
180
+ end
180
181
 
181
- # 目前,SLS API只支持一种数字签名算法,即默认签名算法"hmac-sha1"。其整个签名公式如下:
182
- # Signature = base64(hmac-sha1(UTF8-Encoding-Of(SignString),AccessKeySecret))
183
- def sign(method, logstorename, headers, content, query)
184
- Base64.encode64((HMAC::SHA1.new(@access_key_secret) << string_to_sign(method, logstorename, headers, content, query).chomp).digest).strip
185
- end
182
+ # 目前,SLS API只支持一种数字签名算法,即默认签名算法"hmac-sha1"。其整个签名公式如下:
183
+ # Signature = base64(hmac-sha1(UTF8-Encoding-Of(SignString),AccessKeySecret))
184
+ def sign(method, logstorename, headers, content, query)
185
+ Base64.encode64((HMAC::SHA1.new(@aliyun_access_key_secret) << string_to_sign(method, logstorename, headers, content, query).chomp).digest).strip
186
+ end
186
187
 
187
- def signature(method, logstorename, headers, content, query)
188
- "SLS #{@aliyun_access_key}:#{sign(method, logstorename, headers, content, query)}"
189
- end
188
+ def signature(method, logstorename, headers, content, query)
189
+ "SLS #{@aliyun_access_key_id}:#{sign(method, logstorename, headers, content, query)}"
190
+ end
190
191
 
191
- # content是LogGroup
192
- def compact_headers(content, compressed)
193
- headers = @headers.dup
194
- # headers["x-sls-date"] =
195
- headers["Date"] = DateTime.now.httpdate
196
- headers["x-sls-bodyrawsize"] = "0"
197
-
198
- if content and compressed
199
- body = LogGroup.encode(content)
200
- headers["Content-Length"] = compressed.bytesize.to_s
201
- # 日志内容包含的日志必须小于3MB和4096条。
202
- raise AliyunSls::PostBodyTooLarge, "content length is larger than 3MB" if headers["Content-Length"].to_i > 3*1024**2*8
203
- raise AliyunSls::PostBodyTooLarge, "content size is more than 4096" if content.logs.size > 4096
204
- # MD5必须为大写字符串
205
- headers["Content-MD5"] = Digest::MD5.hexdigest(compressed).upcase
206
- headers["Content-Type"] = "application/x-protobuf"
207
- headers["x-sls-bodyrawsize"] = body.bytesize.to_s
208
- headers["x-sls-compresstype"] = "deflate"
209
- end
210
- headers
211
- end
192
+ # content是LogGroup
193
+ def compact_headers(content, compressed)
194
+ headers = @headers.dup
195
+ # headers["x-sls-date"] =
196
+ headers["Date"] = DateTime.now.httpdate
197
+ headers["x-sls-bodyrawsize"] = "0"
198
+
199
+ if content and compressed
200
+ body = content.encode.to_s
201
+ headers["Content-Length"] = compressed.bytesize.to_s
202
+ # 日志内容包含的日志必须小于3MB和4096条。
203
+ raise AliyunSls::PostBodyTooLarge, "content length is larger than 3MB" if headers["Content-Length"].to_i > 3*1024**2*8
204
+ raise AliyunSls::PostBodyTooLarge, "content size is more than 4096" if content.logs.size > 4096
205
+ # MD5必须为大写字符串
206
+ headers["Content-MD5"] = Digest::MD5.hexdigest(compressed).upcase
207
+ headers["Content-Type"] = "application/x-protobuf"
208
+ headers["x-sls-bodyrawsize"] = body.bytesize.to_s
209
+ headers["x-sls-compresstype"] = "deflate"
210
+ end
211
+ headers
212
+ end
212
213
 
213
- def parse_response(response)
214
- # 如果返回结果报错,则解析报错内容打印到日志中
215
- if response.code.to_s =~ /[4|5]\d\d/
216
- msg = "status #{response.code} body #{response.body}"
217
- if $logger and $logger.respond_to?(:error)
218
- $logger.error msg
219
- else
220
- puts msg
221
- end
222
- end
223
- response
214
+ def parse_response(response)
215
+ # 如果返回结果报错,则解析报错内容打印到日志中
216
+ if response.code.to_s =~ /[4|5]\d\d/
217
+ msg = "status #{response.code} body #{response.body}"
218
+ if $logger and $logger.respond_to?(:error)
219
+ $logger.error msg
220
+ else
221
+ puts msg
224
222
  end
223
+ end
224
+ response
225
225
  end
226
+ end
226
227
  end
@@ -0,0 +1,50 @@
1
+ require 'beefcake'
2
+
3
+ module AliyunSlsSdk
4
+ module Protobuf
5
+
6
+ # message Log
7
+ # {
8
+ # required uint32 time = 1; // UNIX Time Format
9
+ # message Content
10
+ # {
11
+ # required string key = 1;
12
+ # required string value = 2;
13
+ # }
14
+ # repeated Content contents= 2;
15
+ # }
16
+
17
+ # message LogGroup
18
+ # {
19
+ # repeated Log logs= 1;
20
+ # optional string reserved =2; // 内部字段,不需要填写
21
+ # optional string topic = 3;
22
+ # optional string source = 4;
23
+ # }
24
+
25
+ class Log
26
+ include Beefcake::Message
27
+
28
+ required :time, :uint32, 1
29
+
30
+ class Content
31
+ include Beefcake::Message
32
+
33
+ required :key, :string, 1
34
+ required :value, :string, 2
35
+ end
36
+
37
+ repeated :contents, Content, 2
38
+ end
39
+
40
+ class LogGroup
41
+ include Beefcake::Message
42
+
43
+ repeated :logs, Log, 1
44
+ optional :reserved, :string, 2
45
+ optional :topic, :string, 3
46
+ optional :source, :string, 4
47
+ end
48
+
49
+ end
50
+ end
@@ -1,3 +1,3 @@
1
1
  module AliyunSlsSdk
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aliyun_sls_sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - linhua.tlh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-28 00:00:00.000000000 Z
11
+ date: 2017-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -39,19 +39,19 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: google-protobuf
42
+ name: beefcake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '3.2'
47
+ version: '0'
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: '3.2'
54
+ version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: file-tail
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -122,9 +122,8 @@ files:
122
122
  - aliyun_sls_sdk.gemspec
123
123
  - lib/aliyun_sls_sdk.rb
124
124
  - lib/aliyun_sls_sdk/connection.rb
125
- - lib/aliyun_sls_sdk/sls_message_types_pb.rb
125
+ - lib/aliyun_sls_sdk/protobuf.rb
126
126
  - lib/aliyun_sls_sdk/version.rb
127
- - sls_message_types.proto
128
127
  homepage: https://help.aliyun.com/product/28958.html
129
128
  licenses:
130
129
  - MIT
@@ -1,31 +0,0 @@
1
- # Generated by the protocol buffer compiler. DO NOT EDIT!
2
- # source: sls_message_types.proto
3
-
4
- require 'google/protobuf'
5
-
6
- module AliyunSlsSdk
7
- Google::Protobuf::DescriptorPool.generated_pool.build do
8
- add_message "Log" do
9
- optional :time, :uint32, 1
10
- repeated :contents, :message, 2, "Log.Content"
11
- end
12
- add_message "Log.Content" do
13
- optional :key, :string, 1
14
- optional :value, :string, 2
15
- end
16
- add_message "LogGroup" do
17
- repeated :logs, :message, 1, "Log"
18
- optional :reserved, :string, 2
19
- optional :topic, :string, 3
20
- optional :source, :string, 4
21
- end
22
- add_message "LogGroupList" do
23
- optional :logGroupList, :message, 1, "LogGroup"
24
- end
25
- end
26
-
27
- Log = Google::Protobuf::DescriptorPool.generated_pool.lookup("Log").msgclass
28
- Log::Content = Google::Protobuf::DescriptorPool.generated_pool.lookup("Log.Content").msgclass
29
- LogGroup = Google::Protobuf::DescriptorPool.generated_pool.lookup("LogGroup").msgclass
30
- LogGroupList = Google::Protobuf::DescriptorPool.generated_pool.lookup("LogGroupList").msgclass
31
- end
@@ -1,23 +0,0 @@
1
- syntax = "proto3";
2
-
3
- message Log
4
- {
5
- uint32 time = 1; // UNIX Time Format
6
- message Content
7
- {
8
- string key = 1;
9
- string value = 2;
10
- }
11
- repeated Content contents= 2;
12
- }
13
- message LogGroup
14
- {
15
- repeated Log logs= 1;
16
- string reserved =2; // 内部字段,不需要填写
17
- string topic = 3;
18
- string source = 4;
19
- }
20
- message LogGroupList
21
- {
22
- LogGroup logGroupList = 1;
23
- }