nex_client 0.2.0 → 0.3.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: eaf3b1116d1276f01639f77b71218bb6423c7be0
4
- data.tar.gz: 3d5abdcc04437acd20d48c797909d3b5d30d7c04
3
+ metadata.gz: 966a1986c27f330dde365f817b8ce3380274a50a
4
+ data.tar.gz: 04a370447d11ce3a192429af577c90d773b09c03
5
5
  SHA512:
6
- metadata.gz: 39cf5913237a6a192c3117737c3970f63d153bea86f7d474fe1f5cbbb429647b8c88ff377d27fa6f10c15114349a7da5c8ab94191921556a26102f5dbcc7dd5a
7
- data.tar.gz: f16059882c2d143616ad268737a1ba2987a380b8c9e1d5683acbe5ed8f3fa098397509173a42e9e70a5f79fb8b38a75e3247574c0cd1f97e311618f5ff827935
6
+ metadata.gz: c47f1ed90b41a780f4329503bcb7c96bb004c8de9cf7f2ff0ae50e44b1973b7367050bd9ddc4a7131091239f1b2d59433a38b72b03e67a979ad7619cde0b731d
7
+ data.tar.gz: b99d5eb4c7dc37c3e7d06f59f6be3ea7d547c6202162260407d46c5b67b434b12414705048f3f5637117ccf84668dce3abb8eddd1f3aa82c82cf27162c962a52
data/README.md CHANGED
@@ -12,7 +12,7 @@ NexClient is both a ruby client and a command line tool for Nex!™ PaaS
12
12
 
13
13
  You can install the gem by running:
14
14
  ```bash
15
- gem install nex_cli
15
+ gem install nex_client
16
16
  ```
17
17
 
18
18
  ## Getting started with the cli
@@ -67,9 +67,9 @@ module NexClient
67
67
  c.syntax = 'nex-cli apps [options]'
68
68
  c.summary = 'Manage apps'
69
69
  c.description = 'List, create, manage, scale and delete apps'
70
- c.example 'list all active apps', 'nex-cli apps'
70
+ c.example 'list all my active apps', 'nex-cli apps'
71
71
  c.example 'list all active apps for owner myorg', 'nex-cli apps --owner myorg'
72
- c.example 'list all terminated apps', 'nex-cli apps --status terminated'
72
+ c.example 'list all my terminated apps', 'nex-cli apps --status terminated'
73
73
  c.example 'list all terminated apps for owner myorg', 'nex-cli apps --status terminated --owner myorg'
74
74
  c.option '--all', 'list all apps (no filtering)'
75
75
  c.option '--status <active|terminated>', String, 'list all apps in a given status'
@@ -21,6 +21,13 @@ module NexClient
21
21
  # Create table
22
22
  list = NexClient::Addon.includes(:app).where(filters).order('status')
23
23
  self.display_addons(list)
24
+
25
+ # Loop through results
26
+ while (list.pages.links||{})['next']
27
+ ask("Press enter for next page")
28
+ list = list.pages.next
29
+ self.display_addons(list)
30
+ end
24
31
  end
25
32
 
26
33
  def self.logs(args,opts)
@@ -4,7 +4,7 @@ module NexClient
4
4
  module Commands
5
5
  module Apps
6
6
  extend Helpers
7
-
7
+
8
8
  SCALING_DIRECTIONS = [:up,:down]
9
9
  APPS_TITLE = "App Details".colorize(:green)
10
10
  APPS_HEADERS = ['id','name','status','image','ssl','storage','preferred region','nodes','owner'].map(&:upcase)
@@ -20,7 +20,7 @@ module NexClient
20
20
  filters[:status] = [opts.status || 'active']
21
21
  filters[:ssl_enabled] = opts.ssl if opts.ssl.present?
22
22
  filters[:persistent_storage] = opts.storage if opts.storage.present?
23
- filters[:'owner.handle'] = opts.owner if opts.owner.present?
23
+ filters[:'owner.handle'] = opts.owner || '@self'
24
24
 
25
25
  # All option
26
26
  filters = {} if opts.all
@@ -28,6 +28,13 @@ module NexClient
28
28
  # Display
29
29
  list = NexClient::App.includes(:owner).where(filters).order('status')
30
30
  self.display_apps(list)
