Class: Fog::Compute::Google::HttpHealthCheck
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Google::HttpHealthCheck
- Defined in:
- lib/fog/google/models/compute/http_health_check.rb
Constant Summary collapse
- RUNNING_STATE =
"READY"
Instance Method Summary collapse
Instance Method Details
#destroy(async = true) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/fog/google/models/compute/http_health_check.rb', line 43 def destroy(async=true) requires :name operation = service.delete_http_health_check(name) if not async # wait until "DONE" to ensure the operation doesn't fail, raises # exception on error Fog.wait_for do operation = service.get_global_operation(operation.body["name"]) operation.body["status"] == "DONE" end end operation end |
#ready? ⇒ Boolean
58 59 60 61 62 63 64 65 |
# File 'lib/fog/google/models/compute/http_health_check.rb', line 58 def ready? begin service.get_http_health_check(self.name) true rescue Fog::Errors::NotFound false end end |
#reload ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/fog/google/models/compute/http_health_check.rb', line 67 def reload requires :name return unless data = begin collection.get(name) rescue Excon::Errors::SocketError nil end new_attributes = data.attributes merge_attributes(new_attributes) self end |
#save ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/fog/google/models/compute/http_health_check.rb', line 24 def save requires :name = { 'description' => description, 'host' => host, 'requestPath' => request_path || "/", 'port' => port || 80, 'checkIntervalSec' => check_interval_sec || 5, 'timeoutSec' => timeout_sec || 5, 'unhealthyThreshold' => unhealthy_threshold || 2, 'healthyThreshold' => healthy_threshold || 2, } service.insert_http_health_check(name, ).body data = service.backoff_if_unfound {service.get_http_health_check(name).body} merge_attributes(data) end |