class AwsInventory::Keypair

Public Instance Methods

data() click to toggle source
# File lib/aws_inventory/keypair.rb, line 6
def data
  key_pairs.map do |key|
    instance_count = instance_count(key)

    [key.key_name, instance_count]
  end
end
header() click to toggle source
# File lib/aws_inventory/keypair.rb, line 2
def header
  ["Key Name", "Instance Count"]
end
instance_count(key) click to toggle source
# File lib/aws_inventory/keypair.rb, line 22
def instance_count(key)
  instances.count { |i| i.key_name == key.key_name }
end
key_pairs() click to toggle source
# File lib/aws_inventory/keypair.rb, line 18
def key_pairs
  @key_pairs ||= ec2.describe_key_pairs.key_pairs
end
sort(data) click to toggle source
# File lib/aws_inventory/keypair.rb, line 14
def sort(data)
  data.sort_by { |i| i[1] }.reverse
end