nex_client 0.16.0.pre1 → 0.16.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 65ff74c01669c2d62ffd1ff2f86d968636376ff9
4
- data.tar.gz: bc06abd22d617d961eadcaa2bb79c28a6244b5e2
3
+ metadata.gz: 727229b96317d3a2a14803712ad8bc5cc3df368b
4
+ data.tar.gz: db3eee696bbee741e2dcb307b4217c033b549c09
5
5
  SHA512:
6
- metadata.gz: 4f985e4a4926104ee1d5e3dbb7ca66a1b13c1ad3aeea7e9928a39766eb63ef3b44df13e763d1af8bf4150f1d126fa408960f5fc37a4561ee1ed624508ac640d7
7
- data.tar.gz: 685bd46320361767df2d89cbc7faf30ec4e4eadd02cdcfa0f772fd0cc1bee48eed5270b156a973061516c4e9b98c4a4da2536129d331e899ff3b8c3494269f7f
6
+ metadata.gz: da2bf4d72a045db4bbb98d6b42c890ad6f767530f562c8a4ee3869e852c5b407f38290be1f55f9a8891318e52de63a62bbfc515aa407d4d30eb0ffc120740008
7
+ data.tar.gz: f6baf5690f4d3c8a6dcaecbc706d0fe757cf190052ca5ff585a87654240ebd86b69b01dfe16ad241bb7d73083a6a37a5af5b80e1efac5c58ecba5bd152f5be6e
@@ -38,6 +38,7 @@ module NexClient
38
38
  c.example 'create redis addon for myapp', 'nex-cli addons:create redis myapp'
39
39
  c.option '--size SIZE', Integer, 'specify container size (default: 2, min: 1, max: 20). Container will have N shares of CPU and N*128M of memory.'
40
40
  c.option '--http-log-drain DRAIN_URL', String, 'specify the URL of a remote log drain'
41
+ c.option '--region-balancing REGIONS', String, 'specify how the addon should be proportionally distributed geographically. E.g. "all" or "ap-southeast-1,us-west-2" or "ap-southeast-1=1,us-west-2=2".'
41
42
  c.action do |args, options|
42
43
  NexClient::Commands::Addons.create(args,options)
43
44
  end
@@ -60,6 +61,7 @@ module NexClient
60
61
  c.example 'scale myaddon down by removing one node', 'nex-cli addons:down myaddon'
61
62
  c.example 'scale myaddon down by removing two nodes', 'nex-cli addons:down myaddon --count 2'
62
63
  c.option '--count NUMBER', String, 'number of nodes to bring down'
64
+ c.option '--region REGION', String, 'region to scale down'
63
65
  c.action do |args, options|
64
66
  NexClient::Commands::Addons.scale(:down,args,options)
65
67
  end
@@ -101,6 +103,16 @@ module NexClient
101
103
  end
102
104
  end
103
105
 
106
+ command :'addons:restart' do |c|
107
+ c.syntax = 'nex-cli addons:restart APP_NAME'
108
+ c.summary = 'Restart an addon'
109
+ c.description = 'Initiate a phased restart of an addon'
110
+ c.example 'phase-restart my-awesome-app', 'nex-cli addons:restart my-awesome-app'
111
+ c.action do |args, options|
112
+ NexClient::Commands::Addons.restart(args,options)
113
+ end
114
+ end
115
+
104
116
  command :'addons:ssh' do |c|
105
117
  c.syntax = 'nex-cli addons:ssh ADDON_NAME [options]'
106
118
  c.summary = 'SSH to an addon container [platform admin]'
@@ -118,6 +130,7 @@ module NexClient
118
130
  c.example 'scale myaddon up by adding one node', 'nex-cli addons:up myaddon'
119
131
  c.example 'scale myaddon up by adding two nodes', 'nex-cli addons:up myaddon --count 2'
120
132
  c.option '--count NUMBER', String, 'number of nodes to bring up'
