Class: Fog::Compute::Ecloud::InternetService
- Inherits:
-
Ecloud::Model
- Object
- Model
- Ecloud::Model
- Fog::Compute::Ecloud::InternetService
- Defined in:
- lib/fog/compute/ecloud/models/internet_service.rb
Instance Attribute Summary
Attributes inherited from Ecloud::Model
Instance Method Summary collapse
- #create_monitor(options = {}) ⇒ Object
- #delete ⇒ Object (also: #destroy)
- #disable_monitor ⇒ Object
- #edit(options) ⇒ Object
- #id ⇒ Object
- #monitors ⇒ Object
- #nodes ⇒ Object
- #ready? ⇒ Boolean
- #save ⇒ Object
Methods inherited from Ecloud::Model
Instance Method Details
#create_monitor(options = {}) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/fog/compute/ecloud/models/internet_service.rb', line 53 def create_monitor( = {}) = {:type => :default}.merge() case [:type] when :default data = service.monitors_create_default(href + "/action/createDefaultMonitor").body when :ping [:enabled] ||= true [:uri] = href + "/action/createPingMonitor" data = service.monitors_create_ping().body when :http [:uri] = href + "/action/createHttpMonitor" data = service.monitors_create_http().body when :ecv [:uri] = href + "/action/createEcvMonitor" data = service.monitors_create_ecv().body when :loopback data = service.monitors_create_loopback(href).body end monitor = Fog::Compute::Ecloud::Monitors.new(:service => service, :href => data[:href]) end |
#delete ⇒ Object Also known as: destroy
48 49 50 51 |
# File 'lib/fog/compute/ecloud/models/internet_service.rb', line 48 def delete data = service.internet_service_delete(href).body self.service.tasks.new(data) end |
#disable_monitor ⇒ Object
74 75 76 77 |
# File 'lib/fog/compute/ecloud/models/internet_service.rb', line 74 def disable_monitor data = service.monitors_disable(href + "/action/disableMonitor").body task = Fog::Compute::Ecloud::Tasks.new(:service => service, :href => data[:href]) end |
#edit(options) ⇒ Object
42 43 44 45 46 |
# File 'lib/fog/compute/ecloud/models/internet_service.rb', line 42 def edit() [:uri] = href data = service.internet_service_edit().body task = Fog::Compute::Ecloud::Tasks.new(:service => service, :href => data[:href])[0] end |
#id ⇒ Object
79 80 81 |
# File 'lib/fog/compute/ecloud/models/internet_service.rb', line 79 def id href.scan(/\d+/)[0] end |
#monitors ⇒ Object
29 30 31 |
# File 'lib/fog/compute/ecloud/models/internet_service.rb', line 29 def monitors @monitors ||= Fog::Compute::Ecloud::Monitors.new(:service => service, :href => "#{service.base_path}/internetServices/#{id}/monitor") end |
#nodes ⇒ Object
25 26 27 |
# File 'lib/fog/compute/ecloud/models/internet_service.rb', line 25 def nodes @nodes ||= Fog::Compute::Ecloud::Nodes.new(:service => service, :href => href) end |
#ready? ⇒ Boolean
21 22 23 |
# File 'lib/fog/compute/ecloud/models/internet_service.rb', line 21 def ready? !self.port.nil? end |
#save ⇒ Object
33 34 35 36 37 38 39 40 |
# File 'lib/fog/compute/ecloud/models/internet_service.rb', line 33 def save unless persisted? result = service.internet_service_create( collection.href, _compose_service_data ) merge_attributes(result.body) else service.configure_internet_service( href, _compose_service_data, _compose_ip_data ) end end |