Sha256: 5dd5f2ebd0c4b4d9a041cce05ff8a36ed7a8f611cb322fba3229f234d0134abe

Contents?: true

Size: 1.42 KB

Versions: 17

Compression:

Stored size: 1.42 KB

Contents

require 'fog/core/model'

module Fog
  module Compute
    class AWS

      class Subnet < Fog::Model

        identity  :subnet_id,                   :aliases => 'subnetId'
        attribute :state     
        attribute :vpc_id,                      :aliases => 'vpcId'
        attribute :cidr_block,                  :aliases => 'cidrBlock'
        attribute :available_ip_address_count,  :aliases => 'availableIpAddressCount'
        attribute :availability_zone,           :aliases => 'availabilityZone'
        attribute :tag_set,                     :aliases => 'tagSet'


        # Removes an existing subnet
        #
        # subnet.destroy
        #
        # ==== Returns
        #
        # True or false depending on the result
        #

        def destroy
          requires :subnet_id

          connection.delete_subnet(subnet_id)
          true
        end

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

        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

      end
    end
  end
end

Version data entries

17 entries across 17 versions & 9 rubygems

Version Path
fog-nirvanix-1.8.2 lib/fog/aws/models/compute/subnet.rb
fog-nirvanix-1.8.1 lib/fog/aws/models/compute/subnet.rb
fog-parser-fix-1.6.1 lib/fog/aws/models/compute/subnet.rb
fog-test-again-1.6.0 lib/fog/aws/models/compute/subnet.rb
fog-parser-fix-1.6.0 lib/fog/aws/models/compute/subnet.rb
ey-vendored-backup-3.0.27 vendor/gems/fog/lib/fog/aws/models/compute/subnet.rb
fog-sgonyea-1.8.1 lib/fog/aws/models/compute/subnet.rb
fog-1.8.0 lib/fog/aws/models/compute/subnet.rb
fog-maestrodev-1.7.0.20121114190951 lib/fog/aws/models/compute/subnet.rb
fog-1.7.0 lib/fog/aws/models/compute/subnet.rb
fog-1.6.0 lib/fog/aws/models/compute/subnet.rb
fog-1.5.0 lib/fog/aws/models/compute/subnet.rb
fog-1.4.0 lib/fog/aws/models/compute/subnet.rb
michiels-fog-1.3.1 lib/fog/aws/models/compute/subnet.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/lib/fog/aws/models/compute/subnet.rb
fog-1.3.1 lib/fog/aws/models/compute/subnet.rb
fog-1.3.0 lib/fog/aws/models/compute/subnet.rb