Class: Ey::Core::Client::Firewall

Inherits:
Model
  • Object
show all
Extended by:
Associations
Defined in:
lib/ey-core/models/firewall.rb

Instance Attribute Summary collapse

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 Attribute Details

#clusterObject

Returns the value of attribute cluster.



20
21
22
# File 'lib/ey-core/models/firewall.rb', line 20

def cluster
  @cluster
end

Instance Method Details

#destroy!Object



43
44
45
# File 'lib/ey-core/models/firewall.rb', line 43

def destroy!
  connection.requests.new(self.connection.destroy_firewall("id" => self.id).body["request"])
end

#rulesObject



16
17
18
# File 'lib/ey-core/models/firewall.rb', line 16

def rules
  firewall_rules
end

#save!Object



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/ey-core/models/firewall.rb', line 22

def save!
  raise "Not implemented"

  # Todo: this is not currently supported in the API
  requires :name, :provider_id, :environment_id

  params = {
    "url"      => self.collection.url,
    "firewall" => {
      "name"     => self.name,
    },
    "environment" => self.environment,
    "provider"    => self.provider_id,
  }

  if new_record?
    self.connection.requests.new(self.connection.create_firewall(params).body["request"])
  else raise NotImplementedError
  end
end