Sha256: bf2ad5efc7e82ec819c7ad1f4d7428f28c237c236aad1f2114604cc5ac42b34d

Contents?: true

Size: 1.55 KB

Versions: 2

Compression:

Stored size: 1.55 KB

Contents

# coding: utf-8
#
# Author:: Dangleterre Michaël
# © Copyright ArubaCloud.
#
# LICENSE: MIT (http://opensource.org/licenses/MIT)
#

require 'fog/arubacloud/service'
require 'fog/arubacloud/error'
require 'benchmark'


module Fog
  module ArubaCloud
    class Compute
      class Real
        def add_instance(data)
          body = self.body('SetEnqueueLoadBalancerAddInstances').merge(
              :Instances => {
                  :loadBalancerID => data[:id],
                  :Instances => [
                      {
                          :LoadBalancerInstance => [
                              {
                                  :IPAddress => data[:ipaddress]
                              }
                          ]
                      }
                  ]
              }
          )
          response = nil
          time = Benchmark.realtime {
            response = request(body, 'SetEnqueueLoadBalancerAddInstances', 'SetEnqueueLoadBalancerAddInstances Error')
          }
          Fog::Logger.debug("SetEnqueueLoadBalancerAddInstances time: #{time}")
          if response['Success']
            response
          else
            raise Fog::ArubaCloud::Errors::RequestError.new('Error during the request.')
          end
        end # add_instance

        class Mock
          def add_instance
            raise Fog::Errors::MockNotImplemented.new(
                      'Mock not implemented. Feel free to contribute.'
                  )
          end # add_instance
        end # Mock
      end # Real

    end # Compute
  end # ArubaCloud
end # Fog

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-arubacloud-0.0.6 lib/fog/arubacloud/compute/requests/add_instance.rb
fog-arubacloud-0.0.5 lib/fog/arubacloud/compute/requests/add_instance.rb