31
+
32
+ # Loop through results
33
+ while (list.pages.links||{})['next']
34
+ ask("Press enter for next page")
35
+ list = list.pages.next
36
+ self.display_apps(list)
37
+ end
31
38
  end
32
39
 
33
40
  def self.info(args,opts)
@@ -25,6 +25,13 @@ module NexClient
25
25
  # Create table
26
26
  list = NexClient::CubeInstance.includes(:cluster).where(filters).order('status')
27
27
  self.display_cubes(list)
28
+
29
+ # Loop through results
30
+ while (list.pages.links||{})['next']
31
+ ask("Press enter for next page")
32
+ list = list.pages.next
33
+ self.display_cubes(list)
34
+ end
28
35
  end
29
36
 
30
37
  def self.trigger_action(action,args,opts)
@@ -16,6 +16,13 @@ module NexClient
16
16
  # Create table
17
17
  list = NexClient::CubeTemplate.where(filters).order('human_id')
18
18
  self.display_templates(list)
19
+
20
+ # Loop through results
21
+ while (list.pages.links||{})['next']
22
+ ask("Press enter for next page")
23
+ list = list.pages.next
24
+ self.display_templates(list)
25
+ end
19
26
  end
20
27
 
21
28
  def self.display_templates(list)
@@ -14,6 +14,13 @@ module NexClient
14
14
  # Create table
15
15
  list = NexClient::Domain.includes(:origin).where(filters).order('cname')
16
16
  self.display_domains(list)
17
+
18
+ # Loop through results
19
+ while (list.pages.links||{})['next']
20
+ ask("Press enter for next page")
21
+ list = list.pages.next
22
+ self.display_domains(list)
23
+ end
17
24
  end
18
25
 
19
26
  def self.create(args,opts)
@@ -8,8 +8,16 @@ module NexClient
8
8
  ORGS_HEADERS = ['id','name','handle'].map(&:upcase)
9
9
 
10
10
  def self.list(args,opts)
11
- # Create table
12
- self.display_organizations(NexClient::Organization.order('handle'))
11
+ # Display list
12
+ list = NexClient::Organization.order('handle')
13
+ self.display_organizations(list)
14
+
15
+ # Loop through results
16
+ while (list.pages.links||{})['next']
17
+ ask("Press enter for next page")
18
+ list = list.pages.next
19
+ self.display_organizations(list)
20
+ end
13
21
  end
14
22
 
15
23
  def self.display_organizations(list)
@@ -30,26 +30,58 @@ module NexClient
30
30
 
31
31
  # Create table
32
32
  if !only_type || only_type == 'compute'
33
- self.display_compute_racks(NexClient::ComputeRack.where(filters).order('aws_region,status'))
33
+ list = NexClient::ComputeRack.where(filters).order('vpc_region,status')
34
+ self.display_compute_racks(list)
35
+
36
+ # Loop through results
37
+ while (list.pages.links||{})['next']
38
+ ask("Press enter for next page")
39
+ list = list.pages.next
40
+ self.display_compute_racks(list)
41
+ end
34
42
  end
35
43
 
36
44
  if !only_type || only_type == 'storage'
37
- self.display_storage_racks(NexClient::StorageRack.where(filters).order('aws_region,status'))
45
+ list = NexClient::StorageRack.where(filters).order('vpc_region,status')
46
+ self.display_storage_racks(list)
47
+
48
+ # Loop through results
49
+ while (list.pages.links||{})['next']
50
+ ask("Press enter for next page")
51
+ list = list.pages.next
52
+ self.display_storage_racks(list)
53
+ end
38
54
  end
39
55
 
40
56
  if !only_type || only_type == 'routing'
41
- self.display_routing_racks(NexClient::RoutingRack.where(filters).order('aws_region,status'))
57
+ list = NexClient::RoutingRack.where(filters).order('vpc_region,status')
58
+ self.display_routing_racks(list)
59
+
60
+ # Loop through results
61
+ while (list.pages.links||{})['next']
62
+ ask("Press enter for next page")
63
+ list = list.pages.next
64
+ self.display_routing_racks(list)
65
+ end
42
66
  end
43
67
 
44
68
  if !only_type || only_type == 'gateway'
