enfcli 3.13.0.pre.alpha → 3.14.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.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/enfapi.rb +13 -0
- data/lib/enfcli/commands/xcr.rb +54 -0
- data/lib/enfcli/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 91ec0465a2a25d90a5f3bf2650f03c3422b399b308e37c96fbdcf7feb44e5fae
|
4
|
+
data.tar.gz: 575c1396fca448b2b849564e8daec5ff9fc758e88d87d49a9907a33dd05a3c6b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 34a6c0e065204ebb830c5c73e63d4fbacd440b697689b2bae666bda36da8052a60cec5608d635afaaac0cffd5d412fe20a902125c7b3e936220042786c1ccdc3
|
7
|
+
data.tar.gz: e7effce7e3eafdaa12658825dbee79c7c889aab51a9a76d81b1f2da75a195ffe6099758f1a53444cc3943e3c60d36fe4e4632961295f614e982bea833fcf20ec
|
data/Gemfile.lock
CHANGED
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
|
data/lib/enfcli/commands/xcr.rb
CHANGED
@@ -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
|
data/lib/enfcli/version.rb
CHANGED