app42 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/RELEASE.md +5 -1
- data/lib/app42/base/constants.rb +3 -0
- data/lib/app42/base/help.rb +250 -74
- data/lib/app42/base/message.rb +6 -1
- data/lib/app42/base/shell.rb +13 -4
- data/lib/app42/base/util.rb +11 -29
- data/lib/app42/command/app.rb +6 -6
- data/lib/app42/command/authorize.rb +6 -1
- data/lib/app42/command/base.rb +153 -8
- data/lib/app42/command/client.rb +28 -4
- data/lib/app42/command/config.rb +46 -0
- data/lib/app42/command/gpaas.rb +126 -0
- data/lib/app42/command/setup.rb +8 -8
- data/lib/app42/command/wordpress.rb +4 -4
- data/lib/app42/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a42af4dc576b6652113d47ccbca40c15f5272ae2
|
4
|
+
data.tar.gz: 58c60fa6325505cb88ee8af901202cdde6a71609
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd2cb6f61994df6407f716bc27c90307b6dbbeb777736c1b426dc1326b5634b5f5841b6e10d4585d3a9e092ebea9373f28b19360f8c707879fcbbf206291c8ae
|
7
|
+
data.tar.gz: f809ee2c8e48e3e94d7bd7ffd8c66607f9695f727f9d8afa151ba0bfe822e6faaf935c4c3989f14e4d5819c2d39e349765f60226923cd8b1da994d13ee6a232a
|
data/RELEASE.md
CHANGED
data/lib/app42/base/constants.rb
CHANGED
data/lib/app42/base/help.rb
CHANGED
@@ -19,13 +19,10 @@ module App42
|
|
19
19
|
#{how_to}
|
20
20
|
|
21
21
|
Thank You for installing App42 PaaS Ruby Client! This is a powerful tool to make your Applications live with-in minutes.
|
22
|
-
App42 PaaS is world's most advanced PaaS solution which supports multiple languages(Java, PHP, Ruby) and services
|
23
|
-
(RDBMS like MySQL and PostgreSQL to NoSQL storage like MongoDB and CouchDB). To Get Started Signup at app42paas.shephertz.com,
|
22
|
+
App42 PaaS is world's most advanced PaaS solution which supports multiple languages(Java, PHP, Ruby, Nodejs) and services
|
23
|
+
(RDBMS like MySQL and PostgreSQL to NoSQL storage like MongoDB, Redis and CouchDB). To Get Started Signup at app42paas.shephertz.com,
|
24
24
|
get your API Key and Secret key after you login and finally use App42 command to push your code to cloud. Enjoy Coding!!
|
25
25
|
|
26
|
-
$ app42 addKeys
|
27
|
-
|
28
|
-
|
29
26
|
Key
|
30
27
|
keys # List API key and Secret key
|
31
28
|
addKeys # Add API key and Secret key
|
@@ -47,39 +44,33 @@ module App42
|
|
47
44
|
logs # Returns the log file URL(s) for the application
|
48
45
|
addCustomURL # Add a custom URL to an app
|
49
46
|
removeCustomURL # Remove a custom URL from an app
|
50
|
-
customURLInfo # List all custom
|
47
|
+
customURLInfo # List all custom URL(s) of an app
|
51
48
|
|
52
49
|
Services
|
53
|
-
createService # Creates a new service e.g. MySQL, MongoDB, CouchDB, PostgreSQL etc.
|
50
|
+
createService # Creates a new service e.g. MySQL, MongoDB, CouchDB, PostgreSQL, Redis etc.
|
54
51
|
deleteService # Delete provisioned service
|
55
52
|
startService # Start the service
|
56
53
|
restartService # Restart the service
|
57
54
|
stopService # Stop the service
|
55
|
+
resetServicePassword # Reset password of provisioned service
|
58
56
|
scaleService # Vertically scale service by number of Kontena(s)
|
59
57
|
descaleService # Vertically descale services by number of Kontena(s)
|
60
|
-
uploadBackup # Upload
|
61
|
-
services # List all the provisioned services with their meta details
|
62
|
-
serviceInfo # Show meta information of the provisioned service
|
63
|
-
resetServicePassword # Reset password of provisioned service
|
58
|
+
uploadBackup # Upload existing backup into a service
|
64
59
|
bindIP # Bind IP to provisioned service
|
65
60
|
unbindIP # Unbind IP from provisioned service
|
66
61
|
bindInfo # Show IP bind information related to provisioned service
|
62
|
+
services # List all the provisioned services with their meta details
|
63
|
+
serviceInfo # Show meta information of the provisioned service
|
67
64
|
|
68
|
-
|
69
|
-
supportedServices # List supported services by App42
|
70
|
-
iaasProviders # List supported IaaS providers by App42
|
71
|
-
runtimes # List supported runtimes by App42
|
72
|
-
activities # List all activities with their status
|
73
|
-
|
74
|
-
Setup
|
65
|
+
BPaaS
|
75
66
|
setupBPaaS # Setup App42 BPaaS by choosing required configuration
|
76
|
-
|
67
|
+
deleteBPaaS # Delete the BPaaS setup
|
77
68
|
startBPaaS # Start the BPaaS setup
|
78
69
|
stopBPaaS # Stop the BPaaS setup
|
79
|
-
setupInfo # Show setup information
|
80
70
|
upgradeBPaas # Upgrade BPaaS by choosing required configuration
|
81
71
|
downgradeBPaas # Downgrade BPaaS by choosing required configuration
|
82
|
-
|
72
|
+
bPaaSInfo # Show BPaaS setup information
|
73
|
+
bPaaSSetups # List all the BPaaS setups
|
83
74
|
|
84
75
|
WordPress
|
85
76
|
setupWordPress # Setup App42 WordPress by choosing required configuration
|
@@ -89,12 +80,28 @@ module App42
|
|
89
80
|
upgradeWordPress # Upgrade WordPress by choosing required configuration
|
90
81
|
downgradeWordPress # Downgrade WordPress by choosing required configuration
|
91
82
|
wordPressInfo # Show WordPress setup information
|
92
|
-
wordPressSetups # List all the WordPress setups
|
83
|
+
wordPressSetups # List all the WordPress setups
|
84
|
+
|
85
|
+
GPaaS
|
86
|
+
setupGPaaS # Setup App42 GPaaS by choosing required configuration
|
87
|
+
deleteGPaaS # Delete the GPaaS setup
|
88
|
+
startGPaaS # Start the GPaaS setup
|
89
|
+
stopGPaaS # Stop the GPaaS setup
|
90
|
+
upgradeGPaas # Upgrade GPaaS by choosing required configuration
|
91
|
+
downgradeGPaas # Downgrade GPaaS by choosing required configuration
|
92
|
+
gPaaSInfo # Show GPaaS setup information
|
93
|
+
gPaaSSetups # List all the GPaaS setups
|
93
94
|
|
94
95
|
Help
|
95
96
|
version # Show Ruby client gem version
|
96
97
|
help # List available commands and their description
|
97
98
|
COMMAND --help # Display detailed help of a specific command
|
99
|
+
|
100
|
+
Misc
|
101
|
+
supportedServices # List supported services by App42
|
102
|
+
iaasProviders # List supported IaaS providers by App42
|
103
|
+
runtimes # List supported runtimes by App42
|
104
|
+
activities # List all activities with their status
|
98
105
|
USAGE
|
99
106
|
end
|
100
107
|
|
@@ -786,7 +793,7 @@ Example:
|
|
786
793
|
| scale | COMPLETED | demo | APP | 2013-10-25 06:41:25.0 |
|
787
794
|
| descale | COMPLETED | demo | APP | 2013-10-25 06:42:12.0 |
|
788
795
|
| descale | COMPLETED | demo | APP | 2013-10-25 06:42:13.0 |
|
789
|
-
|
|
796
|
+
| restart | COMPLETED | demo | APP | 2013-10-25 06:44:31.0 |
|
790
797
|
| stop | COMPLETED | demo | APP | 2013-10-25 06:45:23.0 |
|
791
798
|
| start | COMPLETED | demo | APP | 2013-10-25 06:45:49.0 |
|
792
799
|
| scale | COMPLETED | demo | APP | 2013-10-25 06:52:56.0 |
|
@@ -967,38 +974,38 @@ Usage:
|
|
967
974
|
|
968
975
|
Example:
|
969
976
|
$app42 setupBPaaS
|
970
|
-
Enter Setup Name:
|
977
|
+
Enter Setup Name: demo
|
971
978
|
Checking Setup Name Availability... OK
|
972
979
|
|
973
980
|
1: Shared
|
974
981
|
Select Instance Type [Shared]:
|
975
982
|
|
976
|
-
1: Amazon
|
977
|
-
Select IaaS Provider [Amazon
|
983
|
+
1: Amazon (Oregon)
|
984
|
+
Select IaaS Provider [Amazon (Oregon)]:
|
978
985
|
|
979
986
|
1: Light
|
980
987
|
2: Medium
|
981
988
|
3: Heavy
|
982
|
-
Select Flavour [Light]:
|
983
|
-
|
984
|
-
Setting up the infrastructure... OK
|
989
|
+
Select Flavour [Light]:
|
985
990
|
|
986
|
-
|
991
|
+
Setting up the BPaaS infrastructure... OK
|
987
992
|
|
988
|
-
|
993
|
+
Operation is in progress, Please wait...-
|
994
|
+
BPaaS Setup has been completed successfully.
|
989
995
|
|
996
|
+
Your BPaaS setup has been completed successfully, For details, Login to PaaSHQ console.
|
990
997
|
DESC
|
991
998
|
end
|
992
999
|
|
993
|
-
def
|
1000
|
+
def deletebpaas
|
994
1001
|
print <<-DESC
|
995
1002
|
Usage:
|
996
|
-
app42
|
1003
|
+
app42 deleteBPaaS
|
997
1004
|
|
998
1005
|
Delete the setup
|
999
1006
|
|
1000
1007
|
Example:
|
1001
|
-
$app42
|
1008
|
+
$app42 deleteBPaaS
|
1002
1009
|
Enter Setup Name: demo
|
1003
1010
|
Deleting Setup... OK
|
1004
1011
|
|
@@ -1007,42 +1014,44 @@ Example:
|
|
1007
1014
|
DESC
|
1008
1015
|
end
|
1009
1016
|
|
1010
|
-
def
|
1017
|
+
def bpaasinfo
|
1011
1018
|
print <<-DESC
|
1012
1019
|
Usage:
|
1013
|
-
app42
|
1020
|
+
app42 bPaaSInfo
|
1014
1021
|
|
1015
1022
|
Show setup information
|
1016
1023
|
|
1017
1024
|
Example:
|
1018
|
-
$app42
|
1025
|
+
$app42 bPaaSInfo
|
1019
1026
|
Enter Setup Name: demo
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
+
|
1028
|
+
+-----------------------+----------------------------------------+------------+-----------------+------------+---------+---------------+--------------+-------------------------------------+
|
1029
|
+
| === demo Details === |
|
1030
|
+
+-----------------------+----------------------------------------+------------+-----------------+------------+---------+---------------+--------------+-------------------------------------+
|
1031
|
+
| Created On | Api Server Url | Setup Name | Iaas Provider | Setup Type | Vm Type | Setup Flavour | Setup Status | App Hq Url |
|
1032
|
+
+-----------------------+----------------------------------------+------------+-----------------+------------+---------+---------------+--------------+-------------------------------------+
|
1033
|
+
| 2014-02-24 08:00:21.0 | https://democloudapi.iab.app42paas.com | demo | Amazon (Oregon) | BPaaS | Shared | light | RUNNING | https://demoapphq.iab.app42paas.com |
|
1034
|
+
+-----------------------+----------------------------------------+------------+-----------------+------------+---------+---------------+--------------+-------------------------------------+
|
1027
1035
|
DESC
|
1028
1036
|
end
|
1029
1037
|
|
1030
|
-
def
|
1038
|
+
def bpaassetups
|
1031
1039
|
print <<-DESC
|
1032
1040
|
Usage:
|
1033
|
-
app42
|
1041
|
+
app42 bPaaSSetups
|
1034
1042
|
|
1035
|
-
List all the setups
|
1043
|
+
List all the BPaaS setups
|
1036
1044
|
|
1037
1045
|
Example:
|
1038
|
-
$app42
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
+
$app42 bPaaSSetups
|
1047
|
+
|
1048
|
+
+-----------------------+----------------------------------------+------------+-----------------+------------+--------------------------+---------+---------------+--------------+-------------------------------------+
|
1049
|
+
| === Setups List === |
|
1050
|
+
+-----------------------+----------------------------------------+------------+-----------------+------------+--------------------------+---------+---------------+--------------+-------------------------------------+
|
1051
|
+
| Created On | Api Server Url | Setup Name | Iaas Provider | Setup Type | Email | Vm Type | Setup Flavour | Setup Status | App Hq Url |
|
1052
|
+
+-----------------------+----------------------------------------+------------+-----------------+------------+--------------------------+---------+---------------+--------------+-------------------------------------+
|
1053
|
+
| 2014-02-24 08:00:21.0 | https://democloudapi.iab.app42paas.com | demo | Amazon (Oregon) | BPaaS | pravinmishra88@gmail.com | Shared | light | RUNNING | https://demoapphq.iab.app42paas.com |
|
1054
|
+
+-----------------------+----------------------------------------+------------+-----------------+------------+--------------------------+---------+---------------+--------------+-------------------------------------+
|
1046
1055
|
DESC
|
1047
1056
|
end
|
1048
1057
|
|
@@ -1061,7 +1070,6 @@ Example:
|
|
1061
1070
|
Operation is in progress, Please wait...|
|
1062
1071
|
|
1063
1072
|
BPaaS setup demo started successfully.
|
1064
|
-
|
1065
1073
|
DESC
|
1066
1074
|
end
|
1067
1075
|
|
@@ -1080,7 +1088,6 @@ Example:
|
|
1080
1088
|
Operation is in progress, Please wait...|
|
1081
1089
|
|
1082
1090
|
BPaaS setup demo stopped successfully.
|
1083
|
-
|
1084
1091
|
DESC
|
1085
1092
|
end
|
1086
1093
|
|
@@ -1139,27 +1146,27 @@ Usage:
|
|
1139
1146
|
|
1140
1147
|
Example:
|
1141
1148
|
$app42 setupWordPress
|
1142
|
-
Enter
|
1149
|
+
Enter Wordpress Name: demo
|
1143
1150
|
|
1144
1151
|
Checking WordPress Name Availability... OK
|
1145
1152
|
|
1146
1153
|
1: Shared
|
1147
1154
|
Select Instance Type [Shared]:
|
1148
1155
|
|
1149
|
-
1: Amazon (
|
1150
|
-
Select IaaS Provider [Amazon (
|
1156
|
+
1: Amazon (Oregon)
|
1157
|
+
Select IaaS Provider [Amazon (Oregon)]:
|
1151
1158
|
|
1152
1159
|
1: Light
|
1153
1160
|
2: Medium
|
1154
1161
|
3: Heavy
|
1155
1162
|
Select Flavour [Light]:
|
1156
1163
|
|
1157
|
-
Setting up the infrastructure... OK
|
1164
|
+
Setting up the wordpress infrastructure... OK
|
1158
1165
|
|
1159
1166
|
Operation is in progress, Please wait...-
|
1167
|
+
WordPress Setup has been completed successfully.
|
1160
1168
|
|
1161
|
-
Your WordPress setup has been completed successfully, For details, Login to
|
1162
|
-
|
1169
|
+
Your WordPress setup has been completed successfully, For details, Login to PaaSHQ console.
|
1163
1170
|
DESC
|
1164
1171
|
end
|
1165
1172
|
|
@@ -1172,12 +1179,12 @@ Usage:
|
|
1172
1179
|
|
1173
1180
|
Example:
|
1174
1181
|
$app42 startWordPress
|
1175
|
-
Enter
|
1176
|
-
Starting WordPress Setup demo... OK
|
1182
|
+
Enter Wordpress Name: demo
|
1177
1183
|
|
1178
|
-
|
1179
|
-
Setup started successfully.
|
1184
|
+
Starting Wordpress Setup demo... OK
|
1180
1185
|
|
1186
|
+
Operation is in progress, Please wait...|
|
1187
|
+
WordPress Setup has been started successfully.
|
1181
1188
|
DESC
|
1182
1189
|
end
|
1183
1190
|
|
@@ -1190,12 +1197,12 @@ Usage:
|
|
1190
1197
|
|
1191
1198
|
Example:
|
1192
1199
|
$app42 stopWordPress
|
1193
|
-
Enter
|
1194
|
-
Stopping WordPress Setup demo... OK
|
1200
|
+
Enter Wordpress Name: demo
|
1195
1201
|
|
1196
|
-
|
1197
|
-
Setup stopped successfully.
|
1202
|
+
Stopping Wordpress Setup demo... OK
|
1198
1203
|
|
1204
|
+
Operation is in progress, Please wait...|
|
1205
|
+
WordPress Setup has been stopped successfully.
|
1199
1206
|
DESC
|
1200
1207
|
end
|
1201
1208
|
|
@@ -1322,7 +1329,6 @@ Example:
|
|
1322
1329
|
|
1323
1330
|
Adding Custom URL To Application demo... OK
|
1324
1331
|
Custom URL added successfully.
|
1325
|
-
|
1326
1332
|
DESC
|
1327
1333
|
end
|
1328
1334
|
|
@@ -1341,7 +1347,6 @@ Example:
|
|
1341
1347
|
|
1342
1348
|
Removing Custom URL... OK
|
1343
1349
|
Custom URL deleted successfully.
|
1344
|
-
|
1345
1350
|
DESC
|
1346
1351
|
end
|
1347
1352
|
|
@@ -1363,9 +1368,180 @@ Example:
|
|
1363
1368
|
+-------------+-----------------------+----------------------------+
|
1364
1369
|
| demo | 2014-01-27 06:35:55.0 | http://test.naveengoswami.com |
|
1365
1370
|
+----------+-----------------------+-------------------------------+
|
1371
|
+
DESC
|
1372
|
+
end
|
1373
|
+
|
1374
|
+
def setupgpaas
|
1375
|
+
print <<-DESC
|
1376
|
+
Usage:
|
1377
|
+
app42 setupGPaaS
|
1378
|
+
|
1379
|
+
Setup App42 GPaaS by choosing required configuration
|
1380
|
+
|
1381
|
+
Example:
|
1382
|
+
$ app42 setupGPaaS
|
1383
|
+
Enter Setup Name: demo
|
1384
|
+
Checking Setup Name Availability... OK
|
1385
|
+
|
1386
|
+
1: Amazon (Northern Virginia)
|
1387
|
+
Select IaaS Provider [Amazon (Northern Virginia)]:
|
1388
|
+
|
1389
|
+
1: t1.micro
|
1390
|
+
2: m1.small
|
1391
|
+
3: m1.medium
|
1392
|
+
4: m1.large
|
1393
|
+
5: m1.xlarge
|
1394
|
+
Select Instance Configuration [t1.micro]:
|
1395
|
+
|
1396
|
+
Setting up the GPaaS infrastructure... OK
|
1397
|
+
|
1398
|
+
Operation is in progress, Please wait...|
|
1399
|
+
GPaaS Setup has been completed successfully.
|
1400
|
+
|
1401
|
+
Your GPaaS setup has been completed successfully, For details, Login to PaaSHQ console.
|
1402
|
+
DESC
|
1403
|
+
end
|
1404
|
+
|
1405
|
+
def startgpaas
|
1406
|
+
print <<-DESC
|
1407
|
+
Usage:
|
1408
|
+
app42 startGPaaS
|
1409
|
+
|
1410
|
+
Start the GPaaS setup
|
1411
|
+
|
1412
|
+
Example:
|
1413
|
+
$app42 startGPaaS
|
1414
|
+
Enter Setup Name: demo
|
1415
|
+
Starting GPaaS Setup fsdfds... OK
|
1416
|
+
|
1417
|
+
Operation is in progress, Please wait...-
|
1418
|
+
GPaaS Setup has been started successfully.
|
1419
|
+
DESC
|
1420
|
+
end
|
1421
|
+
|
1422
|
+
def stopgpaas
|
1423
|
+
print <<-DESC
|
1424
|
+
Usage:
|
1425
|
+
app42 stopGPaaS
|
1426
|
+
|
1427
|
+
Stop the GPaaS setup
|
1428
|
+
|
1429
|
+
Example:
|
1430
|
+
$app42 stopGPaaS
|
1431
|
+
Enter Setup Name: demo
|
1432
|
+
Stopping GPaaS Setup demo... OK
|
1433
|
+
|
1434
|
+
Operation is in progress, Please wait...|
|
1435
|
+
GPaaS Setup has been stopped successfully.
|
1436
|
+
DESC
|
1437
|
+
end
|
1438
|
+
|
1439
|
+
def upgradegpaas
|
1440
|
+
print <<-DESC
|
1441
|
+
Usage:
|
1442
|
+
app42 upgradeGPaaS
|
1443
|
+
|
1444
|
+
Upgrade GPaaS by choosing required configuration
|
1445
|
+
|
1446
|
+
Example:
|
1447
|
+
$app42 upgradeGPaaS
|
1448
|
+
Enter Setup Name: demo
|
1449
|
+
|
1450
|
+
1: m1.small
|
1451
|
+
2: m1.medium
|
1452
|
+
3: m1.large
|
1453
|
+
4: m1.xlarge
|
1454
|
+
Select Instance Configuration [m1.small]:
|
1455
|
+
|
1456
|
+
Upgrading Setup... OK
|
1457
|
+
|
1458
|
+
Operation is in progress, Please wait...|
|
1459
|
+
GPaaS Setup has been updated successfully.
|
1460
|
+
DESC
|
1461
|
+
end
|
1462
|
+
|
1463
|
+
def downgradegpaas
|
1464
|
+
print <<-DESC
|
1465
|
+
Usage:
|
1466
|
+
app42 downgradeGPaaS
|
1467
|
+
|
1468
|
+
Downgrade GPaaS by choosing required configuration
|
1469
|
+
|
1470
|
+
Example:
|
1471
|
+
$app42 downgradeGPaaS
|
1472
|
+
Enter Setup Name: demo
|
1473
|
+
|
1474
|
+
1: t1.micro
|
1475
|
+
Select Instance Configuration [t1.micro]:
|
1476
|
+
|
1477
|
+
Downgrading Setup... OK
|
1366
1478
|
|
1479
|
+
Operation is in progress, Please wait...-
|
1480
|
+
GPaaS Setup has been updated successfully.
|
1481
|
+
DESC
|
1482
|
+
end
|
1483
|
+
|
1484
|
+
def deletegpaas
|
1485
|
+
print <<-DESC
|
1486
|
+
Usage:
|
1487
|
+
app42 deleteGPaaS
|
1488
|
+
|
1489
|
+
Delete the GPaaS setup
|
1490
|
+
|
1491
|
+
Example:
|
1492
|
+
$app42 deleteGPaaS
|
1493
|
+
Enter Setup Name: demo
|
1494
|
+
Deleting Setup... OK
|
1495
|
+
|
1496
|
+
Operation is in progress, Please wait...-
|
1497
|
+
Setup deleted successfully.
|
1498
|
+
DESC
|
1499
|
+
end
|
1500
|
+
|
1501
|
+
def gpaasinfo
|
1502
|
+
print <<-DESC
|
1503
|
+
Usage:
|
1504
|
+
app42 gPaaSInfo
|
1505
|
+
|
1506
|
+
Show GPaaS setup information
|
1507
|
+
|
1508
|
+
Options:
|
1509
|
+
[--setup SETUP] # Name of setup, you want to info
|
1510
|
+
|
1511
|
+
Example:
|
1512
|
+
$ app42 gPaaSInfo
|
1513
|
+
Enter Setup Name: demo
|
1514
|
+
|
1515
|
+
+-----------------------+-------------------------------------------+------------+----------------------------+------------+-----------+---------------+--------------+
|
1516
|
+
| === gpaas Details === |
|
1517
|
+
+-----------------------+-------------------------------------------+------------+----------------------------+------------+-----------+---------------+--------------+
|
1518
|
+
| Created On | Api Server Url | Setup Name | Iaas Provider | Setup Type | Vm Type | Setup Flavour | Setup Status |
|
1519
|
+
+-----------------------+-------------------------------------------+------------+----------------------------+------------+-----------+---------------+--------------+
|
1520
|
+
| 2014-02-21 09:36:43.0 | ec2-54-237-87-107.compute-1.amazonaws.com | demo | Amazon (Northern Virginia) | GPaaS | Dedicated | t1.micro | RUNNING |
|
1521
|
+
+-----------------------+-------------------------------------------+------------+----------------------------+------------+-----------+---------------+--------------+
|
1367
1522
|
DESC
|
1368
|
-
end
|
1523
|
+
end
|
1524
|
+
|
1525
|
+
def gpaassetups
|
1526
|
+
print <<-DESC
|
1527
|
+
Usage:
|
1528
|
+
app42 gPaaSSetups
|
1529
|
+
|
1530
|
+
List all the GPaaS setups
|
1531
|
+
|
1532
|
+
Example:
|
1533
|
+
$app42 app42 gPaaSSetups
|
1534
|
+
|
1535
|
+
+-----------------------+-------------------------------------------+------------+----------------------------+------------+--------------------------+-----------+---------------+--------------+
|
1536
|
+
| === Setups List === |
|
1537
|
+
+-----------------------+-------------------------------------------+------------+----------------------------+------------+--------------------------+-----------+---------------+--------------+
|
1538
|
+
| Created On | App Url | Setup Name | Iaas Provider | Setup Type | Email | Vm Type | Setup Flavour | Setup Status |
|
1539
|
+
+-----------------------+-------------------------------------------+------------+----------------------------+------------+--------------------------+-----------+---------------+--------------+
|
1540
|
+
| 2014-02-06 13:49:07.0 | ec2-54-221-96-246.compute-1.amazonaws.com | demo | Amazon (Northern Virginia) | GPaaS | pravinmishra88@gmail.com | Dedicated | t1.micro | RUNNING |
|
1541
|
+
+-----------------------+-------------------------------------------+------------+----------------------------+------------+--------------------------+-----------+---------------+--------------+
|
1542
|
+
|
1543
|
+
DESC
|
1544
|
+
end
|
1369
1545
|
|
1370
1546
|
def version
|
1371
1547
|
print <<-DESC
|
data/lib/app42/base/message.rb
CHANGED
@@ -22,6 +22,7 @@ module Message
|
|
22
22
|
REQUEST_PROGRESS = "\nYour request is in progress. Please check the request status after sometime."
|
23
23
|
LOG_MESSAGE = "Please visit below URL(s) to access app logs"
|
24
24
|
|
25
|
+
|
25
26
|
# validation message
|
26
27
|
IP_NOT_VALID = "Please provide the valid Source IP."
|
27
28
|
ACCESS_TIME = "Access time should be a valid number and it should not be more than 720(1 month) hours."
|
@@ -37,7 +38,11 @@ module Message
|
|
37
38
|
TIME_OUT_ERROR = "Request Timed Out. Please try after some time."
|
38
39
|
BAD_RESPONSE_ERROR = "Received bad HTTP response from"
|
39
40
|
|
40
|
-
# BPaaS and WordPress
|
41
|
+
# BPaaS, GPaaS and WordPress
|
41
42
|
HIGHLY_CONF = "You are already at highest configuration."
|
42
43
|
LOW_CONF = "You are already at lowest configuration."
|
44
|
+
URL_WILL_CHANGE = "\nStopping setup will modify your app public URL. Are you sure you want to stop Setup 'gpaas'?"
|
45
|
+
BPAAS_SUCCESSFUL = "Your BPaaS setup has been completed successfully, For details, Login to PaaSHQ console."
|
46
|
+
GPAAS_SUCCESSFUL = "Your GPaaS setup has been completed successfully, For details, Login to PaaSHQ console."
|
47
|
+
WORDPRESS_SUCCESSFUL = "Your WordPress setup has been completed successfully, For details, Login to PaaSHQ console."
|
43
48
|
end
|
data/lib/app42/base/shell.rb
CHANGED
@@ -46,9 +46,9 @@ module App42
|
|
46
46
|
'upgradebpaas',
|
47
47
|
'downgradebpaas',
|
48
48
|
'stopbpaas',
|
49
|
-
'
|
50
|
-
'
|
51
|
-
'
|
49
|
+
'deletebpaas',
|
50
|
+
'bpaasinfo',
|
51
|
+
'bpaassetups',
|
52
52
|
'setupwordpress',
|
53
53
|
'deletewordpress',
|
54
54
|
'upgradewordpress',
|
@@ -59,7 +59,16 @@ module App42
|
|
59
59
|
'wordpressinfo',
|
60
60
|
'addcustomurl',
|
61
61
|
'removecustomurl',
|
62
|
-
'customurlinfo'
|
62
|
+
'customurlinfo',
|
63
|
+
'setupgpaas',
|
64
|
+
'startgpaas',
|
65
|
+
'upgradegpaas',
|
66
|
+
'downgradegpaas',
|
67
|
+
'stopgpaas',
|
68
|
+
'deletegpaas',
|
69
|
+
'gpaasinfo',
|
70
|
+
'gpaassetups'
|
71
|
+
|
63
72
|
]
|
64
73
|
|
65
74
|
end
|
data/lib/app42/base/util.rb
CHANGED
@@ -420,20 +420,11 @@ module App42
|
|
420
420
|
end
|
421
421
|
|
422
422
|
# Get flavour for upgrade
|
423
|
-
def
|
423
|
+
def get_flavour_for_upgrade_or_downgrade setup_name, type
|
424
424
|
flavour_hash = {}
|
425
|
-
flavour_type = App42::Command::Config.new.
|
425
|
+
flavour_type = App42::Command::Config.new.get_flavour_type_fm_server_for_upgrade_or_downgrade setup_name, type
|
426
426
|
flavour_type['flavours'].select {|each_flavour| flavour_hash["#{each_flavour['id']}"] = each_flavour['name']}
|
427
427
|
|
428
|
-
query_params = params
|
429
|
-
query_params.store('setupName', setup_name)
|
430
|
-
wordpress_info = build_get_request query_params, 'setup', "#{setup_name}"
|
431
|
-
|
432
|
-
flavour_hash.delete 'light' if wordpress_info['setupInfo']['setupFlavour'] == App42::FLAVOUR_TYPE.first
|
433
|
-
['light','medium'].each{|f| flavour_hash.delete f} if wordpress_info['setupInfo']['setupFlavour'] == App42::FLAVOUR_TYPE[1]
|
434
|
-
message "#{Message::HIGHLY_CONF}", true, 'red' if wordpress_info['setupInfo']['setupFlavour'] == App42::FLAVOUR_TYPE[2]
|
435
|
-
exit! if wordpress_info['setupInfo']['setupFlavour'] == App42::FLAVOUR_TYPE[2]
|
436
|
-
|
437
428
|
flavour = input "Select Flavour", flavour_hash.values, true
|
438
429
|
|
439
430
|
flavour_id = nil
|
@@ -441,26 +432,17 @@ module App42
|
|
441
432
|
return flavour_id
|
442
433
|
end
|
443
434
|
|
444
|
-
# Get
|
445
|
-
def
|
446
|
-
|
447
|
-
|
448
|
-
|
435
|
+
# Get instance configuration
|
436
|
+
def get_instance_config_for_upgrade_or_downgrade iaas, vm_type, setup_name, type
|
437
|
+
instance_config_hash = {}
|
438
|
+
instance_config_type = App42::Command::Config.new.get_instance_config_for_upgrade_or_downgrade iaas, vm_type, setup_name, type
|
439
|
+
instance_config_type['IMList'].select {|each_instance_config| instance_config_hash["#{each_instance_config['id']}"] = each_instance_config['name']}
|
440
|
+
instance_config = input "Select Instance Configuration", instance_config_hash.values, true
|
449
441
|
|
450
|
-
|
451
|
-
|
452
|
-
wordpress_info = build_get_request query_params, 'setup', "#{setup_name}"
|
453
|
-
|
454
|
-
message "#{Message::LOW_CONF}", true, 'red' if wordpress_info['setupInfo']['setupFlavour'] == App42::FLAVOUR_TYPE.first
|
455
|
-
exit! if wordpress_info['setupInfo']['setupFlavour'] == App42::FLAVOUR_TYPE.first
|
456
|
-
['heavy','medium'].each{|f| flavour_hash.delete f} if wordpress_info['setupInfo']['setupFlavour'] == App42::FLAVOUR_TYPE[1]
|
457
|
-
['heavy'].each{|f| flavour_hash.delete f} if wordpress_info['setupInfo']['setupFlavour'] == App42::FLAVOUR_TYPE[2]
|
458
|
-
|
459
|
-
flavour = input "Select Flavour", flavour_hash.values, true
|
442
|
+
instance_config_id = nil
|
443
|
+
instance_config_hash.each_pair{|ic| instance_config_id = ic[0] if ic[1] == instance_config}
|
460
444
|
|
461
|
-
|
462
|
-
flavour_hash.each_pair{|fl| flavour_id = fl[0] if fl[1] == flavour}
|
463
|
-
return flavour_id
|
445
|
+
return instance_config_id
|
464
446
|
end
|
465
447
|
|
466
448
|
end
|
data/lib/app42/command/app.rb
CHANGED
@@ -112,7 +112,7 @@ module App42
|
|
112
112
|
input "Choose Upload Type", app_source_type, true
|
113
113
|
end
|
114
114
|
|
115
|
-
def ask_scale_type
|
115
|
+
def ask_scale_type
|
116
116
|
input "Choose Scale Type", App42::SCALE_TYPE, true
|
117
117
|
end
|
118
118
|
|
@@ -248,16 +248,16 @@ module App42
|
|
248
248
|
def add_custom_url
|
249
249
|
@options[:name] = get_app_name if @options[:name].nil?
|
250
250
|
custom_url = get_custom_url if is_app_exist? @options[:name]
|
251
|
-
|
252
|
-
exit! if
|
251
|
+
custom_url_res = custom_url_operation "addcustomurl", @options[:name], custom_url
|
252
|
+
exit! if custom_url_res
|
253
253
|
end
|
254
254
|
|
255
255
|
# Remove custom URL of app
|
256
256
|
def remove_custom_url
|
257
257
|
@options[:name] = get_app_name if @options[:name].nil?
|
258
258
|
custom_url = get_custom_url if is_app_exist? @options[:name]
|
259
|
-
|
260
|
-
exit! if
|
259
|
+
custom_url_res = custom_url_operation "removecustomurl", @options[:name], custom_url
|
260
|
+
exit! if custom_url_res
|
261
261
|
end
|
262
262
|
|
263
263
|
# List all custom urls of apps
|
@@ -274,7 +274,7 @@ module App42
|
|
274
274
|
|
275
275
|
rows_header.map { |e| rows_header_final << camel_case_to_whitespace(e) }
|
276
276
|
|
277
|
-
table = Terminal::Table.new :title => Paint["=== #{@options[:name]}
|
277
|
+
table = Terminal::Table.new :title => Paint["=== #{@options[:name]} Custom URLs Details ===", :green], :headings => rows_header_final, :rows => rows
|
278
278
|
puts table
|
279
279
|
end
|
280
280
|
|
@@ -11,7 +11,7 @@ module App42::Command
|
|
11
11
|
check_key_file?
|
12
12
|
end
|
13
13
|
|
14
|
-
def is_authorize?(api_key, secret_key)
|
14
|
+
def is_authorize?(api_key, secret_key)
|
15
15
|
if api_key.nil? || secret_key.nil?
|
16
16
|
message "#{Message::ADD_KEY}", true, 'red'
|
17
17
|
puts App42::Base::Help.addkeys
|
@@ -23,6 +23,11 @@ module App42::Command
|
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
|
+
def is_authorize_for_dedicated?
|
27
|
+
subscription = App42::Command::Base.new.get_subscription
|
28
|
+
return subscription["success"]
|
29
|
+
end
|
30
|
+
|
26
31
|
end
|
27
32
|
|
28
33
|
end
|
data/lib/app42/command/base.rb
CHANGED
@@ -63,6 +63,10 @@ module App42
|
|
63
63
|
vm_type_array = vm_type['deploymentType'].map(&:capitalize)
|
64
64
|
input "Select Instance Type", vm_type_array, true
|
65
65
|
end
|
66
|
+
|
67
|
+
def get_subscription
|
68
|
+
subscription = App42::Command::Config.new.subscription
|
69
|
+
end
|
66
70
|
|
67
71
|
# @return iaas providers
|
68
72
|
def get_iaas_providers
|
@@ -365,7 +369,7 @@ module App42
|
|
365
369
|
end
|
366
370
|
|
367
371
|
if host_response['success']
|
368
|
-
puts Paint["
|
372
|
+
puts Paint["#{Message::BPAAS_SUCCESSFUL}", :green]
|
369
373
|
return true
|
370
374
|
else
|
371
375
|
puts Paint["#{response['description']}", :red]
|
@@ -376,6 +380,46 @@ module App42
|
|
376
380
|
end
|
377
381
|
end
|
378
382
|
|
383
|
+
# setup GPaaS
|
384
|
+
def create_gpaas_setup setup_name, iaas, vm_type, setup_type, flavour
|
385
|
+
begin
|
386
|
+
body = {'app42' => {"request"=> {
|
387
|
+
"setupName" => setup_name,
|
388
|
+
"iaas" => iaas,
|
389
|
+
"vmType" => vm_type,
|
390
|
+
"setupType" => 'setupGPaaS',
|
391
|
+
"flavour" => flavour
|
392
|
+
}}}.to_json
|
393
|
+
|
394
|
+
query_params = params
|
395
|
+
query_params.store('body', body)
|
396
|
+
|
397
|
+
response = with_progress(Paint["Setting up the GPaaS infrastructure", :yellow]) do |s|
|
398
|
+
build_post_request body, query_params, "gpaas", nil
|
399
|
+
end
|
400
|
+
|
401
|
+
if response["success"] == true && response["transactionId"]
|
402
|
+
transaction_success = check_transaction_status_of_setup response["transactionId"], previous_completed = 0, 'created'
|
403
|
+
end
|
404
|
+
|
405
|
+
if transaction_success
|
406
|
+
transaction_params = params
|
407
|
+
transaction_params.store('setupName', setup_name)
|
408
|
+
host_response = build_get_request transaction_params, "gpaas", "#{setup_name}"
|
409
|
+
end
|
410
|
+
|
411
|
+
if host_response['success']
|
412
|
+
puts Paint["#{Message::GPAAS_SUCCESSFUL}", :green]
|
413
|
+
return true
|
414
|
+
else
|
415
|
+
puts Paint["#{response['description']}", :red]
|
416
|
+
end
|
417
|
+
rescue Interrupt
|
418
|
+
puts Paint[" Command cancelled.", :red]
|
419
|
+
exit!
|
420
|
+
end
|
421
|
+
end
|
422
|
+
|
379
423
|
# setup wordpress
|
380
424
|
def create_wordpress_setup wordpress_name, iaas, vm_type, flavour
|
381
425
|
begin
|
@@ -405,7 +449,7 @@ module App42
|
|
405
449
|
end
|
406
450
|
|
407
451
|
if host_response['success']
|
408
|
-
puts Paint["
|
452
|
+
puts Paint["#{Message::WORDPRESS_SUCCESSFUL}", :green]
|
409
453
|
return true
|
410
454
|
else
|
411
455
|
puts Paint["#{response['description']}", :red]
|
@@ -426,7 +470,7 @@ module App42
|
|
426
470
|
# true:: if cloud setup upgraded
|
427
471
|
# OR
|
428
472
|
# ERROR message in case failed
|
429
|
-
def
|
473
|
+
def upgrade_or_downgrade_cloudapi action, setup_name, flavour
|
430
474
|
begin
|
431
475
|
response = with_progress(Paint[ action.to_s == "upgrade" ? "Upgrading Setup" : "Downgrading Setup", :yellow]) do |s|
|
432
476
|
query_params = params
|
@@ -444,7 +488,39 @@ module App42
|
|
444
488
|
puts Paint[" Command cancelled.", :red]
|
445
489
|
exit!
|
446
490
|
rescue Exception => e
|
447
|
-
puts e
|
491
|
+
puts e
|
492
|
+
end
|
493
|
+
end
|
494
|
+
|
495
|
+
# upgrade GPaaS setup, as a
|
496
|
+
#
|
497
|
+
# ==== Parameters
|
498
|
+
# setup_name = setup_name provided by user
|
499
|
+
# flavour = flavour provided by user
|
500
|
+
#
|
501
|
+
# ==== return
|
502
|
+
# true:: if GpaaS setup upgraded
|
503
|
+
# OR
|
504
|
+
# ERROR message in case failed
|
505
|
+
def upgrade_or_downgrade_gpaas action, setup_name, flavour
|
506
|
+
begin
|
507
|
+
response = with_progress(Paint[ action.to_s == "upgrade" ? "Upgrading Setup" : "Downgrading Setup", :yellow]) do |s|
|
508
|
+
query_params = params
|
509
|
+
body = {'app42' => {"request"=> {
|
510
|
+
"setupName" => setup_name,
|
511
|
+
"flavour" => flavour
|
512
|
+
}}}.to_json
|
513
|
+
|
514
|
+
query_params.store('body', body)
|
515
|
+
build_put_request body, query_params, 'gpaas/upgrade', nil
|
516
|
+
end
|
517
|
+
transaction_success = check_transaction_status response["transactionId"], previous_completed = 0, 'deleted' if response["success"] == true && response["transactionId"]
|
518
|
+
response['success'] ? (return true) : (message "#{response['description']}", true, 'red')
|
519
|
+
rescue Interrupt
|
520
|
+
puts Paint[" Command cancelled.", :red]
|
521
|
+
exit!
|
522
|
+
rescue Exception => e
|
523
|
+
puts e
|
448
524
|
end
|
449
525
|
end
|
450
526
|
|
@@ -752,7 +828,7 @@ module App42
|
|
752
828
|
|
753
829
|
# Custom operation will take placed like add, remove etc.
|
754
830
|
# expect +what+ as operation, +app_name+ as application name and +url+ custom url.
|
755
|
-
def
|
831
|
+
def custom_url_operation what, app_name, url
|
756
832
|
begin
|
757
833
|
if what.to_s == 'addcustomurl'
|
758
834
|
response = with_progress(Paint[ "Adding Custom URL To Application #{app_name}", :yellow]) do |s|
|
@@ -762,7 +838,7 @@ module App42
|
|
762
838
|
}}}.to_json
|
763
839
|
query_params = params
|
764
840
|
query_params.store('body', body)
|
765
|
-
build_post_request body, query_params, "app", "customurl"
|
841
|
+
build_post_request body, query_params, "app", "customurl"
|
766
842
|
end
|
767
843
|
else
|
768
844
|
response = with_progress(Paint[ "Removing Custom URL", :yellow]) do |s|
|
@@ -893,7 +969,7 @@ module App42
|
|
893
969
|
# true:: if cloud setup deleted
|
894
970
|
# OR
|
895
971
|
# ERROR message in case failed
|
896
|
-
def
|
972
|
+
def delete_cloudapi setup_name
|
897
973
|
begin
|
898
974
|
response = with_progress(Paint["Deleting Setup", :yellow]) do |s|
|
899
975
|
query_params = params
|
@@ -912,6 +988,34 @@ module App42
|
|
912
988
|
end
|
913
989
|
end
|
914
990
|
|
991
|
+
# delete GPaaS setup, as a
|
992
|
+
#
|
993
|
+
# ==== Parameters
|
994
|
+
# setup_name = setup_name provided by user
|
995
|
+
#
|
996
|
+
# ==== return
|
997
|
+
# true:: if gpaas setup deleted
|
998
|
+
# OR
|
999
|
+
# ERROR message in case failed
|
1000
|
+
def delete_gpaas setup_name
|
1001
|
+
begin
|
1002
|
+
response = with_progress(Paint["Deleting Setup", :yellow]) do |s|
|
1003
|
+
query_params = params
|
1004
|
+
query_params.store('setupName', setup_name)
|
1005
|
+
build_delete_request query_params, "gpaas", "#{setup_name}"
|
1006
|
+
end
|
1007
|
+
|
1008
|
+
transaction_success = check_transaction_status response["transactionId"], previous_completed = 0, 'deleted' if response["success"] == true && response["transactionId"]
|
1009
|
+
|
1010
|
+
response['success'] ? (return true) : (message "#{response['description']}", true, 'red')
|
1011
|
+
rescue Interrupt
|
1012
|
+
puts Paint[" Command cancelled.", :red]
|
1013
|
+
exit!
|
1014
|
+
rescue Exception => e
|
1015
|
+
puts e
|
1016
|
+
end
|
1017
|
+
end
|
1018
|
+
|
915
1019
|
# delete wordpress setup, as a
|
916
1020
|
#
|
917
1021
|
# ==== Parameters
|
@@ -942,7 +1046,7 @@ module App42
|
|
942
1046
|
|
943
1047
|
# All application operation will take placed like app start, stop etc.
|
944
1048
|
# expect +what+ as operation and +setup_name+ as BPaaS name.
|
945
|
-
def
|
1049
|
+
def cloudapi_operation what, setup_name
|
946
1050
|
begin
|
947
1051
|
if what.to_s == 'stop'
|
948
1052
|
response = with_progress(Paint[ "Stopping BPaaS Setup #{setup_name}", :yellow]) do |s|
|
@@ -981,6 +1085,47 @@ module App42
|
|
981
1085
|
end
|
982
1086
|
end
|
983
1087
|
|
1088
|
+
# All GPaaS operation will take placed like start, stop etc.
|
1089
|
+
# expect +what+ as operation and +setup_name+ as BPaaS name.
|
1090
|
+
def gpaas_operation what, setup_name
|
1091
|
+
begin
|
1092
|
+
if what.to_s == 'stop'
|
1093
|
+
response = with_progress(Paint[ "Stopping GPaaS Setup #{setup_name}", :yellow]) do |s|
|
1094
|
+
body = {'app42' => {"request"=> {
|
1095
|
+
"setupName" => setup_name
|
1096
|
+
}}}.to_json
|
1097
|
+
|
1098
|
+
query_params = params
|
1099
|
+
query_params.store('body', body)
|
1100
|
+
build_put_request body, query_params, "gpaas", "#{what}" if what.to_s == 'stop'
|
1101
|
+
end
|
1102
|
+
else
|
1103
|
+
response = with_progress(Paint["#{what.capitalize}ing GPaaS Setup #{setup_name}", :yellow]) do |s|
|
1104
|
+
body = {'app42' => {"request"=> {
|
1105
|
+
"setupName" => setup_name
|
1106
|
+
}}}.to_json
|
1107
|
+
|
1108
|
+
query_params = params
|
1109
|
+
query_params.store('body', body)
|
1110
|
+
build_put_request body, query_params, "gpaas", "#{what}" if what.to_s == 'restart' || what.to_s == 'start'
|
1111
|
+
end
|
1112
|
+
end
|
1113
|
+
|
1114
|
+
if response["success"] == true && response["transactionId"]
|
1115
|
+
if what.to_s == 'stop'
|
1116
|
+
check_transaction_status response["transactionId"], previous_completed = 0, "#{what}ped"
|
1117
|
+
else
|
1118
|
+
check_transaction_status response["transactionId"], previous_completed = 0, "#{what}ed"
|
1119
|
+
end
|
1120
|
+
end
|
1121
|
+
|
1122
|
+
response['success'] ? (return true) : (message "#{response['description']}", true, 'red')
|
1123
|
+
rescue Interrupt
|
1124
|
+
puts Paint[" Command cancelled.", :red]
|
1125
|
+
exit!
|
1126
|
+
end
|
1127
|
+
end
|
1128
|
+
|
984
1129
|
# All wordpress operation will take placed like app start, stop etc.
|
985
1130
|
# expect +what+ as operation and +wordpress_name+ as wordpress name.
|
986
1131
|
def wordpress_operation what, setup_name
|
data/lib/app42/command/client.rb
CHANGED
@@ -255,13 +255,13 @@ module App42
|
|
255
255
|
when 'downgradebpaas'
|
256
256
|
set_cmd(:setup, :downgrade)
|
257
257
|
|
258
|
-
when '
|
258
|
+
when 'deletebpaas'
|
259
259
|
set_cmd(:setup, :delete_cloud_api)
|
260
260
|
|
261
|
-
when '
|
261
|
+
when 'bpaasinfo'
|
262
262
|
set_cmd(:setup, :info)
|
263
263
|
|
264
|
-
when '
|
264
|
+
when 'bpaassetups'
|
265
265
|
set_cmd(:setup, :setups)
|
266
266
|
|
267
267
|
when 'setupwordpress'
|
@@ -295,7 +295,31 @@ module App42
|
|
295
295
|
set_cmd(:app, :remove_custom_url)
|
296
296
|
|
297
297
|
when 'customurlinfo'
|
298
|
-
set_cmd(:app, :urls)
|
298
|
+
set_cmd(:app, :urls)
|
299
|
+
|
300
|
+
when 'setupgpaas'
|
301
|
+
set_cmd(:gpaas, :setup)
|
302
|
+
|
303
|
+
when 'startgpaas'
|
304
|
+
set_cmd(:gpaas, :start)
|
305
|
+
|
306
|
+
when 'stopgpaas'
|
307
|
+
set_cmd(:gpaas, :stop)
|
308
|
+
|
309
|
+
when 'upgradegpaas'
|
310
|
+
set_cmd(:gpaas, :upgrade)
|
311
|
+
|
312
|
+
when 'downgradegpaas'
|
313
|
+
set_cmd(:gpaas, :downgrade)
|
314
|
+
|
315
|
+
when 'deletegpaas'
|
316
|
+
set_cmd(:gpaas, :delete)
|
317
|
+
|
318
|
+
when 'gpaasinfo'
|
319
|
+
set_cmd(:gpaas, :info)
|
320
|
+
|
321
|
+
when 'gpaassetups'
|
322
|
+
set_cmd(:gpaas, :setups)
|
299
323
|
|
300
324
|
else
|
301
325
|
puts Paint["app42: Unknown command [#{action}]", :red]
|
data/lib/app42/command/config.rb
CHANGED
@@ -19,6 +19,13 @@ module App42::Command
|
|
19
19
|
build_get_request params, 'info', 'subscription'
|
20
20
|
end
|
21
21
|
|
22
|
+
#
|
23
|
+
# return subscription
|
24
|
+
#
|
25
|
+
def subscription
|
26
|
+
build_get_request params, 'info', 'subscriptiontype'
|
27
|
+
end
|
28
|
+
|
22
29
|
#
|
23
30
|
# return list of iaas_providers
|
24
31
|
#
|
@@ -40,6 +47,36 @@ module App42::Command
|
|
40
47
|
build_get_request params, 'info', 'setuptype'
|
41
48
|
end
|
42
49
|
|
50
|
+
#
|
51
|
+
# return list of instance configuration
|
52
|
+
#
|
53
|
+
def get_instance_config_type iaas, vm_type
|
54
|
+
query_params = params
|
55
|
+
query_params.store('vmType', vm_type)
|
56
|
+
query_params.store('iaas', iaas)
|
57
|
+
build_get_request query_params, 'info', 'instanceconfig'
|
58
|
+
end
|
59
|
+
|
60
|
+
#
|
61
|
+
# return list of instance configuration
|
62
|
+
#
|
63
|
+
def get_instance_config_for_upgrade_or_downgrade iaas, vm_type, setup_name, type
|
64
|
+
query_params = params
|
65
|
+
query_params.store('vmType', vm_type)
|
66
|
+
query_params.store('iaas', iaas)
|
67
|
+
query_params.store('setupName', setup_name)
|
68
|
+
build_get_request query_params, 'info', "instanceconfig/#{type}"
|
69
|
+
end
|
70
|
+
|
71
|
+
#
|
72
|
+
# return setup details
|
73
|
+
#
|
74
|
+
def get_setup_details setup_name
|
75
|
+
query_params = params
|
76
|
+
query_params.store('setupName', setup_name)
|
77
|
+
build_get_request query_params, 'info', 'setupdetails'
|
78
|
+
end
|
79
|
+
|
43
80
|
#
|
44
81
|
# return list of flavour
|
45
82
|
#
|
@@ -47,6 +84,15 @@ module App42::Command
|
|
47
84
|
build_get_request params, 'info', 'flavour'
|
48
85
|
end
|
49
86
|
|
87
|
+
#
|
88
|
+
# return list of flavour
|
89
|
+
#
|
90
|
+
def get_flavour_type_fm_server_for_upgrade_or_downgrade setup_name, type
|
91
|
+
query_params = params
|
92
|
+
query_params.store('setupName', setup_name)
|
93
|
+
build_get_request query_params, 'info', "flavour/#{type}"
|
94
|
+
end
|
95
|
+
|
50
96
|
#
|
51
97
|
# return list of templates
|
52
98
|
#
|
@@ -0,0 +1,126 @@
|
|
1
|
+
require 'app42/command/base'
|
2
|
+
require 'terminal-table'
|
3
|
+
|
4
|
+
module App42
|
5
|
+
module Command
|
6
|
+
class Gpaas < Base
|
7
|
+
|
8
|
+
# Collect all required attributes for new GPaaS spawn
|
9
|
+
# required inputs are setup_name, vm_type, iaas, setup_type and flavour
|
10
|
+
def setup
|
11
|
+
setup_name = get_setup_name_and_check_setup_url_availability if App42::Command::Auth.is_authorize_for_dedicated?
|
12
|
+
vm_type = 'dedicated' # GPaaS need only dedicated server
|
13
|
+
iaas = get_iaas_providers
|
14
|
+
setup_type = get_setup_type
|
15
|
+
flavour = get_instance_config iaas, vm_type
|
16
|
+
setup_cloud_api_res = App42::Command::Base.new.create_gpaas_setup setup_name, iaas, vm_type, setup_type, flavour
|
17
|
+
exit! if setup_cloud_api_res
|
18
|
+
end
|
19
|
+
|
20
|
+
# Delete App42 GPaaS setup, return true or error code/message
|
21
|
+
def delete
|
22
|
+
@options[:setup] = get_setup_name if @options[:setup].nil?
|
23
|
+
response = delete_gpaas @options[:setup] if is_setup_name_exist? @options[:setup]
|
24
|
+
exit! if response
|
25
|
+
end
|
26
|
+
|
27
|
+
# collect GPaaS setup name from user and proceed GPaaS start request
|
28
|
+
def start
|
29
|
+
@options[:setup] = get_setup_name if @options[:setup].nil?
|
30
|
+
response = gpaas_operation __method__, @options[:setup] if is_setup_name_exist? @options[:setup]
|
31
|
+
exit! if response
|
32
|
+
end
|
33
|
+
|
34
|
+
# collect GPaaS setup name from user and proceed GPaaS stop request
|
35
|
+
def stop
|
36
|
+
ans = ask Paint["#{Message::URL_WILL_CHANGE}", :red], :default => true ; print_new_line
|
37
|
+
ans == true ? (@options[:setup] = get_setup_name if @options[:setup].nil?) : (exit!)
|
38
|
+
response = gpaas_operation __method__, @options[:setup] if is_setup_name_exist? @options[:setup]
|
39
|
+
exit! if response
|
40
|
+
end
|
41
|
+
|
42
|
+
# collect GPaaS setup name from user and proceed GPaaS upgrade request
|
43
|
+
def upgrade
|
44
|
+
@options[:setup] = get_setup_name if @options[:setup].nil?
|
45
|
+
print_new_line
|
46
|
+
iaas, vm_type = get_iaas_and_vm_type @options[:setup]
|
47
|
+
flavour = get_instance_config_for_upgrade_or_downgrade iaas, vm_type, @options[:setup], __method__.to_s if is_setup_name_exist? @options[:setup]
|
48
|
+
response = upgrade_or_downgrade_gpaas __method__, @options[:setup], flavour
|
49
|
+
exit! if response
|
50
|
+
end
|
51
|
+
|
52
|
+
# collect GPaaS setup name from user and proceed GPaaS downgrade request
|
53
|
+
def downgrade
|
54
|
+
@options[:setup] = get_setup_name if @options[:setup].nil?
|
55
|
+
print_new_line
|
56
|
+
iaas, vm_type = get_iaas_and_vm_type @options[:setup]
|
57
|
+
flavour = get_instance_config_for_upgrade_or_downgrade iaas, vm_type, @options[:setup], __method__.to_s if is_setup_name_exist? @options[:setup]
|
58
|
+
response = upgrade_or_downgrade_gpaas __method__, @options[:setup], flavour
|
59
|
+
exit! if response
|
60
|
+
end
|
61
|
+
|
62
|
+
# return setup type
|
63
|
+
def get_setup_type
|
64
|
+
setup_type_hash = {}
|
65
|
+
setup_type = App42::Command::Config.new.get_setup_type_fm_server
|
66
|
+
|
67
|
+
setup_type['setupTypes'].select {|each_setup_type| setup_type_hash["#{each_setup_type['id']}"] = each_setup_type['name']}
|
68
|
+
return setup_type_hash.keys.first
|
69
|
+
end
|
70
|
+
|
71
|
+
# return instance configuration
|
72
|
+
def get_instance_config iaas, vm_type
|
73
|
+
instance_config_hash = {}
|
74
|
+
instance_config_type = App42::Command::Config.new.get_instance_config_type iaas, vm_type
|
75
|
+
instance_config_type['IMList'].select {|each_instance_config| instance_config_hash["#{each_instance_config['id']}"] = each_instance_config['name']}
|
76
|
+
instance_config = input "Select Instance Configuration", instance_config_hash.values, true
|
77
|
+
|
78
|
+
instance_config_id = nil
|
79
|
+
instance_config_hash.each_pair{|ic| instance_config_id = ic[0] if ic[1] == instance_config}
|
80
|
+
return instance_config_id
|
81
|
+
end
|
82
|
+
|
83
|
+
# return setup details
|
84
|
+
def get_iaas_and_vm_type setup_name
|
85
|
+
setup_details = App42::Command::Config.new.get_setup_details setup_name
|
86
|
+
return setup_details['iaas'], setup_details['containerType'] if setup_details['success']
|
87
|
+
end
|
88
|
+
|
89
|
+
# get details information of App42 GPaaS setup
|
90
|
+
def info
|
91
|
+
@options[:setup] = get_setup_name if @options[:setup].nil?
|
92
|
+
query_params = params
|
93
|
+
query_params.store('setupName', @options[:setup])
|
94
|
+
setup_info = build_get_request query_params, 'gpaas', "#{@options[:setup]}"
|
95
|
+
rows, rows_header_final, rows_header = [], [], nil
|
96
|
+
if setup_info && setup_info['setupInfo']
|
97
|
+
rows_header = setup_info['setupInfo'].keys
|
98
|
+
rows << setup_info['setupInfo'].values
|
99
|
+
|
100
|
+
rows_header.map { |e| rows_header_final << camel_case_to_whitespace(e) }
|
101
|
+
|
102
|
+
table = Terminal::Table.new :title => Paint["=== #{@options[:setup]} Details ===", :green], :headings => rows_header_final, :rows => rows
|
103
|
+
puts table
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
# List all setups
|
108
|
+
def setups
|
109
|
+
query_params = params
|
110
|
+
setups = build_get_request query_params, 'gpaas', nil
|
111
|
+
rows, rows_header_final, rows_header = [], [], nil
|
112
|
+
if setups && setups['setups']
|
113
|
+
setups['setups'].each do |e|
|
114
|
+
rows_header = e.keys
|
115
|
+
rows << e.values
|
116
|
+
end
|
117
|
+
|
118
|
+
rows_header.map { |e| rows_header_final << camel_case_to_whitespace(e) }
|
119
|
+
|
120
|
+
table = Terminal::Table.new :title => Paint["=== Setups List ===", :green], :headings => rows_header_final, :rows => rows
|
121
|
+
puts table
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
data/lib/app42/command/setup.rb
CHANGED
@@ -5,7 +5,7 @@ module App42
|
|
5
5
|
module Command
|
6
6
|
class Setup < Base
|
7
7
|
|
8
|
-
# Collect all required attributes for new App42
|
8
|
+
# Collect all required attributes for new App42 cloud setup spawn
|
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
|
@@ -20,21 +20,21 @@ module App42
|
|
20
20
|
# Delete App42 cloud API setup, return true or error code/message
|
21
21
|
def delete_cloud_api
|
22
22
|
@options[:setup] = get_setup_name if @options[:setup].nil?
|
23
|
-
response =
|
23
|
+
response = delete_cloudapi @options[:setup] if is_setup_name_exist? @options[:setup]
|
24
24
|
exit! if response
|
25
25
|
end
|
26
26
|
|
27
27
|
# collect BPaaS setup name from user and proceed BPaaS start request
|
28
28
|
def start
|
29
29
|
@options[:setup] = get_setup_name if @options[:setup].nil?
|
30
|
-
response =
|
30
|
+
response = cloudapi_operation __method__, @options[:setup] if is_setup_name_exist? @options[:setup]
|
31
31
|
exit! if response
|
32
32
|
end
|
33
33
|
|
34
34
|
# collect BPaaS setup name from user and proceed BPaaS stop request
|
35
35
|
def stop
|
36
36
|
@options[:setup] = get_setup_name if @options[:setup].nil?
|
37
|
-
response =
|
37
|
+
response = cloudapi_operation __method__, @options[:setup] if is_setup_name_exist? @options[:setup]
|
38
38
|
exit! if response
|
39
39
|
end
|
40
40
|
|
@@ -42,8 +42,8 @@ module App42
|
|
42
42
|
def upgrade
|
43
43
|
@options[:setup] = get_setup_name if @options[:setup].nil?
|
44
44
|
print_new_line
|
45
|
-
flavour =
|
46
|
-
response =
|
45
|
+
flavour = get_flavour_for_upgrade_or_downgrade @options[:setup], __method__.to_s if is_setup_name_exist? @options[:setup]
|
46
|
+
response = upgrade_or_downgrade_cloudapi __method__, @options[:setup], flavour
|
47
47
|
exit! if response
|
48
48
|
end
|
49
49
|
|
@@ -51,8 +51,8 @@ module App42
|
|
51
51
|
def downgrade
|
52
52
|
@options[:setup] = get_setup_name if @options[:setup].nil?
|
53
53
|
print_new_line
|
54
|
-
flavour =
|
55
|
-
response =
|
54
|
+
flavour = get_flavour_for_upgrade_or_downgrade @options[:setup], __method__.to_s if is_setup_name_exist? @options[:setup]
|
55
|
+
response = upgrade_or_downgrade_cloudapi __method__, @options[:setup], flavour
|
56
56
|
exit! if response
|
57
57
|
end
|
58
58
|
|
@@ -40,16 +40,16 @@ module App42
|
|
40
40
|
# collect Wordpress setup name from user and proceed Wordpress upgrade request
|
41
41
|
def upgrade
|
42
42
|
@options[:wordpress] = get_wordpress_name if @options[:wordpress].nil?
|
43
|
-
flavour =
|
44
|
-
response = upgrade_or_downgrade_wordpress __method__, @options[:wordpress], flavour
|
43
|
+
flavour = get_flavour_for_upgrade_or_downgrade @options[:wordpress], __method__.to_s if is_setup_name_exist? @options[:wordpress]
|
44
|
+
response = upgrade_or_downgrade_wordpress __method__, @options[:wordpress], flavour
|
45
45
|
exit! if response
|
46
46
|
end
|
47
47
|
|
48
48
|
# collect Wordpress setup name from user and proceed Wordpress downgrade request
|
49
49
|
def downgrade
|
50
50
|
@options[:wordpress] = get_wordpress_name if @options[:wordpress].nil?
|
51
|
-
flavour =
|
52
|
-
response = upgrade_or_downgrade_wordpress __method__, @options[:wordpress], flavour
|
51
|
+
flavour = get_flavour_for_upgrade_or_downgrade @options[:wordpress], __method__.to_s if is_setup_name_exist? @options[:wordpress]
|
52
|
+
response = upgrade_or_downgrade_wordpress __method__, @options[:wordpress], flavour
|
53
53
|
exit! if response
|
54
54
|
end
|
55
55
|
|
data/lib/app42/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app42
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ShepHertz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-02-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -208,6 +208,7 @@ files:
|
|
208
208
|
- lib/app42/command/base.rb
|
209
209
|
- lib/app42/command/client.rb
|
210
210
|
- lib/app42/command/config.rb
|
211
|
+
- lib/app42/command/gpaas.rb
|
211
212
|
- lib/app42/command/info.rb
|
212
213
|
- lib/app42/command/service.rb
|
213
214
|
- lib/app42/command/setup.rb
|