133
+ c.option '--region REGION', String, 'region to scale up'
121
134
  c.action do |args, options|
122
135
  NexClient::Commands::Addons.scale(:up,args,options)
123
136
  end
@@ -128,8 +141,12 @@ module NexClient
128
141
  c.summary = 'Update addon settings'
129
142
  c.description = 'Update addon settings'
130
143
  c.example 'change container size to 4', 'nex-cli addons:update myaddon --size 4'
144
+ c.example 'balance containers equally between regions', 'nex-cli apps:update myapp --region-balancing="ap-southeast-1,us-west-2"'
145
+ c.example 'deploy more containers in one region', 'nex-cli apps:update myapp --region-balancing="ap-southeast-1=1,us-west-2=2"'
146
+ c.example 'scale containers across all regions', 'nex-cli apps:update myapp --region-balancing=all'
131
147
  c.option '--size SIZE', Integer, 'change container size (default: 2, min: 1, max: 20). Container will have N shares of CPU and N*128M of memory. [restart required]'
132
148
  c.option '--http-log-drain DRAIN_URL', String, 'specify the URL of a remote log drain. [restart required]'
149
+ c.option '--region-balancing REGIONS', String, 'specify how scalability should be handled per region. E.g. "all" or "ap-southeast-1,us-west-2" or "ap-southeast-1=1,us-west-2=2".'
133
150
  c.action do |args, options|
134
151
  NexClient::Commands::Addons.update(args,options)
135
152
  end
@@ -171,6 +188,8 @@ module NexClient
171
188
  c.option '--owner ORGANIZATION_HANDLE', 'specify an organisation as owner (organization admin only)'
172
189
  c.option '--desc DESCRIPTION', String, 'description for this application (140 characters max)'
173
190
  c.option '--tags TAG_LIST', Array, 'comma separated list of tags describing this app'
191
+ c.option '--region REGION', String, 'default region to use deploy/scale this application'
192
+ c.option '--region-balancing REGIONS', String, 'specify how scalability should be handled per region. E.g. "all" or "ap-southeast-1,us-west-2" or "ap-southeast-1=1,us-west-2=2".'
174
193
  c.action do |args, options|
175
194
  NexClient::Commands::Apps.create(args,options)
176
195
  end
@@ -193,6 +212,7 @@ module NexClient
193
212
  c.example 'scale myapp down by removing one node', 'nex-cli apps:down myapp'
194
213
  c.example 'scale myapp down by removing two nodes', 'nex-cli apps:down myapp --count 2'
195
214
  c.option '--count NUMBER', String, 'number of nodes to bring down'
215
+ c.option '--region REGION', String, 'region to scale down'
196
216
  c.action do |args, options|
197
217
  NexClient::Commands::Apps.scale(:down,args,options)
198
218
  end
@@ -246,11 +266,30 @@ module NexClient
246
266
 
247
267
  command :'apps:scm' do |c|
248
268
  c.syntax = 'nex-cli apps:scm APP_NAME [options]'
249
- c.summary = 'Manage the SCM of your apps'
250
- c.description = 'Link/unlink an SCM (e.g. github) to your applications'
269
+ c.summary = 'Manage source control for your apps'
270
+ c.description = <<~HEREDOC
271
+ Link/unlink an SCM (e.g. github, s3) to your applications
272
+
273
+ Github:
274
+ -------
275
+ Use: --link github:repo[:branch] (--credentials GITHUB_OAUTH_TOKEN)
276
+ The branch will be defaulted to your default repository branch if unspecified.
277
+ Specifying 'credentials'is optional if your account on Nex!™ has been created through github or
278
+ if the repository is public.
279
+
280
+ S3:
281
+ ---
282
+ Use: --link s3:bucket/folder[:tar_package] --credentials AWS_KEY:AWS_SECRET
283
+ The branch must be the name of an actual file. It will be defaulted to 'latest.tar.gz'. This filename will
284
+ be overriden if you specify a different filename when sending deployment webhooks ('after' attribute).
285
+ Specifying credentials is only required if the S3 bucket is private.
286
+ HEREDOC
251
287
  c.example 'link myapp to github using some/repo on branch master', 'nex-cli apps:scm myapp --link github:some/repo'
