aliyun_sls_sdk 0.0.2 → 0.0.4

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: 06026a99ab9e00ffead4a3f9a327cdc81fb42cfb
4
- data.tar.gz: 204c854483de06e96a8a928a8ecb1b3aeb35f2fb
3
+ metadata.gz: cc07413c32c73b456a587f6e989ba703a730f364
4
+ data.tar.gz: 31314032b496372b15a7071efcd7163cf868862a
5
5
  SHA512:
6
- metadata.gz: ffa653d8be8e2d42ac3708842cc4668e7e21d9d1ff4402c43f7b034b3d8433ffbe6227e3ed5bded20c8b3eec54f9574d4e3b0e36ad7088a058e1cd3d60b58b11
7
- data.tar.gz: badb32a9c472c5f7880d42fbcbc18ff0eabca0671dec3787abb35006570bd3be8c56e40abbe7688aeec53c4f5b0da3faa4910add2fa4356daac8290efe21574a
6
+ metadata.gz: a74d8f5aae9cb3bba763b5de1a1ec67719c5e069c197df420f9856e455fcfa426d458ed106d3df28987ef2bfd9e59575656fd7b8fe6c9f73c06c918fe628eb9d
7
+ data.tar.gz: 878dd8a3b97c27749169afc86e22e23e812dc72585360cdc62eb1f095b462a009fc323f50d79c538e32b7ac7916316f2d8f3620d21b928ecfa9748638d56df6f
@@ -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 "beefcake", "~> 0"
22
+ spec.add_dependency "google-protobuf", "~>3.2"
23
23
  spec.add_dependency "file-tail", "~> 0"
24
24
  spec.add_dependency "ruby-hmac", "~> 0"
25
25
  spec.add_dependency "addressable", "~> 0"
@@ -24,7 +24,7 @@ module AliyunSlsSdk
24
24
  # http://docs.aliyun.com/#/pub/sls/api/apilist&PutLogs
25
25
  def puts_logs(logstorename, content)
26
26
  # 压缩content数据
27
- compressed = Zlib::Deflate.deflate(content.encode.to_s)
27
+ compressed = Zlib::Deflate.deflate(LogGroup.encode(content))
28
28
  headers = compact_headers(content, compressed)
29
29
  headers["Authorization"] = signature("POST", logstorename, headers, content, {})
30
30
 
@@ -196,7 +196,7 @@ DOC
196
196
  headers["x-sls-bodyrawsize"] = "0"
197
197
 
198
198
  if content and compressed
199
- body = content.encode.to_s
199
+ body = LogGroup.encode(content)
200
200
  headers["Content-Length"] = compressed.bytesize.to_s
201
201
  # 日志内容包含的日志必须小于3MB和4096条。
202
202
  raise AliyunSls::PostBodyTooLarge, "content length is larger than 3MB" if headers["Content-Length"].to_i > 3*1024**2*8
@@ -0,0 +1,31 @@
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,3 +1,3 @@
1
1
  module AliyunSlsSdk
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -1,6 +1,6 @@
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')
3
2
  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
6
  class PostBodyInvalid < RuntimeError; end
@@ -0,0 +1,23 @@
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
+ }
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.2
4
+ version: 0.0.4
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-27 00:00:00.000000000 Z
11
+ date: 2017-03-28 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: beefcake
42
+ name: google-protobuf
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '3.2'
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: '0'
54
+ version: '3.2'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: file-tail
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -122,8 +122,9 @@ 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/protobuf.rb
125
+ - lib/aliyun_sls_sdk/sls_message_types_pb.rb
126
126
  - lib/aliyun_sls_sdk/version.rb
127
+ - sls_message_types.proto
127
128
  homepage: https://help.aliyun.com/product/28958.html
128
129
  licenses:
129
130
  - MIT
@@ -1,50 +0,0 @@
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