app42 0.6.3 → 0.6.4

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 CHANGED
@@ -35,4 +35,10 @@ Client library and command-line tool to deploy and manage apps on App42PaaS.
35
35
 
36
36
  ### 0.6.3 (09-04-2014)
37
37
 
38
- - Restart command for BPaaS, GPaaS and WordPress setup
38
+ - Restart command for BPaaS, GPaaS and WordPress setup
39
+
40
+ ### 0.6.4 (22-04-2014)
41
+
42
+ - Add Elastic IP to GPaaS
43
+ - Update GPaaS dashboard
44
+
@@ -45,6 +45,8 @@ module App42
45
45
  addCustomURL # Add a custom URL to an app
46
46
  removeCustomURL # Remove a custom URL from an app
47
47
  customURLInfo # List all custom URL(s) of an app
48
+ assignStaticIP # Assign Static IP to App belonging to GPaaS
49
+ releaseStaticIP # Release Static IP from App belonging to GPaaS
48
50
 
49
51
  Services
50
52
  createService # Creates a new service e.g. MySQL, MongoDB, CouchDB, PostgreSQL, Redis etc.
@@ -94,6 +96,7 @@ module App42
94
96
  downgradeGPaas # Downgrade GPaaS by choosing required configuration
95
97
  gPaaSInfo # Show GPaaS setup information
96
98
  gPaaSSetups # List all the GPaaS setups
99
+ upgradeGPaaSDashboard # Upgrade the GPaaS Setup Dashoard
97
100
 
98
101
  Help
99
102
  version # Show Ruby client gem version
@@ -571,6 +574,45 @@ Example:
571
574
  DESC
572
575
  end
573
576
 
577
+ def assignstaticip
578
+ print <<-DESC
579
+ Usage:
580
+ app42 assignStaticIP
581
+
582
+ Assign Static IP to App belonging to GPaaS
583
+
584
+ Example:
585
+ $app42 assignStaticIP
586
+ Enter App Name: demo
587
+
588
+ Assigning Static IP to App demoGPaaS... OK
589
+
590
+ Operation is in progress, Please wait...|
591
+ Static IP assigned successfully.
592
+ DESC
593
+ end
594
+
595
+ def releasestaticip
596
+ print <<-DESC
597
+ Usage:
598
+ app42 releaseStaticIP
599
+
600
+ Release Static IP from App belonging to GPaaS
601
+
602
+ Example:
603
+ $app42 releaseStaticIP
604
+ Enter App Name: demo
605
+
606
+ Releasing Static IP from App demogpaas... OK
607
+
608
+ Operation is in progress, Please wait...|
609
+ Static IP released successfully.
610
+
611
+ DESC
612
+ end
613
+
614
+
615
+
574
616
  def createservice
575
617
  print <<-DESC
576
618
  Usage:
@@ -1327,6 +1369,8 @@ Example:
1327
1369
  5: m1.xlarge
1328
1370
  Select Instance Configuration [t1.micro]:
1329
1371
 
1372
+ Do you want to add Static IP? [Yn]:
1373
+
1330
1374
  Setting up the GPaaS infrastructure... OK
1331
1375
 
1332
1376
  Operation is in progress, Please wait...|
@@ -1494,6 +1538,25 @@ Example:
1494
1538
  DESC
1495
1539
  end
1496
1540
 
1541
+ def upgradegpaasdashboard
1542
+ print <<-DESC
1543
+ Usage:
1544
+ app42 upgradeGPaaSDashboard
1545
+
1546
+ Upgrade the GPaaS Setup Dashoard
1547
+
1548
+ Example:
1549
+ $app42 app42 upgradeGPaaSDashboard
1550
+
1551
+ Enter Setup Name: demo
1552
+
1553
+ Upgrading GPaaS Setup... OK
1554
+
1555
+ Operation is in progress, Please wait...
1556
+ GPaaS Setup Dashboard has been updated successfully.
1557
+ DESC
1558
+ end
1559
+
1497
1560
  def supportedservices
