class Fog::Compute::Ecloud::InternetService

Public Instance Methods

create_monitor(options = {}) click to toggle source
# File lib/fog/ecloud/models/compute/internet_service.rb, line 49
def create_monitor(options = {})
  options = {:type => :default}.merge(options)
  case options[:type]
  when :default
    data = connection.monitors_create_default(href + "/action/createDefaultMonitor").body
  when :ping
    options[:enabled] ||= true
    options[:uri] = href + "/action/createPingMonitor"
    data = connection.monitors_create_ping(options).body
  when :http
    options[:uri] = href + "/action/createHttpMonitor"
    data = connection.monitors_create_http(options).body
  when :ecv
    options[:uri] = href + "/action/createEcvMonitor"
    data = connection.monitors_create_ecv(options).body
  when :loopback
    data = connection.monitors_create_loopback(href).body
  end
  monitor = Fog::Compute::Ecloud::Monitors.new(:connection => connection, :href => data[:href])
end
delete() click to toggle source
# File lib/fog/ecloud/models/compute/internet_service.rb, line 44
def delete
  data = connection.internet_service_delete(href).body
  task = Fog::Compute::Ecloud::Tasks.new(:connection => connection, :href => data[:href])[0]
end
disable_monitor() click to toggle source
# File lib/fog/ecloud/models/compute/internet_service.rb, line 70
def disable_monitor
  data = connection.monitors_disable(href + "/action/disableMonitor").body
  task = Fog::Compute::Ecloud::Tasks.new(:connection => connection, :href => data[:href])
end
edit(options) click to toggle source
# File lib/fog/ecloud/models/compute/internet_service.rb, line 38
def edit(options)
  options[:uri] = href
  data = connection.internet_service_edit(options).body
  task = Fog::Compute::Ecloud::Tasks.new(:connection => connection, :href => data[:href])[0]
end
id() click to toggle source
# File lib/fog/ecloud/models/compute/internet_service.rb, line 75
def id
  href.scan(/\d+/)[0]
end
monitors() click to toggle source
# File lib/fog/ecloud/models/compute/internet_service.rb, line 25
def monitors
  @monitors ||= Fog::Compute::Ecloud::Monitors.new(:connection => connection, :href => "/cloudapi/ecloud/internetServices/#{id}/monitor") 
end
nodes() click to toggle source
# File lib/fog/ecloud/models/compute/internet_service.rb, line 21
def nodes
  @nodes ||= Fog::Compute::Ecloud::Nodes.new(:connection => connection, :href => href)
end
save() click to toggle source
# File lib/fog/ecloud/models/compute/internet_service.rb, line 29
def save
  if new_record?
    result = connection.internet_service_create( collection.href, _compose_service_data )
    merge_attributes(result.body)
  else
    connection.configure_internet_service( href, _compose_service_data, _compose_ip_data )
  end
end

Private Instance Methods

_compose_service_data() click to toggle source
# File lib/fog/ecloud/models/compute/internet_service.rb, line 81
def _compose_service_data
  #For some reason inject didn't work
  service_data = {}
  self.class.attributes.select{ |attribute| attribute != :backup_service_data }.each { |attribute| service_data[attribute] = send(attribute) }
  service_data.reject! {|k, v| v.nil? }
  service_data
end