Sha256: bff703c331fb3cbe20101b49287e900cb5a8a5658cda13bcb1a6b145b2be6304

Contents?: true

Size: 1.55 KB

Versions: 22

Compression:

Stored size: 1.55 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

22 entries across 22 versions & 5 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/aws/models/compute/route_table.rb
fog-aws-0.1.1 lib/fog/aws/models/compute/route_table.rb
fog-aws-0.1.0 lib/fog/aws/models/compute/route_table.rb
fog-aws-0.0.8 lib/fog/aws/models/compute/route_table.rb
fog-aws-0.0.7 lib/fog/aws/models/compute/route_table.rb
fog-aws-0.0.6 lib/fog/aws/models/compute/route_table.rb
fog-aws-0.0.5 lib/fog/aws/models/compute/route_table.rb
fog-1.26.0 lib/fog/aws/models/compute/route_table.rb
fog-1.25.0 lib/fog/aws/models/compute/route_table.rb
nsidc-fog-1.24.1 lib/fog/aws/models/compute/route_table.rb
fog-1.24.0 lib/fog/aws/models/compute/route_table.rb
ns-fog-1.22.11 lib/fog/aws/models/compute/route_table.rb
ns-fog-1.22.10 lib/fog/aws/models/compute/route_table.rb
ns-fog-1.22.9 lib/fog/aws/models/compute/route_table.rb
ns-fog-1.22.8 lib/fog/aws/models/compute/route_table.rb
ns-fog-1.22.7 lib/fog/aws/models/compute/route_table.rb
ns-fog-1.22.6 lib/fog/aws/models/compute/route_table.rb
fog-1.23.0 lib/fog/aws/models/compute/route_table.rb
ns-fog-1.22.4 lib/fog/aws/models/compute/route_table.rb
ns-fog-1.22.3 lib/fog/aws/models/compute/route_table.rb