pi 0.1.35 → 0.1.36

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -59,87 +59,87 @@ Try 'pi help [command]' or 'pi help options' for more information.
59
59
  Currently available pi commands are:
60
60
 
61
61
  User
62
- login [env] [--user,--password] Login
63
- logout Logs current user out of the system
64
- info List system information
65
- user Display user information
66
- targets List available targets infomation
67
- password [oldpassword] [--password PASS] Change the password for the current user
68
- github [name] [--email,--password] Bind to the github account
69
- runtimes Display the supported runtimes of the system
70
- frameworks Display the supported frameworks of the system
71
- version Display version information
72
- help [command] Get general help or help on a specific command
73
- help options Get help on available options
74
-
62
+ login [env] [--user,--password] Login
63
+ logout Logs current user out of the system
64
+ info List system information
65
+ user Display user information
66
+ targets List available targets infomation
67
+ password [oldpassword] [--password PASS] Change the password for the current user
68
+ github [name] [--email,--password] Bind to the github account
69
+ runtimes Display the supported runtimes of the system
70
+ frameworks Display the supported frameworks of the system
71
+ version Display version information
72
+ help [command] Get general help or help on a specific command
73
+ help options Get help on available options
74
+
75
75
  Project
76
- projects List created projects
77
- create-project [project] Create a new project
78
- delete-project [projectid] Delete the project
79
- project-events [projectid] List the event info for the project
80
- project-tags [projectid] List the tags for the project
81
- project-commits [projectid] List the commit log for the project
82
- upload [projectid] [--path,--ver,--desc] Upload the war package for java project
83
-
84
- Application
85
- apps [--projectid,--target] List deployed applications
86
- create-app [appname] Create a new application
87
- delete-app [appid] Delete the application
88
- delete-app <appname> <--target TARGET> Delete the application
89
- start-app [appid] Start the application
90
- start-app <appname> <--target TARGET> Start the application
91
- stop-app [appid] Stop the application
92
- stop-app <appname> <--target TARGET> Stop the application
93
- stop-app --graceful Stop the application in a graceful mode
94
- restart-app [appid] Restart the application
95
- restart-app <appname> <--target TARGET> Restart the application
96
- restart-app --graceful Restart the application in a graceful mode
97
- scale-app [appid] [--instance N] Scale the application instances up or down
98
- scale-app <appname> <--target TARGET> [--instance N] Scale the application instances up or down
99
- update-app [appid] [--ver VERSION] Update the application
100
- update-app <appname> <--target TARGET> [--ver VERSION] Update the application
101
- update-app --graceful Update the application in a graceful mode
102
- status [appid] Display resource usage for the application
103
- status <appname> <--target TARGET> Display resource usage for the application
104
- app-env [appid] Display the environments for the application
105
- app-env <appname> <--target TARGET> Display the environments for the application
106
- create-env [appid] [--name,--value] Create the environment for the application
107
- create-env <appname> <--target TARGET> [--name,--value] Create the environment for the application
108
- delete-env [appid] [--name NAME] Delete the environment for the application
109
- delete-env <appname> <--target TARGET> [--name NAME] Delete the environment for the application
110
- app-log [appid] [--instanceid,--file] List the logs for the application
111
- app-log <appname> <--target TARGET> [--instanceid,--file] List the logs for the application
112
-
76
+ projects List created projects
77
+ create-project [project] Create a new project
78
+ delete-project [projectid] Delete the project
79
+ project-events [projectid] List the event info for the project
80
+ project-tags [projectid] List the tags for the project
81
+ project-commits [projectid] List the commit log for the project
82
+ upload [projectid] [--path,--ver,--desc] Upload the war package for java project
83
+
84
+ Application
85
+ apps [--projectid,--target] List deployed applications
86
+ create-app [appname] Create a new application
87
+ delete-app [appid] Delete the application
88
+ delete-app <appname> <--target TARGET> Delete the application
89
+ start-app [appid] Start the application
90
+ start-app <appname> <--target TARGET> Start the application
91
+ stop-app [appid] Stop the application
92
+ stop-app <appname> <--target TARGET> Stop the application
93
+ stop-app --graceful Stop the application in a graceful mode
94
+ restart-app [appid] Restart the application
95
+ restart-app <appname> <--target TARGET> Restart the application
96
+ restart-app --graceful Restart the application in a graceful mode
97
+ scale-app [appid] [--instance N] Scale the application instances up or down
98
+ scale-app <appname> <--target TARGET> [--instance N] Scale the application instances up or down
99
+ update-app [appid] [--ver VERSION] Update the application
100
+ update-app <appname> <--target TARGET> [--ver VERSION] Update the application
101
+ update-app --graceful Update the application in a graceful mode
102
+ status [appid] Display resource usage for the application
103
+ status <appname> <--target TARGET> Display resource usage for the application
104
+ app-env [appid] Display the environments for the application
105
+ app-env <appname> <--target TARGET> Display the environments for the application
106
+ create-env [appid] [--name,--value] Create the environment for the application
107
+ create-env <appname> <--target TARGET> [--name,--value] Create the environment for the application
108
+ delete-env [appid] [--name NAME] Delete the environment for the application
109
+ delete-env <appname> <--target TARGET> [--name NAME] Delete the environment for the application
110
+ app-log [appid] [--instanceid,--file] List the logs for the application
111
+ app-log <appname> <--target TARGET> [--instanceid,--file] List the logs for the application
112
+
113
113
  Service
