Sha256: 6a08206164e2ea6c8f3a16187bf39f8cada500a3a0f3da0827e9c85423aa31d3

Contents?: true

Size: 1.73 KB

Versions: 39

Compression:

Stored size: 1.73 KB

Contents

module Fog
  module Network
    class OpenStack
      class Real
        def create_lb_health_monitor(type, delay, timeout, max_retries, options = {})
          data = {
            'health_monitor' => {
              'type'        => type,
              'delay'       => delay,
              'timeout'     => timeout,
              'max_retries' => max_retries
            }
          }

          vanilla_options = [:http_method, :url_path, :expected_codes, :admin_state_up, :tenant_id]
          vanilla_options.reject { |o| options[o].nil? }.each do |key|
            data['health_monitor'][key] = options[key]
          end

          request(
            :body    => Fog::JSON.encode(data),
            :expects => [201],
            :method  => 'POST',
            :path    => 'lb/health_monitors'
          )
        end
      end

      class Mock
        def create_lb_health_monitor(type, delay, timeout, max_retries, options = {})
          response = Excon::Response.new
          response.status = 201
          data = {
            'id'             => Fog::Mock.random_numbers(6).to_s,
            'type'           => type,
            'delay'          => delay,
            'timeout'        => timeout,
            'max_retries'    => max_retries,
            'http_method'    => options[:http_method],
            'url_path'       => options[:url_path],
            'expected_codes' => options[:expected_codes],
            'status'         => 'ACTIVE',
            'admin_state_up' => options[:admin_state_up],
            'tenant_id'      => options[:tenant_id],
          }

          self.data[:lb_health_monitors][data['id']] = data
          response.body = {'health_monitor' => data}
          response
        end
      end
    end
  end
end

Version data entries

39 entries across 37 versions & 3 rubygems

Version Path
fog-openstack-0.1.31 lib/fog/network/openstack/requests/create_lb_health_monitor.rb
fog-openstack-0.3.10 lib/fog/network/openstack/requests/create_lb_health_monitor.rb
fog-openstack-0.1.30 lib/fog/network/openstack/requests/create_lb_health_monitor.rb
fog-openstack-0.1.29 lib/fog/network/openstack/requests/create_lb_health_monitor.rb
fog-openstack-0.3.9 lib/fog/network/openstack/requests/create_lb_health_monitor.rb
fog-openstack-0.1.28 lib/fog/network/openstack/requests/create_lb_health_monitor.rb
fog-openstack-0.3.8 lib/fog/network/openstack/requests/create_lb_health_monitor.rb
fog-openstack-0.3.7 lib/fog/network/openstack/requests/create_lb_health_monitor.rb
fog-openstack-0.3.6 lib/fog/network/openstack/requests/create_lb_health_monitor.rb
fog-openstack-0.3.5 lib/fog/network/openstack/requests/create_lb_health_monitor.rb
fog-openstack-0.3.4 lib/fog/network/openstack/requests/create_lb_health_monitor.rb
fog-openstack-0.3.3 lib/fog/network/openstack/requests/create_lb_health_monitor.rb
fog-openstack-0.3.2 lib/fog/network/openstack/requests/create_lb_health_monitor.rb
fog-openstack-0.3.0 lib/fog/network/openstack/requests/create_lb_health_monitor.rb
fog-openstack-0.2.4 lib/fog/network/openstack/requests/create_lb_health_monitor.rb
fog-openstack-0.2.3 lib/fog/network/openstack/requests/create_lb_health_monitor.rb
fog-openstack-0.2.2 lib/fog/network/openstack/requests/create_lb_health_monitor.rb
fog-openstack-0.2.1 lib/fog/network/openstack/requests/create_lb_health_monitor.rb
fog-openstack-0.2.0 lib/fog/network/openstack/requests/create_lb_health_monitor.rb
fog-zj-0.1.28 lib/fog/network/openstack/requests/create_lb_health_monitor.rb