class Fog::Compute::Google::HttpHealthCheck

Constants

RUNNING_STATE

Public Instance Methods

destroy(async=true) click to toggle source
# File lib/fog/google/models/compute/http_health_check.rb, line 41
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?() click to toggle source
# File lib/fog/google/models/compute/http_health_check.rb, line 56
def ready?
  begin
    service.get_http_health_check(self.name)
    true
  rescue Fog::Errors::NotFound
    false
  end
end
reload() click to toggle source
# File lib/fog/google/models/compute/http_health_check.rb, line 65
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() click to toggle source
# File lib/fog/google/models/compute/http_health_check.rb, line 22
def save
  requires :name

  options = {
    '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, options).body
  data = service.backoff_if_unfound {service.get_http_health_check(name).body}
  merge_attributes(data)
end