Class: Fog::Compute::Google::Firewall
- Inherits:
-
Model
- Object
- Model
- Fog::Compute::Google::Firewall
- Defined in:
- lib/fog/compute/google/models/firewall.rb
Overview
Represents a Firewall resource
Instance Method Summary collapse
- #create ⇒ Object
- #destroy(async = true) ⇒ Object
- #patch(diff = {}) ⇒ Object
- #save ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/fog/compute/google/models/firewall.rb', line 34 def create data = service.insert_firewall(identity, attributes) operation = Fog::Compute::Google::Operations.new(:service => service) .get(data.name) operation.wait_for { !pending? } reload end |
#destroy(async = true) ⇒ Object
62 63 64 65 66 67 68 69 70 |
# File 'lib/fog/compute/google/models/firewall.rb', line 62 def destroy(async = true) requires :identity data = service.delete_firewall(identity) operation = Fog::Compute::Google::Operations.new(:service => service) .get(data.name) operation.wait_for { ready? } unless async operation end |
#patch(diff = {}) ⇒ Object
52 53 54 55 56 57 58 59 60 |
# File 'lib/fog/compute/google/models/firewall.rb', line 52 def patch(diff = {}) requires :identity data = service.patch_firewall(identity, diff) operation = Fog::Compute::Google::Operations.new(:service => service) .get(data.name) operation.wait_for { !pending? } reload end |
#save ⇒ Object
28 29 30 31 32 |
# File 'lib/fog/compute/google/models/firewall.rb', line 28 def save requires :identity id.nil? ? create : update end |
#update ⇒ Object
42 43 44 45 46 47 48 49 50 |
# File 'lib/fog/compute/google/models/firewall.rb', line 42 def update requires :identity, :allowed, :network data = service.update_firewall(identity, attributes) operation = Fog::Compute::Google::Operations.new(:service => service) .get(data.name) operation.wait_for { !pending? } reload end |