Sha256: 2ac521c1e9692c9406d2960a9da940a6003afbdcd50913f8b1bc161f5d31f44c
Contents?: true
Size: 1.03 KB
Versions: 12
Compression:
Stored size: 1.03 KB
Contents
class AffinityGroup < CloudstackCli::Base desc 'list', 'list affinity groups' option :account option :name option :type option :listall 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
12 entries across 12 versions & 1 rubygems