class Fog::Compute::Google::GlobalForwardingRule
Public Instance Methods
destroy(async = true)
click to toggle source
# File lib/fog/compute/google/models/global_forwarding_rule.rb, line 34 def destroy(async = true) requires :identity data = service.delete_global_forwarding_rule(identity) operation = Fog::Compute::Google::Operations.new(:service => service) .get(data.name, nil, data.region) operation.wait_for { ready? } unless async operation end
ready?()
click to toggle source
# File lib/fog/compute/google/models/global_forwarding_rule.rb, line 54 def ready? service.get_global_forwarding_rule(name) true rescue ::Google::Apis::ClientError => e raise e unless e.status_code == 404 false end
reload()
click to toggle source
# File lib/fog/compute/google/models/global_forwarding_rule.rb, line 62 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/compute/google/models/global_forwarding_rule.rb, line 24 def save requires :identity data = service.insert_global_forwarding_rule(identity, attributes) operation = Fog::Compute::Google::Operations.new(:service => service) .get(data.name, nil, data.region) operation.wait_for { ready? } reload end
set_target(new_target)
click to toggle source
# File lib/fog/compute/google/models/global_forwarding_rule.rb, line 43 def set_target(new_target) requires :identity new_target = new_target.self_link unless new_target.class == String self.target = new_target service.set_global_forwarding_rule_target( identity, :target => new_target ) reload end