Class: Fog::Compute::Google::Firewall

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/compute/google/models/firewall.rb

Overview

Represents a Firewall resource

Instance Method Summary collapse

Instance Method Details

#createObject


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

#saveObject


28
29
30
31
32
# File 'lib/fog/compute/google/models/firewall.rb', line 28

def save
  requires :identity

  id.nil? ? create : update
end

#updateObject


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