1498
1561
  print <<-DESC
1499
1562
  Usage:
@@ -42,6 +42,7 @@ module Message
42
42
  HIGHLY_CONF = "You are already at highest configuration."
43
43
  LOW_CONF = "You are already at lowest configuration."
44
44
  URL_WILL_CHANGE = "\nStopping setup will modify your app public URL. Are you sure you want to stop Setup 'gpaas'?"
45
+ ADD_STATIC_IP = "Do you want to add Static IP?"
45
46
  BPAAS_SUCCESSFUL = "Your BPaaS setup has been completed successfully, For details, Login to PaaSHQ console."
46
47
  GPAAS_SUCCESSFUL = "Your GPaaS setup has been completed successfully, For details, Login to PaaSHQ console."
47
48
  WORDPRESS_SUCCESSFUL = "Your WordPress setup has been completed successfully, For details, Login to PaaSHQ console."
@@ -70,7 +70,10 @@ module App42
70
70
  'downgradegpaas',
71
71
  'deletegpaas',
72
72
  'gpaasinfo',
73
- 'gpaassetups'
73
+ 'gpaassetups',
74
+ 'assignstaticip',
75
+ 'releasestaticip',
76
+ 'upgradegpaasdashboard'
74
77
 
75
78
  ]
76
79
 
@@ -277,7 +277,20 @@ module App42
277
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
+ end
280
281
 
282
+ # Assign static IP to App
283
+ def assign
284
+ @options[:name] = get_app_name if @options[:name].nil?
285
+ response = assign_release_static_ip "assignstaticip", @options[:name] if is_app_exist? @options[:name]
286
+ exit! if response
287
+ end
288
+
289
+ # Release static IP of App
290
+ def release
291
+ @options[:name] = get_app_name if @options[:name].nil?
292
+ response = assign_release_static_ip "releasestaticip", @options[:name] if is_app_exist? @options[:name]
293
+ exit! if response
281
294
  end
282
295
 
283
296
  end
@@ -381,14 +381,15 @@ module App42
381
381
  end
382
382
 
383
383
  # setup GPaaS
384
- def create_gpaas_setup setup_name, iaas, vm_type, setup_type, flavour
384
+ def create_gpaas_setup setup_name, iaas, vm_type, setup_type, flavour, ans
385
385
  begin
386
386
  body = {'app42' => {"request"=> {
387
387
  "setupName" => setup_name,
388
388
  "iaas" => iaas,
389
389
  "vmType" => vm_type,
390
390
  "setupType" => 'setupGPaaS',
391
- "flavour" => flavour
391
+ "flavour" => flavour,
392
+ "staticIP" => ans
392
393
  }}}.to_json
393
394
 
394
395
  query_params = params
@@ -1126,6 +1127,72 @@ module App42
1126
1127
  end
1127
1128
  end
1128
1129
 
