iron_worker_ng 1.6.6 → 1.6.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +10 -0
- data/lib/iron_worker_ng.rb +2 -0
- data/lib/iron_worker_ng/api_client.rb +43 -3
- data/lib/iron_worker_ng/cli.rb +11 -2
- data/lib/iron_worker_ng/client.rb +61 -1
- data/lib/iron_worker_ng/version.rb +1 -1
- 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: 5d728037b73dde617ad9e2582e64b1fef7abf017
|
4
|
+
data.tar.gz: f2fc30107924b9e1a007f708ec263ab39dbcbc27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc54768fd8b07b050addebdf0871a9417f63a28fb7b1e3f5037087cf4181dd174fbcf77bf24678262ec24c9bf2611e59471423591a8119f391260bc5feb3959a
|
7
|
+
data.tar.gz: df384b6b78e00dcaf2b95e4b547ef14cc0c8049c03c443f6275d65cbf3d3b06e1e6c2cd259cc6e7171569896c7c411c3242775e4643bb0c65f230f261bd995ee
|
data/README.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
# DEPRECATED
|
2
|
+
|
3
|
+
## This gem is deprecated! Please find the new tools at the links below.
|
4
|
+
|
5
|
+
* Use the new [Docker Workflow](https://github.com/iron-io/dockerworker/) for creating/packaging your workers.
|
6
|
+
* Use the new [IronCLI](https://github.com/iron-io/ironcli) for command line tools.
|
7
|
+
* Use the [iron_worker](https://github.com/iron-io/iron_worker_ruby) gem in your Ruby code.
|
8
|
+
|
9
|
+
# Please read above for changes to the Iron.io tooling, only use the below documentation if you need it for legacy apps
|
10
|
+
|
1
11
|
# Introduction
|
2
12
|
|
3
13
|
To run your code in cloud you need to do three things:
|
data/lib/iron_worker_ng.rb
CHANGED
@@ -15,19 +15,23 @@ module IronWorkerNG
|
|
15
15
|
:user_agent => IronWorkerNG.full_version
|
16
16
|
}
|
17
17
|
|
18
|
-
super('iron', 'worker', options, default_options, [:project_id, :token, :api_version])
|
18
|
+
super('iron', 'worker', options, default_options, [:project_id, :token, :jwt, :api_version])
|
19
19
|
|
20
20
|
#puts "nhp.proxy yo #{rest.wrapper.http.proxy_uri}" if defined? Net::HTTP::Persistent
|
21
21
|
#puts "RestClient.proxy yo #{RestClient.proxy}" if defined? RestClient
|
22
22
|
#puts "InternalClient.proxy yo #{Rest::InternalClient.proxy}" if defined? Rest::InternalClient
|
23
23
|
|
24
|
-
IronCore::Logger.error 'IronWorkerNG', "Token is not set", IronCore::Error if @token.nil?
|
24
|
+
IronCore::Logger.error 'IronWorkerNG', "Token is not set", IronCore::Error if @token.nil? && @jwt.nil?
|
25
25
|
|
26
26
|
check_id(@project_id, 'project_id')
|
27
27
|
end
|
28
28
|
|
29
29
|
def headers
|
30
|
-
|
30
|
+
if !@jwt.nil?
|
31
|
+
super.merge({'Authorization' => "JWT #{@jwt}"})
|
32
|
+
else
|
33
|
+
super.merge({'Authorization' => "OAuth #{@token}"})
|
34
|
+
end
|
31
35
|
end
|
32
36
|
|
33
37
|
def base_url
|
@@ -151,5 +155,41 @@ module IronWorkerNG
|
|
151
155
|
def projects_get
|
152
156
|
parse_response(get("projects/#{@project_id}"))
|
153
157
|
end
|
158
|
+
|
159
|
+
def clusters_list
|
160
|
+
parse_response(get("clusters"))
|
161
|
+
end
|
162
|
+
|
163
|
+
def clusters_get(cluster_id)
|
164
|
+
parse_response(get("clusters/#{cluster_id}"))
|
165
|
+
end
|
166
|
+
|
167
|
+
def clusters_credentials(cluster_id)
|
168
|
+
parse_response(get("clusters/#{cluster_id}/credentials"))
|
169
|
+
end
|
170
|
+
|
171
|
+
def clusters_create(options = {})
|
172
|
+
parse_response(post("clusters", options))
|
173
|
+
end
|
174
|
+
|
175
|
+
def clusters_update(cluster_id, options = {})
|
176
|
+
parse_response(put("clusters/#{cluster_id}", options))
|
177
|
+
end
|
178
|
+
|
179
|
+
def clusters_delete(cluster_id)
|
180
|
+
parse_response(delete("clusters/#{cluster_id}"))
|
181
|
+
end
|
182
|
+
|
183
|
+
def clusters_share(cluster_id, options = {})
|
184
|
+
parse_response(post("clusters/#{cluster_id}/share", options))
|
185
|
+
end
|
186
|
+
|
187
|
+
def clusters_shared_list
|
188
|
+
parse_response(get("clusters/shared"))
|
189
|
+
end
|
190
|
+
|
191
|
+
def clusters_unshare(cluster_id, user_id)
|
192
|
+
parse_response(post("clusters/#{cluster_id}/unshare/#{user_id}"))
|
193
|
+
end
|
154
194
|
end
|
155
195
|
end
|
data/lib/iron_worker_ng/cli.rb
CHANGED
@@ -10,6 +10,7 @@ module IronWorkerNG
|
|
10
10
|
@env = nil
|
11
11
|
@project_id = nil
|
12
12
|
@token = nil
|
13
|
+
@jwt = nil
|
13
14
|
@http_proxy = nil
|
14
15
|
end
|
15
16
|
|
@@ -42,7 +43,13 @@ module IronWorkerNG
|
|
42
43
|
|
43
44
|
@token = token
|
44
45
|
end
|
45
|
-
|
46
|
+
|
47
|
+
def jwt=(jwt)
|
48
|
+
@client = nil
|
49
|
+
|
50
|
+
@jwt = jwt
|
51
|
+
end
|
52
|
+
|
46
53
|
def http_proxy=(http_proxy)
|
47
54
|
@client = nil
|
48
55
|
@http_proxy = http_proxy
|
@@ -60,7 +67,9 @@ module IronWorkerNG
|
|
60
67
|
if @client.nil?
|
61
68
|
log_group "Creating client"
|
62
69
|
|
63
|
-
@client = IronWorkerNG::Client.new(:config => @config, :env => @env, :project_id => @project_id,
|
70
|
+
@client = IronWorkerNG::Client.new(:config => @config, :env => @env, :project_id => @project_id,
|
71
|
+
:token => @token,
|
72
|
+
:jwt => @jwt,
|
64
73
|
:http_proxy => @http_proxy
|
65
74
|
)
|
66
75
|
|
@@ -41,6 +41,10 @@ module IronWorkerNG
|
|
41
41
|
@api.token
|
42
42
|
end
|
43
43
|
|
44
|
+
def jwt
|
45
|
+
@api.jwt
|
46
|
+
end
|
47
|
+
|
44
48
|
def project_id
|
45
49
|
@api.project_id
|
46
50
|
end
|
@@ -442,7 +446,63 @@ EXEC_FILE
|
|
442
446
|
OpenStruct.new(res)
|
443
447
|
end
|
444
448
|
|
445
|
-
def
|
449
|
+
def clusters_list
|
450
|
+
IronCore::Logger.debug 'IronWorkerNG', "Calling clusters.list"
|
451
|
+
res = @api.clusters_list
|
452
|
+
res['clusters'].map { |s| OpenStruct.new(s.merge('_id' => s['id'])) }
|
453
|
+
end
|
454
|
+
|
455
|
+
def clusters_get(id)
|
456
|
+
IronCore::Logger.debug 'IronWorkerNG', "Calling projects.get"
|
457
|
+
res = @api.clusters_get(id)['cluster']
|
458
|
+
res['_id'] = res['id']
|
459
|
+
OpenStruct.new(res)
|
460
|
+
end
|
461
|
+
|
462
|
+
def clusters_credentials(id)
|
463
|
+
IronCore::Logger.debug 'IronWorkerNG', "Calling projects.get"
|
464
|
+
res = @api.clusters_credentials(id)['cluster']
|
465
|
+
res['_id'] = res['id']
|
466
|
+
OpenStruct.new(res)
|
467
|
+
end
|
468
|
+
|
469
|
+
def clusters_create(params = {})
|
470
|
+
IronCore::Logger.debug 'IronWorkerNG', "Calling clusters.create with params='#{params.to_s}'"
|
471
|
+
res = @api.clusters_create(params)
|
472
|
+
OpenStruct.new(res)
|
473
|
+
end
|
474
|
+
|
475
|
+
def clusters_update(cluster_id, params = {})
|
476
|
+
IronCore::Logger.debug 'IronWorkerNG', "Calling clusters.update with params='#{params.to_s}'"
|
477
|
+
res = @api.clusters_update(cluster_id, params)
|
478
|
+
OpenStruct.new(res)
|
479
|
+
end
|
480
|
+
|
481
|
+
def clusters_delete(cluster_id)
|
482
|
+
IronCore::Logger.debug 'IronWorkerNG', "Calling clusters.delete with cluster_id='#{cluster_id}'"
|
483
|
+
res = @api.clusters_delete(cluster_id)
|
484
|
+
OpenStruct.new(res)
|
485
|
+
end
|
486
|
+
|
487
|
+
def clusters_share(cluster_id, params = {})
|
488
|
+
IronCore::Logger.debug 'IronWorkerNG', "Calling clusters.share with params='#{params.to_s}'"
|
489
|
+
res = @api.clusters_share(cluster_id, params)
|
490
|
+
OpenStruct.new(res)
|
491
|
+
end
|
492
|
+
|
493
|
+
def clusters_shared_list
|
494
|
+
IronCore::Logger.debug 'IronWorkerNG', "Calling clusters.shared.list"
|
495
|
+
res = @api.clusters_shared_list
|
496
|
+
res['clusters'].map { |s| OpenStruct.new(s.merge('_id' => s['id'])) }
|
497
|
+
end
|
498
|
+
|
499
|
+
def clusters_unshare(cluster_id, user_id)
|
500
|
+
IronCore::Logger.debug 'IronWorkerNG', "Calling clusters.unshare with cluster_id='#{cluster_id}', user_id='#{user_id}'"
|
501
|
+
res = @api.clusters_unshare(cluster_id, user_id)
|
502
|
+
OpenStruct.new(res)
|
503
|
+
end
|
504
|
+
|
505
|
+
def params_for_legacy(code_name, params = {})
|
446
506
|
if params.is_a?(String)
|
447
507
|
params = JSON.parse(params)
|
448
508
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iron_worker_ng
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Kirilenko
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-
|
12
|
+
date: 2015-10-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: iron_core
|
@@ -241,7 +241,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
241
241
|
version: 1.3.6
|
242
242
|
requirements: []
|
243
243
|
rubyforge_project:
|
244
|
-
rubygems_version: 2.
|
244
|
+
rubygems_version: 2.4.5
|
245
245
|
signing_key:
|
246
246
|
specification_version: 4
|
247
247
|
summary: New generation ruby client for IronWorker
|