enfcli 3.13.0.pre.alpha → 3.14.0.pre.alpha

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 522440e411980f0f45893f8e062e68dbfe53e0f1c322cc6dcd3b41a4b37b1546
4
- data.tar.gz: a29c99ae3bada808e496be1da3c27746fa5e53d01c8fbe02796a97c62220c680
3
+ metadata.gz: 91ec0465a2a25d90a5f3bf2650f03c3422b399b308e37c96fbdcf7feb44e5fae
4
+ data.tar.gz: 575c1396fca448b2b849564e8daec5ff9fc758e88d87d49a9907a33dd05a3c6b
5
5
  SHA512:
6
- metadata.gz: 4890b71f648e7a082f63f0861e36c11147d5c863767d49e69f3bb4e11c6ba9fe1928f32932a53a71a87f81c3371fbc8981a463f9044865a086107efc5cf3f50f
7
- data.tar.gz: b814bcef370608ad93f4248eacca7254be81f0e9a93855fd6bd4bade190eb828bca7b016ccfb3996fa7c5e03158bf08370d221d9f120b6a9ffec27c9d1cfd44a
6
+ metadata.gz: 34a6c0e065204ebb830c5c73e63d4fbacd440b697689b2bae666bda36da8052a60cec5608d635afaaac0cffd5d412fe20a902125c7b3e936220042786c1ccdc3
7
+ data.tar.gz: e7effce7e3eafdaa12658825dbee79c7c889aab51a9a76d81b1f2da75a195ffe6099758f1a53444cc3943e3c60d36fe4e4632961295f614e982bea833fcf20ec
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- enfcli (3.13.0.pre.alpha)
4
+ enfcli (3.14.0.pre.alpha)
5
5
  rest-client (~> 2.0)
6
6
  terminal-table
7
7
  thor (~> 0.20.0)
data/lib/enfapi.rb CHANGED
@@ -454,6 +454,19 @@ module EnfApi
454
454
  }
455
455
  end
456
456
 
457
+ def update_nw(network_cidr, nw_hash)
458
+ json = to_json(nw_hash)
459
+ @api["/api/xcr/v2/nws/#{network_cidr}"].put(json, @headers) {|response, request, result|
460
+ process_api_response response, request, result
461
+ }
462
+ end
463
+
464
+ def get_nw(network_cidr)
465
+ @api["/api/xcr/v2/nws/#{network_cidr}"].get(@headers) {|response, request, result|
466
+ process_api_response response, request, result
467
+ }
468
+ end
469
+
457
470
  def list_nw_connections(domain_id, network_cidr, file = nil)
458
471
  @api["/api/xcr/v2/domains/#{domain_id}/nws/#{network_cidr}/cxns"].get(@headers) {|response, request, result|
459
472
  process_api_response response, request, result
@@ -61,6 +61,24 @@ module EnfCli
61
61
  render_table(headings, rows)
62
62
  end
63
63
 
64
+ def display_network network
65
+ network_cidr = network[:network]
66
+ name = network[:name] || ""
67
+ description = network[:description] || ""
68
+ status = network[:status] || ""
69
+ created_by = network[:created_by] || ""
70
+ inserted_at = network[:inserted_date] || ""
71
+ modified_at = network[:modified_date] || ""
72
+
73
+ say "Network: #{network_cidr}\n", nil, true
74
+ say "Name: #{name}\n", nil, true
75
+ say "Description: #{description}\n", nil, true
76
+ say "Status: #{status}\n", nil, true
77
+ say "Created By: #{created_by}\n", nil, true
78
+ say "Inserted At: #{inserted_at}\n", nil, true
79
+ say "Modified At: #{modified_at}\n", nil, true
80
+ end
81
+
64
82
  def display_limits limits
65
83
  # Extract default limits
66
84
  default_limits = limits[:default]
@@ -133,6 +151,42 @@ module EnfCli
133
151
  end
134
152
  end
135
153
 
154
+ desc "get-network", "Display network details"
155
+ method_option :network, :type => :string, :required => true
156
+ def get_network
157
+ try_with_rescue_in_session do
158
+ # call the api
159
+ data = EnfApi::API.instance.get_nw options.network
160
+ nw = data[:data][0]
161
+
162
+ # display data
163
+ display_network nw
164
+ end
165
+ end
166
+
167
+ desc "update-network", "Update an network's metadata"
168
+ method_option :network, :type => :string, :required => true
169
+ method_option :name, :type => :array, :required => false, :banner => "NAME"
170
+ method_option :description, :type => :array, :required => false, :banner => "DESCRIPTION"
171
+ def update_network
172
+ try_with_rescue_in_session do
173
+ # Get options
174
+ name = options.name.join(" ").gsub(/\A"+(.*?)"+\Z/m, '\1') if options.name
175
+ description = options.description.join(" ").gsub(/\A"+(.*?)"+\Z/m, '\1') if options.description
176
+
177
+ # Call the api
178
+ hash = {}.tap do |h|
179
+ h[:name] = name if options.name
180
+ h[:description] = description if options.description
181
+ end
182
+ data = EnfApi::API.instance.update_nw options.network, hash
183
+ networks = data[:data]
184
+
185
+ # display table
186
+ display_networks networks
187
+ end
188
+ end
189
+
136
190
  desc "list-enf-networks", "List enf /34 networks"
137
191
  def list_enf_networks
138
192
  try_with_rescue_in_session do
@@ -14,5 +14,5 @@
14
14
  # limitations under the License.
15
15
  #
16
16
  module EnfCli
17
- VERSION = '3.13.0-alpha'
17
+ VERSION = '3.14.0-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.13.0.pre.alpha
4
+ version: 3.14.0.pre.alpha
5
5
  platform: ruby
6
6
  authors:
7
7
  - Venkatakumar Srinivasan