Sha256: 3a2b9479f200e2a3d49053f5f9830c2a5ba8200595def5eb77638f699588c74b

Contents?: true

Size: 1.53 KB

Versions: 37

Compression:

Stored size: 1.53 KB

Contents

module Fog
  module AWS
    class Compute
      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 & 1 rubygems

Version Path
fog-aws-3.30.0 lib/fog/aws/models/compute/route_table.rb
fog-aws-3.29.0 lib/fog/aws/models/compute/route_table.rb
fog-aws-3.28.0 lib/fog/aws/models/compute/route_table.rb
fog-aws-3.27.0 lib/fog/aws/models/compute/route_table.rb
fog-aws-3.26.0 lib/fog/aws/models/compute/route_table.rb
fog-aws-3.25.0 lib/fog/aws/models/compute/route_table.rb
fog-aws-3.24.0 lib/fog/aws/models/compute/route_table.rb
fog-aws-3.23.0 lib/fog/aws/models/compute/route_table.rb
fog-aws-3.22.0 lib/fog/aws/models/compute/route_table.rb
fog-aws-3.21.1 lib/fog/aws/models/compute/route_table.rb
fog-aws-3.21.0 lib/fog/aws/models/compute/route_table.rb
fog-aws-3.20.0 lib/fog/aws/models/compute/route_table.rb
fog-aws-3.19.0 lib/fog/aws/models/compute/route_table.rb
fog-aws-3.18.0 lib/fog/aws/models/compute/route_table.rb
fog-aws-3.17.0 lib/fog/aws/models/compute/route_table.rb
fog-aws-3.16.0 lib/fog/aws/models/compute/route_table.rb
fog-aws-3.15.0 lib/fog/aws/models/compute/route_table.rb
fog-aws-3.14.0 lib/fog/aws/models/compute/route_table.rb
fog-aws-3.13.0 lib/fog/aws/models/compute/route_table.rb
fog-aws-3.12.0 lib/fog/aws/models/compute/route_table.rb