1130
+ # Assign and Release static IP to App
1131
+ # expect +what+ as operation and +app_name+ as App name.
1132
+ def assign_release_static_ip what, app_name
1133
+ begin
1134
+ if what.to_s == 'assignstaticip'
1135
+ response = with_progress(Paint[ "Assigning Static IP to App #{app_name}", :yellow]) do |s|
1136
+ body = {'app42' => {"request"=> {
1137
+ "appName" => app_name
1138
+ }}}.to_json
1139
+
1140
+ query_params = params
1141
+ query_params.store('body', body)
1142
+ build_put_request body, query_params, "app", "assignstaticip"
1143
+ end
1144
+ else
1145
+ response = with_progress(Paint["Releasing Static IP from App #{app_name}", :yellow]) do |s|
1146
+ body = {'app42' => {"request"=> {
1147
+ "appName" => app_name
1148
+ }}}.to_json
1149
+
1150
+ query_params = params
1151
+ query_params.store('body', body)
1152
+ build_put_request body, query_params, "app", "releasestaticip"
1153
+ end
1154
+ end
1155
+
1156
+ if response["success"] == true && response["transactionId"]
1157
+ if what.to_s == 'assignstaticip'
1158
+ check_transaction_status response["transactionId"], previous_completed = 0, "Assigned"
1159
+ else
1160
+ check_transaction_status response["transactionId"], previous_completed = 0, "Released"
1161
+ end
1162
+ end
1163
+
1164
+ response['success'] ? (return true) : (message "#{response['description']}", true, 'red')
1165
+ rescue Interrupt
1166
+ puts Paint[" Command cancelled.", :red]
1167
+ exit!
1168
+ end
1169
+ end
1170
+
1171
+ # Udate GPaaS Dashboard
1172
+ # expect +setup_name+ as GPaaS name.
1173
+ def update_gpaas_dashboard setup_name
1174
+ begin
1175
+ response = with_progress(Paint["Upgrading GPaaS Setup", :yellow]) do |s|
1176
+ body = {'app42' => {"request"=> {
1177
+ "setupName" => setup_name
1178
+ }}}.to_json
1179
+
1180
+ query_params = params
1181
+ query_params.store('body', body)
1182
+ build_put_request body, query_params, "gpaas", "update/dashboard"
1183
+ end
1184
+
1185
+ transaction_success = check_transaction_status response["transactionId"], previous_completed = 0, 'upgraded' if response["success"] == true && response["transactionId"]
1186
+
1187
+ response['success'] ? (return true) : (message "#{response['description']}", true, 'red')
1188
+ rescue Interrupt
1189
+ puts Paint[" Command cancelled.", :red]
1190
+ exit!
1191
+ rescue Exception => e
1192
+ puts e
1193
+ end
1194
+ end
1195
+
1129
1196
  # All wordpress operation will take placed like app start, stop etc.
1130
1197
  # expect +what+ as operation and +wordpress_name+ as wordpress name.
1131
1198
  def wordpress_operation what, setup_name
@@ -330,6 +330,16 @@ module App42
330
330
  when 'gpaassetups'
331
331
  set_cmd(:gpaas, :setups)
332
332
 
333
+ when 'assignstaticip'
334
+ set_cmd(:app, :assign)
335
+
336
+ when 'releasestaticip'
337
+ set_cmd(:app, :release)
338
+
339
+ when 'upgradegpaasdashboard'
340
+ set_cmd(:gpaas, :update)
341
+
342
+
333
343
  else
334
344
  puts Paint["app42: Unknown command [#{action}]", :red]
335
345
  App42::Base::Help.how_to
@@ -13,7 +13,8 @@ module App42
13
13
  iaas = get_iaas_providers
14
14
  setup_type = get_setup_type
15
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
16
+ ans = ask Paint["#{Message::ADD_STATIC_IP}", :red], :default => true ; print_new_line
17
+ setup_cloud_api_res = App42::Command::Base.new.create_gpaas_setup setup_name, iaas, vm_type, setup_type, flavour, ans
17
18
  exit! if setup_cloud_api_res
18
19
  end
19
20
 
@@ -68,6 +69,13 @@ module App42
68
69
  exit! if response
69
70
  end
70
71
 
72
+ # Update GPaaS Dashboard
73
+ def update
74
+ @options[:setup] = get_setup_name if @options[:setup].nil?
75
+ print_new_line
76
+ response = update_gpaas_dashboard @options[:setup] if is_setup_name_exist? @options[:setup]
77
+ end
78
+
71
79
  # return setup type
72
80
  def get_setup_type
73
81
  setup_type_hash = {}
@@ -3,7 +3,7 @@ module App42
3
3
  module VERSION
4
4
  MAJOR = 0
5
5
  MINOR = 6
6
- TINY = 3
6
+ TINY = 4
7
7
  PRE = "alpha"
8
8
 
9
9
  STRING = [MAJOR, MINOR, TINY].compact.join('.')
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.6.3
4
+ version: 0.6.4
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-04-09 00:00:00.000000000 Z
12
+ date: 2014-04-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler