Class: Akashi::Vpc::Instance
- Inherits:
-
Base
show all
- Defined in:
- lib/akashi/vpc/instance.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Ec2::Base
#name, #name=, service_class
Methods inherited from Base
all, base_class, collection, find, find_by, #initialize, where
Constructor Details
This class inherits a constructor from Akashi::Base
Class Method Details
.create ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/akashi/vpc/instance.rb', line 13
def create
response = Akashi::Aws.ec2.client.create_vpc(
cidr_block: "10.0.0.0/16",
instance_tenancy: "default",
)
new(response[:vpc][:vpc_id]).tap do |instance|
instance.name = Akashi.name
route_table = Akashi::Vpc::RouteTable.find_by(vpc_id: instance.id)
puts "Created a VPC (#{instance.id}). RouteTable is \"#{route_table.id}\"."
end
end
|
.object_class ⇒ Object
27
28
29
|
# File 'lib/akashi/vpc/instance.rb', line 27
def object_class
@object_class ||= "VPC"
end
|
Instance Method Details
#internet_gateway=(internet_gateway) ⇒ Object
Also known as:
attach_internet_gateway
6
7
8
9
|
# File 'lib/akashi/vpc/instance.rb', line 6
def internet_gateway=(internet_gateway)
@object.internet_gateway = internet_gateway.id
puts "Attached an InternetGateway (#{internet_gateway.id}) to a VPC (#{id})."
end
|