class Ufo::Network::Fetch
Public Class Methods
new(vpc_id)
click to toggle source
# File lib/ufo/network/fetch.rb, line 8 def initialize(vpc_id) @vpc_id = vpc_id end
Public Instance Methods
security_group_id()
click to toggle source
default security group
# File lib/ufo/network/fetch.rb, line 39 def security_group_id resp = ec2.describe_security_groups(filters: [ {name: "vpc-id", values: [vpc_id]}, {name: "group-name", values: ["default"]} ]) resp.security_groups.first.group_id end
subnet_ids()
click to toggle source
all subnets
# File lib/ufo/network/fetch.rb, line 30 def subnet_ids resp = ec2.describe_subnets(filters: [ {name: "vpc-id", values: [vpc_id]} ]) resp.subnets.map(&:subnet_id).sort end
vpc_id()
click to toggle source
# File lib/ufo/network/fetch.rb, line 12 def vpc_id return @vpc_id if @vpc_id resp = ec2.describe_vpcs(filters: [ {name: "isDefault", values: ["true"]} ]) default_vpc = resp.vpcs.first if default_vpc default_vpc.vpc_id else puts "A default vpc was not found in this AWS account and region.".color(:red) puts "Because there is no default vpc, please specify the --vpc-id option. More info: http://ufoships.com/reference/ufo-init/" exit 1 end end