114
- app-service [appid] Display the binded services for the application
115
- app-service <appname> <--target TARGET> Display the binded services for the application
116
- bind-service [appid] [--service SERVICE] Bind the services for the application
117
- bind-service <appname> <--target TARGET> [--service] Bind the services for the application
118
- unbind-service [appid] [--service SERVICE] Unbind the services for the application
119
- unbind-service <appname> <--target TARGET> [--service] Unbind the services for the application
120
- services List dedicated services
121
- service [serviceid] List the connection info for the service
122
- export-service [serviceid] Export dedicated service url
123
- import-service [url] Import dedicated service
124
- check-service [serviceid] Check availability for the service
125
- delete-service [serviceid] Delete the service
126
- register-service [serviceid] [--target TARGET] Register to target
127
- deregister-service [serviceid] [--target TARGET] Deregister to target
128
-
114
+ app-service [appid] Display the binded services for the application
115
+ app-service <appname> <--target TARGET> Display the binded services for the application
116
+ bind-service [appid] [--service SERVICE] Bind the services for the application
117
+ bind-service <appname> <--target TARGET> [--service] Bind the services for the application
118
+ unbind-service [appid] [--service SERVICE] Unbind the services for the application
119
+ unbind-service <appname> <--target TARGET> [--service] Unbind the services for the application
120
+ services List dedicated services
121
+ service [serviceid] List the connection info for the service
122
+ export-service [serviceid] Export dedicated service url
123
+ import-service [url] Import dedicated service
124
+ check-service [serviceid] Check availability for the service
125
+ delete-service [serviceid] Delete the service
126
+ register-service [serviceid] [--target TARGET] Register to target
127
+ deregister-service [serviceid] [--target TARGET] Deregister to target
128
+
129
129
  DNS
130
- app-dns [appid] Display the mapped urls for the application
131
- app-dns <appname> <--target TARGET> Display the mapped urls for the application
132
- map-dns [appid] [--dns DNS] Map the urls for the application
133
- map-dns <appname> <--target TARGET> [--dns DNS] Map the urls for the application
134
- unmap-dns [appid] [--dns DNS] Unmap the urls for the application
135
- unmap-dns <appname> <--target TARGET> [--dns DNS] Unmap the urls for the application
136
- dns List the dns
137
- zones List the dns zones
138
- dns-records [dnsid] List the record info for the registered dns
139
- create-dns [dnsname] [--zoneid,--projectid,--desc] Create a new dns
140
- register-dns [dnsid] [--target,--continent,--country] Register to target
141
- deregister-dns [dnsid] [--recordid ID] Deregister to target
142
- delete-dns [dnsid] Delete the dns
130
+ app-dns [appid] Display the mapped urls for the application
131
+ app-dns <appname> <--target TARGET> Display the mapped urls for the application
132
+ map-dns [appid] [--dns DNS] Map the urls for the application
133
+ map-dns <appname> <--target TARGET> [--dns DNS] Map the urls for the application
134
+ unmap-dns [appid] [--dns DNS] Unmap the urls for the application
135
+ unmap-dns <appname> <--target TARGET> [--dns DNS] Unmap the urls for the application
136
+ dns List the dns
137
+ zones List the dns zones
138
+ dns-records [dnsid] List the record info for the registered dns
139
+ create-dns [dnsname] [--zoneid,--projectid,--desc] Create a new dns
140
+ register-dns [dnsid] [--target,--continent,--country,--region] Register to target
141
+ deregister-dns [dnsid] [--recordid ID] Deregister to target
142
+ delete-dns [dnsid] Delete the dns
143
143
 
