Class: Inventory::Keypair
- Inherits:
-
Base
- Object
- Base
- Inventory::Keypair
show all
- Defined in:
- lib/inventory/keypair.rb
Instance Method Summary
collapse
Methods inherited from Base
eager_load!, inherited, #initialize, #report, #show, subclasses, #test_mode
#acm, #cfn, #cw, #eb, #ec2, #ecs, #elbv1, #elbv2, #iam, #pricing, #rds, #route53
Methods included from Shared
#instances, #security_groups
Instance Method Details
#data ⇒ Object
6
7
8
9
10
11
12
|
# File 'lib/inventory/keypair.rb', line 6
def data
key_pairs.map do |key|
instance_count = instance_count(key)
[key.key_name, instance_count]
end
end
|
2
3
4
|
# File 'lib/inventory/keypair.rb', line 2
def
["Key Name", "Instance Count"]
end
|
#instance_count(key) ⇒ Object
22
23
24
|
# File 'lib/inventory/keypair.rb', line 22
def instance_count(key)
instances.count { |i| i.key_name == key.key_name }
end
|
#key_pairs ⇒ Object
18
19
20
|
# File 'lib/inventory/keypair.rb', line 18
def key_pairs
@key_pairs ||= ec2.describe_key_pairs.key_pairs
end
|
#sort(data) ⇒ Object
14
15
16
|
# File 'lib/inventory/keypair.rb', line 14
def sort(data)
data.sort_by { |i| i[1] }.reverse
end
|