252
288
  c.example 'link myapp to github using some/repo on branch develop', 'nex-cli apps:scm myapp --link github:some/repo:develop'
253
- c.option '--link <provider>:<repo>[:branch]', String, 'link your SCM repo to this application (only github supported)'
289
+ c.example 'link myapp to s3 using a bucket, path and filename', 'nex-cli apps:scm myapp --link s3:bucket/folder:somefile.tar.gz --credentials AWS_KEY:AWS_SECRET'
290
+ c.example 'link myapp to s3 to the latest.tar.gz file in folder', 'nex-cli apps:scm myapp --link s3:bucket/folder --credentials AWS_KEY:AWS_SECRET'
291
+ c.option '--credentials api_key[:api_secret]', String, 'colon separated key/secret pair to use with the provider'
292
+ c.option '--link <provider>:<repo>[:branch]', String, 'link your SCM repo to this application (github and s3 supported)'
254
293
  c.option '--unlink', 'unlink your SCM from the application'
255
294
  c.action do |args, options|
256
295
  NexClient::Commands::Apps.manage_scm(args,options)
@@ -284,6 +323,7 @@ module NexClient
284
323
  c.example 'scale myapp up by adding one node', 'nex-cli apps:up myapp'
285
324
  c.example 'scale myapp up by adding two nodes', 'nex-cli apps:up myapp --count 2'
286
325
  c.option '--count NUMBER', String, 'number of nodes to bring up'
326
+ c.option '--region REGION', String, 'region to scale up'
287
327
  c.action do |args, options|
288
328
  NexClient::Commands::Apps.scale(:up,args,options)
289
329
  end
@@ -294,11 +334,16 @@ module NexClient
294
334
  c.summary = 'Update apps settings'
295
335
  c.description = 'Update application settings'
296
336
  c.example 'change container size to 4', 'nex-cli apps:update myapp --size 4'
337
+ c.example 'balance containers equally between regions', 'nex-cli apps:update myapp --region-balancing="ap-southeast-1,us-west-2"'
338
+ c.example 'deploy more containers in one region', 'nex-cli apps:update myapp --region-balancing="ap-southeast-1=1,us-west-2=2"'
339
+ c.example 'scale containers across all regions', 'nex-cli apps:update myapp --region-balancing=all'
297
340
  c.option '--desc DESCRIPTION', String, 'update the application description'
298
341
  c.option '--http-log-drain DRAIN_URL', String, 'specify the URL of a remote log drain. [restart required]'
299
342
  c.option '--image-tag IMAGE_TAG', String, 'update the docker image tag [restart required]'
300
343
  c.option '--size SIZE', Integer, 'change container size (default: 2, min: 1, max: 20). Container will have N shares of CPU and N*128M of memory. [restart required]'
301
344
  c.option '--tags TAG_LIST', String, 'comma separated list of tags to use to describe the app'
345
+ c.option '--region REGION', String, 'default region to use deploy/scale this application'
346
+ c.option '--region-balancing REGIONS', String, 'specify how the app should be proportionally distributed geographically. E.g. "all" or "ap-southeast-1,us-west-2" or "ap-southeast-1=1,us-west-2=2". [restart required]'
302
347
  c.action do |args, options|
303
348
  NexClient::Commands::Apps.update(args,options)
304
349
  end
@@ -315,10 +360,12 @@ module NexClient
315
360
  c.example 'Add env variables to myapp from file and prefix all vars with foo (foo_myvar)', 'nex-cli apps:vars myapp --env-file ~/myenvfile --env-prefix foo'
