Class: Fog::Compute::AWS::Subnet
- Defined in:
- lib/rackspace-fog/aws/models/compute/subnet.rb
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
-
#destroy ⇒ Object
Removes an existing subnet.
-
#save ⇒ Object
Create a subnet.
Methods inherited from Model
#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
Instance Method Details
#destroy ⇒ Object
Removes an existing subnet
subnet.destroy
Returns
True or false depending on the result
27 28 29 30 31 32 |
# File 'lib/rackspace-fog/aws/models/compute/subnet.rb', line 27 def destroy requires :subnet_id connection.delete_subnet(subnet_id) true 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 subnetSet object
44 45 46 47 48 49 50 51 52 |
# File 'lib/rackspace-fog/aws/models/compute/subnet.rb', line 44 def save requires :vpc_id, :cidr_block data = connection.create_subnet(vpc_id, cidr_block).body['subnetSet'].first new_attributes = data.reject {|key,value| key == 'requestId'} merge_attributes(new_attributes) true true end |