Sha256: 52e186d2fca29550897b8a04bf231fac3d77bb684e53e8efe68de0d928ca115f

Contents?: true

Size: 785 Bytes

Versions: 4

Compression:

Stored size: 785 Bytes

Contents

module Fog
  module Network
    class AzureRM
      # Real class for Network Request
      class Real
        def get_available_ipaddresses_count(subnet_name, address_prefix, ip_configurations_ids, express_route_enabled)
          Fog::Logger.debug "Getting free IP Address count of Subnet #{subnet_name}"
          total_ipaddresses = (2**(32 - address_prefix.split('/').last.to_i)) - 2
          total_ipaddresses -= 3 if express_route_enabled
          used_ip_address = ip_configurations_ids.nil? ? 0 : ip_configurations_ids.count
          total_ipaddresses - used_ip_address
        end
      end

      # Mock class for Network Request
      class Mock
        def get_available_ipaddress_count(*)
          65_531
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.1 lib/fog/azurerm/requests/network/get_available_ipaddresses_count.rb
fog-azure-rm-0.1.0 lib/fog/azurerm/requests/network/get_available_ipaddresses_count.rb
fog-azure-rm-0.0.9 lib/fog/azurerm/requests/network/get_available_ipaddresses_count.rb
fog-azure-rm-0.0.8 lib/fog/azurerm/requests/network/get_available_ipaddresses_count.rb