45
- self.display_gateway_racks(NexClient::GatewayRack.where(filters).order('aws_region,status'))
69
+ list = NexClient::GatewayRack.where(filters).order('vpc_region,status')
70
+ self.display_gateway_racks(list)
71
+
72
+ # Loop through results
73
+ while (list.pages.links||{})['next']
74
+ ask("Press enter for next page")
75
+ list = list.pages.next
76
+ self.display_gateway_racks(list)
77
+ end
46
78
  end
47
79
  end
48
80
 
49
81
  def self.display_compute_racks(list)
50
82
  table = Terminal::Table.new title: COMPUTE_RACKS_TITLE, headings: RACKS_HEADERS do |t|
51
83
  [list].flatten.compact.each do |e|
52
- t.add_row(['compute',e.id,e.aws_region,e.stack,e.status,e.aws_local_ip_address,'-',"#{e.used_pu}/#{e.total_pu}"])
84
+ t.add_row(['compute',e.id,e.vpc_region,e.stack,e.status,e.private_ip_address,'-',"#{e.used_pu}/#{e.total_pu}"])
53
85
  end
54
86
  end
55
87
  puts table
@@ -59,7 +91,7 @@ module NexClient
59
91
  def self.display_storage_racks(list)
60
92
  table = Terminal::Table.new title: STORAGE_RACKS_TITLE, headings: RACKS_HEADERS do |t|
61
93
  [list].flatten.compact.each do |e|
62
- t.add_row(['storage',e.id,e.aws_region,'-',e.status,e.aws_local_ip_address,'-',"#{e.used_su}/#{e.total_su}"])
94
+ t.add_row(['storage',e.id,e.vpc_region,'-',e.status,e.private_ip_address,'-',"#{e.used_su}/#{e.total_su}"])
63
95
  end
64
96
  end
65
97
  puts table
@@ -69,7 +101,7 @@ module NexClient
69
101
  def self.display_routing_racks(list)
70
102
  table = Terminal::Table.new title: ROUTING_RACKS_TITLE, headings: RACKS_HEADERS do |t|
71
103
  [list].flatten.compact.each do |e|
72
- t.add_row(['routing',e.id,e.aws_region,'-',e.status,e.aws_local_ip_address,'-','-'])
104
+ t.add_row(['routing',e.id,e.vpc_region,'-',e.status,e.private_ip_address,'-','-'])
73
105
  end
74
106
  end
75
107
  puts table
@@ -79,7 +111,7 @@ module NexClient
79
111
  def self.display_gateway_racks(list)
80
112
  table = Terminal::Table.new title: GATEWAY_RACKS_TITLE, headings: RACKS_HEADERS do |t|
81
113
  [list].flatten.compact.each do |e|
82
- t.add_row(['gateway',e.id,e.aws_region,'-',e.status,e.aws_local_ip_address,e.ip_address,'-'])
114
+ t.add_row(['gateway',e.id,e.vpc_region,'-',e.status,e.private_ip_address,e.ip_address,'-'])
83
115
  end
84
116
  end
85
117
  puts table
@@ -14,6 +14,13 @@ module NexClient
14
14
  # Create table
15
15
  list = NexClient::SslCertificate.includes(:origin).where(filters).order('cname')
16
16
  self.display_certs(list)
17
+
18
+ # Loop through results
19
+ while (list.pages.links||{})['next']
20
+ ask("Press enter for next page")
21
+ list = list.pages.next
22
+ self.display_certs(list)
23
+ end
17
24
  end
18
25
 
19
26
  def self.create(args,opts)
@@ -16,7 +16,15 @@ module NexClient
16
16
  end
17
17
 
18
18
  # Create table
19
- self.display_users(NexClient::User.includes(:organizations).where(filters).order('handle'))
19
+ list = NexClient::User.includes(:organizations).where(filters).order('handle')
20
+ self.display_users(list)
21
+
22
+ # Loop through results
23
+ while (list.pages.links||{})['next']
24
+ ask("Press enter for next page")
25
+ list = list.pages.next
26
+ self.display_users(list)
27
+ end
20
28
  end
21
29
 
22
30
  def self.display_users(list)
@@ -1,3 +1,3 @@
1
1
  module NexClient
2
- VERSION = '0.2.0'
2
+ VERSION = '0.3.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.2.0
4
+ version: 0.3.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: 2016-08-01 00:00:00.000000000 Z
11
+ date: 2016-08-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json_api_client