316
361
  c.option '--add MYVAR=value,MYVAR2=value,...', Array, 'comma separated list of env variables'
317
362
  c.option '--delete MYVAR,MYVAR2,...', Array, 'comma separated list of env variables'
363
+ c.option '--delete-all', 'delete all vars'
318
364
  c.option '--full-vars', 'do not truncate environment variables'
319
365
  c.option '--env-file FILE', String, 'newline separated list of env variables (MYVAR=1) or YAML file. Note that YAML parsing is recursive.'
320
366
  c.option '--env-prefix PREFIX', String, 'prefix all variables contained in the env file with the specified prefix (PREFIX_MYVAR)'
321
367
  c.option '--raw', 'vars are returned in a environment file format (key=value)'
368
+ c.option '--yaml', 'vars are returned in a yaml file format'
322
369
  c.action do |args, options|
323
370
  NexClient::Commands::Apps.manage_vars(args,options)
324
371
  end
@@ -404,7 +451,7 @@ module NexClient
404
451
  end
405
452
 
406
453
  command :'cubes:events' do |c|
407
- c.syntax = 'nex-cli cubes:events ID [options]'
454
+ c.syntax = 'nex-cli cubes:events CUBE_ID [options]'
408
455
  c.summary = 'Gather system events'
409
456
  c.description = 'Gather system events for a given cube'
410
457
  c.example 'display events for mycube', 'nex-cli cubes:events mycube'
@@ -417,7 +464,7 @@ module NexClient
417
464
  end
418
465
 
419
466
  command :'cubes:info' do |c|
420
- c.syntax = 'nex-cli cubes:info ID [options]'
467
+ c.syntax = 'nex-cli cubes:info CUBE_ID [options]'
421
468
  c.summary = 'Display information on a cube'
422
469
  c.description = 'Display information about a given cube'
423
470
  c.example 'display info for mycube', 'nex-cli cubes:info mycube'
@@ -427,7 +474,7 @@ module NexClient
427
474
  end
428
475
 
429
476
  command :'cubes:logs' do |c|
430
- c.syntax = 'nex-cli cubes:logs APP_NAME [options]'
477
+ c.syntax = 'nex-cli cubes:logs CUBE_ID [options]'
431
478
  c.summary = 'Gather cube logs'
432
479
  c.description = 'Gather container logs for a given cube'
433
480
  c.example 'gather logs for mycube', 'nex-cli cubes:logs mycube'
@@ -448,6 +495,16 @@ module NexClient
448
495
  end
449
496
  end
450
497
 
498
+ command :'cubes:snapshots' do |c|
499
+ c.syntax = 'nex-cli cubes:snapshots CUBE_ID'
500
+ c.summary = 'List cube snapshots'
501
+ c.description = 'List all snapshots created for a given cube. This command is only effective for cubes with a backup strategy (e.g. addons)'
502
+ c.example 'gather snapshots created for mycube', 'nex-cli cubes:snapshots mycube'
503
+ c.action do |args, options|
504
+ NexClient::Commands::CubeInstances.snapshots(args,options)
505
+ end
506
+ end
507
+
451
508
  command :'cubes:start' do |c|
452
509
  c.syntax = 'nex-cli cubes:start CUBE_ID'
453
510
  c.summary = 'Start a cube'
@@ -105,11 +105,8 @@ module NexClient
105
105
  attrs[:service] = svc_name
106
106
  attrs[:container_size] = opts.size if opts.size.present?
107
107
 
108
- # Option: HTTP Log Drain
109
- if opts.http_log_drain.present?
110
- attrs[:opts] ||= {}
111
- attrs[:opts][:http_log_drain] = opts.http_log_drain
112
- end
108
+ # Additional options (log drain, region balancing)
109
+ attrs[:opts] = self.extract_config_options(opts)
113
110
 
114
111
  addon = NexClient::Addon.new(attrs)
115
112
  addon.relationships.attributes = { app: { data: { type: 'apps', id: app.id } } }
