pi 0.1.26 → 0.1.27

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.
data/lib/cli/usage.rb CHANGED
@@ -25,83 +25,91 @@ class PI::Cli::Runner
25
25
  Currently available pi commands are:
26
26
 
27
27
  User
28
- login [url] [--user,--password] Login
29
- logout Logs current user out of the system
30
- info List system information
31
- user Display user information
32
- targets List available targets infomation
33
- password [oldpassword] [--password PASS] Change the password for the current user
34
- github [name] [--email,--password] Bind to the github account
35
- runtimes Display the supported runtimes of the system
36
- frameworks Display the supported frameworks of the system
37
- version Display version information
38
- help [command] Get general help or help on a specific command
39
- help options Get help on available options
28
+ login [url] [--user,--password] Login
29
+ logout Logs current user out of the system
30
+ info List system information
31
+ user Display user information
32
+ targets List available targets infomation
33
+ password [oldpassword] [--password PASS] Change the password for the current user
34
+ github [name] [--email,--password] Bind to the github account
35
+ runtimes Display the supported runtimes of the system
36
+ frameworks Display the supported frameworks of the system
37
+ version Display version information
38
+ help [command] Get general help or help on a specific command
39
+ help options Get help on available options
40
40
 
41
41
  Project
42
- projects List created projects
43
- create-project [project] Create a new project
44
- delete-project [projectid] Delete the project
45
- project-events [projectid] List the event info for the project
46
- project-tags [projectid] List the tags for the project
47
- project-commits [projectid] List the commit log for the project
48
- upload [projectid][--path,--ver,--desc] Upload the war package for java project
42
+ projects List created projects
43
+ create-project [project] Create a new project
44
+ delete-project [projectid] Delete the project
45
+ project-events [projectid] List the event info for the project
46
+ project-tags [projectid] List the tags for the project
47
+ project-commits [projectid] List the commit log for the project
48
+ upload [projectid] [--path,--ver,--desc] Upload the war package for java project
49
49
 
50
50
  Application
51
- apps [--projectid,--target] List deployed applications
52
- create-app [appname] Create a new application
53
- delete-app [appid] Delete the application
54
- delete-app <appname> <--target TARGET> Delete the application
55
- start-app [appid] Start the application
56
- start-app <appname> <--target TARGET> Start the application
57
- stop-app [appid] Stop the application
58
- stop-app <appname> <--target TARGET> Stop the application
59
- restart-app [appid] Restart the application
60
- restart-app <appname> <--target TARGET> Restart the application
61
- scale-app [appid] [--instance N] Scale the application instances up or down
62
- scale-app <appname> <--target TARGET> [--instance N] Scale the application instances up or down
63
- update-app [appid] [--ver VERSION] Update the application
64
- update-app <appname> <--target TARGET>[--ver VERSION] Update the application
65
- status [appid] Display resource usage for the application
66
- status <appname> <--target TARGET> Display resource usage for the application
67
- app-env [appid] Display the environments for the application
68
- app-env <appname> <--target TARGET> Display the environments for the application
69
- create-env [appid][--name,--value] Create the environment for the application
70
- create-env <appname><--target TARGET>[--name,--value] Create the environment for the application
71
- delete-env [appid] [--name NAME] Delete the environment for the application
72
- delete-env <appname> <--target TARGET> [--name NAME] Delete the environment for the application
73
- app-log [appid] List the logs for the application
74
- app-log <appname> <--target TARGET> List the logs for the application
75
-
51
+ apps [--projectid,--target] List deployed applications
52
+ create-app [appname] Create a new application
53
+ delete-app [appid] Delete the application
54
+ delete-app <appname> <--target TARGET> Delete the application
55
+ start-app [appid] Start the application
56
+ start-app <appname> <--target TARGET> Start the application
57
+ stop-app [appid] Stop the application
58
+ stop-app <appname> <--target TARGET> Stop the application
59
+ stop-app --graceful Stop the application in a graceful mode
60
+ restart-app [appid] Restart the application
61
+ restart-app <appname> <--target TARGET> Restart the application
62
+ restart-app --graceful --lazy Restart the application in a graceful and lazy mode
63
+ scale-app [appid] [--instance N] Scale the application instances up or down
64
+ scale-app <appname> <--target TARGET> [--instance N] Scale the application instances up or down
65
+ scale-app --graceful Scale the application instances in a graceful mode
66
+ update-app [appid] [--ver VERSION] Update the application
67
+ update-app <appname> <--target TARGET> [--ver VERSION] Update the application
68
+ update-app --graceful --lazy Update the application in a graceful and lazy mode
69
+ status [appid] Display resource usage for the application
70
+ status <appname> <--target TARGET> Display resource usage for the application
71
+ app-env [appid] Display the environments for the application
72
+ app-env <appname> <--target TARGET> Display the environments for the application
73
+ create-env [appid] [--name,--value] Create the environment for the application
74
+ create-env <appname> <--target TARGET> [--name,--value] Create the environment for the application
75
+ delete-env [appid] [--name NAME] Delete the environment for the application
76
+ delete-env <appname> <--target TARGET> [--name NAME] Delete the environment for the application
77
+ app-log [appid] [--instanceid,--file] List the logs for the application
78
+ app-log <appname> <--target TARGET> [--instanceid,--file] List the logs for the application
79
+ app-debug [appid] List the debug info for the application
80
+ app-debug <appname> <--target TARGET> List the debug info for the application
81
+
76
82
  Service
