Class: Bim::Action::Meta
- Inherits:
-
Object
- Object
- Bim::Action::Meta
- Extended by:
- Util
- Defined in:
- lib/bim/action/meta.rb
Overview
Meta class uses by Bim::Subcommands::Meta
Constant Summary collapse
- DEVICE_PATH =
'/mgmt/tm/cm/device'.freeze
- DEVICE_GROUP_PATH =
'/mgmt/tm/cm/deviceGroup'.freeze
Constants included from Util
Class Method Summary collapse
Class Method Details
.actives ⇒ Object
11 12 13 14 15 16 |
# File 'lib/bim/action/meta.rb', line 11 def actives cond = proc { |item| item['failoverState'] == 'active' } select_map(URI.join(Bim::BASE_URL, Bim::Action::Meta::DEVICE_PATH), cond) do |item| { hostname: item['hostname'], ip: item['managementIp'] } end end |
.device_groups ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/bim/action/meta.rb', line 18 def device_groups cond = proc { |item| item['type'] == 'sync-failover' } select_map(URI.join(Bim::BASE_URL, Bim::Action::Meta::DEVICE_GROUP_PATH), cond) do |item| m = if item&.dig('devicesReference')&.dig('link') uri_r = URI.parse(item['devicesReference']['link'].sub('localhost', BIGIP_HOST)) JSON.parse(get_body(uri_r))['items'].map { |item_in| item_in['name'] } end { name: item['name'], members: m } end end |