enfcli 3.10.2.pre.alpha → 3.10.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 911c67da3112f2c2240015845fd40ab32f4d1068511b2ffab9c986e706320312
4
- data.tar.gz: 2e6d53761dfc8e6cab5b547002d70b9e512527b066bfc25f7631b910f493cea5
3
+ metadata.gz: 3c844fc472faecb61f1ec4f1cf04dd9b198fae57df6e63aaac36b29edf2ebdde
4
+ data.tar.gz: db2d9ce8d78b232366fd213dcef0513c8ebc47c9d4ffc2c6f3eaff65fdbe7574
5
5
  SHA512:
6
- metadata.gz: 258b0fce7207eb1628da9c2ae321b49f8721620d3379af8e21ae59fd0668eb764dac903bd35cd82860d3a1a8f52044dfaf01e482a6acf67f262c949350fc753f
7
- data.tar.gz: 925900da48be2d664d7bd3d8d3b44db6b7dffc37fc1a406c611f6293f4e47edd9deaba76038e87ae02c544b96163c0d33740a73e06d2bc6228b84ce9a9713cf0
6
+ metadata.gz: 1881463071fb9054a7e5bd495b8129c023883855d26f0471a5d3735eceaff8706c4c173716fd9419b9348a6e47cd0bffa7d8a57d814d72d89acfa44813ed3303
7
+ data.tar.gz: 52ba4f03d178d6bb39ab13da2b5639889bb712686ed9d22a89a21ae2d3e34e0a93fe362e5470cd9f142030fe31364d6306e51865b17bd9cf9d076d7a1955ba37
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- enfcli (3.10.2.pre.alpha)
4
+ enfcli (3.10.3.pre.alpha)
5
5
  rest-client (~> 2.0)
6
6
  terminal-table
7
7
  thor (~> 0.20.0)
@@ -100,11 +100,15 @@ module EnfCli
100
100
  end
101
101
 
102
102
  def display_groups groups
103
- headings = ['DAA Group', 'Base Name', 'Provisioned', 'Onboarded', 'Domain' ]
103
+ headings = ['DAA Group', 'Base Name', 'Provisioned', 'Onboarded', 'Default Network', 'Domain' ]
104
+ say groups
104
105
  rows = groups.map{ |hash|
105
- [ Base64.decode64(hash[:gid]).unpack("H*")[0], Base64.decode64(hash[:basename]),
106
- hash[:provisioned_count], hash[:onboarded_count],
107
- "#{IPAddr::new_ntoh( Base64.decode64(hash[:domain][:prefix]) )}/#{hash[:domain][:prefix_length]}"
106
+ [ Base64.decode64(hash[:gid]).unpack("H*")[0],
107
+ Base64.decode64(hash[:basename]),
108
+ hash[:provisioned_count],
109
+ hash[:onboarded_count],
110
+ hash[:default_network] ? "#{IPAddr::new_ntoh( Base64.decode64(hash[:default_network][:prefix]) )}/#{hash[:default_network][:prefix_length]}" : '<not set>',
111
+ "#{IPAddr::new_ntoh( Base64.decode64(hash[:domain][:prefix]) )}/#{hash[:domain][:prefix_length]}",
108
112
  ]
109
113
  }
110
114
  render_table(headings, rows)
@@ -296,6 +300,7 @@ module EnfCli
296
300
  desc "add-group-to-network", "Associate a DAA Group with /64 network"
297
301
  method_option :'network', :type => :string, :required => true
298
302
  method_option *option_gid
303
+ method_option :'set_as_default', :type => :boolean, default: false, desc: "Set the network as the default for this group"
299
304
  def add_group_to_network
300
305
  try_with_rescue_in_session do
301
306
  network = EnfCli::IPV6Cidr.new options[:network]
@@ -316,10 +321,18 @@ module EnfCli
316
321
  # url safe encode gid
317
322
  enc_gid = Base64.urlsafe_encode64([gid].pack("H*"))
318
323
 
319
- # Post to server
320
- EnfApi::Iam.instance.add_group_to_network enc_gid, ipv6_network
324
+ if options[:set_as_default]
325
+ modified_group = {
326
+ :gid => Base64.strict_encode64([gid].pack("H*")),
327
+ :default_network => ipv6_network
328
+ }
321
329
 
322
- say "Associated group #{gid} with #{network}", :green
330
+ EnfApi::Iam.instance.update_group enc_gid, modified_group
331
+ say "Associated group #{gid} with #{network} as default network", :green
332
+ else
333
+ EnfApi::Iam.instance.add_group_to_network enc_gid, ipv6_network
334
+ say "Associated group #{gid} with #{network}", :green
335
+ end
323
336
  end
324
337
  end
325
338
 
@@ -14,5 +14,5 @@
14
14
  # limitations under the License.
15
15
  #
16
16
  module EnfCli
17
- VERSION = '3.10.2-alpha'
17
+ VERSION = '3.10.3-alpha'
18
18
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enfcli
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.10.2.pre.alpha
4
+ version: 3.10.3.pre.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Venkatakumar Srinivasan