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 +4 -4
- data/aliyun_sls_sdk.gemspec +1 -1
- data/lib/aliyun_sls_sdk.rb +15 -8
- data/lib/aliyun_sls_sdk/connection.rb +197 -196
- data/lib/aliyun_sls_sdk/protobuf.rb +50 -0
- data/lib/aliyun_sls_sdk/version.rb +1 -1
- metadata +6 -7
- data/lib/aliyun_sls_sdk/sls_message_types_pb.rb +0 -31
- data/sls_message_types.proto +0 -23
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a5379de759aaffcc2806796c3ac6352cea1baac
|
4
|
+
data.tar.gz: 15cd324d103afaf804110ef26c4789ebe3cd7993
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 783c03b3c249d078068076784ee53939147e70abd1734f97e2ffd26ac71880ed607ccc7354908d71730d2714d3fae6b66468e9b63aa4aaec9f1854d34af27ff6
|
7
|
+
data.tar.gz: 131b92443f4108ea49a3abf69f49876a1194e2c1b253707f47f5b579bc1db34576c5bf1c72cb65bc4902df5b253dfdafcf4cfbff3bd9aedda735e0a4b456207f
|
data/aliyun_sls_sdk.gemspec
CHANGED
@@ -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 "
|
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"
|
data/lib/aliyun_sls_sdk.rb
CHANGED
@@ -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
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
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
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
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
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
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
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
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
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
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
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
125
|
-
|
126
|
-
#{
|
127
|
-
#{headers['Content-
|
128
|
-
#{headers['
|
129
|
-
#{headers
|
130
|
-
#{
|
131
|
-
|
132
|
-
|
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
|
-
|
136
|
-
|
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
|
-
|
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
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
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
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
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
|
-
|
184
|
-
|
185
|
-
|
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
|
-
|
188
|
-
|
189
|
-
|
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
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
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
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
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
|
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
|
+
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-
|
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:
|
42
|
+
name: beefcake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
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: '
|
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/
|
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
|
data/sls_message_types.proto
DELETED
@@ -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
|
-
}
|