@@ -139,11 +136,9 @@ module NexClient
139
136
  attrs = {}
140
137
  attrs[:container_size] = opts.size if opts.size.present?
141
138
 
142
- # Option: HTTP Log Drain
143
- if opts.http_log_drain.present?
144
- attrs[:opts] ||= (e.opts || {}).dup
145
- attrs[:opts]['http_log_drain'] = opts.http_log_drain
146
- end
139
+ # Additional options (log drain, region balancing)
140
+ # Hash#dup is required for the resource to detect changes
141
+ attrs[:opts] = (e.opts || {}).dup.merge(self.extract_config_options(opts))
147
142
 
148
143
  # Update
149
144
  e.update_attributes(attrs)
@@ -202,6 +197,28 @@ module NexClient
202
197
  success("Successfully requested to scale #{name} #{direction} by #{count} #{'node'.pluralize(count)}...")
203
198
  end
204
199
 
200
+ def self.restart(args,opts)
201
+ name = args.first
202
+ e = NexClient::Addon.find(name: name).first
203
+
204
+ # Display error
205
+ unless e
206
+ error("Error! Could not find addon: #{name}")
207
+ return false
208
+ end
209
+
210
+ # Perform
211
+ e.restart
212
+
213
+ # Display errors if any
214
+ if e.errors.any?
215
+ display_record_errors(e)
216
+ return false
217
+ end
218
+
219
+ success("Initiated phased restart for addon: #{name}...")
220
+ end
221
+
205
222
  def self.display_addons(list)
206
223
  table = Terminal::Table.new title: ADDONS_TITLE, headings: ADDONS_HEADERS do |t|
207
224
  [list].flatten.compact.each do |e|
@@ -252,6 +269,16 @@ module NexClient
252
269
  return '-' unless record.node_count && record.max_node_count
253
270
  "#{record.node_count}/#{record.max_node_count}"
254
271
  end
272
+
273
+ def self.extract_config_options(cli_opts)
274
+ hash = {}
275
+ %w(http_log_drain region_balancing).each do |opt_name|
276
+ if cli_opts.method_missing(opt_name.to_sym).present?
277
+ hash[opt_name.to_s] = cli_opts.method_missing(opt_name.to_sym)
278
+ end
279
+ end
280
+ return hash
281
+ end
255
282
  end
256
283
  end
257
284
  end
@@ -14,7 +14,7 @@ module NexClient
14
14
  OPTS_HEADERS = ['key','value'].map(&:upcase)
15
15
 
16
16
  SCM_TITLE = "Source Control Management".colorize(:yellow)
17
- SCM_HEADERS = ['provider','repo','branch','last commit'].map(&:upcase)
17
+ SCM_HEADERS = ['provider','repo','branch','last commit','webhook'].map(&:upcase)
18
18
 
19
19
  def self.list(args,opts)
20
20
  filters = {}
@@ -133,12 +133,10 @@ module NexClient
133
133
  attrs[:container_size] = opts.size if opts.size.present?
134
134
  attrs[:description] = opts.desc if opts.desc.present?
135
135
  attrs[:tag_list] = opts.tags if opts.tags.present?
136
+ attrs[:preferred_region] = opts.region if opts.region.present?
136
137
 
137
- # Option: HTTP Log Drain
138
- if opts.http_log_drain.present?
139
- attrs[:opts] ||= {}
140
- attrs[:opts]['http_log_drain'] = opts.http_log_drain
141
- end
138
+ # Additional options (log drain, region balancing)
139
+ attrs[:opts] = self.extract_config_options(opts)
142
140
 
143
141
  # Env variables via command line
144
142
  if opts.env.present?
@@ -199,12 +197,11 @@ module NexClient
199
197
  attrs[:description] = opts.desc if opts.desc.present?
200
198
  attrs[:tag_list] = opts.tags if opts.tags.present?