77
- app-service [appid] Display the binded services for the application
78
- app-service <appname> <--target TARGET> Display the binded services for the application
79
- bind-service [appid][--service SERVICE] Bind the services for the application
80
- bind-service <appname> <--target TARGET> [--service] Bind the services for the application
81
- unbind-service [appid][--service SERVICE] Unbind the services for the application
82
- unbind-service <appname> <--target TARGET>[--service] Unbind the services for the application
83
- services List dedicated services
84
- service [serviceid] List the connection info for the service
85
- export-service [serviceid] Export dedicated service url
86
- import-service [url] Import dedicated service
87
- check-service [serviceid] Check availability for the service
88
- delete-service [serviceid] Delete the service
89
- register-service [serviceid] [--target,--type] Register to target
90
- deregister-service [serviceid] [--target TARGET] Deregister to target
83
+ app-service [appid] Display the binded services for the application
84
+ app-service <appname> <--target TARGET> Display the binded services for the application
85
+ bind-service [appid] [--service SERVICE] Bind the services for the application
86
+ bind-service <appname> <--target TARGET> [--service] Bind the services for the application
87
+ bind-service --graceful --lazy Bind the services for the application in a graceful and lazy mode
88
+ unbind-service [appid] [--service SERVICE] Unbind the services for the application
89
+ unbind-service <appname> <--target TARGET> [--service] Unbind the services for the application
90
+ unbind-service --graceful --lazy Unbind the services for the application in a graceful and lazy mode
91
+ services List dedicated services
92
+ service [serviceid] List the connection info for the service
93
+ export-service [serviceid] Export dedicated service url
94
+ import-service [url] Import dedicated service
95
+ check-service [serviceid] Check availability for the service
96
+ delete-service [serviceid] Delete the service
97
+ register-service [serviceid] [--target,--type] Register to target
98
+ deregister-service [serviceid] [--target TARGET] Deregister to target
91
99
 
92
100
  DNS
93
- app-dns [appid] Display the mapped urls for the application
94
- app-dns <appname> <--target TARGET> Display the mapped urls for the application
95
- map-dns [appid] [--dns DNS] Map the urls for the application
96
- map-dns <appname> <--target TARGET> [--dns DNS] Map the urls for the application
97
- unmap-dns [appid] [--dns DNS] Unmap the urls for the application
98
- unmap-dns <appname> <--target TARGET> [--dns DNS] Unmap the urls for the application
99
- dns List the dns
100
- zones List the dns zones
101
- create-dns [dnsname] [--zoneid,--projectid,--desc] Create a new dns
102
- register-dns [dnsid] Register to target
103
- deregister-dns [dnsid] Deregister to target
104
- delete-dns [dnsid] Delete the dns
101
+ app-dns [appid] Display the mapped urls for the application
102
+ app-dns <appname> <--target TARGET> Display the mapped urls for the application
103
+ map-dns [appid] [--dns DNS] Map the urls for the application
104
+ map-dns <appname> <--target TARGET> [--dns DNS] Map the urls for the application
105
+ unmap-dns [appid] [--dns DNS] Unmap the urls for the application
106
+ unmap-dns <appname> <--target TARGET> [--dns DNS] Unmap the urls for the application
107
+ dns List the dns
108
+ zones List the dns zones
109
+ create-dns [dnsname] [--zoneid,--projectid,--desc] Create a new dns
110
+ register-dns [dnsid] [--target,--continent,--country] Register to target
111
+ deregister-dns [dnsid] [--recordid ID] Deregister to target
112
+ delete-dns [dnsid] Delete the dns
105
113
  USAGE
106
114
 
107
115
  end
data/lib/cli/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module PI
2
2
  module Cli
3
- VERSION = '0.1.26'
3
+ VERSION = '0.1.27'
4
4
  end
5
5
  end
data/lib/pi/client.rb CHANGED
@@ -158,6 +158,7 @@ class PI::Client
158
158
  end
159
159
 
160
160
  def project_binary_existed(projectid,versionname)
161
+ versionname = uri_encode(versionname)
161
162
  http_get("#{PI::PROJECT_PATH}/binary/existed/#{projectid}/#{versionname}")
162
163
  end
163
164
 
@@ -193,8 +194,8 @@ class PI::Client
193
194
  http_get("#{PI::APP_PATH}/target/#{targetname}/memory")
194
195
  end
195
196
 
196
- def app_message(targetname,appname,message)
197
- json_get("#{PI::APP_PATH}/message/#{targetname}/#{appname}?eventName=#{message}")
197
+ def app_message(uuid)
198
+ json_get("#{PI::APP_PATH}/message/#{uuid}")
198
199
  end
