druid_config 0.4.0 → 0.5.0

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: bf454ef0181ed1e25627d5cfc70229feb60acc4b
4
- data.tar.gz: b71143a30e604c6463738ea4a543a9775e50768d
3
+ metadata.gz: afe7ee37715de2ecf08282e55c33fc67620b32c6
4
+ data.tar.gz: 167c6181c42cc87102c2fd5f8339e8cd461354c1
5
5
  SHA512:
6
- metadata.gz: a3c56389d7dbc9778bb6c29091e8538da10b3dd1856e32d266290cfe3fa94e8d4ecea7b3d77997e793f00818c7a89831d40f38d25901a17d6a052a5dddc32240
7
- data.tar.gz: 67ef3c716e5561a6043a009298039c01247a060356eba2f5d209a374c88f254c3bbde2ee99f4241d2618b2c8e7980921598878d3af39ae67b63324b0e636cebc
6
+ metadata.gz: 571ba6d0d2493d88bb3b67926b14bf864c9c6f3897505e68610a8ebf2ab0df733a48068c532a3286f8cdfd945210b91ad6bca635d1500e3f146a4c56e0a31c32
7
+ data.tar.gz: 0004ae8c20b1e9248a5ae6a11a42732b0c42fa3f19b5f7bcd577534a9acefeeb6da489039ac6c8e9dec162dbdccabe96252b0dfda5146faba015f52c64528d23
@@ -41,6 +41,44 @@ module DruidConfig
41
41
  end
42
42
  end
43
43
 
44
+ # Enable the current data source
45
+ #
46
+ def enable
47
+ secure_query do
48
+ self.class.post("/datasources/#{@name}")
49
+ end
50
+ end
51
+
52
+ # Disable the current data source
53
+ #
54
+ def disable
55
+ secure_query do
56
+ self.class.delete("/datasources/#{@name}")
57
+ end
58
+ end
59
+
60
+ # Destroy the current data source. Becareful, this action will remove the
61
+ # data associated to the data source
62
+ #
63
+ # @param interval [String] Optional parameter to define the interval to
64
+ # destroy the data associated to the data source. By default, it will
65
+ # destroy all data.
66
+ #
67
+ # @return [Hash, nil] Hash with error or nil
68
+ #
69
+ def destroy(interval = nil)
70
+ interval = all_interval unless interval
71
+ # Disable data source
72
+ disable
73
+ # Execute kill task
74
+ secure_query do
75
+ self.class.delete(
76
+ "/datasources/#{@name}?kill=true&interval=#{interval}")
77
+ end
78
+ end
79
+
80
+ # Destroy current data source
81
+
44
82
  # Intervals
45
83
  # -----------------
46
84
  def intervals(params = '')
@@ -126,6 +164,19 @@ module DruidConfig
126
164
 
127
165
  private
128
166
 
167
+ # Return an ISO8601 interval from 0 to tomorrow. This is used to destroy
168
+ # all the data of a data source
169
+ #
170
+ # @return [String] ISO8601 interval
171
+ #
172
+ def all_interval
173
+ beginning = '1970-01-01T00:00:00Z'
174
+ # We use today + 1.day to ensure all data is deleted
175
+ last = (Time.now + 24*60*60).strftime('%Y-%m-%dT%H:%M:00Z')
176
+ # Return the interval
177
+ "#{beginning}/#{last}"
178
+ end
179
+
129
180
  #
130
181
  # Save rules of this data source
131
182
  #
@@ -4,7 +4,7 @@
4
4
  module DruidConfig
5
5
  module Version
6
6
  # Version of the gem
7
- VERSION = '0.4.0'
7
+ VERSION = '0.5.0'
8
8
 
9
9
  # Base URI foor coordinator queries
10
10
  API_VERSION = 'v1'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: druid_config
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Angel M Miguel
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-24 00:00:00.000000000 Z
11
+ date: 2016-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: zk
@@ -200,7 +200,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
200
  version: '0'
201
201
  requirements: []
202
202
  rubyforge_project:
203
- rubygems_version: 2.4.6
203
+ rubygems_version: 2.2.2
204
204
  signing_key:
205
205
  specification_version: 4
206
206
  summary: Fetch Druid info and configure your cluster
@@ -210,4 +210,3 @@ test_files:
210
210
  - spec/data_source_spec.rb
211
211
  - spec/node_spec.rb
212
212
  - spec/spec_helper.rb
213
- has_rdoc: