Class: Fog::Compute::AWS::VPC
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::AWS::VPC
- Defined in:
- lib/fog/aws/models/compute/vpc.rb
Instance Method Summary collapse
-
#destroy ⇒ Object
Removes an existing vpc.
-
#initialize(attributes = {}) ⇒ VPC
constructor
A new instance of VPC.
- #ready? ⇒ Boolean
-
#save ⇒ Object
Create a vpc.
Constructor Details
#initialize(attributes = {}) ⇒ VPC
Returns a new instance of VPC.
17 18 19 20 21 |
# File 'lib/fog/aws/models/compute/vpc.rb', line 17 def initialize(attributes={}) self. ||= "default" self.tenancy ||= "default" super end |
Instance Method Details
#destroy ⇒ Object
Removes an existing vpc
vpc.destroy
Returns
True or false depending on the result
37 38 39 40 41 42 |
# File 'lib/fog/aws/models/compute/vpc.rb', line 37 def destroy requires :id service.delete_vpc(id) true end |
#ready? ⇒ Boolean
23 24 25 26 |
# File 'lib/fog/aws/models/compute/vpc.rb', line 23 def ready? requires :state state == 'available' end |
#save ⇒ Object
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.
55 56 57 58 59 60 61 62 |
# File 'lib/fog/aws/models/compute/vpc.rb', line 55 def save requires :cidr_block data = service.create_vpc(cidr_block).body['vpcSet'].first new_attributes = data.reject {|key,value| key == 'requestId'} merge_attributes(new_attributes) true end |