201
199
  attrs[:image_tag] = opts.image_tag if opts.image_tag.present?
200
+ attrs[:preferred_region] = opts.region if opts.region.present?
202
201
 
203
- # Option: HTTP Log Drain
204
- if opts.http_log_drain.present?
205
- attrs[:opts] ||= (e.opts || {}).dup
206
- attrs[:opts]['http_log_drain'] = opts.http_log_drain
207
- end
202
+ # Additional options (log drain, region balancing)
203
+ # Hash#dup is required for the resource to detect changes
204
+ attrs[:opts] = (e.opts || {}).dup.merge(self.extract_config_options(opts))
208
205
 
209
206
  # Update
210
207
  e.update_attributes(attrs)
@@ -348,6 +345,16 @@ module NexClient
348
345
 
349
346
  # Delete vars
350
347
  (opts.delete || []).each { |k| vars.delete(k) }
348
+ # Delete all vars
349
+ if opts.delete_all
350
+ # Ask confirmation
351
+ answer = ask('Enter the name of this app to confirm: ')
352
+ unless answer == e.name
353
+ error('Aborting vars deletion')
354
+ return false
355
+ end
356
+ vars = {}
357
+ end
351
358
 
352
359
  # Update and reload the resource
353
360
  e.update_attributes(vars: vars)
@@ -356,7 +363,9 @@ module NexClient
356
363
  end
357
364
 
358
365
  # Display all vars
359
- if opts.raw
366
+ if opts.yaml
367
+ self.display_yaml_vars(e.all_vars)
368
+ elsif opts.raw
360
369
  self.display_raw_vars(e.all_vars)
361
370
  else
362
371
  self.display_vars(e.all_vars,!opts.full_vars)
@@ -376,7 +385,15 @@ module NexClient
376
385
  # Link SCM
377
386
  if opts.link
378
387
  provider,repo,branch = opts.link.split(':')
379
- attrs = { provider: provider, config: { repo: repo, branch: branch } }
388
+ credentials = opts.credentials
389
+ attrs = {
390
+ provider: provider,
391
+ config: {
392
+ repo: repo,
393
+ branch: branch,
394
+ credentials: credentials
395
+ }
396
+ }
380
397
 
381
398
  # Update and reload the resource
382
399
  e.link_scm({data: { attributes: attrs } })
@@ -390,7 +407,7 @@ module NexClient
390
407
  e = NexClient::App.find(e.id).first
391
408
  end
392
409
 
393
- # Display all vars
410
+ # Display SCM
394
411
  self.display_scm(e.scm)
395
412
  end
396
413
 
@@ -425,7 +442,13 @@ module NexClient
425
442
  def self.display_scm(list)
426
443
  table = Terminal::Table.new title: SCM_TITLE, headings: SCM_HEADERS do |t|
427
444
  [list].flatten.compact.each do |e|
428
- t.add_row([e['provider'],e['repo'],e['branch'],e['last_commit'] || '- nothing pushed yet -'])
445
+ t.add_row([
446
+ e['provider'],
447
+ e['repo'],
448
+ e['branch'],
449
+ e['last_commit'] || '- nothing pushed yet -',
450
+ e['webhook_enabled'].to_s == 'true' ? e['webhook_url'] : '- Not enabled -'
451
+ ])
429
452
  end
430
453
  end
431
454
  puts table
@@ -459,6 +482,16 @@ module NexClient
459
482
  return '-' unless record.node_count && record.max_node_count
460
483
  "#{record.node_count}/#{record.max_node_count}"
461
484
  end
485
+
486
+ def self.extract_config_options(cli_opts)
487
+ hash = {}
488
+ %w(http_log_drain region_balancing).each do |opt_name|
489
+ if cli_opts.method_missing(opt_name.to_sym).present?
490
+ hash[opt_name.to_s] = cli_opts.method_missing(opt_name.to_sym)
491
+ end
492
+ end
493
+ return hash
494
+ end
462
495
  end
