Sha256: 004e618ce85c070e87cdae717bdba0f2e00625a23d01c1534f0005c06262559e

Contents?: true

Size: 1.46 KB

Versions: 27

Compression:

Stored size: 1.46 KB

Contents

module Fog
  module Compute
    class Ecloud
      class Real
        def get_virtual_machine_assigned_ips(virtual_machine_id)
          request(
            :uri => "#{base_path}/virtualmachines/#{virtual_machine_id}/assignedips",
            :parse   => true
          )
        end
      end

      class Mock
        def get_virtual_machine_assigned_ips(virtual_machine_id)
          server         = self.data[:servers][virtual_machine_id.to_i]
          compute_pool   = self.data[:compute_pools][server[:compute_pool_id]]
          environment_id = compute_pool[:environment_id]
          environment    = self.data[:environments][environment_id]

          networks = self.data[:networks].values.select{|n| n[:environment_id] == environment_id}
          networks = networks.map{|n| deep_copy(Fog::Ecloud.slice(n, :environment, :id))}

          networks.each do |network|
            address = network[:IpAddresses][:IpAddress].map{|ia| ia[:name]}
            network[:IpAddresses][:IpAddress] = address.first
          end

          body = {
            :href  => "/cloudapi/ecloud/virtualMachines/#{virtual_machine_id}/assignedIps",
            :type  => "application/vnd.tmrk.cloud.network",
            :Links => {
              :Link => Fog::Ecloud.keep(environment, :name, :href, :type)
            },
            :Networks => {:Network => (networks.size > 1 ? networks : networks.first)},
          }

          response(:body =>  body)
        end
      end
    end
  end
end

Version data entries

27 entries across 25 versions & 6 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-ecloud-0.3.0/lib/fog/compute/ecloud/requests/get_virtual_machine_assigned_ips.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-ecloud-0.3.0/lib/fog/compute/ecloud/requests/get_virtual_machine_assigned_ips.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-ecloud-0.3.0/lib/fog/compute/ecloud/requests/get_virtual_machine_assigned_ips.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-ecloud-0.1.1/lib/fog/compute/ecloud/requests/get_virtual_machine_assigned_ips.rb
fog-ecloud-0.3.0 lib/fog/compute/ecloud/requests/get_virtual_machine_assigned_ips.rb
fog-ecloud-0.2.0 lib/fog/compute/ecloud/requests/get_virtual_machine_assigned_ips.rb
fog-ecloud-0.1.3 lib/fog/compute/ecloud/requests/get_virtual_machine_assigned_ips.rb
fog-ecloud-0.1.2 lib/fog/compute/ecloud/requests/get_virtual_machine_assigned_ips.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/ecloud/requests/compute/get_virtual_machine_assigned_ips.rb
fog-ecloud-0.1.1 lib/fog/compute/ecloud/requests/get_virtual_machine_assigned_ips.rb
fog-ecloud-0.1.0 lib/fog/compute/ecloud/requests/get_virtual_machine_assigned_ips.rb
fog-ecloud-0.0.2 lib/fog/ecloud/requests/compute/get_virtual_machine_assigned_ips.rb
fog-ecloud-0.0.1 lib/fog/ecloud/requests/compute/get_virtual_machine_assigned_ips.rb
fog-1.25.0 lib/fog/ecloud/requests/compute/get_virtual_machine_assigned_ips.rb
nsidc-fog-1.24.1 lib/fog/ecloud/requests/compute/get_virtual_machine_assigned_ips.rb
fog-1.24.0 lib/fog/ecloud/requests/compute/get_virtual_machine_assigned_ips.rb
ns-fog-1.22.11 lib/fog/ecloud/requests/compute/get_virtual_machine_assigned_ips.rb
ns-fog-1.22.10 lib/fog/ecloud/requests/compute/get_virtual_machine_assigned_ips.rb
ns-fog-1.22.9 lib/fog/ecloud/requests/compute/get_virtual_machine_assigned_ips.rb
ns-fog-1.22.8 lib/fog/ecloud/requests/compute/get_virtual_machine_assigned_ips.rb