Sha256: 6d98f424c47bbeb5143afcd5f7d6757aa2e2886215a807282fe0ec7af90c6f6c
Contents?: true
Size: 1.06 KB
Versions: 13
Compression:
Stored size: 1.06 KB
Contents
class AffinityGroup < CloudstackCli::Base desc 'list', 'list affinity groups' option :account option :name option :type option :listall, type: :boolean, default: true option :keyword option :format, default: "table", enum: %w(table json yaml) def list resolve_account affinity_groups = client.list_affinity_groups(options) if affinity_groups.size < 1 say "No affinity groups found." else case options[:format].to_sym when :yaml puts({affinity_groups: affinity_groups}.to_yaml) when :json puts JSON.pretty_generate(affinity_groups: affinity_groups) else table = [%w(Domain Account Name, Description, VMs)] affinity_groups.each do |group| table << [ group['domain'], group['account'], group['name'], group['description'], group['virtualmachineIds'] ? group['virtualmachineIds'].size : nil ] end print_table table say "Total number of affinity groups: #{affinity_groups.size}" end end end end
Version data entries
13 entries across 13 versions & 1 rubygems