enfcli 4.0.0 → 4.1.0.pre.alpha

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.
@@ -13,34 +13,32 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
  #
16
- require 'enfthor'
17
- require 'enfapi'
16
+ require "enfthor"
17
+ require "enfapi"
18
18
 
19
19
  module EnfCli
20
-
21
20
  module Cmd
22
-
23
21
  class User < EnfThor
24
22
  no_commands {
25
- def display_invites invites
26
- headings = ['Id', 'User Name', 'Full Name', 'Invited By', 'Invite Code']
27
- rows = invites.map{ |hash|
28
- [ hash[:id], hash[:email], hash[:name], hash[:invited_by], hash[:invite_token] ]
23
+ def display_invites(invites)
24
+ headings = ["Id", "User Name", "Full Name", "Invited By", "Invite Code"]
25
+ rows = invites.map { |hash|
26
+ [hash[:id], hash[:email], hash[:name], hash[:invited_by], hash[:invite_token]]
29
27
  }
30
28
 
31
29
  render_table(headings, rows)
32
30
  end
33
31
 
34
- def display_users users
35
- headings = ['Id', 'User Name', 'Full Name', 'Last Login', 'Type', 'Reset Code', 'Reset Time', 'Status']
36
- rows = users.map{ |hash|
37
- [ hash[:user_id], hash[:username], hash[:full_name], hash[:last_login], hash[:type], hash[:reset_code],
38
- format_date(hash[:reset_time]), hash[:status] ]
32
+ def display_users(users)
33
+ headings = ["Id", "User Name", "Full Name", "Last Login", "Type", "Reset Code", "Reset Time", "Status"]
34
+ rows = users.map { |hash|
35
+ [hash[:user_id], hash[:username], hash[:full_name], hash[:last_login], hash[:type], hash[:reset_code],
36
+ format_date(hash[:reset_time]), hash[:status]]
39
37
  }
40
38
  render_table(headings, rows)
41
39
  end
42
40
 
43
- def send_invite options, user_type
41
+ def send_invite(options, user_type)
44
42
  # Get options
45
43
  domain_network = options.domain
46
44
 
@@ -60,6 +58,7 @@ module EnfCli
60
58
  method_option :domain, :default => nil, :type => :string, :aliases => "-d"
61
59
  method_option :'name', :type => :array, :required => true, :banner => "NAME"
62
60
  method_option :'email', :type => :string, :required => true, :banner => "EMAIL"
61
+
63
62
  def invite_read_only_user
64
63
  try_with_rescue_in_session do
65
64
  # use the domain network of the user
@@ -85,6 +84,7 @@ module EnfCli
85
84
  method_option :domain, :default => nil, :type => :string, :aliases => "-d"
86
85
  method_option :'name', :type => :array, :required => true, :banner => "NAME"
87
86
  method_option :'email', :type => :string, :required => true, :banner => "EMAIL"
87
+
88
88
  def invite_domain_admin_user
89
89
  try_with_rescue_in_session do
90
90
  # use the domain network of the user
@@ -109,6 +109,7 @@ module EnfCli
109
109
  desc "invite-enf-admin-user", "Invite an ENF administrator"
110
110
  method_option :'name', :type => :array, :required => true, :banner => "NAME"
111
111
  method_option :'email', :type => :string, :required => true, :banner => "EMAIL"
112
+
112
113
  def invite_enf_admin_user
113
114
  try_with_rescue_in_session do
114
115
  # Get user role
@@ -124,6 +125,7 @@ module EnfCli
124
125
  desc "invite-iam-admin-user", "Invite an IAM administrator"
125
126
  method_option :'name', :type => :array, :required => true, :banner => "NAME"
126
127
  method_option :'email', :type => :string, :required => true, :banner => "EMAIL"
128
+
127
129
  def invite_iam_admin_user
128
130
  try_with_rescue_in_session do
129
131
  # Get user role
@@ -140,6 +142,7 @@ module EnfCli
140
142
  method_option :'captive-domain', :type => :string, :required => true, :banner => "CAPTIVE CONTROL DOMAIN"
141
143
  method_option :'name', :type => :array, :required => true, :banner => "NAME"
142
144
  method_option :'email', :type => :string, :required => true, :banner => "EMAIL"
145
+
143
146
  def invite_captive_admin_user
144
147
  try_with_rescue_in_session do
145
148
  # Get user role
@@ -152,9 +155,9 @@ module EnfCli
152
155
  end
153
156
  end
154
157
 
155
-
156
158
  desc "cancel-user-invite", "Cancel an invite"
157
159
  method_option :email, :type => :string, :required => true
160
+
158
161
  def cancel_user_invite
159
162
  try_with_rescue_in_session do
160
163
  # call api
@@ -167,6 +170,7 @@ module EnfCli
167
170
 
168
171
  desc "resend-user-invite", "Resend an invite"
169
172
  method_option :email, :type => :string, :required => true
173
+
170
174
  def resend_user_invite
171
175
  try_with_rescue_in_session do
172
176
  # call api
@@ -179,6 +183,7 @@ module EnfCli
179
183
 
180
184
  desc "list-invites", "List user invites"
181
185
  method_option :domain, :default => nil, :type => :string, :aliases => "-d"
186
+
182
187
  def list_invites
183
188
  try_with_rescue_in_session do
184
189
  # use the domain network of the user
@@ -205,6 +210,7 @@ module EnfCli
205
210
 
206
211
  desc "list-users", "List users"
207
212
  method_option :domain, :default => nil, :type => :string, :aliases => "-d"
213
+
208
214
  def list_users
209
215
  try_with_rescue_in_session do
210
216
  # use the domain network of the user
@@ -231,6 +237,7 @@ module EnfCli
231
237
 
232
238
  desc "deactivate-user", "Deactivate User"
233
239
  method_option :user_id, :required => true, :type => :numeric
240
+
234
241
  def deactivate_user
235
242
  try_with_rescue_in_session do
236
243
 
@@ -239,12 +246,12 @@ module EnfCli
239
246
  EnfApi::API.instance.update_user_status options[:user_id], status
240
247
 
241
248
  say "Deactivated user!", :green
242
-
243
249
  end
244
250
  end
245
251
 
246
252
  desc "activate-user", "Activate User"
247
253
  method_option :user_id, :required => true, :type => :numeric
254
+
248
255
  def activate_user
249
256
  try_with_rescue_in_session do
250
257
 
@@ -253,12 +260,8 @@ module EnfCli
253
260
  EnfApi::API.instance.update_user_status options[:user_id], status
254
261
 
255
262
  say "Activated user!", :green
256
-
257
263
  end
258
264
  end
259
-
260
265
  end
261
-
262
266
  end
263
-
264
267
  end
@@ -13,55 +13,50 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
  #
16
- require 'enfthor'
17
- require 'enfapi'
16
+ require "enfthor"
17
+ require "enfapi"
18
18
 
19
19
  module EnfCli
20
-
21
20
  module Cmd
22
-
23
21
  class Xcr < EnfThor
24
22
  no_commands {
25
- def display_endpoints eps
26
- headings = ['IPV6', 'Name', 'State', 'Network', 'Remote IP']
27
- rows = eps.map{ |hash|
28
- [ hash[:ipv6],
29
- hash[:name],
30
- hash[:state],
31
- hash[:state] == 'OFFLINE' ? '' : hash[:ev_asn_org],
32
- hash[:state] == 'OFFLINE' ? '' : hash[:ev_remote_ip]
33
- ]
23
+ def display_endpoints(eps)
24
+ headings = ["IPV6", "Name", "State", "Network", "Remote IP"]
25
+ rows = eps.map { |hash|
26
+ [hash[:ipv6],
27
+ hash[:name],
28
+ hash[:state],
29
+ hash[:state] == "OFFLINE" ? "" : hash[:ev_asn_org],
30
+ hash[:state] == "OFFLINE" ? "" : hash[:ev_remote_ip]]
34
31
  }
35
32
  render_table(headings, rows, options.file)
36
33
  end
37
34
 
38
- def display_endpoint_events events
39
- headings = ['Time', 'IPV6', 'Source', 'Event', 'Network', 'Remote IP']
40
- rows = events.map{ |hash|
41
- [ hash[:inserted_date], hash[:ipv6_text], hash[:source], hash[:type], hash[:asn_org], hash[:remote_ip]]
35
+ def display_endpoint_events(events)
36
+ headings = ["Time", "IPV6", "Source", "Event", "Network", "Remote IP"]
37
+ rows = events.map { |hash|
38
+ [hash[:inserted_date], hash[:ipv6_text], hash[:source], hash[:type], hash[:asn_org], hash[:remote_ip]]
42
39
  }
43
40
  render_table(headings, rows)
44
41
  end
45
42
 
46
- def display_domains domains
47
- headings = ['Name', 'Network', 'Status']
48
- rows = domains.map{ |hash|
49
- [ hash[:name], hash[:network], hash[:status]
50
- ]
43
+ def display_domains(domains)
44
+ headings = ["Name", "Network", "Status"]
45
+ rows = domains.map { |hash|
46
+ [hash[:name], hash[:network], hash[:status]]
51
47
  }
52
48
  render_table(headings, rows)
53
49
  end
54
50
 
55
- def display_networks networks
56
- headings = ['Name', 'Network', 'Description', 'Status']
57
- rows = networks.map{ |hash|
58
- [ hash[:name], hash[:network], hash[:description], hash[:status]
59
- ]
51
+ def display_networks(networks)
52
+ headings = ["Name", "Network", "Description", "Status"]
53
+ rows = networks.map { |hash|
54
+ [hash[:name], hash[:network], hash[:description], hash[:status]]
60
55
  }
61
56
  render_table(headings, rows)
62
57
  end
63
58
 
64
- def display_network network
59
+ def display_network(network)
65
60
  network_cidr = network[:network]
66
61
  name = network[:name] || ""
67
62
  description = network[:description] || ""
@@ -79,27 +74,27 @@ module EnfCli
79
74
  say "Modified At: #{modified_at}\n", nil, true
80
75
  end
81
76
 
82
- def display_limits limits
77
+ def display_limits(limits)
83
78
  # Extract default limits
84
79
  default_limits = limits[:default]
85
80
  current_limits = limits[:current]
86
81
  max_limits = limits[:max]
87
82
 
88
83
  # add type to the limits hash
89
- default_limits[:limit] = 'DEFAULT' if default_limits
90
- max_limits[:limit] = 'MAX' if max_limits
91
- current_limits[:limit] = 'CURRENT' if current_limits
84
+ default_limits[:limit] = "DEFAULT" if default_limits
85
+ max_limits[:limit] = "MAX" if max_limits
86
+ current_limits[:limit] = "CURRENT" if current_limits
92
87
 
93
88
  limits_array = []
94
89
  limits_array.push default_limits if default_limits
95
90
  limits_array.push current_limits if current_limits
96
91
  limits_array.push max_limits if max_limits
97
92
 
98
- headings = ['Limit', 'Pkts/Sec', 'Pkts Burst Size', 'Bytes/Sec', 'Bytes Burst Size']
99
- headings << 'Inherited' if limits_array.reduce(false){ |acc, hash| acc or hash.member?(:inherit)}
93
+ headings = ["Limit", "Pkts/Sec", "Pkts Burst Size", "Bytes/Sec", "Bytes Burst Size"]
94
+ headings << "Inherited" if limits_array.reduce(false) { |acc, hash| acc or hash.member?(:inherit) }
100
95
 
101
- rows = limits_array.map{ |hash|
102
- row = [ hash[:limit], hash[:packets_per_second], hash[:packets_burst_size], hash[:bytes_per_second], hash[:bytes_burst_size] ]
96
+ rows = limits_array.map { |hash|
97
+ row = [hash[:limit], hash[:packets_per_second], hash[:packets_burst_size], hash[:bytes_per_second], hash[:bytes_burst_size]]
103
98
  row << hash[:inherit] ? "Y" : "N" if hash.member?(:inherit)
104
99
  row
105
100
  }
@@ -109,6 +104,7 @@ module EnfCli
109
104
  }
110
105
 
111
106
  desc "list-networks", "List all virtual networks in domain"
107
+
112
108
  def list_networks
113
109
  try_with_rescue_in_session do
114
110
  domain_id = EnfCli::CTX.instance.session[:domain_id]
@@ -125,6 +121,7 @@ module EnfCli
125
121
  desc "provision-network", "Provision a Network"
126
122
  method_option :name, :type => :array, :required => true, :banner => "NAME"
127
123
  method_option :description, :type => :array, :banner => "DESCRIPTION"
124
+
128
125
  def provision_network
129
126
  try_with_rescue_in_session do
130
127
  # verify domain context is set
@@ -140,7 +137,7 @@ module EnfCli
140
137
  hash = {
141
138
  :name => network_name,
142
139
  :domain_id => domain_id,
143
- :description => description
140
+ :description => description,
144
141
  }
145
142
  data = EnfApi::API.instance.create_nw hash
146
143
  networks = data[:data]
@@ -153,6 +150,7 @@ module EnfCli
153
150
 
154
151
  desc "get-network", "Display network details"
155
152
  method_option :network, :type => :string, :required => true
153
+
156
154
  def get_network
157
155
  try_with_rescue_in_session do
158
156
  # call the api
@@ -168,6 +166,7 @@ module EnfCli
168
166
  method_option :network, :type => :string, :required => true
169
167
  method_option :name, :type => :array, :required => false, :banner => "NAME"
170
168
  method_option :description, :type => :array, :required => false, :banner => "DESCRIPTION"
169
+
171
170
  def update_network
172
171
  try_with_rescue_in_session do
173
172
  # Get options
@@ -188,6 +187,7 @@ module EnfCli
188
187
  end
189
188
 
190
189
  desc "list-enf-networks", "List enf /34 networks"
190
+
191
191
  def list_enf_networks
192
192
  try_with_rescue_in_session do
193
193
  # Call the api
@@ -195,27 +195,26 @@ module EnfCli
195
195
  networks = data[:data]
196
196
 
197
197
  # Display the data
198
- headings = ['Id', 'Parent', 'Network', 'Notes', 'Status', 'Type']
199
- rows = networks.map{ |hash|
200
- [ hash[:id], hash[:parent], hash[:network], hash[:notes], hash[:status], hash[:type] ]
198
+ headings = ["Id", "Parent", "Network", "Notes", "Status", "Type"]
199
+ rows = networks.map { |hash|
200
+ [hash[:id], hash[:parent], hash[:network], hash[:notes], hash[:status], hash[:type]]
201
201
  }
202
202
  render_table(headings, rows)
203
-
204
203
  end
205
204
  end
206
205
 
207
206
  desc "list-domains", "List all domains"
207
+
208
208
  def list_domains
209
209
  try_with_rescue_in_session do
210
210
  session = EnfCli::CTX.instance.session
211
211
 
212
212
  # call api
213
- data = {:data => []}
213
+ data = { :data => [] }
214
214
  case session[:type]
215
- when 'XAPTUM_ADMIN'
215
+ when "XAPTUM_ADMIN"
216
216
  data = EnfApi::API.instance.list_domains
217
-
218
- when 'DOMAIN_ADMIN'
217
+ when "DOMAIN_ADMIN"
219
218
  data = EnfApi::API.instance.get_domain session[:domain_id]
220
219
  end
221
220
 
@@ -229,6 +228,7 @@ module EnfCli
229
228
  method_option :name, :type => :string, :required => true
230
229
  method_option :'admin-name', :type => :array, :required => true, :banner => "ADMIN_NAME"
231
230
  method_option :'admin-email', :type => :string, :required => true, :banner => "EMAIL"
231
+
232
232
  def provision_domain
233
233
  try_with_rescue_in_session do
234
234
  # Get cli params
@@ -241,7 +241,7 @@ module EnfCli
241
241
  :admin_name => admin_name,
242
242
  :admin_email => admin_email,
243
243
  :name => domain_name,
244
- :type => 'CUSTOMER_SOURCE'
244
+ :type => "CUSTOMER_SOURCE",
245
245
  }
246
246
  data = EnfApi::API.instance.create_domain hash
247
247
 
@@ -252,8 +252,9 @@ module EnfCli
252
252
  end
253
253
 
254
254
  desc "list-domain-rate-limits", "List domain rate limits"
255
- method_option :network, :type => :string, :required => true, :banner => '</48 Network>'
256
- method_option :filter, :type => :string, :enum => ['default', 'max']
255
+ method_option :network, :type => :string, :required => true, :banner => "</48 Network>"
256
+ method_option :filter, :type => :string, :enum => ["default", "max"]
257
+
257
258
  def list_domain_rate_limits
258
259
  try_with_rescue_in_session do
259
260
  # Call the api
@@ -264,7 +265,7 @@ module EnfCli
264
265
 
265
266
  # if the Api returns only the rate limits object, have to add type explicitly to display
266
267
  limits = {
267
- options[:filter].to_sym => limits
268
+ options[:filter].to_sym => limits,
268
269
  } if options[:filter]
269
270
 
270
271
  # Display limits
@@ -274,7 +275,8 @@ module EnfCli
274
275
 
275
276
  desc "list-network-rate-limits", "List network rate limits"
276
277
  method_option :network, :type => :string, :required => true
277
- method_option :filter, :type => :string, :enum => ['default', 'max']
278
+ method_option :filter, :type => :string, :enum => ["default", "max"]
279
+
278
280
  def list_network_rate_limits
279
281
  try_with_rescue_in_session do
280
282
  # Call the api
@@ -285,7 +287,7 @@ module EnfCli
285
287
 
286
288
  # if the Api returns only the rate limits object, have to add type explicitly to display
287
289
  limits = {
288
- options[:filter].to_sym => limits
290
+ options[:filter].to_sym => limits,
289
291
  } if options[:filter]
290
292
 
291
293
  # Display limits
@@ -295,7 +297,8 @@ module EnfCli
295
297
 
296
298
  desc "list-endpoint-rate-limits", "List endpoints rate limits"
297
299
  method_option :ipv6, :type => :string, :required => true
298
- method_option :filter, :type => :string, :enum => ['current', 'max']
300
+ method_option :filter, :type => :string, :enum => ["current", "max"]
301
+
299
302
  def list_endpoint_rate_limits
300
303
  try_with_rescue_in_session do
301
304
  # Call the api
@@ -306,10 +309,9 @@ module EnfCli
306
309
 
307
310
  # if the Api returns only the rate limits object, have to add type explicitly to display
308
311
  limits = {
309
- options[:filter].to_sym => limits
312
+ options[:filter].to_sym => limits,
310
313
  } if options[:filter]
311
314
 
312
-
313
315
  # Display limits
314
316
  display_limits limits
315
317
  end
@@ -317,10 +319,11 @@ module EnfCli
317
319
 
318
320
  desc "activate-domain", "Activate a customer's /48 domain"
319
321
  method_option :network, :type => :string, :required => true
322
+
320
323
  def activate_domain
321
324
  try_with_rescue_in_session do
322
325
  # Call api
323
- data = EnfApi::API.instance.update_domain_status options[:network], {:status => "ACTIVE"}
326
+ data = EnfApi::API.instance.update_domain_status options[:network], { :status => "ACTIVE" }
324
327
  domains = data[:data]
325
328
 
326
329
  # Display the data
@@ -331,10 +334,11 @@ module EnfCli
331
334
 
332
335
  desc "deactivate-domain", "Deactivate a customer's /48 domain"
333
336
  method_option :network, :type => :string, :required => true
337
+
334
338
  def deactivate_domain
335
339
  try_with_rescue_in_session do
336
340
  # Call api
337
- data = EnfApi::API.instance.update_domain_status options[:network], {:status => "READY"}
341
+ data = EnfApi::API.instance.update_domain_status options[:network], { :status => "READY" }
338
342
  domains = data[:data]
339
343
 
340
344
  # Display the data
@@ -345,26 +349,27 @@ module EnfCli
345
349
 
346
350
  desc "set-domain-rate-limits", "Update a customer /48 domain's endpoint rate limits"
347
351
  method_option :network, :type => :string, :required => true
348
- method_option :limit, :type => :string, :enum => ['default', 'max'], :required => true
352
+ method_option :limit, :type => :string, :enum => ["default", "max"], :required => true
349
353
  method_option :'packets-per-second', :type => :numeric, :required => true
350
354
  method_option :'packets-burst-size', :type => :numeric, :required => true
351
355
  method_option :'bytes-per-second', :type => :numeric, :required => true
352
356
  method_option :'bytes-burst-size', :type => :numeric, :required => true
357
+
353
358
  def set_domain_rate_limits
354
359
  try_with_rescue_in_session do
355
360
  # Call api
356
361
  hash = {
357
- :packets_per_second => options['packets-per-second'],
358
- :packets_burst_size => options['packets-burst-size'],
359
- :bytes_per_second => options['bytes-per-second'],
360
- :bytes_burst_size => options['bytes-burst-size']
362
+ :packets_per_second => options["packets-per-second"],
363
+ :packets_burst_size => options["packets-burst-size"],
364
+ :bytes_per_second => options["bytes-per-second"],
365
+ :bytes_burst_size => options["bytes-burst-size"],
361
366
  }
362
367
  data = EnfApi::API.instance.update_domain_rate_limits options[:network], options[:limit], hash
363
368
  limits = data[:data][0]
364
369
 
365
370
  # The Api returns only the rate limits object. Have to add type explicitly to display
366
371
  limits_hash = {
367
- options[:limit].to_sym => limits
372
+ options[:limit].to_sym => limits,
368
373
  }
369
374
  display_limits limits_hash
370
375
  end
@@ -372,26 +377,27 @@ module EnfCli
372
377
 
373
378
  desc "set-network-rate-limits", "Update a customer /64 network's endpoint rate limits"
374
379
  method_option :network, :type => :string, :required => true
375
- method_option :limit, :type => :string, :enum => ['default', 'max'], :required => true
380
+ method_option :limit, :type => :string, :enum => ["default", "max"], :required => true
376
381
  method_option :'packets-per-second', :type => :numeric, :required => true
377
382
  method_option :'packets-burst-size', :type => :numeric, :required => true
378
383
  method_option :'bytes-per-second', :type => :numeric, :required => true
379
384
  method_option :'bytes-burst-size', :type => :numeric, :required => true
385
+
380
386
  def set_network_rate_limits
381
387
  try_with_rescue_in_session do
382
388
  # Call api
383
389
  hash = {
384
- :packets_per_second => options['packets-per-second'],
385
- :packets_burst_size => options['packets-burst-size'],
386
- :bytes_per_second => options['bytes-per-second'],
387
- :bytes_burst_size => options['bytes-burst-size']
390
+ :packets_per_second => options["packets-per-second"],
391
+ :packets_burst_size => options["packets-burst-size"],
392
+ :bytes_per_second => options["bytes-per-second"],
393
+ :bytes_burst_size => options["bytes-burst-size"],
388
394
  }
389
395
  data = EnfApi::API.instance.update_network_rate_limits options[:network], options[:limit], hash
390
396
  limits = data[:data][0]
391
397
 
392
398
  # The Api returns only the rate limits object. Have to add type explicitly to display
393
399
  limits_hash = {
394
- options[:limit].to_sym => limits
400
+ options[:limit].to_sym => limits,
395
401
  }
396
402
  display_limits limits_hash
397
403
  end
@@ -399,19 +405,20 @@ module EnfCli
399
405
 
400
406
  desc "reset-network-rate-limits", "Reset customer /64 network's endpoint rate limits to domains rate limits"
401
407
  method_option :network, :type => :string, :required => true
402
- method_option :limit, :type => :string, :enum => ['default', 'max'], :required => true
408
+ method_option :limit, :type => :string, :enum => ["default", "max"], :required => true
409
+
403
410
  def reset_network_rate_limits
404
411
  try_with_rescue_in_session do
405
412
  # Call api
406
413
  hash = {
407
- :inherit => true
414
+ :inherit => true,
408
415
  }
409
416
  data = EnfApi::API.instance.update_network_rate_limits options[:network], options[:limit], hash
410
417
  limits = data[:data][0]
411
418
 
412
419
  # The Api returns only the rate limits object. Have to add type explicitly to display
413
420
  limits_hash = {
414
- options[:limit].to_sym => limits
421
+ options[:limit].to_sym => limits,
415
422
  }
416
423
  display_limits limits_hash
417
424
  end
@@ -419,26 +426,27 @@ module EnfCli
419
426
 
420
427
  desc "set-endpoint-rate-limits", "Update an ipv6 endpoint rate limits"
421
428
  method_option :ipv6, :type => :string, :required => true
422
- method_option :limit, :type => :string, :enum => ['current', 'max'], :required => true
429
+ method_option :limit, :type => :string, :enum => ["current", "max"], :required => true
423
430
  method_option :'packets-per-second', :type => :numeric, :required => true
424
431
  method_option :'packets-burst-size', :type => :numeric, :required => true
425
432
  method_option :'bytes-per-second', :type => :numeric, :required => true
426
433
  method_option :'bytes-burst-size', :type => :numeric, :required => true
434
+
427
435
  def set_endpoint_rate_limits
428
436
  try_with_rescue_in_session do
429
437
  # Call api
430
438
  hash = {
431
- :packets_per_second => options['packets-per-second'],
432
- :packets_burst_size => options['packets-burst-size'],
433
- :bytes_per_second => options['bytes-per-second'],
434
- :bytes_burst_size => options['bytes-burst-size']
439
+ :packets_per_second => options["packets-per-second"],
440
+ :packets_burst_size => options["packets-burst-size"],
441
+ :bytes_per_second => options["bytes-per-second"],
442
+ :bytes_burst_size => options["bytes-burst-size"],
435
443
  }
436
444
  data = EnfApi::API.instance.update_ep_rate_limits options[:ipv6], options[:limit], hash
437
445
  limits = data[:data][0]
438
446
 
439
447
  # The Api returns only the rate limits object. Have to add type explicitly to display
440
448
  limits_hash = {
441
- options[:limit].to_sym => limits
449
+ options[:limit].to_sym => limits,
442
450
  }
443
451
  display_limits limits_hash
444
452
  end
@@ -446,19 +454,20 @@ module EnfCli
446
454
 
447
455
  desc "reset-endpoint-rate-limits", "Reset an ipv6 endpoint rate limits to network's rate limits"
448
456
  method_option :ipv6, :type => :string, :required => true
449
- method_option :limit, :type => :string, :enum => ['current', 'max'], :required => true
457
+ method_option :limit, :type => :string, :enum => ["current", "max"], :required => true
458
+
450
459
  def reset_endpoint_rate_limits
451
460
  try_with_rescue_in_session do
452
461
  # Call api
453
462
  hash = {
454
- :inherit => true
463
+ :inherit => true,
455
464
  }
456
465
  data = EnfApi::API.instance.update_ep_rate_limits options[:ipv6], options[:limit], hash
457
466
  limits = data[:data][0]
458
467
 
459
468
  # The Api returns only the rate limits object. Have to add type explicitly to display
460
469
  limits_hash = {
461
- options[:limit].to_sym => limits
470
+ options[:limit].to_sym => limits,
462
471
  }
463
472
  display_limits limits_hash
464
473
  end
@@ -467,6 +476,7 @@ module EnfCli
467
476
  desc "list-endpoints", "List all connections in a network"
468
477
  method_option :network, :type => :string, :required => true
469
478
  method_option :file, :type => :string, :aliases => "-f"
479
+
470
480
  def list_endpoints
471
481
  try_with_rescue_in_session do
472
482
  # verify domain context is set
@@ -484,6 +494,7 @@ module EnfCli
484
494
 
485
495
  desc "list-endpoint-events", "List connect/disconnect events for an ipv6 endpoint"
486
496
  method_option :ipv6, :type => :string, :required => true
497
+
487
498
  def list_endpoint_events
488
499
  try_with_rescue_in_session do
489
500
  # call the api
@@ -492,12 +503,12 @@ module EnfCli
492
503
 
493
504
  # display data
494
505
  display_endpoint_events events
495
-
496
506
  end
497
507
  end
498
508
 
499
509
  desc "list-network-events", "List connect/disconnect events of ipv6 endpoints in a network"
500
510
  method_option :network, :type => :string, :required => true
511
+
501
512
  def list_network_events
502
513
  try_with_rescue_in_session do
503
514
  # call the api
@@ -511,6 +522,7 @@ module EnfCli
511
522
 
512
523
  desc "get-endpoint", "Display an ipv6 endpoint's information"
513
524
  method_option :ipv6, :type => :string, :required => true
525
+
514
526
  def get_endpoint
515
527
  try_with_rescue_in_session do
516
528
  # call the api
@@ -525,6 +537,7 @@ module EnfCli
525
537
  desc "update-endpoint", "Update an ipv6 endpoint's name"
526
538
  method_option :ipv6, :type => :string, :required => true
527
539
  method_option :name, :type => :array, :required => true, :banner => "NAME"
540
+
528
541
  def update_endpoint
529
542
  try_with_rescue_in_session do
530
543
  # Call the api
@@ -538,6 +551,7 @@ module EnfCli
538
551
 
539
552
  desc "activate-enf-network", "Active a /34 enf network"
540
553
  method_option :network, :type => :string, :required => true
554
+
541
555
  def activate_enfnw
542
556
  try_with_rescue_in_session do
543
557
  # Call the api
@@ -547,7 +561,6 @@ module EnfCli
547
561
  say "Activated Enf Network #{options.network}!", :green
548
562
  end
549
563
  end
550
-
551
564
  end # class
552
565
  end # module Cmd
553
566
  end # module EnfCli