Sha256: 9a809a1b7f5f7b39bfbfd8b669662907fd99bb96efdb9e84f97df9dcd5aee99d

Contents?: true

Size: 1.57 KB

Versions: 38

Compression:

Stored size: 1.57 KB

Contents

module Fog
  module Rackspace
    class Monitoring
      class Real

        def create_check(entity_id, options = {})
          data = options.dup
          request(
            :body     => JSON.encode(data),
            :expects  => [201],
            :method   => 'POST',
            :path     => "entities/#{entity_id}/checks"
          )
        end
      end

      class Mock
        def create_check(entity_id, options = {})

          account_id = Fog::Mock.random_numbers(6).to_s
          mock_id = Fog::Mock.random_letters(10).to_s
          
          if options[:type] == ""
            raise Fog::Rackspace::Monitoring::BadRequest
          end

          response = Excon::Response.new
          response.status = 201
          response.body = ""
          response.headers = {
            "Date"                  => Time.now.utc.to_s,
            "Location"              => "https://monitoring.api.rackspacecloud.com/v1.0/" + account_id + "/" + entity_id + "/checks/" + mock_id,
            "X-Object-ID"           => mock_id,
            "X-RateLimit-Limit"     => "50000",
            "X-RateLimit-Remaining" => "49627",
            "X-RateLimit-Window"    => "24 hours",
            "X-RateLimit-Type"      => "global",
            "X-Response-Id"         => "knvlknvosnd20038hgouwvn9nv",
            "X-LB"                  => "ord1-maas-prod-api1",
            "Content-Length"        => "0",
            "Content-Type"          => "text/plain",
          }
          response.remote_ip = Fog::Rackspace::MockData.ipv4_address
          response
        end
      end
    end
  end
end

Version data entries

38 entries across 38 versions & 2 rubygems

Version Path
fog-maestrodev-1.18.0.20131205181604 lib/fog/rackspace/requests/monitoring/create_check.rb
fog-maestrodev-1.18.0.20131127194823 lib/fog/rackspace/requests/monitoring/create_check.rb
fog-maestrodev-1.18.0.20131126183714 lib/fog/rackspace/requests/monitoring/create_check.rb
fog-maestrodev-1.18.0.20131126122111 lib/fog/rackspace/requests/monitoring/create_check.rb
fog-maestrodev-1.18.0.20131125111730 lib/fog/rackspace/requests/monitoring/create_check.rb
fog-maestrodev-1.18.0.20131125083406 lib/fog/rackspace/requests/monitoring/create_check.rb
fog-maestrodev-1.18.0.20131123105121 lib/fog/rackspace/requests/monitoring/create_check.rb
fog-maestrodev-1.18.0.20131122203507 lib/fog/rackspace/requests/monitoring/create_check.rb
fog-maestrodev-1.18.0.20131121075022 lib/fog/rackspace/requests/monitoring/create_check.rb
fog-maestrodev-1.18.0.20131118164830 lib/fog/rackspace/requests/monitoring/create_check.rb
fog-maestrodev-1.18.0.20131115184302 lib/fog/rackspace/requests/monitoring/create_check.rb
fog-maestrodev-1.18.0.20131114200144 lib/fog/rackspace/requests/monitoring/create_check.rb
fog-maestrodev-1.18.0.20131112185232 lib/fog/rackspace/requests/monitoring/create_check.rb
fog-maestrodev-1.18.0.20131111203459 lib/fog/rackspace/requests/monitoring/create_check.rb
fog-1.18.0 lib/fog/rackspace/requests/monitoring/create_check.rb
fog-1.17.0 lib/fog/rackspace/requests/monitoring/create_check.rb
fog-1.16.0 lib/fog/rackspace/requests/monitoring/create_check.rb
fog-maestrodev-1.15.0.20130927082724 lib/fog/rackspace/requests/monitoring/create_check.rb