Class: Awful::Vpce
Constant Summary
collapse
- COLORS =
{
available: :green,
pending: :yellow,
deleting: :red,
deleted: :green,
}
Instance Method Summary
collapse
Methods inherited from Cli
#initialize, #ll, #version
Constructor Details
This class inherits a constructor from Awful::Cli
Instance Method Details
#dump(*ids) ⇒ Object
42
43
44
45
46
47
48
|
# File 'lib/awful/vpce.rb', line 42
def dump(*ids)
ec2.describe_vpc_endpoints(
filters: [{name: 'vpc-endpoint-id', values: ids}]
).vpc_endpoints.output do |endpoints|
puts YAML.dump(endpoints.map{ |e| stringify_keys(e.to_hash) })
end
end
|
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/awful/vpce.rb', line 21
def ls(*ids)
filters = [
{ name: 'vpc-endpoint-id', values: ids },
{ name: 'vpc-id', values: Array(options[:vpc]) },
{ name: 'service-name', values: Array(options[:service]).map { |s| "com.amazonaws.#{ENV['AWS_REGION']}.#{s.downcase}" } },
{ name: 'vpc-endpoint-state', values: Array(options[:state]) },
].reject { |f| f[:values].empty? }
filters = nil if filters.empty?
ec2.describe_vpc_endpoints(filters: filters).vpc_endpoints.output do |endpoints|
if options[:long]
print_table endpoints.map { |e|
[e.vpc_endpoint_id, e.vpc_id, e.service_name, color(e.state), e.creation_timestamp]
}
else
puts endpoints.map(&:vpc_endpoint_id)
end
end
end
|