Sha256: 9c48ec0fe0332515483027ecf43b681e73835ec93d6ca11df8d5e2053a9e5534

Contents?: true

Size: 1.6 KB

Versions: 4

Compression:

Stored size: 1.6 KB

Contents

module Fog
  module Network
    class HuaweiCloud
      class Real
        def update_lbaas_healthmonitor(healthmonitor_id, options = {})
          data = {'healthmonitor' => {}}

          vanilla_options = [:name, :delay, :timeout, :max_retries, :http_method, :url_path, :expected_codes, :admin_state_up]
          vanilla_options.select { |o| options.key?(o) }.each do |key|
            data['healthmonitor'][key] = options[key]
          end

          request(
            :body    => Fog::JSON.encode(data),
            :expects => 200,
            :method  => 'PUT',
            :path    => "lbaas/healthmonitors/#{healthmonitor_id}"
          )
        end
      end

      class Mock
        def update_lbaas_healthmonitor(healthmonitor_id, options = {})
          response = Excon::Response.new
          if healthmonitor = list_lbaas_health_monitors.body['healthmonitors'].find { |_| _['id'] == healthmonitor_id }
            healthmonitor['delay']          = options[:delay]
            healthmonitor['timeout']        = options[:timeout]
            healthmonitor['max_retries']    = options[:max_retries]
            healthmonitor['http_method']    = options[:http_method]
            healthmonitor['url_path']       = options[:url_path]
            healthmonitor['expected_codes'] = options[:expected_codes]
            healthmonitor['admin_state_up'] = options[:admin_state_up]
            response.body = {'healthmonitor' => healthmonitor}
            response.status = 200
            response
          else
            raise Fog::Network::HuaweiCloud::NotFound
          end
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fog-huaweicloud-0.0.3 lib/fog/network/huaweicloud/requests/update_lbaas_healthmonitor.rb
fog-huaweicloud-0.0.2 lib/fog/network/huaweicloud/requests/update_lbaas_healthmonitor.rb
fog-huaweicloud-0.1.3 lib/fog/network/huaweicloud/requests/update_lbaas_healthmonitor.rb
fog-huaweicloud-0.1.2 lib/fog/network/huaweicloud/requests/update_lbaas_healthmonitor.rb