Class: Simplenet::Client::Firewall

Inherits:
Base
  • Object
show all
Defined in:
lib/simplenet/client/firewall.rb

Instance Method Summary collapse

Methods inherited from Base

#delete, #list, #method_missing, #show

Constructor Details

#initialize(url) ⇒ Firewall

Returns a new instance of Firewall.



5
6
7
8
# File 'lib/simplenet/client/firewall.rb', line 5

def initialize(url)
  @url     = url
  @fullurl = "#{url}/firewalls"
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Simplenet::Client::Base

Instance Method Details

#attach_anycast(uuid, anycast_id) ⇒ Object



26
27
28
29
30
31
32
33
# File 'lib/simplenet/client/firewall.rb', line 26

def attach_anycast(uuid, anycast_id)
  simplenet_post("#{@fullurl}/#{uuid}/anycasts", {
    :anycast_id => anycast_id
  })
rescue Simplenet::Exception::EntityNotFoundError
  msg = "Ip not found on simplestack. Is the anycast created already?"
  raise Simplenet::Exception::EntityNotFoundError.new(msg)
end

#create(zone_id, name, mac) ⇒ Object



10
11
12
# File 'lib/simplenet/client/firewall.rb', line 10

def create(zone_id, name, mac)
  simplenet_post(@fullurl, {"name" => name, "zone_id" => zone_id, "mac" => mac})
end

#detach_anycast(uuid, anycast_id) ⇒ Object



35
36
37
# File 'lib/simplenet/client/firewall.rb', line 35

def detach_anycast(uuid, anycast_id)
  simplenet_delete("#{@fullurl}/#{uuid}/anycasts/#{anycast_id}")
end

#disable(uuid) ⇒ Object



18
19
20
# File 'lib/simplenet/client/firewall.rb', line 18

def disable(uuid)
  simplenet_post("#{@fullurl}/disable", {"id" => uuid})
end

#enable(uuid) ⇒ Object



14
15
16
# File 'lib/simplenet/client/firewall.rb', line 14

def enable(uuid)
  simplenet_post("#{@fullurl}/enable", {"id" => uuid})
end

#sync(uuid) ⇒ Object



22
23
24
# File 'lib/simplenet/client/firewall.rb', line 22

def sync(uuid)
  simplenet_post("#{@fullurl}/sync", {"id" => uuid})
end