144
144
  4. Example
145
145
 
@@ -156,7 +156,7 @@ wangjing@wangjing-pc:~$ pi login www --user wangjing --password cloudpi
156
156
  Successfully logged into [http://api.samsungcloud.org]
157
157
 
158
158
  wangjing@wangjing-pc:~$ pi version
159
- pi 0.1.34
159
+ pi 0.1.36
160
160
 
161
161
  wangjing@wangjing-pc:~$ pi info
162
162
 
@@ -173,93 +173,93 @@ Try 'pi help [command]' or 'pi help options' for more information.
173
173
  Currently available pi commands are:
174
174
 
175
175
  User
176
- login [env] [--user,--password] Login
177
- logout Logs current user out of the system
178
- info List system information
179
- user Display user information
180
- targets List available targets infomation
181
- password [oldpassword] [--password PASS] Change the password for the current user
182
- github [name] [--email,--password] Bind to the github account
183
- runtimes Display the supported runtimes of the system
184
- frameworks Display the supported frameworks of the system
185
- version Display version information
186
- help [command] Get general help or help on a specific command
187
- help options Get help on available options
188
-
176
+ login [env] [--user,--password] Login
177
+ logout Logs current user out of the system
178
+ info List system information
179
+ user Display user information
180
+ targets List available targets infomation
181
+ password [oldpassword] [--password PASS] Change the password for the current user
182
+ github [name] [--email,--password] Bind to the github account
183
+ runtimes Display the supported runtimes of the system
184
+ frameworks Display the supported frameworks of the system
185
+ version Display version information
186
+ help [command] Get general help or help on a specific command
187
+ help options Get help on available options
188
+
189
189
  Project
190
- projects List created projects
191
- create-project [project] Create a new project
192
- delete-project [projectid] Delete the project
193
- project-events [projectid] List the event info for the project
194
- project-tags [projectid] List the tags for the project
195
- project-commits [projectid] List the commit log for the project
196
- upload [projectid] [--path,--ver,--desc] Upload the war package for java project
197
-
198
- Application
199
- apps [--projectid,--target] List deployed applications
200
- create-app [appname] Create a new application
201
- delete-app [appid] Delete the application
202
- delete-app <appname> <--target TARGET> Delete the application
203
- start-app [appid] Start the application
204
- start-app <appname> <--target TARGET> Start the application
205
- stop-app [appid] Stop the application
206
- stop-app <appname> <--target TARGET> Stop the application
207
- stop-app --graceful Stop the application in a graceful mode
208
- restart-app [appid] Restart the application
209
- restart-app <appname> <--target TARGET> Restart the application
210
- restart-app --graceful Restart the application in a graceful mode
211
- scale-app [appid] [--instance N] Scale the application instances up or down
212
- scale-app <appname> <--target TARGET> [--instance N] Scale the application instances up or down
213
- update-app [appid] [--ver VERSION] Update the application
214
- update-app <appname> <--target TARGET> [--ver VERSION] Update the application
215
- update-app --graceful Update the application in a graceful mode
216
- status [appid] Display resource usage for the application
217
- status <appname> <--target TARGET> Display resource usage for the application
218
- app-env [appid] Display the environments for the application
219
- app-env <appname> <--target TARGET> Display the environments for the application
220
- create-env [appid] [--name,--value] Create the environment for the application
221
- create-env <appname> <--target TARGET> [--name,--value] Create the environment for the application
222
- delete-env [appid] [--name NAME] Delete the environment for the application
223
- delete-env <appname> <--target TARGET> [--name NAME] Delete the environment for the application
224
- app-log [appid] [--instanceid,--file] List the logs for the application
225
- app-log <appname> <--target TARGET> [--instanceid,--file] List the logs for the application
226
-
190
+ projects List created projects
191
+ create-project [project] Create a new project
192
+ delete-project [projectid] Delete the project
193
+ project-events [projectid] List the event info for the project
194
+ project-tags [projectid] List the tags for the project
195
+ project-commits [projectid] List the commit log for the project
196
+ upload [projectid] [--path,--ver,--desc] Upload the war package for java project
197
+
198
+ Application
199
+ apps [--projectid,--target] List deployed applications
200
+ create-app [appname] Create a new application
201
+ delete-app [appid] Delete the application
202
+ delete-app <appname> <--target TARGET> Delete the application
203
+ start-app [appid] Start the application
204
+ start-app <appname> <--target TARGET> Start the application
205
+ stop-app [appid] Stop the application
206
+ stop-app <appname> <--target TARGET> Stop the application
207
+ stop-app --graceful Stop the application in a graceful mode
208
+ restart-app [appid] Restart the application
209
+ restart-app <appname> <--target TARGET> Restart the application
210
+ restart-app --graceful Restart the application in a graceful mode
211
+ scale-app [appid] [--instance N] Scale the application instances up or down
212
+ scale-app <appname> <--target TARGET> [--instance N] Scale the application instances up or down
213
+ update-app [appid] [--ver VERSION] Update the application
214
+ update-app <appname> <--target TARGET> [--ver VERSION] Update the application
215
+ update-app --graceful Update the application in a graceful mode
216
+ status [appid] Display resource usage for the application
217
+ status <appname> <--target TARGET> Display resource usage for the application
218
+ app-env [appid] Display the environments for the application
219
+ app-env <appname> <--target TARGET> Display the environments for the application
220
+ create-env [appid] [--name,--value] Create the environment for the application
221
+ create-env <appname> <--target TARGET> [--name,--value] Create the environment for the application
222
+ delete-env [appid] [--name NAME] Delete the environment for the application
223
+ delete-env <appname> <--target TARGET> [--name NAME] Delete the environment for the application
224
+ app-log [appid] [--instanceid,--file] List the logs for the application
225
+ app-log <appname> <--target TARGET> [--instanceid,--file] List the logs for the application
226
+
227
227
  Service
228
- app-service [appid] Display the binded services for the application
229
- app-service <appname> <--target TARGET> Display the binded services for the application
230
- bind-service [appid] [--service SERVICE] Bind the services for the application
231
- bind-service <appname> <--target TARGET> [--service] Bind the services for the application
232
- unbind-service [appid] [--service SERVICE] Unbind the services for the application
233
- unbind-service <appname> <--target TARGET> [--service] Unbind the services for the application
234
- services List dedicated services
235
- service [serviceid] List the connection info for the service
236
- export-service [serviceid] Export dedicated service url
237
- import-service [url] Import dedicated service
238
- check-service [serviceid] Check availability for the service
239
- delete-service [serviceid] Delete the service
240
- register-service [serviceid] [--target TARGET] Register to target
241
- deregister-service [serviceid] [--target TARGET] Deregister to target
242
-
228
+ app-service [appid] Display the binded services for the application
229
+ app-service <appname> <--target TARGET> Display the binded services for the application
230
+ bind-service [appid] [--service SERVICE] Bind the services for the application
231
+ bind-service <appname> <--target TARGET> [--service] Bind the services for the application
232
+ unbind-service [appid] [--service SERVICE] Unbind the services for the application
233
+ unbind-service <appname> <--target TARGET> [--service] Unbind the services for the application
234
+ services List dedicated services
235
+ service [serviceid] List the connection info for the service
236
+ export-service [serviceid] Export dedicated service url
237
+ import-service [url] Import dedicated service
238
+ check-service [serviceid] Check availability for the service
239
+ delete-service [serviceid] Delete the service
240
+ register-service [serviceid] [--target TARGET] Register to target
241
+ deregister-service [serviceid] [--target TARGET] Deregister to target
242
+
243
243
  DNS
244
- app-dns [appid] Display the mapped urls for the application
245
- app-dns <appname> <--target TARGET> Display the mapped urls for the application
246
- map-dns [appid] [--dns DNS] Map the urls for the application
247
- map-dns <appname> <--target TARGET> [--dns DNS] Map the urls for the application
248
- unmap-dns [appid] [--dns DNS] Unmap the urls for the application
249
- unmap-dns <appname> <--target TARGET> [--dns DNS] Unmap the urls for the application
250
- dns List the dns
251
- zones List the dns zones
252
- dns-records [dnsid] List the record info for the registered dns
253
- create-dns [dnsname] [--zoneid,--projectid,--desc] Create a new dns
254
- register-dns [dnsid] [--target,--continent,--country] Register to target
255
- deregister-dns [dnsid] [--recordid ID] Deregister to target
256
- delete-dns [dnsid] Delete the dns
244
+ app-dns [appid] Display the mapped urls for the application
245
+ app-dns <appname> <--target TARGET> Display the mapped urls for the application
246
+ map-dns [appid] [--dns DNS] Map the urls for the application
247
+ map-dns <appname> <--target TARGET> [--dns DNS] Map the urls for the application
248
+ unmap-dns [appid] [--dns DNS] Unmap the urls for the application
249
+ unmap-dns <appname> <--target TARGET> [--dns DNS] Unmap the urls for the application
250
+ dns List the dns
251
+ zones List the dns zones
252
+ dns-records [dnsid] List the record info for the registered dns
253
+ create-dns [dnsname] [--zoneid,--projectid,--desc] Create a new dns
254
+ register-dns [dnsid] [--target,--continent,--country,--region] Register to target
255
+ deregister-dns [dnsid] [--recordid ID] Deregister to target
256
+ delete-dns [dnsid] Delete the dns
257
257
 
258
258
  wangjing@wangjing-pc:~$ pi help options
259
259
 
260
260
  Available options:
261
261
 
262
- --user USER
262
+ --user USER
263
263
  --password PASS
264
264
  --name NAME
265
265
  --email EMAIL
@@ -273,6 +273,7 @@ Available options:
273
273
  --service SERVICE
274
274
  --dns DNS
275
275
  --zoneid ID
276
+ --region REGION
276
277
  --instanceid N
277
278
  --file FILE
278
279
  --continent CONT
@@ -299,13 +300,12 @@ Github Account Email: ruanzhimin@gmail.com
299
300
 
300
301
  wangjing@wangjing-pc:~$ pi targets
301
302
 
302
- +-----------+-----------------------------------+
303
- | Name | URL |
304
- +-----------+-----------------------------------+
305
- | bst-dev | http://bst-dev.samsungcloud.org |
306
- | target-hq | http://target-hq.samsungcloud.org |
307
- | func-test | http://func-test.samsungcloud.org |
308
- +-----------+-----------------------------------+
303
+ +-----------+---------------------------------+
304
+ | Name | URL |
305
+ +-----------+---------------------------------+
306
+ | bst-dev | http://bst-dev.samsungcloud.org |
307
+ | target-hq | http://target-hq.cloudtao.net |
308
+ +-----------+---------------------------------+
309
309
 
310
310
  wangjing@wangjing-pc:~$ pi runtimes
311
311
 
@@ -528,6 +528,26 @@ Select continent: 4
528
528
  Select continent: Default
529
529
  OK
530
530
 
531
+ wangjing@wangjing-pc:~$ pi register-dns
532
+ 1: wangjingtest.samsungpaas.com
533
+ 2: picture.samsungpaas.com
534
+ 3: testapp.cloudtao.net
535
+ Select DNS: 3
536
+ 1: bst-dev
537
+ 2: target-hq
538
+ Select target: 2
539
+ 1: eu-west-1
540
+ 2: sa-east-1
541
+ 3: us-east-1
542
+ 4: ap-northeast-1
543
+ 5: us-west-2
544
+ 6: us-west-1
545
+ 7: ap-southeast-1
546
+ 8: ap-southeast-2
547
+ 9: DEFAULT
548
+ Select region: 1
549
+ OK
550
+
531
551
  wangjing@wangjing-pc:~$ pi map-dns
532
552
  1: all
533
553
  2: project
@@ -215,13 +215,14 @@ module PI::Cli::Command
215
215
 
216
216
  def register_dns(dnsid=nil)
217
217
  all_opts = total_opts
218
- all_opts_except_valid_opts = all_opts.delete_if{ |key,value| key.to_s =~ /(target|continent|country)/i}
218
+ all_opts_except_valid_opts = all_opts.delete_if{ |key,value| key.to_s =~ /(target|continent|country|region)/i}
219
219
  all_opts_except_valid_opts.each_value do |value|
220
220
  err "Invalid options" if value != nil
221
221
  end
222
222
  client.check_login_status
223
223
  target = @options[:target]
224
224
  continent = @options[:continent]
225
+ region = @options[:region]
225
226
  if continent
226
227
  continents = client.dns_continents
227
228
  err "Invalid continent" unless continents.has_key?(continent.to_sym)
@@ -230,44 +231,73 @@ module PI::Cli::Command
230
231
  if country && continent
231
232
  countries = client.dns_country(continent)
232
233
  err "Invalid country" unless countries.has_key?(country.to_sym)
233
- end
234
+ end
235
+ if region
236
+ unless dnsid
237
+ dnsid = choose_dnsid
238
+ end
239
+ regions = client.regions(dnsid)
240
+ if regions.empty?
241
+ err "Invalid option, usage: pi register-dns [dnsid] [--target,--continent,--country]"
242
+ else
243
+ err "Invalid region" unless regions.include?(region)
244
+ end
245
+ end
234
246
  unless dnsid
235
247
  dnsid = choose_dnsid
236
248
  end
249
+ dns = client.dns
250
+ zoneid = nil
251
+ dns.each do |d|
252
+ zoneid = d[:zoneId] if dnsid == d[:id]
253
+ end
254
+ zones = client.dns_zone_list
255
+ zonetype = nil
256
+ zones.each do |z|
257
+ zonetype = z[:zoneType] if z[:id] == zoneid
258
+ end
237
259
  unless target
238
260
  targets = client.usable_dns_target(dnsid)
239
261
  target = ask"Select target", :choices => targets.collect { |t| t[:targetName] }, :indexed => true
240
262
  end
241
- unless continent
242
- continents = client.dns_continents
243
- err "No continents" if continents.nil? || continents.empty?
244
- tmp = continents.values
245
- tmp.sort! {|a, b| a <=> b }
246
- continent = ask"Select continent", :choices => tmp.collect { |t| t }, :indexed => true
247
- display "Select continent: #{continent}"
248
- continent = continents.invert["#{continent}"]
249
- end
250
- if continent.to_s == "DEFAULT"
251
- manifest = {
252
- :continentCode => continent,
253
- :countryCode => "DEFAULT"
254
- }
255
- else
256
- unless country
257
- countries = client.dns_country(continent)
258
- err "No countries" if countries.nil? || countries.empty?
259
- tmp = countries.values
263
+
264
+ if zonetype == "cloudpidns"
265
+ unless continent
266
+ continents = client.dns_continents
267
+ err "No continents" if continents.nil? || continents.empty?
268
+ tmp = continents.values
260
269
  tmp.sort! {|a, b| a <=> b }
261
- country = ask"Select country", :choices => tmp.collect { |t| t }, :indexed => true
262
- display "Select country: #{country}"
263
- country = countries.invert["#{country}"]
270
+ continent = ask"Select continent", :choices => tmp.collect { |t| t }, :indexed => true
271
+ display "Select continent: #{continent}"
272
+ continent = continents.invert["#{continent}"]
273
+ end
274
+ if continent.to_s == "DEFAULT"
275
+ manifest = {
276
+ :continentCode => continent,
277
+ :countryCode => "DEFAULT"
278
+ }
279
+ else
280
+ unless country
281
+ countries = client.dns_country(continent)
282
+ err "No countries" if countries.nil? || countries.empty?
283
+ tmp = countries.values
284
+ tmp.sort! {|a, b| a <=> b }
285
+ country = ask"Select country", :choices => tmp.collect { |t| t }, :indexed => true
286
+ display "Select country: #{country}"
287
+ country = countries.invert["#{country}"]
288
+ end
289
+ manifest = {
290
+ :continentCode => continent,
291
+ :countryCode => country
292
+ }
293
+ end
294
+ else
295
+ unless region
296
+ regions = client.regions(dnsid)
297
+ region = ask"Select region", :choices => regions, :indexed => true
264
298
  end
265
- manifest = {
266
- :continentCode => continent,
267
- :countryCode => country
268
- }
269
299
  end
270
- client.register_dns(dnsid, target, manifest)
300
+ client.register_dns(dnsid, target, region, manifest)
271
301
  display "OK".green
272
302
  end
273
303
 
@@ -278,11 +308,11 @@ module PI::Cli::Command
278
308
  err "Invalid options" if value != nil
279
309
  end
280
310
  client.check_login_status
281
- recordid = @options[:recordid]
282
- unless dnsid
283
- dnsid = choose_dnsid
284
- end
311
+ recordid = @options[:recordid]
285
312
  unless recordid
313
+ unless dnsid
314
+ dnsid = choose_dnsid
315
+ end
286
316
  targets = client.usable_dns_target(dnsid)
287
317
  target = ask"Select target", :choices => targets.collect { |t| t[:targetName] }, :indexed => true
288
318
  record = Array.new
@@ -41,6 +41,7 @@ class PI::Cli::Runner
41
41
  opts.on('--service SERVICE') { |service| @options[:service] = service }
42
42
  opts.on('--dns DNS') { |dns| @options[:dns] = dns }
43
43
  opts.on('--zoneid ID') { |id| @options[:zoneid] = id }
44
+ opts.on('--region REGION') { |region| @options[:region] = region }
44
45
  opts.on('--instanceid N') { |inst| @options[:instanceid] = inst }
45
46
  opts.on('--file FILE') { |file| @options[:file] = file }
46
47
  opts.on('--continent CONT') { |cont| @options[:continent] = cont }
@@ -355,7 +356,7 @@ class PI::Cli::Runner
355
356
  set_cmd(:dns, :delete_dns, @args.size == 1 ? 1 : 0)
356
357
 
357
358
  when 'register-dns'
358
- usage('pi register-dns [dnsid] [--target,--continent,--country]')
359
+ usage('pi register-dns [dnsid] [--target,--continent,--country,--region]')
359
360
  set_cmd(:dns, :register_dns, @args.size == 1 ? 1 : 0)
360
361
 
361
362
  when 'dns-records'
@@ -25,87 +25,87 @@ class PI::Cli::Runner
25
25
  Currently available pi commands are:
26
26
 
27
27
  User
28
- login [env] [--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 [env] [--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
- 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 Restart the application in a graceful 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
- update-app [appid] [--ver VERSION] Update the application
66
- update-app <appname> <--target TARGET> [--ver VERSION] Update the application
67
- update-app --graceful Update the application in a graceful mode
68
- status [appid] Display resource usage for the application
69
- status <appname> <--target TARGET> Display resource usage for the application
70
- app-env [appid] Display the environments for the application
71
- app-env <appname> <--target TARGET> Display the environments for the application
72
- create-env [appid] [--name,--value] Create the environment for the application
73
- create-env <appname> <--target TARGET> [--name,--value] Create the environment for the application
74
- delete-env [appid] [--name NAME] Delete the environment for the application
75
- delete-env <appname> <--target TARGET> [--name NAME] Delete the environment for the application
76
- app-log [appid] [--instanceid,--file] List the logs for the application
77
- app-log <appname> <--target TARGET> [--instanceid,--file] List the logs for the 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
+ 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 Restart the application in a graceful 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
+ update-app [appid] [--ver VERSION] Update the application
66
+ update-app <appname> <--target TARGET> [--ver VERSION] Update the application
67
+ update-app --graceful Update the application in a graceful mode
68
+ status [appid] Display resource usage for the application
69
+ status <appname> <--target TARGET> Display resource usage for the application
70
+ app-env [appid] Display the environments for the application
71
+ app-env <appname> <--target TARGET> Display the environments for the application
72
+ create-env [appid] [--name,--value] Create the environment for the application
73
+ create-env <appname> <--target TARGET> [--name,--value] Create the environment for the application
74
+ delete-env [appid] [--name NAME] Delete the environment for the application
75
+ delete-env <appname> <--target TARGET> [--name NAME] Delete the environment for the application
76
+ app-log [appid] [--instanceid,--file] List the logs for the application
77
+ app-log <appname> <--target TARGET> [--instanceid,--file] List the logs for the application
78
78
 
79
79
  Service
80
- app-service [appid] Display the binded services for the application
81
- app-service <appname> <--target TARGET> Display the binded services for the application
82
- bind-service [appid] [--service SERVICE] Bind the services for the application
83
- bind-service <appname> <--target TARGET> [--service] Bind the services for the application
84
- unbind-service [appid] [--service SERVICE] Unbind the services for the application
85
- unbind-service <appname> <--target TARGET> [--service] Unbind the services for the application
86
- services List dedicated services
87
- service [serviceid] List the connection info for the service
88
- export-service [serviceid] Export dedicated service url
89
- import-service [url] Import dedicated service
90
- check-service [serviceid] Check availability for the service
91
- delete-service [serviceid] Delete the service
92
- register-service [serviceid] [--target TARGET] Register to target
93
- deregister-service [serviceid] [--target TARGET] Deregister to target
80
+ app-service [appid] Display the binded services for the application
81
+ app-service <appname> <--target TARGET> Display the binded services for the application
82
+ bind-service [appid] [--service SERVICE] Bind the services for the application
83
+ bind-service <appname> <--target TARGET> [--service] Bind the services for the application
84
+ unbind-service [appid] [--service SERVICE] Unbind the services for the application
85
+ unbind-service <appname> <--target TARGET> [--service] Unbind the services for the application
86
+ services List dedicated services
87
+ service [serviceid] List the connection info for the service
88
+ export-service [serviceid] Export dedicated service url
89
+ import-service [url] Import dedicated service
90
+ check-service [serviceid] Check availability for the service
91
+ delete-service [serviceid] Delete the service
92
+ register-service [serviceid] [--target TARGET] Register to target
93
+ deregister-service [serviceid] [--target TARGET] Deregister to target
94
94
 
95
95
  DNS
96
- app-dns [appid] Display the mapped urls for the application
97
- app-dns <appname> <--target TARGET> Display the mapped urls for the application
98
- map-dns [appid] [--dns DNS] Map the urls for the application
99
- map-dns <appname> <--target TARGET> [--dns DNS] Map the urls for the application
100
- unmap-dns [appid] [--dns DNS] Unmap the urls for the application
101
- unmap-dns <appname> <--target TARGET> [--dns DNS] Unmap the urls for the application
102
- dns List the dns
103
- zones List the dns zones
104
- dns-records [dnsid] List the record info for the registered dns
105
- create-dns [dnsname] [--zoneid,--projectid,--desc] Create a new dns
106
- register-dns [dnsid] [--target,--continent,--country] Register to target
107
- deregister-dns [dnsid] [--recordid ID] Deregister to target
108
- delete-dns [dnsid] Delete the dns
96
+ app-dns [appid] Display the mapped urls for the application
97
+ app-dns <appname> <--target TARGET> Display the mapped urls for the application
98
+ map-dns [appid] [--dns DNS] Map the urls for the application
99
+ map-dns <appname> <--target TARGET> [--dns DNS] Map the urls for the application
100
+ unmap-dns [appid] [--dns DNS] Unmap the urls for the application
101
+ unmap-dns <appname> <--target TARGET> [--dns DNS] Unmap the urls for the application
102
+ dns List the dns
103
+ zones List the dns zones
104
+ dns-records [dnsid] List the record info for the registered dns
105
+ create-dns [dnsname] [--zoneid,--projectid,--desc] Create a new dns
106
+ register-dns [dnsid] [--target,--continent,--country,--region] Register to target
107
+ deregister-dns [dnsid] [--recordid ID] Deregister to target
108
+ delete-dns [dnsid] Delete the dns
109
109
  USAGE
110
110
 
111
111
  end
@@ -1,5 +1,5 @@
1
1
  module PI
2
2
  module Cli
3
- VERSION = '0.1.35'
3
+ VERSION = '0.1.36'
4
4
  end
5
5
  end
@@ -416,10 +416,16 @@ class PI::Client
416
416
  json_get("#{PI::DNS_PATH}/country/#{continents}")
417
417
  end
418
418
 
419
- def register_dns(dnsid, target, manifest={})
419
+ def register_dns(dnsid, target, region=nil, manifest={})
420
420
  dnsid = uri_encode(dnsid)
421
421
  target = uri_encode(target)
422
- json_post("#{PI::DNS_PATH}/view/#{dnsid}/#{target}", manifest)
422
+ region = uri_encode(region)
423
+ json_post("#{PI::DNS_PATH}/view/#{dnsid}/#{target}?region=#{region}", manifest)
424
+ end
425
+
426
+ def regions(dnsid)
427
+ dnsid = uri_encode(dnsid)
428
+ json_get("#{PI::DNS_PATH}/region/#{dnsid}")
423
429
  end
424
430
 
425
431
  def deregister_dns(recordid)
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: 93
4
+ hash: 83
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 35
10
- version: 0.1.35
9
+ - 36
10
+ version: 0.1.36
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-12-11 00:00:00 Z
18
+ date: 2013-02-05 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: json_pure