Class: Fog::Compute::Google::TargetHttpProxy
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Google::TargetHttpProxy
- Defined in:
- lib/fog/compute/google/models/target_http_proxy.rb
Constant Summary collapse
- RUNNING_STATE =
"READY".freeze
Instance Method Summary collapse
- #destroy(async = true) ⇒ Object
- #ready? ⇒ Boolean
- #reload ⇒ Object
- #save ⇒ Object
- #set_url_map(url_map) ⇒ Object
Instance Method Details
#destroy(async = true) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/fog/compute/google/models/target_http_proxy.rb', line 28 def destroy(async = true) requires :name operation = service.delete_target_http_proxy(name) 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? ⇒ Boolean
46 47 48 49 50 51 |
# File 'lib/fog/compute/google/models/target_http_proxy.rb', line 46 def ready? service.get_target_http_proxy(name) true rescue Fog::Errors::NotFound false end |
#reload ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/fog/compute/google/models/target_http_proxy.rb', line 53 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
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/fog/compute/google/models/target_http_proxy.rb', line 14 def save requires :name = { "description" => description, "urlMap" => url_map } data = service.insert_target_http_proxy(name, ).body operation = Fog::Compute::Google::Operations.new(:service => service).get(data["name"], data["zone"]) operation.wait_for { !pending? } reload end |
#set_url_map(url_map) ⇒ Object
41 42 43 44 |
# File 'lib/fog/compute/google/models/target_http_proxy.rb', line 41 def set_url_map(url_map) service.set_target_http_proxy_url_map(self, url_map) reload end |