Class: Fog::Compute::Brightbox::FirewallPolicy
- Defined in:
- lib/rackspace-fog/brightbox/models/compute/firewall_policy.rb
Instance Attribute Summary
Attributes inherited from Model
Instance Method Summary collapse
- #apply_to(server_group_id) ⇒ Object
- #destroy ⇒ Object
- #remove(server_group_id) ⇒ Object
-
#save ⇒ Object
Sticking with existing Fog behaviour, save does not update but creates a new resource.
Methods inherited from Model
#initialize, #inspect, #reload, #symbolize_keys, #to_json, #wait_for
Methods included from Attributes::ClassMethods
#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes
Methods included from Attributes::InstanceMethods
#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one
Constructor Details
This class inherits a constructor from Fog::Model
Instance Method Details
#apply_to(server_group_id) ⇒ Object
35 36 37 38 39 40 41 42 43 |
# File 'lib/rackspace-fog/brightbox/models/compute/firewall_policy.rb', line 35 def apply_to(server_group_id) requires :identity = { :server_group => server_group_id } data = connection.apply_to_firewall_policy(identity, ) merge_attributes(data) true end |
#destroy ⇒ Object
55 56 57 58 59 |
# File 'lib/rackspace-fog/brightbox/models/compute/firewall_policy.rb', line 55 def destroy requires :identity data = connection.destroy_firewall_policy(identity) true end |
#remove(server_group_id) ⇒ Object
45 46 47 48 49 50 51 52 53 |
# File 'lib/rackspace-fog/brightbox/models/compute/firewall_policy.rb', line 45 def remove(server_group_id) requires :identity = { :server_group => server_group_id } data = connection.remove_firewall_policy(identity, ) merge_attributes(data) true end |
#save ⇒ Object
Sticking with existing Fog behaviour, save does not update but creates a new resource
23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/rackspace-fog/brightbox/models/compute/firewall_policy.rb', line 23 def save raise Fog::Errors::Error.new('Resaving an existing object may create a duplicate') if identity = { :server_group => server_group_id, :name => name, :description => description }.delete_if {|k,v| v.nil? || v == "" } data = connection.create_firewall_policy() merge_attributes(data) true end |