Module: Arista::EAPI
- Defined in:
- lib/arista/eapi.rb,
lib/arista/eapi/parser.rb,
lib/arista/eapi/switch.rb,
lib/arista/eapi/request.rb,
lib/arista/eapi/version.rb,
lib/arista/eapi/response.rb,
lib/arista/eapi/parser/show.rb
Defined Under Namespace
Modules: Error Classes: Parser, Request, Response, Switch
Constant Summary collapse
- JSON_COMMANDS =
[ 'show aliases', 'show interfaces', 'show interfaces counters', 'show interfaces counters discards', 'show interfaces status', 'show interfaces switchport vlan mapping', 'show ip interface', 'show ipv6 interface', 'show mac address-table', 'show mac address-table aging-time', 'show management api http-commands', 'show management api http-commands certificate', 'show monitor server-failure history', 'show monitor server-failure servers', 'show monitor session', 'show privilege', 'show sflow', 'show sflow interfaces', 'show spanning-tree topology status', 'show version', 'show version license', 'show vlan', 'show vlan trunk group', ]
- VERSION =
"0.10.3"
Class Method Summary collapse
-
.format_for(*commands) ⇒ Object
Public: Determine the eAPI supported format based on the commands.
Class Method Details
.format_for(*commands) ⇒ Object
Public: Determine the eAPI supported format based on the commands.
options - List of commands to check format options for.
Examples
Arista::EAPI.format_for('show vlan')
#=> 'json'
Arista::EAPI.format_for('show vlan', 'show lldp neighbors')
#=> text
Returns json if all commands support JSON output, otherwise returns text.
54 55 56 |
# File 'lib/arista/eapi.rb', line 54 def self.format_for(*commands) (commands.flatten - JSON_COMMANDS).size > 0 ? 'text' : 'json' end |