199
200
 
200
201
  def delete_app(appid)
@@ -205,23 +206,28 @@ class PI::Client
205
206
  json_post("#{PI::APP_PATH}/#{appid}/start",manifest={})
206
207
  end
207
208
 
208
- def stop_app(appid)
209
- json_post("#{PI::APP_PATH}/#{appid}/stop",manifest={})
209
+ def stop_app(appid, graceful)
210
+ json_post("#{PI::APP_PATH}/#{appid}/stop?graceful=#{graceful}",manifest={})
210
211
  end
211
212
 
212
- def scale_app(appid,instance)
213
- json_post("#{PI::APP_PATH}/#{appid}/scale?instance=#{instance}", manifest={})
213
+ def restart_app(appid, graceful, lazy)
214
+ json_post("#{PI::APP_PATH}/#{appid}/restart?graceful=#{graceful}&lazy=#{lazy}",manifest={})
214
215
  end
215
216
 
216
- def update_app(appid, tag)
217
- json_post("#{PI::APP_PATH}/#{appid}/rollback/#{tag}", manifest={})
217
+ def scale_app(appid, instance, graceful)
218
+ json_post("#{PI::APP_PATH}/#{appid}/scale?instance=#{instance}&graceful=#{graceful}", manifest={})
219
+ end
220
+
221
+ def update_app(appid, tag, graceful, lazy)
222
+ json_post("#{PI::APP_PATH}/#{appid}/rollback/#{tag}?graceful=#{graceful}&lazy=#{lazy}", manifest={})
218
223
  end
219
224
 
220
225
  def status(appid)
221
226
  json_get("#{PI::APP_PATH}/#{appid}/monitor")
222
227
  end
223
228
 
224
- def app_log(appid,filepath,instanceindex)
229
+ def app_log(appid, filepath, instanceindex)
230
+ filepath = uri_encode(filepath)
225
231
  http_get("#{PI::APP_PATH}/#{appid}/logs?filePath=#{filepath}&instanceIndex=#{instanceindex}")
226
232
  end
227
233
 
@@ -234,12 +240,18 @@ class PI::Client
234
240
  end
235
241
 
236
242
  def delete_env(appid, env)
243
+ env = uri_encode(env)
237
244
  http_delete("#{PI::APP_PATH}/#{appid}/env/#{env}",'application/json')
238
245
  end
239
246
 
240
- def env_verify(appid,name)
247
+ def env_verify(appid, name)
248
+ name = uri_encode(name)
241
249
  http_get("#{PI::APP_PATH}/#{appid}/env/verify?name=#{name}")
242
250
  end
251
+
252
+ def app_debug_info(appid)
253
+ json_get("#{PI::APP_PATH}/#{appid}/debug")
254
+ end
243
255
 
244
256
  #####################################################
245
257
  # services
@@ -253,12 +265,12 @@ class PI::Client
253
265
  json_get("#{PI::APP_PATH}/#{appid}/service/bind")
254
266
  end
255
267
 
256
- def bind_service(appid, manifest={})
257
- json_post("#{PI::APP_PATH}/#{appid}/service/bind",manifest)
268
+ def bind_service(appid, graceful, lazy, manifest={})
269
+ json_post("#{PI::APP_PATH}/#{appid}/service/bind?graceful=#{graceful}&lazy=#{lazy}",manifest)
258
270
  end
259
271
 
260
- def unbind_service(appid, servicename)
261
- http_delete("#{PI::APP_PATH}/#{appid}/service/unbind/#{servicename}",'application/json')
272
+ def unbind_service(appid, servicename, graceful, lazy)
273
+ http_delete("#{PI::APP_PATH}/#{appid}/service/unbind/#{servicename}?graceful=#{graceful}&lazy=#{lazy}",'application/json')
262
274
  end
263
275
 
264
276
  def services
@@ -330,7 +342,7 @@ class PI::Client
330
342
  end
331
343
 
332
344
  def dns_zone_list
333
- json_get("#{PI::DNS_PATH}/dnszone/list")
345
+ json_get("#{PI::DNS_PATH}/dnszones")
334
346
  end
335
347
 
336
348
  def verify_dns(dnsname, zoneid)
@@ -362,6 +374,10 @@ class PI::Client
362
374
  end
363
375
 
364
376
  ######################################################
377
+
378
+ def uri_encode(name)
379
+ URI.encode name.to_s, Regexp.new("[^#{URI::PATTERN::UNRESERVED}]")
380
+ end
365
381
 
366
382
  private
367
383
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pi
3
3
  version: !ruby/object:Gem::Version
4
- hash: 47
4
+ hash: 45
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 26
10
- version: 0.1.26
9
+ - 27
10
+ version: 0.1.27
11
11
  platform: ruby
12
12
  authors:
13
13
  - Samsung
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-08-15 00:00:00 Z
18
+ date: 2012-08-24 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: json_pure