463
496
  end
464
497
  end
@@ -7,6 +7,9 @@ module NexClient
7
7
  CUBES_TITLE = "Cube Instances".colorize(:blue)
8
8
  CUBES_HEADERS = ['id','status','container','region','storage','ip','port','cluster'].map(&:upcase)
9
9
 
10
+ SNAPSHOTS_TITLE = "Snapshots".colorize(:magenta)
11
+ SNAPSHOTS_HEADERS = ['created_at','rack ip','path'].map(&:upcase)
12
+
10
13
  def self.list(args,opts)
11
14
  filters = {}
12
15
  filters[:status] = opts.status if opts.status.present?
@@ -55,6 +58,21 @@ module NexClient
55
58
  self.display_logs(logs.log_ret)
56
59
  end
57
60
 
61
+ def self.snapshots(args,opts)
62
+ name = args.first
63
+ e = NexClient::CubeInstance.find(uuid: name).first
64
+
65
+ # Display error
66
+ unless e
67
+ error("Error! Could not find cube: #{name}")
68
+ return false
69
+ end
70
+
71
+ # Retrieve snapshots and display them
72
+ snapshots = e.snapshots.first['snapshots']
73
+ self.display_snapshots(snapshots)
74
+ end
75
+
58
76
  def self.trigger_action(action,args,opts)
59
77
  id = args.first
60
78
  e = NexClient::CubeInstance.find(uuid: id).first
@@ -218,6 +236,20 @@ module NexClient
218
236
  puts logs
219
237
  puts "\n"
220
238
  end
239
+
240
+ def self.display_snapshots(snapshots)
241
+ table = Terminal::Table.new title: SNAPSHOTS_TITLE, headings: SNAPSHOTS_HEADERS do |t|
242
+ [snapshots].flatten.compact.each do |e|
243
+ t.add_row([
244
+ e['created_at'],
245
+ e['ip_address'],
246
+ e['path']
247
+ ])
248
+ end
249
+ end
250
+ puts table
251
+ puts "\n"
252
+ end
221
253
  end
222
254
  end
223
255
  end
@@ -167,6 +167,11 @@ module NexClient
167
167
  puts "\n"
168
168
  end
169
169
 
170
+ def display_yaml_vars(vars)
171
+ puts vars.to_yaml
172
+ puts "\n"
173
+ end
174
+
170
175
  def display_vars(list,truncate = true)
171
176
  table = Terminal::Table.new title: VARS_TITLE, headings: VARS_HEADERS do |t|
172
177
  [list].flatten.compact.each do |e|
@@ -10,7 +10,7 @@ module NexClient
10
10
  STORAGE_RACKS_TITLE = "Storage Racks".colorize(:blue)
11
11
  ROUTING_RACKS_TITLE = "Routing Racks".colorize(:green)
12
12
  GATEWAY_RACKS_TITLE = "Gateway Racks".colorize(:yellow)
13
- RACKS_HEADERS = ['type','id','region','stack','status','iip','eip','capacity'].map(&:upcase)
13
+ RACKS_HEADERS = ['type','id','region','stack','status','iip','eip','capacity','machine size','machine id'].map(&:upcase)
14
14
 
15
15
  def self.list(args,opts)
16
16
  filters = {}
@@ -172,7 +172,18 @@ module NexClient
172
172
  def self.display_compute_racks(list)
173
173
  table = Terminal::Table.new title: COMPUTE_RACKS_TITLE, headings: RACKS_HEADERS do |t|
174
174
  [list].flatten.compact.each do |e|
175
- t.add_row(['compute',e.id,e.vpc_region,e.stack,e.status,e.private_ip_address,'-',"#{e.used_pu}/#{e.total_pu}"])
175
+ t.add_row([
176
+ 'compute',
177
+ e.id,
178
+ e.vpc_region,
179
+ e.stack,
180
+ e.status,
181
+ e.private_ip_address,
182
+ '-',
183
+ "#{e.used_pu}/#{e.total_pu}",
184
+ e.machine_type,
185
+ e.machine_id
186
+ ])
176
187
  end
