Sha256: f783430d9a02325fd6a49cc5cf59bc10774e6b51ec7ca39a7e13f91364edb23a

Contents?: true

Size: 1.41 KB

Versions: 25

Compression:

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

          service.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 = service.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

25 entries across 25 versions & 6 rubygems

Version Path
gapinc-fog-1.12.1.2.1 lib/fog/aws/models/compute/subnet.rb
fog-maestrodev-1.15.0.20130829165835 lib/fog/aws/models/compute/subnet.rb
fog-1.15.0 lib/fog/aws/models/compute/subnet.rb
gapinc-fog-1.14.0 lib/fog/aws/models/compute/subnet.rb
fog-maestrodev-1.14.0.20130806165225 lib/fog/aws/models/compute/subnet.rb
fog-1.14.0 lib/fog/aws/models/compute/subnet.rb
fog-1.13.0 lib/fog/aws/models/compute/subnet.rb
gapinc-fog-1.12.1.2 lib/fog/aws/models/compute/subnet.rb
gapinc-fog-1.12.1.1 lib/fog/aws/models/compute/subnet.rb
gapinc-fog-1.12.1a lib/fog/aws/models/compute/subnet.rb
gapinc-fog-1.12.1 lib/fog/aws/models/compute/subnet.rb
fog-1.12.1 lib/fog/aws/models/compute/subnet.rb
fog-1.12.0 lib/fog/aws/models/compute/subnet.rb
hpfog-0.0.20 lib/fog/aws/models/compute/subnet.rb
vagrant-shell-0.2.6 vendor/bundle/gems/fog-1.10.1/lib/fog/aws/models/compute/subnet.rb
vagrant-shell-0.2.5 vendor/bundle/gems/fog-1.10.1/lib/fog/aws/models/compute/subnet.rb
fog-1.11.1 lib/fog/aws/models/compute/subnet.rb
fog-1.11.0 lib/fog/aws/models/compute/subnet.rb
fog-1.10.1 lib/fog/aws/models/compute/subnet.rb
fog-test-me-1.10.0 lib/fog/aws/models/compute/subnet.rb