Class: Fog::Compute::AWS::RouteTable

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/aws/models/compute/route_table.rb

Instance Attribute Summary

Attributes inherited from Model

#collection, #service

Instance Method Summary collapse

Methods inherited from Model

#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 Fog::Core::DeprecatedConnectionAccessors

#connection, #connection=, #prepare_service_value

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #persisted?, #requires, #requires_one

Constructor Details

#initialize(attributes = {}) ⇒ RouteTable

Returns a new instance of RouteTable.



17
18
19
# File 'lib/fog/aws/models/compute/route_table.rb', line 17

def initialize(attributes={})
  super
end

Instance Method Details

#destroyObject

Remove an existing route table

route_tables.destroy

Returns

True or false depending on the result



30
31
32
33
34
35
# File 'lib/fog/aws/models/compute/route_table.rb', line 30

def destroy
  requires :id

  service.delete_route_table(id)
  true
end

#saveObject

Create a route table

>> routetable = connection.route_tables.new >> routetable.save

Returns:

True or an exception depending on the result. Keep in mind that this creates a new route table.



47
48
49
50
51
52
53
54
# File 'lib/fog/aws/models/compute/route_table.rb', line 47

def save
  requires :vpc_id

  data = service.create_route_table(vpc_id).body['routeTable'].first
  new_attributes = data.reject {|key,value| key == 'requestId'}
  merge_attributes(new_attributes)
  true
end