class Fog::AWS::Compute::VPC
Public Class Methods
new(attributes={})
click to toggle source
Calls superclass method
# File lib/fog/aws/models/compute/vpc.rb, line 29 def initialize(attributes={}) self.dhcp_options_id ||= "default" self.tenancy ||= "default" self.amazon_provided_ipv_6_cidr_block ||=false super end
Public Instance Methods
classic_link_dns_enabled?()
click to toggle source
# File lib/fog/aws/models/compute/vpc.rb, line 79 def classic_link_dns_enabled? requires :identity service.describe_vpc_classic_link_dns_support(:vpc_ids => [self.identity]).body['vpcs'].first['classicLinkDnsSupported'] rescue nil end
classic_link_enabled?()
click to toggle source
# File lib/fog/aws/models/compute/vpc.rb, line 62 def classic_link_enabled? requires :identity service.describe_vpc_classic_link(:vpc_ids => [self.identity]).body['vpcSet'].first['classicLinkEnabled'] rescue nil end
destroy()
click to toggle source
disable_classic_link()
click to toggle source
# File lib/fog/aws/models/compute/vpc.rb, line 74 def disable_classic_link requires :identity service.disable_vpc_classic_link(self.identity).body['return'] end
disable_classic_link_dns()
click to toggle source
# File lib/fog/aws/models/compute/vpc.rb, line 91 def disable_classic_link_dns requires :identity service.disable_vpc_classic_link_dns_support(self.identity).body['return'] end
enable_classic_link()
click to toggle source
# File lib/fog/aws/models/compute/vpc.rb, line 69 def enable_classic_link requires :identity service.enable_vpc_classic_link(self.identity).body['return'] end
enable_classic_link_dns()
click to toggle source
# File lib/fog/aws/models/compute/vpc.rb, line 86 def enable_classic_link_dns requires :identity service.enable_vpc_classic_link_dns_support(self.identity).body['return'] end
is_default?()
click to toggle source
# File lib/fog/aws/models/compute/vpc.rb, line 41 def is_default? requires :is_default is_default end
ready?()
click to toggle source
# File lib/fog/aws/models/compute/vpc.rb, line 36 def ready? requires :state state == 'available' end
save()
click to toggle source
Create a vpc
>> g = AWS.vpcs.new(:cidr_block => “10.1.2.0/24”) >> g.save
Returns:¶ ↑
True or an exception depending on the result. Keep in mind that this creates a new vpc. As such, it yields an InvalidGroup.Duplicate exception if you attempt to save an existing vpc.
# File lib/fog/aws/models/compute/vpc.rb, line 107 def save requires :cidr_block options = { 'AmazonProvidedIpv6CidrBlock' => amazon_provided_ipv_6_cidr_block, 'InstanceTenancy' => tenancy } data = service.create_vpc(cidr_block, options).body['vpcSet'].first new_attributes = data.reject {|key,value| key == 'requestId'} new_attributes = data.reject {|key,value| key == 'requestId' || key == 'tagSet' } merge_attributes(new_attributes) if tags = self.tags # expect eventual consistency Fog.wait_for { self.reload rescue nil } service.create_tags( self.identity, tags ) end true end
subnets()
click to toggle source
# File lib/fog/aws/models/compute/vpc.rb, line 25 def subnets service.subnets(:filters => {'vpcId' => self.identity}).all end