class Fog::Compute::Google::UrlMap
Constants
- RUNNING_STATE
Public Instance Methods
add_host_rules(rules_to_add, async = true)
click to toggle source
# File lib/fog/compute/google/models/url_map.rb, line 58 def add_host_rules(rules_to_add, async = true) requires :identity rules = (host_rules || []).concat rules_to_add data = service.patch_url_map(identity, :host_rules => rules) operation = Fog::Compute::Google::Operations.new(:service => service) .get(data.name) operation.wait_for { ready? } unless async reload end
add_path_matchers(matchers_to_add, rules_to_add, async = true)
click to toggle source
# File lib/fog/compute/google/models/url_map.rb, line 70 def add_path_matchers(matchers_to_add, rules_to_add, async = true) requires :identity matchers = (path_matchers || []) + matchers_to_add rules = (host_rules || []) + rules_to_add data = service.patch_url_map(identity, :host_rules => rules, :path_matchers => matchers) operation = Fog::Compute::Google::Operations.new(:service => service) .get(data.name) operation.wait_for { ready? } unless async reload end
destroy(async = true)
click to toggle source
# File lib/fog/compute/google/models/url_map.rb, line 43 def destroy(async = true) requires :identity data = service.delete_url_map(identity) operation = Fog::Compute::Google::Operations.new(:service => service) .get(data.name) operation.wait_for { ready? } unless async operation end
invalidate_cache(path, host = nil, async = true)
click to toggle source
# File lib/fog/compute/google/models/url_map.rb, line 85 def invalidate_cache(path, host = nil, async = true) requires :identity data = service.invalidate_url_map_cache(identity, path, host) operation = Fog::Compute::Google::Operations.new(:service => service) .get(data.name) operation.wait_for { ready? } unless async operation end
ready?()
click to toggle source
# File lib/fog/compute/google/models/url_map.rb, line 95 def ready? service.get_url_map(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/url_map.rb, line 103 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/url_map.rb, line 18 def save requires :identity, :default_service options = { :default_service => default_service, :description => description, :fingerprint => fingerprint, :host_rules => host_rules, :path_matchers => path_matchers, :tests => tests } # Update if creation_timestamp is set, create url map otherwise. data = nil if creation_timestamp data = service.update_url_map(identity, options) else data = service.insert_url_map(identity, options) end operation = Fog::Compute::Google::Operations.new(:service => service) .get(data.name) operation.wait_for { ready? } reload end
validate()
click to toggle source
# File lib/fog/compute/google/models/url_map.rb, line 53 def validate requires :identity service.validate_url_map(identity, attributes) end