Class: Fog::Compute::AWS::Subnet
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::AWS::Subnet
- Defined in:
- lib/fog/aws/models/compute/subnet.rb
Instance Method Summary collapse
-
#destroy ⇒ Object
Removes an existing subnet.
- #ready? ⇒ Boolean
-
#save ⇒ Object
Create a subnet.
Instance Method Details
#destroy ⇒ Object
Removes an existing subnet
subnet.destroy
Returns
True or false depending on the result
30 31 32 33 34 35 |
# File 'lib/fog/aws/models/compute/subnet.rb', line 30 def destroy requires :subnet_id service.delete_subnet(subnet_id) true end |
#ready? ⇒ Boolean
16 17 18 19 |
# File 'lib/fog/aws/models/compute/subnet.rb', line 16 def ready? requires :state state == 'available' end |
#save ⇒ Object
Create a subnet
>> g = AWS.subnets.new(:vpc_id => "vpc-someId", :cidr_block => "10.0.0.0/24")
>> g.save
Returns:
requestId and a subnet object
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/fog/aws/models/compute/subnet.rb', line 47 def save requires :vpc_id, :cidr_block = {} ['AvailabilityZone'] = availability_zone if availability_zone data = service.create_subnet(vpc_id, cidr_block, ).body['subnet'] new_attributes = data.reject {|key,value| key == 'requestId'} merge_attributes(new_attributes) true true end |