app42 0.6.4 → 0.7.0
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/RELEASE.md +6 -2
- data/lib/app42/base/constants.rb +6 -2
- data/lib/app42/base/help.rb +114 -23
- data/lib/app42/base/util.rb +11 -1
- data/lib/app42/command/app.rb +66 -8
- data/lib/app42/command/base.rb +44 -19
- data/lib/app42/command/config.rb +33 -5
- data/lib/app42/command/gpaas.rb +7 -5
- data/lib/app42/command/service.rb +2 -2
- data/lib/app42/command/setup.rb +2 -2
- data/lib/app42/command/wordpress.rb +2 -2
- data/lib/app42/version.rb +2 -2
- metadata +2 -2
data/RELEASE.md
CHANGED
@@ -20,7 +20,7 @@ Client library and command-line tool to deploy and manage apps on App42PaaS.
|
|
20
20
|
- Node.js support
|
21
21
|
- WordPress support
|
22
22
|
- BPaaS setup downgrade
|
23
|
-
- WordPress setup donwgrade
|
23
|
+
- WordPress setup donwgrade
|
24
24
|
|
25
25
|
### 0.6.1 (22-01-2014)
|
26
26
|
|
@@ -41,4 +41,8 @@ Client library and command-line tool to deploy and manage apps on App42PaaS.
|
|
41
41
|
|
42
42
|
- Add Elastic IP to GPaaS
|
43
43
|
- Update GPaaS dashboard
|
44
|
-
|
44
|
+
|
45
|
+
### 0.6.7 (05-07-2014)
|
46
|
+
|
47
|
+
- Dedicated Support
|
48
|
+
- Golang Support
|
data/lib/app42/base/constants.rb
CHANGED
@@ -28,6 +28,11 @@ module App42
|
|
28
28
|
# flavour type
|
29
29
|
FLAVOUR_TYPE = ['light', 'medium', 'heavy']
|
30
30
|
|
31
|
+
# app operation type
|
32
|
+
APP_STOP = { "hardStop" => "Hard Stop", "softStop" => "Soft Stop"}
|
33
|
+
APP_START = { "hardStart" => "Hard Start", "softStart" => "Soft Start"}
|
34
|
+
APP_RESTART = { "hardRestart" => "Hard Restart", "softRestart" => "Soft Restart"}
|
35
|
+
|
31
36
|
DATABASE_NAME_NOT_ALLOWED = %w(mysql couchdb mongodb postgresql database sql)
|
32
37
|
|
33
38
|
# regex for special character
|
@@ -41,5 +46,4 @@ module App42
|
|
41
46
|
|
42
47
|
# regex for IP Address
|
43
48
|
IP_REGEX = /^([0]?\d\d?|1[0-1,3-9]\d|12[0-6,8-9]|2[0-4]d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.([01]?\d\d?|2[0-4]\d|25[0-5])\.((?!0)|(?!1)|010|(01[0-9]{1,1}&0[1-9]{1,2})|0[0-9]{1,1}[1-9]{1,1}|[2-9]{0,2}|1[0-9]{1,2}|2[0-4]\d|25[0-4])$/
|
44
|
-
|
45
|
-
end
|
49
|
+
end
|
data/lib/app42/base/help.rb
CHANGED
@@ -200,29 +200,32 @@ Example:
|
|
200
200
|
|
201
201
|
Checking App Name Availability... OK
|
202
202
|
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
203
|
+
1: Shared
|
204
|
+
2: Dedicated
|
205
|
+
Select Instance Type [Shared]:
|
206
|
+
|
207
|
+
1: Amazon (Northern Virginia)
|
208
|
+
Select IaaS Provider [Amazon (Northern Virginia)]:
|
209
|
+
|
210
|
+
1: Ruby 2.0.0
|
211
|
+
2: Java 6
|
212
|
+
3: Java 7
|
213
|
+
4: PHP 5.3
|
214
|
+
5: PHP 5.5
|
215
|
+
6: Node 0.10.22
|
216
|
+
7: Python 2.7
|
217
|
+
8: GO 1.3
|
218
|
+
Select Runtime [Ruby 2.0.0]:
|
219
|
+
|
220
|
+
1: Ruby on Rack
|
221
|
+
2: Rails 4.0
|
222
|
+
3: Sinatra 1.4
|
223
|
+
Select Framework [Ruby on Rack ]:
|
224
|
+
|
225
|
+
1: Passenger 4.0
|
226
|
+
2: Thin 1.6
|
227
|
+
3: Unicorn 4.7
|
228
|
+
Select Web Server [Passenger 4.0]:
|
226
229
|
|
227
230
|
Specify Kontena Power: 1
|
228
231
|
|
@@ -297,6 +300,9 @@ Options:
|
|
297
300
|
[--app APP] # Name of app, you want to scale
|
298
301
|
|
299
302
|
Example:
|
303
|
+
|
304
|
+
**For Shared App**
|
305
|
+
|
300
306
|
$app42 scale
|
301
307
|
Enter App Name: demo
|
302
308
|
|
@@ -307,6 +313,23 @@ Example:
|
|
307
313
|
Horizontal scale by instance(s) [1]:
|
308
314
|
Scaling Application demo by instance 1... OK
|
309
315
|
|
316
|
+
Operation is in progress, Please wait...-
|
317
|
+
Scale has been completed successfully.
|
318
|
+
|
319
|
+
**For Dedicated App**
|
320
|
+
|
321
|
+
$app42 scale
|
322
|
+
Enter App Name: demo
|
323
|
+
|
324
|
+
1: t1.micro
|
325
|
+
2: m1.small
|
326
|
+
3: m1.medium
|
327
|
+
4: m1.large
|
328
|
+
5: m1.xlarge
|
329
|
+
Select Instance Configuration [t1.micro]: 2
|
330
|
+
|
331
|
+
Scaling Application demo by instance m1.small... OK
|
332
|
+
|
310
333
|
Operation is in progress, Please wait...-
|
311
334
|
Scale has been completed successfully.
|
312
335
|
DESC
|
@@ -323,6 +346,9 @@ Options:
|
|
323
346
|
[--app APP] # Name of app, you want to descale
|
324
347
|
|
325
348
|
Example:
|
349
|
+
|
350
|
+
**For Shared App**
|
351
|
+
|
326
352
|
$app42 descale
|
327
353
|
Enter App Name: demo
|
328
354
|
|
@@ -333,6 +359,23 @@ Example:
|
|
333
359
|
Horizontal descale by instance(s) [1]: 1
|
334
360
|
Descaling Application demo by instance 1... OK
|
335
361
|
|
362
|
+
Operation is in progress, Please wait...|
|
363
|
+
Descale has been completed successfully.
|
364
|
+
|
365
|
+
**For Dedicated App**
|
366
|
+
|
367
|
+
Enter App Name: demo
|
368
|
+
|
369
|
+
1: t1.micro
|
370
|
+
2: m1.small
|
371
|
+
3: m1.medium
|
372
|
+
4: m1.large
|
373
|
+
5: m1.xlarge
|
374
|
+
|
375
|
+
Select Instance Configuration [t1.micro]: 1
|
376
|
+
|
377
|
+
Descaling Application demo by instance t1.micro... OK
|
378
|
+
|
336
379
|
Operation is in progress, Please wait...|
|
337
380
|
Descale has been completed successfully.
|
338
381
|
DESC
|
@@ -349,6 +392,9 @@ Options:
|
|
349
392
|
[--app APP] # Name of app, you want to start
|
350
393
|
|
351
394
|
Example:
|
395
|
+
|
396
|
+
**For Shared App**
|
397
|
+
|
352
398
|
$app42 start --app demo
|
353
399
|
Starting Application demo... OK
|
354
400
|
|
@@ -357,6 +403,19 @@ Example:
|
|
357
403
|
-
|
358
404
|
2 out of 3 started
|
359
405
|
|
|
406
|
+
App has been started successfully.
|
407
|
+
|
408
|
+
**For Dedicated App**
|
409
|
+
|
410
|
+
Enter App Name: demo
|
411
|
+
|
412
|
+
1: Hard Start
|
413
|
+
2: Soft Start
|
414
|
+
App Start Type [Hard Start]: 1
|
415
|
+
|
416
|
+
Starting Application demo... OK
|
417
|
+
|
418
|
+
Operation is in progress, Please wait...-
|
360
419
|
App has been started successfully.
|
361
420
|
DESC
|
362
421
|
|
@@ -373,6 +432,9 @@ Options:
|
|
373
432
|
[--app APP] # Name of app, you want to stop
|
374
433
|
|
375
434
|
Example:
|
435
|
+
|
436
|
+
**For Shared App**
|
437
|
+
|
376
438
|
$app42 stop --app demo
|
377
439
|
Stopping Application demo... OK
|
378
440
|
|
@@ -381,6 +443,19 @@ Example:
|
|
381
443
|
-
|
382
444
|
2 out of 3 stopped
|
383
445
|
-
|
446
|
+
App has been stopped successfully.
|
447
|
+
|
448
|
+
**For Dedicated App**
|
449
|
+
|
450
|
+
Enter App Name: demo
|
451
|
+
|
452
|
+
1: Hard Stop
|
453
|
+
2: Soft Stop
|
454
|
+
App Stop Type [Hard Stop]: 1
|
455
|
+
|
456
|
+
Stopping Application demo... OK
|
457
|
+
|
458
|
+
Operation is in progress, Please wait...
|
384
459
|
App has been stopped successfully.
|
385
460
|
DESC
|
386
461
|
end
|
@@ -396,6 +471,9 @@ Options:
|
|
396
471
|
[--app APP] # Name of app, you want to restart
|
397
472
|
|
398
473
|
Example:
|
474
|
+
|
475
|
+
**For Shared App**
|
476
|
+
|
399
477
|
$app42 start --app demo
|
400
478
|
Restarting Application demo... OK
|
401
479
|
|
@@ -404,6 +482,19 @@ Example:
|
|
404
482
|
-
|
405
483
|
2 out of 3 restarted
|
406
484
|
|
|
485
|
+
App has been restarted successfully.
|
486
|
+
|
487
|
+
**For Dedicated App**
|
488
|
+
|
489
|
+
Enter App Name: demo
|
490
|
+
|
491
|
+
1: Hard Restart
|
492
|
+
2: Soft Restart
|
493
|
+
App Start Type [Hard Restart]: 1
|
494
|
+
|
495
|
+
Restarting Application demo... OK
|
496
|
+
|
497
|
+
Operation is in progress, Please wait...-
|
407
498
|
App has been restarted successfully.
|
408
499
|
DESC
|
409
500
|
end
|
data/lib/app42/base/util.rb
CHANGED
@@ -408,6 +408,16 @@ module App42
|
|
408
408
|
end
|
409
409
|
end
|
410
410
|
|
411
|
+
# rest call to server to check whether +Static IP+ assigned OR not.
|
412
|
+
# return true if +Static IP+ assigned else false
|
413
|
+
def is_static_ip_assigned? gpaas_name
|
414
|
+
query_params = params
|
415
|
+
query_params.store('setupName', gpaas_name)
|
416
|
+
|
417
|
+
setup_info = build_get_request query_params, 'gpaas', "#{@options[:setup]}"
|
418
|
+
setup_info["setupInfo"]["staticIP"] == "NULL" ? (return false) : (return true)
|
419
|
+
end
|
420
|
+
|
411
421
|
# Check whether +git URL+ is valid OR not
|
412
422
|
# given +git URL+ must end with +.git+ extension
|
413
423
|
def validate_git_url git_url
|
@@ -447,4 +457,4 @@ module App42
|
|
447
457
|
|
448
458
|
end
|
449
459
|
end
|
450
|
-
end
|
460
|
+
end
|
data/lib/app42/command/app.rb
CHANGED
@@ -10,8 +10,8 @@ module App42
|
|
10
10
|
# collect all required attributes for new VM spawn
|
11
11
|
def setup_infra
|
12
12
|
app_name = get_app_name_and_check_app_url_availability
|
13
|
-
vm_type = get_vm_types
|
14
|
-
iaas = get_iaas_providers
|
13
|
+
vm_type = get_vm_types "app"
|
14
|
+
iaas = get_iaas_providers vm_type
|
15
15
|
app_name, source_url = get_app_source app_name, iaas, vm_type
|
16
16
|
end
|
17
17
|
|
@@ -70,13 +70,17 @@ module App42
|
|
70
70
|
# @param vm_type
|
71
71
|
# @return host name
|
72
72
|
def collect_vm_details app_name, iaas, vm_type
|
73
|
-
runtime = get_runtime
|
73
|
+
runtime = get_runtime iaas, vm_type
|
74
74
|
framework = get_framework iaas, vm_type, runtime
|
75
75
|
webserver = get_webserver iaas, vm_type, runtime, framework
|
76
76
|
os = get_os_for_app iaas, vm_type, runtime, framework, webserver
|
77
77
|
# FIXME, may be configure out later
|
78
78
|
# instance = get_instance 'new_vm'
|
79
|
-
|
79
|
+
if vm_type == "Shared"
|
80
|
+
kontena = get_vmconfig
|
81
|
+
else
|
82
|
+
kontena = App42::Command::Gpaas.new.get_instance_config iaas, vm_type
|
83
|
+
end
|
80
84
|
setup_infra_res = App42::Command::Base.new.create_infrastructure app_name, iaas, vm_type, runtime, framework, webserver, os, kontena
|
81
85
|
exit! if setup_infra_res
|
82
86
|
end
|
@@ -132,6 +136,10 @@ module App42
|
|
132
136
|
# then scale app by no of instance
|
133
137
|
def scale
|
134
138
|
@options[:name] = get_app_name if @options[:name].nil?
|
139
|
+
|
140
|
+
app_info = app_information 'app', @options[:name]
|
141
|
+
scale_dedicated_app @options[:name] if app_info["appInfo"]["vmType"] && app_info["appInfo"]["vmType"] == "Dedicated"
|
142
|
+
|
135
143
|
scale_type = ask_scale_type
|
136
144
|
if scale_type == App42::SCALE_TYPE.first
|
137
145
|
hscale @options[:name]
|
@@ -140,10 +148,34 @@ module App42
|
|
140
148
|
end
|
141
149
|
end
|
142
150
|
|
151
|
+
def scale_dedicated_app app_name
|
152
|
+
iaas, vm_type = get_iaas_and_vm_type_of_app app_name
|
153
|
+
vm_config = App42::Command::Gpaas.new.get_instance_config iaas, vm_type
|
154
|
+
scale_or_descal_res = scale_or_descale_app "scale", vm_config, app_name, "vm"
|
155
|
+
exit! if scale_or_descal_res
|
156
|
+
end
|
157
|
+
|
158
|
+
def descale_dedicated_app app_name
|
159
|
+
iaas, vm_type = get_iaas_and_vm_type_of_app app_name
|
160
|
+
vm_config = App42::Command::Gpaas.new.get_instance_config iaas, vm_type
|
161
|
+
scale_or_descal_res = scale_or_descale_app "descale", vm_config, app_name, "vm"
|
162
|
+
exit! if scale_or_descal_res
|
163
|
+
end
|
164
|
+
|
165
|
+
# return setup details
|
166
|
+
def get_iaas_and_vm_type_of_app app_name
|
167
|
+
app_details = App42::Command::Config.new.get_app_details app_name
|
168
|
+
return app_details['iaas'], app_details['containerType'] if app_details['success']
|
169
|
+
end
|
170
|
+
|
143
171
|
# read +app name+ and number of +instance+ from user
|
144
172
|
# then descale app by no of instance
|
145
173
|
def descale
|
146
174
|
@options[:name] = get_app_name if @options[:name].nil?
|
175
|
+
|
176
|
+
app_info = app_information 'app', @options[:name]
|
177
|
+
descale_dedicated_app @options[:name] if app_info["appInfo"]["vmType"] && app_info["appInfo"]["vmType"] == "Dedicated"
|
178
|
+
|
147
179
|
scale_type = ask_scale_type
|
148
180
|
if scale_type == App42::SCALE_TYPE.first
|
149
181
|
hdescale @options[:name]
|
@@ -190,7 +222,16 @@ module App42
|
|
190
222
|
#
|
191
223
|
def start
|
192
224
|
@options[:name] = get_app_name if @options[:name].nil?
|
193
|
-
|
225
|
+
app_info = app_information 'app', @options[:name]
|
226
|
+
|
227
|
+
action_type_id = nil
|
228
|
+
if app_info["appInfo"]["name"] && app_info["appInfo"]["vmType"] == "Dedicated"
|
229
|
+
action_type = input "App Start Type", APP_START.values, true
|
230
|
+
|
231
|
+
APP_START.each_pair{|action| action_type_id = action[0] if action[1] == action_type}
|
232
|
+
end
|
233
|
+
|
234
|
+
app_operation_req = app_operation __method__, @options[:name], action_type_id if is_app_exist? @options[:name]
|
194
235
|
exit! if app_operation_req
|
195
236
|
end
|
196
237
|
|
@@ -200,7 +241,16 @@ module App42
|
|
200
241
|
#
|
201
242
|
def stop
|
202
243
|
@options[:name] = get_app_name if @options[:name].nil?
|
203
|
-
|
244
|
+
app_info = app_information 'app', @options[:name]
|
245
|
+
|
246
|
+
action_type_id = nil
|
247
|
+
if app_info["appInfo"]["name"] && app_info["appInfo"]["vmType"] == "Dedicated"
|
248
|
+
action_type = input "App Stop Type", APP_STOP.values, true
|
249
|
+
|
250
|
+
APP_STOP.each_pair{|action| action_type_id = action[0] if action[1] == action_type}
|
251
|
+
end
|
252
|
+
|
253
|
+
app_operation_req = app_operation __method__, @options[:name], action_type_id if is_app_exist? @options[:name]
|
204
254
|
exit! if app_operation_req
|
205
255
|
end
|
206
256
|
|
@@ -210,7 +260,15 @@ module App42
|
|
210
260
|
#
|
211
261
|
def restart
|
212
262
|
@options[:name] = get_app_name if @options[:name].nil?
|
213
|
-
|
263
|
+
app_info = app_information 'app', @options[:name]
|
264
|
+
|
265
|
+
action_type_id = nil
|
266
|
+
if app_info["appInfo"]["name"] && app_info["appInfo"]["vmType"] == "Dedicated"
|
267
|
+
action_type = input "App Start Type", APP_RESTART.values, true
|
268
|
+
|
269
|
+
APP_RESTART.each_pair{|action| action_type_id = action[0] if action[1] == action_type}
|
270
|
+
end
|
271
|
+
app_operation_req = app_operation __method__, @options[:name], action_type_id if is_app_exist? @options[:name]
|
214
272
|
exit! if app_operation_req
|
215
273
|
end
|
216
274
|
|
@@ -295,4 +353,4 @@ module App42
|
|
295
353
|
|
296
354
|
end
|
297
355
|
end
|
298
|
-
end
|
356
|
+
end
|
data/lib/app42/command/base.rb
CHANGED
@@ -58,8 +58,8 @@ module App42
|
|
58
58
|
end
|
59
59
|
|
60
60
|
# get supported virtual machine type by app42paas
|
61
|
-
def get_vm_types
|
62
|
-
vm_type = App42::Command::Config.new.get_vm_type
|
61
|
+
def get_vm_types resource_type
|
62
|
+
vm_type = App42::Command::Config.new.get_vm_type resource_type
|
63
63
|
vm_type_array = vm_type['deploymentType'].map(&:capitalize)
|
64
64
|
input "Select Instance Type", vm_type_array, true
|
65
65
|
end
|
@@ -69,9 +69,9 @@ module App42
|
|
69
69
|
end
|
70
70
|
|
71
71
|
# @return iaas providers
|
72
|
-
def get_iaas_providers
|
72
|
+
def get_iaas_providers vm_type
|
73
73
|
iaas_provider_hash = {}
|
74
|
-
iaas_providers = App42::Command::Config.new.get_iaas_provider
|
74
|
+
iaas_providers = App42::Command::Config.new.get_iaas_provider vm_type
|
75
75
|
|
76
76
|
iaas_providers['iaas'].select {|each_iaas| iaas_provider_hash["#{each_iaas['id']}"] = each_iaas['name'] + ' ' + each_iaas['zone']}
|
77
77
|
iaas = input "Select IaaS Provider", iaas_provider_hash.values, true
|
@@ -118,10 +118,11 @@ module App42
|
|
118
118
|
end
|
119
119
|
|
120
120
|
# get supported runtime by app42paas
|
121
|
-
def get_runtime
|
122
|
-
runtime_hash = {}
|
123
|
-
runtimes = App42::Command::Config.new.
|
124
|
-
|
121
|
+
def get_runtime iaas, vm_type
|
122
|
+
runtime_hash, runtimes = {}, nil
|
123
|
+
runtimes = App42::Command::Config.new.get_runtimes_for_dedicated iaas, vm_type if vm_type == "Dedicated"
|
124
|
+
runtimes = App42::Command::Config.new.get_runtimes_for_shared if vm_type == "Shared"
|
125
|
+
|
125
126
|
runtimes['runtimes'].select {|each_rt| runtime_hash["#{each_rt['id']}"] = each_rt['name'] + ' ' + each_rt['version']}
|
126
127
|
rt = input "Select Runtime", runtime_hash.values, true
|
127
128
|
|
@@ -300,7 +301,8 @@ module App42
|
|
300
301
|
# infrastructure setup call
|
301
302
|
def create_infrastructure app_name, iaas, vm_type, runtime, framework, webserver, os, kontena
|
302
303
|
begin
|
303
|
-
|
304
|
+
if vm_type == "Shared"
|
305
|
+
body = {'app42' => {"request"=> {
|
304
306
|
"appName" => app_name,
|
305
307
|
"iaas" => iaas,
|
306
308
|
"vmType" => vm_type,
|
@@ -310,6 +312,18 @@ module App42
|
|
310
312
|
"os" => os,
|
311
313
|
"kontenaPower" => kontena
|
312
314
|
}}}.to_json
|
315
|
+
else
|
316
|
+
body = {'app42' => {"request"=> {
|
317
|
+
"appName" => app_name,
|
318
|
+
"iaas" => iaas,
|
319
|
+
"vmType" => vm_type,
|
320
|
+
"runtime" => runtime,
|
321
|
+
"framework" => framework,
|
322
|
+
"webServer" => webserver,
|
323
|
+
"os" => os,
|
324
|
+
"memoryConfig" => kontena
|
325
|
+
}}}.to_json
|
326
|
+
end
|
313
327
|
|
314
328
|
query_params = params
|
315
329
|
query_params.store('body', body)
|
@@ -690,12 +704,21 @@ module App42
|
|
690
704
|
|
691
705
|
# Scale or descale application by no of instance,
|
692
706
|
# expect +what+ as operation and instance as no of instance
|
693
|
-
def scale_or_descale_app what, instance, app_name
|
694
|
-
begin
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
707
|
+
def scale_or_descale_app what, instance, app_name, action_type = nil
|
708
|
+
begin
|
709
|
+
if action_type == "vm"
|
710
|
+
body = {"app42" => {"request"=> {
|
711
|
+
"appName" => app_name,
|
712
|
+
"memoryConfig" => instance.to_s,
|
713
|
+
"actionType" => action_type
|
714
|
+
}}}.to_json
|
715
|
+
else
|
716
|
+
body = {"app42" => {"request"=> {
|
717
|
+
"appName" => app_name,
|
718
|
+
"instanceCount" => instance.to_s,
|
719
|
+
"actionType" => action_type
|
720
|
+
}}}.to_json
|
721
|
+
end
|
699
722
|
|
700
723
|
query_params = params
|
701
724
|
query_params.store('body', body)
|
@@ -780,12 +803,13 @@ module App42
|
|
780
803
|
|
781
804
|
# All application operation will take placed like app start, stop etc.
|
782
805
|
# expect +what+ as operation and +app_name+ as application name.
|
783
|
-
def app_operation what, app_name
|
806
|
+
def app_operation what, app_name, action_type = nil
|
784
807
|
begin
|
785
808
|
if what.to_s == 'stop'
|
786
809
|
response = with_progress(Paint[ "Stopping Application #{app_name}", :yellow]) do |s|
|
787
810
|
body = {'app42' => {"request"=> {
|
788
|
-
"appName" => app_name
|
811
|
+
"appName" => app_name,
|
812
|
+
"actionType" => action_type
|
789
813
|
}}}.to_json
|
790
814
|
|
791
815
|
query_params = params
|
@@ -800,7 +824,8 @@ module App42
|
|
800
824
|
build_delete_request query_params, "app", "#{app_name}"
|
801
825
|
else
|
802
826
|
body = {'app42' => {"request"=> {
|
803
|
-
"appName" => app_name
|
827
|
+
"appName" => app_name,
|
828
|
+
"actionType" => action_type
|
804
829
|
}}}.to_json
|
805
830
|
|
806
831
|
query_params = params
|
@@ -1455,4 +1480,4 @@ module App42
|
|
1455
1480
|
end
|
1456
1481
|
end
|
1457
1482
|
end
|
1458
|
-
end
|
1483
|
+
end
|
data/lib/app42/command/config.rb
CHANGED
@@ -15,8 +15,8 @@ module App42::Command
|
|
15
15
|
#
|
16
16
|
# return list of virtual machine type
|
17
17
|
#
|
18
|
-
def get_vm_type
|
19
|
-
build_get_request params, 'info',
|
18
|
+
def get_vm_type resource_type
|
19
|
+
build_get_request params, 'info', "subscription/#{resource_type}"
|
20
20
|
end
|
21
21
|
|
22
22
|
#
|
@@ -29,8 +29,10 @@ module App42::Command
|
|
29
29
|
#
|
30
30
|
# return list of iaas_providers
|
31
31
|
#
|
32
|
-
def get_iaas_provider
|
33
|
-
|
32
|
+
def get_iaas_provider( vm_type = "List")
|
33
|
+
query_params = params
|
34
|
+
query_params.store('type', vm_type)
|
35
|
+
build_get_request query_params, 'info', "iaasproviders/#{vm_type}"
|
34
36
|
end
|
35
37
|
|
36
38
|
#
|
@@ -40,6 +42,23 @@ module App42::Command
|
|
40
42
|
build_get_request params, 'info', 'runtimes'
|
41
43
|
end
|
42
44
|
|
45
|
+
#
|
46
|
+
# return list of runtimes for shared
|
47
|
+
#
|
48
|
+
def get_runtimes_for_shared
|
49
|
+
build_get_request params, 'info', 'runtimes'
|
50
|
+
end
|
51
|
+
|
52
|
+
#
|
53
|
+
# return list of runtimes for dedicated VM
|
54
|
+
#
|
55
|
+
def get_runtimes_for_dedicated iaas, vm_type
|
56
|
+
query_params = params
|
57
|
+
query_params.store('vmType', vm_type)
|
58
|
+
query_params.store('iaas', iaas)
|
59
|
+
build_get_request query_params, 'info', 'runtimes/dedicated'
|
60
|
+
end
|
61
|
+
|
43
62
|
#
|
44
63
|
# return list of setup type
|
45
64
|
#
|
@@ -77,6 +96,15 @@ module App42::Command
|
|
77
96
|
build_get_request query_params, 'info', 'setupdetails'
|
78
97
|
end
|
79
98
|
|
99
|
+
#
|
100
|
+
# return setup details
|
101
|
+
#
|
102
|
+
def get_app_details app_name
|
103
|
+
query_params = params
|
104
|
+
query_params.store('appName', app_name)
|
105
|
+
build_get_request query_params, 'info', 'appdetails'
|
106
|
+
end
|
107
|
+
|
80
108
|
#
|
81
109
|
# return list of flavour
|
82
110
|
#
|
@@ -242,4 +270,4 @@ module App42::Command
|
|
242
270
|
end
|
243
271
|
|
244
272
|
end
|
245
|
-
end
|
273
|
+
end
|
data/lib/app42/command/gpaas.rb
CHANGED
@@ -10,7 +10,7 @@ module App42
|
|
10
10
|
def setup
|
11
11
|
setup_name = get_setup_name_and_check_setup_url_availability if App42::Command::Auth.is_authorize_for_dedicated?
|
12
12
|
vm_type = 'dedicated' # GPaaS need only dedicated server
|
13
|
-
iaas = get_iaas_providers
|
13
|
+
iaas = get_iaas_providers vm_type
|
14
14
|
setup_type = get_setup_type
|
15
15
|
flavour = get_instance_config iaas, vm_type
|
16
16
|
ans = ask Paint["#{Message::ADD_STATIC_IP}", :red], :default => true ; print_new_line
|
@@ -32,10 +32,12 @@ module App42
|
|
32
32
|
exit! if response
|
33
33
|
end
|
34
34
|
|
35
|
-
# collect GPaaS setup name from user and proceed GPaaS stop request
|
36
35
|
def stop
|
37
|
-
|
38
|
-
|
36
|
+
@options[:setup] = get_setup_name if @options[:setup].nil?
|
37
|
+
unless is_static_ip_assigned? @options[:setup]
|
38
|
+
ans = ask Paint["#{Message::URL_WILL_CHANGE}", :red], :default => true ; print_new_line
|
39
|
+
ans == true ? (@options[:setup] = get_setup_name if @options[:setup].nil?) : (exit!)
|
40
|
+
end
|
39
41
|
response = gpaas_operation __method__, @options[:setup] if is_setup_name_exist? @options[:setup]
|
40
42
|
exit! if response
|
41
43
|
end
|
@@ -140,4 +142,4 @@ module App42
|
|
140
142
|
end
|
141
143
|
end
|
142
144
|
end
|
143
|
-
end
|
145
|
+
end
|
@@ -87,9 +87,9 @@ module App42::Command
|
|
87
87
|
|
88
88
|
database = '0' if service == 'redis283'
|
89
89
|
|
90
|
-
vm_type = get_vm_types
|
90
|
+
vm_type = get_vm_types "service"
|
91
91
|
|
92
|
-
iaas = get_iaas_providers
|
92
|
+
iaas = get_iaas_providers vm_type
|
93
93
|
|
94
94
|
os = get_os_for_service iaas, vm_type, service
|
95
95
|
|
data/lib/app42/command/setup.rb
CHANGED
@@ -9,8 +9,8 @@ module App42
|
|
9
9
|
# required inputs are setup_name, vm_type, iaas, setup_type and flavour
|
10
10
|
def setup_cloud_api
|
11
11
|
setup_name = get_setup_name_and_check_setup_url_availability
|
12
|
-
vm_type = get_vm_types
|
13
|
-
iaas = get_iaas_providers
|
12
|
+
vm_type = get_vm_types nil
|
13
|
+
iaas = get_iaas_providers vm_type
|
14
14
|
setup_type = get_setup_type
|
15
15
|
flavour = get_flavour
|
16
16
|
setup_cloud_api_res = App42::Command::Base.new.create_cloud_setup setup_name, iaas, vm_type, setup_type, flavour
|
@@ -9,8 +9,8 @@ module App42
|
|
9
9
|
# required inputs are wordpress_name, vm_type, iaas, setup_type and flavour
|
10
10
|
def setup
|
11
11
|
wordpress_name = get_wordpress_name_and_check_wordpress_url_availability
|
12
|
-
vm_type = get_vm_types
|
13
|
-
iaas = get_iaas_providers
|
12
|
+
vm_type = get_vm_types nil
|
13
|
+
iaas = get_iaas_providers vm_type
|
14
14
|
flavour = get_flavour
|
15
15
|
setup_cloud_api_res = App42::Command::Base.new.create_wordpress_setup wordpress_name, iaas, vm_type, flavour
|
16
16
|
exit! if setup_cloud_api_res
|
data/lib/app42/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app42
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-07-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|