Class: Fog::Compute::Google::UrlMap
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Google::UrlMap
- Defined in:
- lib/fog/google/models/compute/url_map.rb
Constant Summary collapse
- RUNNING_STATE =
"READY"
Instance Method Summary collapse
- #add_host_rules(hostRules) ⇒ Object
- #add_path_matchers(pathMatchers, hostRules) ⇒ Object
- #destroy(async = true) ⇒ Object
- #ready? ⇒ Boolean
- #reload ⇒ Object
- #save ⇒ Object
- #validate ⇒ Object
Instance Method Details
#add_host_rules(hostRules) ⇒ Object
55 56 57 58 59 |
# File 'lib/fog/google/models/compute/url_map.rb', line 55 def add_host_rules hostRules hostRules= [hostRules] unless hostRules.class == Array service.update_url_map(self, hostRules) reload end |
#add_path_matchers(pathMatchers, hostRules) ⇒ Object
61 62 63 64 65 66 |
# File 'lib/fog/google/models/compute/url_map.rb', line 61 def add_path_matchers(pathMatchers, hostRules) pathMatchers = [pathMatchers] unless pathMatchers.class == Array hostRules=[hostRules] unless hostRules.class == Array service.update_url_map(self, hostRules, pathMatchers) reload end |
#destroy(async = true) ⇒ Object
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/fog/google/models/compute/url_map.rb', line 38 def destroy(async=true) requires :name operation = service.delete_url_map(name) if not async Fog.wait_for do operation = service.get_global_operation(operation.body["name"]) operation.body["status"] == "DONE" end end operation end |
#ready? ⇒ Boolean
68 69 70 71 72 73 74 75 |
# File 'lib/fog/google/models/compute/url_map.rb', line 68 def ready? begin service.get_url_map(self.name) true rescue Fog::Errors::NotFound false end end |
#reload ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/fog/google/models/compute/url_map.rb', line 77 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 ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/fog/google/models/compute/url_map.rb', line 20 def save requires :name, :defaultService = { 'defaultService' => defaultService, 'description' => description, 'fingerprint' => fingerprint, 'hostRules' => hostRules, 'pathMatchers' => pathMatchers, 'tests' => tests } data = service.insert_url_map(name, ).body operation = Fog::Compute::Google::Operations.new(:service => service).get(data['name']) operation.wait_for { !pending? } reload end |
#validate ⇒ Object
51 52 53 |
# File 'lib/fog/google/models/compute/url_map.rb', line 51 def validate service.validate_url_map self end |