Class: Ey::Core::Client::FirewallRule
- Extended by:
- Associations
- Defined in:
- lib/ey-core/models/firewall_rule.rb
Instance Method Summary collapse
Methods included from Associations
assoc_accessor, assoc_coverage, assoc_reader, assoc_writer, associations, collection_reader
Methods inherited from Model
#destroy, range_parser, #save, #to_s, #update!, #url
Instance Method Details
#destroy! ⇒ Object
38 39 40 |
# File 'lib/ey-core/models/firewall_rule.rb', line 38 def destroy! connection.requests.new(self.connection.destroy_firewall_rule("id" => self.id).body["request"]) end |
#save! ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/ey-core/models/firewall_rule.rb', line 18 def save! requires :firewall_id self.port_range ||= "0-65535" params = { "url" => self.collection.url, "firewall_rule" => { "port_range" => "#{self.port_range.min}-#{self.port_range.max}", "source" => self.source || "0.0.0.0/0", }, "firewall" => self.firewall_id, } if new_record? self.connection.requests.new(self.connection.create_firewall_rule(params).body["request"]) else raise NotImplementedError end end |