class Fog::Compute::Google::TargetInstance
Constants
- RUNNING_STATE
Public Instance Methods
destroy(async = true)
click to toggle source
# File lib/fog/compute/google/models/target_instance.rb, line 32 def destroy(async = true) requires :name, :zone operation = service.delete_target_instance(name, zone) unless async # wait until "DONE" to ensure the operation doesn't fail, raises # exception on error Fog.wait_for do operation.body["status"] == "DONE" end end operation end
ready?()
click to toggle source
# File lib/fog/compute/google/models/target_instance.rb, line 45 def ready? service.get_target_instance(name, zone) true rescue Fog::Errors::NotFound false end
reload()
click to toggle source
# File lib/fog/compute/google/models/target_instance.rb, line 52 def reload requires :name, :zone begin data = collection.get(name, zone) new_attributes = data.attributes merge_attributes(new_attributes) return self rescue Excon::Errors::SocketError return nil end end
save()
click to toggle source
# File lib/fog/compute/google/models/target_instance.rb, line 16 def save requires :name, :zone options = { "description" => description, "zone" => zone, "natPolicy" => nat_policy, "instance" => instance } data = service.insert_target_instance(name, zone, options) operation = Fog::Compute::Google::Operations.new(:service => service).get(data.body["name"], data.body["zone"]) operation.wait_for { !pending? } reload end