Sha256: ef8e2f9b9132738447fa857401ce3f4f0b01e64457716c6b674e1706f6734199

Contents?: true

Size: 1.69 KB

Versions: 28

Compression:

Stored size: 1.69 KB

Contents

module Fog
  module Compute
    class Ecloud
      class Monitor < Fog::Ecloud::Model
        identity :href

        attribute :type, :aliases => :Type
        attribute :other_links, :aliases => :Links
        attribute :interval, :aliases => :Interval, :type => :integer
        attribute :response_timeout, :aliases => :ResponseTimeout, :type => :integer
        attribute :retries, :aliases => :Retries, :type => :integer
        attribute :downtime, :aliases => :Downtime, :type => :integer
        attribute :enabled, :aliases => :Enabled, :type => :boolean
        attribute :request_uri, :aliases => :RequestUri
        attribute :http_headers, :aliases => :HttpHeaders
        attribute :response_codes, :aliases => :ResponseCodes
        attribute :send_string, :aliases => :SendString
        attribute :receive_string, :aliases => :ReceiveString

        def edit(options = {})
          href = "/cloudapi/ecloud/internetServices/#{internet_service_id}/monitor?type="
          case type
          when "application/vnd.tmrk.cloud.pingMonitor"
            options[:uri] = href + "ping"
            data = service.monitors_edit_ping(options).body
          when "application/vnd.tmrk.cloud.httpMonitor"
            options[:uri] = href + "http"
            data = service.monitors_edit_http(options).body
          when "application/vnd.tmrk.cloud.ecvMonitor"
            options[:uri] = href + "ecv"
            data = service.monitors_edit_ecv(options).body
          end
          object = collection.from_data(data)
        end

        def internet_service_id
          other_links[:Link][:href].scan(/\d+/)[0]
        end

        def id
          href.scan(/\d+/)[0]
        end
      end
    end
  end
end

Version data entries

28 entries across 28 versions & 6 rubygems

Version Path
gapinc-fog-1.12.1.2.1 lib/fog/ecloud/models/compute/monitor.rb
fog-1.17.0 lib/fog/ecloud/models/compute/monitor.rb
fog-1.16.0 lib/fog/ecloud/models/compute/monitor.rb
fog-maestrodev-1.15.0.20130927082724 lib/fog/ecloud/models/compute/monitor.rb
fog-maestrodev-1.15.0.20130829165835 lib/fog/ecloud/models/compute/monitor.rb
fog-1.15.0 lib/fog/ecloud/models/compute/monitor.rb
gapinc-fog-1.14.0 lib/fog/ecloud/models/compute/monitor.rb
fog-maestrodev-1.14.0.20130806165225 lib/fog/ecloud/models/compute/monitor.rb
fog-1.14.0 lib/fog/ecloud/models/compute/monitor.rb
fog-1.13.0 lib/fog/ecloud/models/compute/monitor.rb
gapinc-fog-1.12.1.2 lib/fog/ecloud/models/compute/monitor.rb
gapinc-fog-1.12.1.1 lib/fog/ecloud/models/compute/monitor.rb
gapinc-fog-1.12.1a lib/fog/ecloud/models/compute/monitor.rb
gapinc-fog-1.12.1 lib/fog/ecloud/models/compute/monitor.rb
fog-1.12.1 lib/fog/ecloud/models/compute/monitor.rb
fog-1.12.0 lib/fog/ecloud/models/compute/monitor.rb
hpfog-0.0.20 lib/fog/ecloud/models/compute/monitor.rb
vagrant-shell-0.2.6 vendor/bundle/gems/fog-1.10.1/lib/fog/ecloud/models/compute/monitor.rb
vagrant-shell-0.2.5 vendor/bundle/gems/fog-1.10.1/lib/fog/ecloud/models/compute/monitor.rb
fog-1.11.1 lib/fog/ecloud/models/compute/monitor.rb