fluent-plugin-azureeventhubs 0.0.1 → 0.0.2

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: 5491857b05bcfb6db0fb36515adefd80e69b4fdc
4
- data.tar.gz: 8a189efccb6bdaff99fd1ce52f1a85a4b0cdc7e5
3
+ metadata.gz: 0bb3ea484dd72900d92738afc4a4949712320738
4
+ data.tar.gz: 32eaffcadc56261be9b6dd60c9816062001fca41
5
5
  SHA512:
6
- metadata.gz: 6b1b7c7719bb7836a62bbc7c291b1fc5713772d7d436856592f7d5272eee013dc7632baecea48c534fd3a336928c2dcec1099c6b55fc6cc810746030beaad48d
7
- data.tar.gz: 4372244363879f01275cbb6e59caf532170c270c4609b3f2fe086b9c9bab422359bb2e39e23cf6b607632022bac897fcae1e8a1e269a8ac94beaa8960a5cccba
6
+ metadata.gz: 5c2f7b9e06854f9be971022132849b2e8050e3959cf357e112549da885d537ccc4d2d11939aecebc34ebf5d0115f7b6e3d4bf138df0259c654c24f2aaac67c9a
7
+ data.tar.gz: e375ec9e310ef8e301c3ac66d982fe43940a4721e7d93779d86ac1954163556a76b73f154d5b83f77c210fa9f4239495fd4a50cd2e17185cfcf6ef5192c1b484
data/README.md CHANGED
@@ -30,6 +30,7 @@ Or install it yourself as:
30
30
  include_time (true|false) # true: Include time into record [Optional: default => false]
31
31
  tag_time_name record_time # record tag for time when include_time sets true. [Optional: default => 'time']
32
32
  type (https|amqps) # Connection type. [Optional: default => https]. Note that amqps is not implementated.
33
+ expiry_interval <Integer number> # Signature expiration time interval in seconds. [Optional: default => 3600 (60min)]
33
34
  </match>
34
35
  ```
35
36
 
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-plugin-azureeventhubs"
7
- spec.version = "0.0.1"
7
+ spec.version = "0.0.2"
8
8
  spec.authors = ["Hidemasa Togashi"]
9
9
  spec.email = ["togachiro@gmail.com"]
10
10
  spec.summary = "Fluentd output plugin for Azure Event Hubs"
@@ -1,6 +1,6 @@
1
1
 
2
2
  class AzureEventHubsHttpSender
3
- def initialize(connection_string, hub_name)
3
+ def initialize(connection_string, hub_name, expiry=3600)
4
4
  require 'openssl'
5
5
  require 'base64'
6
6
  require 'net/http'
@@ -9,7 +9,7 @@ class AzureEventHubsHttpSender
9
9
  require 'time'
10
10
  @connection_string = connection_string
11
11
  @hub_name = hub_name
12
- @expires_in_mins = 3600
12
+ @expiry_interval = expiry
13
13
 
14
14
  if @connection_string.count(';') != 2
15
15
  raise "Connection String format is not correct"
@@ -29,11 +29,11 @@ class AzureEventHubsHttpSender
29
29
 
30
30
  def generate_sas_token(uri)
31
31
  target_uri = CGI.escape(uri.downcase).downcase
32
- expires = Time.now.to_i + @expires_in_mins
33
- to_sign = "#{target_uri}\n#{expires}";
32
+ expiry = Time.now.to_i + @expiry_interval
33
+ to_sign = "#{target_uri}\n#{expiry}";
34
34
  signature = CGI.escape(Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), @sas_key_value, to_sign)).strip())
35
35
 
36
- token = "SharedAccessSignature sr=#{target_uri}&sig=#{signature}&se=#{expires}&skn=#{@sas_key_name}"
36
+ token = "SharedAccessSignature sr=#{target_uri}&sig=#{signature}&se=#{expiry}&skn=#{@sas_key_name}"
37
37
  return token
38
38
  end
39
39
 
@@ -8,7 +8,7 @@
8
8
  config_param :include_tag, :bool, :default => false
9
9
  config_param :include_time, :bool, :default => false
10
10
  config_param :tag_time_name, :string, :default => 'time'
11
- config_param :expires_mins, :integer, :default => 3600 # 60min
11
+ config_param :expiry_interval, :integer, :default => 3600 # 60min
12
12
  config_param :type, :string, :default => 'https' # https / amqps (Not Implemented)
13
13
 
14
14
  def configure(conf)
@@ -18,7 +18,7 @@
18
18
  raise NotImplementedError
19
19
  else
20
20
  require_relative 'azureeventhubs/http'
21
- @sender = AzureEventHubsHttpSender.new(@connection_string, @hub_name)
21
+ @sender = AzureEventHubsHttpSender.new(@connection_string, @hub_name, @expiry_interval)
22
22
  end
23
23
  end
24
24
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-azureeventhubs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hidemasa Togashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-18 00:00:00.000000000 Z
11
+ date: 2015-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler