nifi_sdk_ruby 0.0.5 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +0 -0
- data/CODE_OF_CONDUCT.md +0 -0
- data/Gemfile +0 -0
- data/LICENSE.txt +0 -0
- data/README.md +0 -0
- data/Rakefile +0 -0
- data/lib/nifi_sdk_ruby.rb +53 -34
- data/lib/nifi_sdk_ruby/version.rb +1 -1
- data/nifi_sdk_ruby.gemspec +0 -0
- data/release.md +0 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3500e4f44bfedf365cf70e160f8dd1ff164778be
|
4
|
+
data.tar.gz: f08829cc3bb7c22621252e480bd13c4c6dbdea2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1b01108a556dbf05f93c47453f9a42f0a66906ad6d70d8f5d93ff200d067470b0a9c87ac7e6a99ca6d573ea6c88080052fe56e0a63d74e68900be3a3fbc32d43
|
7
|
+
data.tar.gz: a989e64241f6b6732bcb7bf2bc9a7b793eec5eea87f3602024c28d53a810fd53b9acf7a82c645cf0723f3799285c1517ae66ff3d1d072cf8f5ce8dc750f8cd55
|
data/.gitignore
CHANGED
File without changes
|
data/CODE_OF_CONDUCT.md
CHANGED
File without changes
|
data/Gemfile
CHANGED
File without changes
|
data/LICENSE.txt
CHANGED
File without changes
|
data/README.md
CHANGED
File without changes
|
data/Rakefile
CHANGED
File without changes
|
data/lib/nifi_sdk_ruby.rb
CHANGED
@@ -14,7 +14,7 @@ class Nifi
|
|
14
14
|
|
15
15
|
DEFAULT_HOST = 'localhost'
|
16
16
|
DEFAULT_SCHEMA = 'http'
|
17
|
-
DEFAULT_PORT =
|
17
|
+
DEFAULT_PORT = 8080
|
18
18
|
DEFAULT_DEBUG = false
|
19
19
|
DEFAULT_ACYNC = false
|
20
20
|
|
@@ -28,20 +28,26 @@ class Nifi
|
|
28
28
|
@@sdk_name
|
29
29
|
@@sdk_version
|
30
30
|
@@client_id
|
31
|
+
@@cert
|
32
|
+
@@cert_key
|
33
|
+
@@cert_password
|
31
34
|
|
32
35
|
def initialize(*args)
|
33
36
|
|
34
37
|
args = args.reduce Hash.new, :merge
|
35
38
|
|
36
|
-
@@schema
|
37
|
-
@@host
|
38
|
-
@@port
|
39
|
-
@@base_url
|
40
|
-
@@debug
|
41
|
-
@@async
|
42
|
-
@@sdk_name
|
43
|
-
@@sdk_version
|
44
|
-
@@client_id
|
39
|
+
@@schema = args[:schema] ? args[:schema] : DEFAULT_SCHEMA
|
40
|
+
@@host = args[:host] ? args[:host] : DEFAULT_HOST
|
41
|
+
@@port = args[:port] ? args[:port] : DEFAULT_PORT
|
42
|
+
@@base_url = @@schema + '://' + @@host + ':' + @@port.to_s + '/nifi-api'
|
43
|
+
@@debug = DEFAULT_DEBUG
|
44
|
+
@@async = DEFAULT_ACYNC
|
45
|
+
@@sdk_name = 'ruby'
|
46
|
+
@@sdk_version = NifiSdkRuby::VERSION
|
47
|
+
@@client_id = SecureRandom.uuid
|
48
|
+
@@cert = args[:cert] ? args[:cert] : nil
|
49
|
+
@@cert_key = args[:cert_key] ? args[:cert_key] : nil
|
50
|
+
@@cert_password = args[:cert_password] ? args[:cert_key] : nil
|
45
51
|
end
|
46
52
|
|
47
53
|
def set_debug(debug = nil)
|
@@ -167,17 +173,17 @@ class Nifi
|
|
167
173
|
version = args[:version].to_s
|
168
174
|
|
169
175
|
params = {
|
170
|
-
|
171
|
-
|
172
|
-
|
176
|
+
revision:{
|
177
|
+
version: version
|
178
|
+
},
|
179
|
+
id: id,
|
180
|
+
component:{
|
173
181
|
id: id,
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
runStatus: 'Running'
|
180
|
-
}
|
182
|
+
state: 'RUNNING'
|
183
|
+
},
|
184
|
+
status:{
|
185
|
+
runStatus: 'Running'
|
186
|
+
}
|
181
187
|
}
|
182
188
|
update_process(id: id, update_json: params)
|
183
189
|
end
|
@@ -192,17 +198,17 @@ class Nifi
|
|
192
198
|
version = args[:version].to_s
|
193
199
|
|
194
200
|
params = {
|
195
|
-
|
196
|
-
|
197
|
-
|
201
|
+
revision:{
|
202
|
+
version: version
|
203
|
+
},
|
204
|
+
id: id,
|
205
|
+
component:{
|
198
206
|
id: id,
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
runStatus: 'Stopped'
|
205
|
-
}
|
207
|
+
state: 'STOPPED'
|
208
|
+
},
|
209
|
+
status:{
|
210
|
+
runStatus: 'Stopped'
|
211
|
+
}
|
206
212
|
}
|
207
213
|
update_process(id: id, update_json: params)
|
208
214
|
end
|
@@ -300,7 +306,8 @@ class Nifi
|
|
300
306
|
name = t.xpath('//template/name').text
|
301
307
|
|
302
308
|
if self.template_by_name? name
|
303
|
-
|
309
|
+
self.delete_template self.get_template_by_name name
|
310
|
+
#raise StandardError.new('The template ' << name << ' already exists')
|
304
311
|
end
|
305
312
|
|
306
313
|
params = Array.new
|
@@ -333,12 +340,12 @@ class Nifi
|
|
333
340
|
res = self.class.exists
|
334
341
|
|
335
342
|
t = res.select do |r|
|
336
|
-
r['name'] == name and r['identifier'] =~
|
343
|
+
r['name'] == name and r['identifier'] =~ /^\/templates\//
|
337
344
|
end
|
338
345
|
|
339
346
|
|
340
347
|
if t.count == 1
|
341
|
-
t[0]['identifier'].scan(/\/templates\/(.*)/)
|
348
|
+
t[0]['identifier'].scan(/\/templates\/(.*)/)[0][0]
|
342
349
|
else
|
343
350
|
raise StandardError.new('Unable to locate template with name ' << name)
|
344
351
|
end
|
@@ -398,6 +405,18 @@ class Nifi
|
|
398
405
|
c.headers['NIFI-SDK-Name'] = @@sdk_name
|
399
406
|
c.headers['NIFI-SDK-Version'] = @@sdk_version
|
400
407
|
c.ssl_verify_peer = false
|
408
|
+
c.ssl_verify_host = false
|
409
|
+
|
410
|
+
if @@schema == 'https' and @@cert
|
411
|
+
c.cert = @@cert
|
412
|
+
end
|
413
|
+
if @@schema == 'https' and @@cert_key
|
414
|
+
c.cert_key = @@cert_key
|
415
|
+
end
|
416
|
+
if @@schema == 'https' and @@cert_password
|
417
|
+
c.certpassword = @@cert_password
|
418
|
+
end
|
419
|
+
|
401
420
|
#c.verbose = true
|
402
421
|
|
403
422
|
case method
|
@@ -431,4 +450,4 @@ class Nifi
|
|
431
450
|
puts c.body_str
|
432
451
|
end
|
433
452
|
end
|
434
|
-
end
|
453
|
+
end
|
data/nifi_sdk_ruby.gemspec
CHANGED
File without changes
|
data/release.md
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nifi_sdk_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Israel Calvete
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -164,7 +164,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
164
164
|
version: '0'
|
165
165
|
requirements: []
|
166
166
|
rubyforge_project:
|
167
|
-
rubygems_version: 2.
|
167
|
+
rubygems_version: 2.5.1
|
168
168
|
signing_key:
|
169
169
|
specification_version: 4
|
170
170
|
summary: A RUBY SDK to use APACHE NIFI API
|