class Fog::Compute::Google::TargetPool
Constants
- RUNNING_STATE
Public Instance Methods
add_health_check(health_check)
click to toggle source
# File lib/fog/compute/google/models/target_pool.rb, line 64 def add_health_check(health_check) health_check = health_check.self_link unless health_check.class == String service.add_target_pool_health_checks(self, [health_check]) reload end
add_instance(instance)
click to toggle source
# File lib/fog/compute/google/models/target_pool.rb, line 52 def add_instance(instance) instance = instance.self_link unless instance.class == String service.add_target_pool_instances(self, [instance]) reload end
destroy(async = true)
click to toggle source
# File lib/fog/compute/google/models/target_pool.rb, line 38 def destroy(async = true) requires :name, :region operation = service.delete_target_pool(name, region) unless async # wait until "DONE" to ensure the operation doesn't fail, raises # exception on error Fog.wait_for do operation = service.get_region_operation(region, operation.body["name"]) operation.body["status"] == "DONE" end end operation end
get_health()
click to toggle source
# File lib/fog/compute/google/models/target_pool.rb, line 76 def get_health service.get_target_pool_health self end
ready?()
click to toggle source
# File lib/fog/compute/google/models/target_pool.rb, line 80 def ready? service.get_target_pool(name, region) true rescue Fog::Errors::NotFound false end
region_name()
click to toggle source
# File lib/fog/compute/google/models/target_pool.rb, line 87 def region_name region.nil? ? nil : region.split("/")[-1] end
reload()
click to toggle source
# File lib/fog/compute/google/models/target_pool.rb, line 91 def reload requires :name, :region return unless data = begin collection.get(name, region) rescue Excon::Errors::SocketError nil end new_attributes = data.attributes merge_attributes(new_attributes) self end
remove_health_check(health_check)
click to toggle source
# File lib/fog/compute/google/models/target_pool.rb, line 70 def remove_health_check(health_check) health_check = health_check.self_link unless health_check.class == String service.remove_target_pool_health_checks(self, [health_check]) reload end
remove_instance(instance)
click to toggle source
# File lib/fog/compute/google/models/target_pool.rb, line 58 def remove_instance(instance) instance = instance.self_link unless instance.class == String service.remove_target_pool_instances(self, [instance]) reload end
save()
click to toggle source
# File lib/fog/compute/google/models/target_pool.rb, line 19 def save requires :name, :region options = { "description" => description, "region" => region, "healthChecks" => health_checks, "instances" => instances, "sessionAffinity" => session_affinity, "failoverRatio" => failover_ratio, "backupPool" => backup_pool } data = service.insert_target_pool(name, region, options).body operation = Fog::Compute::Google::Operations.new(:service => service).get(data["name"], nil, data["region"]) operation.wait_for { !pending? } reload end