Sha256: c3213d1b6e52725db362bfda01dc45452fb9da16a6a2fef556d3d809d34f3eb2

Contents?: true

Size: 1.65 KB

Versions: 29

Compression:

Stored size: 1.65 KB

Contents

module Fog
  module HP
    class Network
      class Real
        # Gets an existing subnet by id
        #
        # ==== Parameters
        # * 'id'<~String>: - UUId for the subnet
        #
        # ==== Returns
        # * response<~Excon::Response>:
        #   * body<~Hash>:
        #     * subnet<~Array>:
        #       * 'id'<~String>: - UUId for the subnet
        #       * 'name'<~String>: - Name of the subnet
        #       * 'network_id'<~String>: - UUId of the network
        #       * 'tenant_id'<~String>: - TenantId that owns the subnet
        #       * 'dns_nameservers'<~Array>: - Array of DNS Nameservers
        #       * 'allocation_pools'<~Array>:
        #         * 'start'<~String>: - Start IP address
        #         * 'end'<~String>: - End IP address
        #       * 'host_routes'<~Array>: - Array of host routes
        #       * 'gateway_ip'<~String>: - Gateway IP address
        #       * 'ip_version'<~Integer>: - IP version, values 4 or 6
        #       * 'cidr'<~String>: - Cidr
        #       * 'enable_dhcp'<~Boolean>: - true or false, defaults to true
        def get_subnet(subnet_id)
          request(
            :expects => 200,
            :method  => 'GET',
            :path    => "subnets/#{subnet_id}"
          )
        end
      end

      class Mock
        def get_subnet(subnet_id)
          response = Excon::Response.new
          if subnet = list_subnets.body['subnets'].find {|_| _['id'] == subnet_id}
            response.status = 200
            response.body = { 'subnet' => subnet }
            response
          else
            raise Fog::HP::Network::NotFound
          end
        end
      end
    end
  end
end

Version data entries

29 entries across 29 versions & 4 rubygems

Version Path
fog-1.37.0 lib/fog/hp/requests/network/get_subnet.rb
fog-1.36.0 lib/fog/hp/requests/network/get_subnet.rb
fog-1.35.0 lib/fog/hp/requests/network/get_subnet.rb
fog-2.0.0.pre.0 lib/fog/hp/requests/network/get_subnet.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-1.32.0/lib/fog/hp/requests/network/get_subnet.rb
fog-1.34.0 lib/fog/hp/requests/network/get_subnet.rb
fog-1.33.0 lib/fog/hp/requests/network/get_subnet.rb
fog-1.32.0 lib/fog/hp/requests/network/get_subnet.rb
fog-1.31.0 lib/fog/hp/requests/network/get_subnet.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/hp/requests/network/get_subnet.rb
fog-1.30.0 lib/fog/hp/requests/network/get_subnet.rb
fog-1.29.0 lib/fog/hp/requests/network/get_subnet.rb
fog-1.28.0 lib/fog/hp/requests/network/get_subnet.rb
fog-1.27.0 lib/fog/hp/requests/network/get_subnet.rb
fog-1.26.0 lib/fog/hp/requests/network/get_subnet.rb
fog-1.25.0 lib/fog/hp/requests/network/get_subnet.rb
nsidc-fog-1.24.1 lib/fog/hp/requests/network/get_subnet.rb
fog-1.24.0 lib/fog/hp/requests/network/get_subnet.rb
ns-fog-1.22.11 lib/fog/hp/requests/network/get_subnet.rb
ns-fog-1.22.10 lib/fog/hp/requests/network/get_subnet.rb