Class: Fog::Compute::Brightbox::FirewallRule
- Inherits:
-
Brightbox::Model
- Object
- Model
- Brightbox::Model
- Fog::Compute::Brightbox::FirewallRule
- Defined in:
- lib/fog/brightbox/models/compute/firewall_rule.rb
Instance Method Summary collapse
- #destroy ⇒ Object
-
#save ⇒ Object
Sticking with existing Fog behaviour, save does not update but creates a new resource.
Methods included from Brightbox::ModelHelper
#collection_name, #resource_name
Instance Method Details
#destroy ⇒ Object
42 43 44 45 46 |
# File 'lib/fog/brightbox/models/compute/firewall_rule.rb', line 42 def destroy requires :identity service.destroy_firewall_rule(identity) true end |
#save ⇒ Object
Sticking with existing Fog behaviour, save does not update but creates a new resource
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/fog/brightbox/models/compute/firewall_rule.rb', line 24 def save raise Fog::Errors::Error.new("Resaving an existing object may create a duplicate") if persisted? requires :firewall_policy_id = { :firewall_policy => firewall_policy_id, :protocol => protocol, :description => description, :source => source, :source_port => source_port, :destination => destination, :destination_port => destination_port, :icmp_type_name => icmp_type_name }.delete_if { |_k, v| v.nil? || v == "" } data = service.create_firewall_rule() merge_attributes(data) true end |