Class: F5::Cli::DeviceGroup

Inherits:
Subcommand show all
Defined in:
lib/f5/cli/application.rb

Instance Method Summary collapse

Instance Method Details

#listObject



397
398
399
400
401
402
403
404
405
406
407
408
# File 'lib/f5/cli/application.rb', line 397

def list
  response = client.Management.DeviceGroup.get_list

  devices = Array(response[:item])
  if devices.empty?
    puts "No devices found"
  else
    devices.each do |p|
      puts p
    end
  end
end

#status(device_group = nil) ⇒ Object



411
412
413
414
415
416
417
418
419
# File 'lib/f5/cli/application.rb', line 411

def status(device_group=nil)
  response = client.Management.DeviceGroup.get_sync_status(device_groups: { item: [ device_group ] })
  puts "STATUS: #{response[:item][:status]}";
  puts "STATUS COLOR: #{response[:item][:color]}";
  puts "STATUS DESCRIPTION: #{response[:item][:member_state]}";
  puts "STATUS SUMMARY: #{response[:item][:summary]}";
  puts "STATUS DETAILS:"
  puts response[:item][:details][:item].nil? ? "No further details." : response[:item][:details][:item]
end

#sync(device_group, device) ⇒ Object



422
423
424
425
426
427
428
429
430
# File 'lib/f5/cli/application.rb', line 422

def sync(device_group, device)
  device = "#{device.gsub(%r{^/Common/}, '')}"
  response = client.System.ConfigSync.synchronize_to_group_v2(group: device_group, device: "/Common/#{device}", force: false)
  if response.nil? || response.empty?
    puts "Sync completed."
  else
    puts "Sync did not complete."
  end
end