177
188
  end
178
189
  puts table
@@ -182,7 +193,18 @@ module NexClient
182
193
  def self.display_storage_racks(list)
183
194
  table = Terminal::Table.new title: STORAGE_RACKS_TITLE, headings: RACKS_HEADERS do |t|
184
195
  [list].flatten.compact.each do |e|
185
- t.add_row(['storage',e.id,e.vpc_region,'-',e.status,e.private_ip_address,'-',"#{e.used_su}/#{e.total_su}"])
196
+ t.add_row([
197
+ 'storage',
198
+ e.id,
199
+ e.vpc_region,
200
+ '-',
201
+ e.status,
202
+ e.private_ip_address,
203
+ '-',
204
+ "#{e.used_su}/#{e.total_su}",
205
+ e.machine_type,
206
+ e.machine_id
207
+ ])
186
208
  end
187
209
  end
188
210
  puts table
@@ -192,7 +214,18 @@ module NexClient
192
214
  def self.display_routing_racks(list)
193
215
  table = Terminal::Table.new title: ROUTING_RACKS_TITLE, headings: RACKS_HEADERS do |t|
194
216
  [list].flatten.compact.each do |e|
195
- t.add_row(['routing',e.id,e.vpc_region,'-',e.status,e.private_ip_address,'-','-'])
217
+ t.add_row([
218
+ 'routing',
219
+ e.id,
220
+ e.vpc_region,
221
+ '-',
222
+ e.status,
223
+ e.private_ip_address,
224
+ '-',
225
+ '-',
226
+ e.machine_type,
227
+ e.machine_id
228
+ ])
196
229
  end
197
230
  end
198
231
  puts table
@@ -202,7 +235,18 @@ module NexClient
202
235
  def self.display_gateway_racks(list)
203
236
  table = Terminal::Table.new title: GATEWAY_RACKS_TITLE, headings: RACKS_HEADERS do |t|
204
237
  [list].flatten.compact.each do |e|
205
- t.add_row(['gateway',e.id,e.vpc_region,'-',e.status,e.private_ip_address,e.ip_address,'-'])
238
+ t.add_row([
239
+ 'gateway',
240
+ e.id,
241
+ e.vpc_region,
242
+ '-',
243
+ e.status,
244
+ e.private_ip_address,
245
+ e.ip_address,
246
+ '-',
247
+ e.machine_type,
248
+ e.machine_id
249
+ ])
206
250
  end
207
251
  end
208
252
  puts table
@@ -15,6 +15,9 @@ module NexClient
15
15
  # PATCH <api_root>/cube_instances/:id/restart
16
16
  custom_endpoint :restart, on: :member, request_method: :patch
17
17
 
18
+ # GET <api_root>/cube_instances/:id/snapshots
19
+ custom_endpoint :snapshots, on: :member, request_method: :get
20
+
18
21
  # PATCH <api_root>/cube_instances/:id/start
19
22
  custom_endpoint :start, on: :member, request_method: :patch
20
23
 
@@ -1,3 +1,3 @@
1
1
  module NexClient
2
- VERSION ||= '0.16.0.pre1'
2
+ VERSION ||= '0.16.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nex_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.16.0.pre1
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arnaud Lachaume
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-19 00:00:00.000000000 Z
11
+ date: 2017-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json_api_client
@@ -181,9 +181,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
181
181
  version: '0'
182
182
  required_rubygems_version: !ruby/object:Gem::Requirement
183
183
  requirements:
184
- - - ">"
184
+ - - ">="
185
185
  - !ruby/object:Gem::Version
186
- version: 1.3.1
186
+ version: '0'
187
187
  requirements: []
188
188
  rubyforge_project:
189
189
  rubygems_version: 2.6.8