Sha256: ab0277f0bcfd1a88bcc559da93d856ee71fcc9f39849e88844156116491d6989

Contents?: true

Size: 1.69 KB

Versions: 64

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 = "#{service.base_path}/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

64 entries across 62 versions & 7 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-ecloud-0.3.0/lib/fog/compute/ecloud/models/monitor.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-ecloud-0.3.0/lib/fog/compute/ecloud/models/monitor.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-ecloud-0.3.0/lib/fog/compute/ecloud/models/monitor.rb
vagrant-cloudstack-1.2.0 vendor/bundle/gems/fog-ecloud-0.1.1/lib/fog/compute/ecloud/models/monitor.rb
fog-ecloud-0.3.0 lib/fog/compute/ecloud/models/monitor.rb
fog-ecloud-0.2.0 lib/fog/compute/ecloud/models/monitor.rb
fog-ecloud-0.1.3 lib/fog/compute/ecloud/models/monitor.rb
fog-ecloud-0.1.2 lib/fog/compute/ecloud/models/monitor.rb
vagrant-cloudstack-1.1.0 vendor/bundle/gems/fog-1.22.1/lib/fog/ecloud/models/compute/monitor.rb
fog-ecloud-0.1.1 lib/fog/compute/ecloud/models/monitor.rb
fog-ecloud-0.1.0 lib/fog/compute/ecloud/models/monitor.rb
fog-ecloud-0.0.2 lib/fog/ecloud/models/compute/monitor.rb
fog-ecloud-0.0.1 lib/fog/ecloud/models/compute/monitor.rb
fog-1.25.0 lib/fog/ecloud/models/compute/monitor.rb
nsidc-fog-1.24.1 lib/fog/ecloud/models/compute/monitor.rb
fog-1.24.0 lib/fog/ecloud/models/compute/monitor.rb
ns-fog-1.22.11 lib/fog/ecloud/models/compute/monitor.rb
ns-fog-1.22.10 lib/fog/ecloud/models/compute/monitor.rb
ns-fog-1.22.9 lib/fog/ecloud/models/compute/monitor.rb
ns-fog-1.22.8 lib/fog/ecloud/models/compute/monitor.rb