Sha256: 824a8e6938ee6fc170fdb927cdba88e7507cf32b15a7c524b0a3d1cdae791736

Contents?: true

Size: 1.57 KB

Versions: 37

Compression:

Stored size: 1.57 KB

Contents

require 'fog/core/model'

module Fog
  module Compute
    class AWS

      class RouteTable < Fog::Model

        identity :id,                :aliases => 'routeTableId'

        attribute :vpc_id,           :aliases => 'vpcId'
        attribute :routes,           :aliases => 'routeSet'
        attribute :associations,     :aliases => 'associationSet'
        attribute :tags,             :aliases => 'tagSet'
        

        def initialize(attributes={})
          super
        end

        # Remove an existing route table
        #
        # route_tables.destroy
        #
        # ==== Returns
        #
        # True or false depending on the result
        #

        def destroy
          requires :id

          service.delete_route_table(id)
          true
        end

        # 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.
        #

        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
        
        private

        def associationSet=(new_association_set)
          merge_attributes(new_association_set.first || {})
        end

        def routeSet=(new_route_set)
          merge_attributes(new_route_set || {})
        end

      end
    end
  end
end

Version data entries

37 entries across 37 versions & 2 rubygems

Version Path
fog-1.22.0 lib/fog/aws/models/compute/route_table.rb
fog-1.21.0 lib/fog/aws/models/compute/route_table.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/aws/models/compute/route_table.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/aws/models/compute/route_table.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/aws/models/compute/route_table.rb
fog-1.20.0 lib/fog/aws/models/compute/route_table.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/aws/models/compute/route_table.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/aws/models/compute/route_table.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/aws/models/compute/route_table.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/aws/models/compute/route_table.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/aws/models/compute/route_table.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/aws/models/compute/route_table.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/aws/models/compute/route_table.rb
fog-1.19.0 lib/fog/aws/models/compute/route_table.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/aws/models/compute/route_table.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/aws/models/compute/route_table.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/aws/models/compute/route_table.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/aws/models/compute/route_table.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/aws/models/compute/route_table.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/aws/models/compute/route_table.rb