Class: SoftLayer::ServerFirewallOrder

Inherits:
Object
  • Object
show all
Defined in:
lib/softlayer/ServerFirewallOrder.rb

Overview

This class allows you to order a Firewall for a server

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server) ⇒ ServerFirewallOrder

Create a new order for the given server

Raises:

  • (ArgumentError)


17
18
19
20
21
# File 'lib/softlayer/ServerFirewallOrder.rb', line 17

def initialize (server)
  @server = server

  raise ArgumentError, "Server does not have an active Public interface" if server.firewall_port_speed == 0
end

Instance Attribute Details

#serverObject (readonly)

The server that you are ordering the firewall for.



13
14
15
# File 'lib/softlayer/ServerFirewallOrder.rb', line 13

def server
  @server
end

Instance Method Details

#place_order!Object

Calls the SoftLayer API to place an order for a new server based on the template in this order. If this succeeds then you will be billed for the new server.

If you provide a block, it will receive the order template as a parameter and the block may make changes to the template before it is submitted.



44
45
46
47
48
49
# File 'lib/softlayer/ServerFirewallOrder.rb', line 44

def place_order!()
  order_template = firewall_order_template
  order_template = yield order_template if block_given?

  server.softlayer_client[:Product_Order].placeOrder(order_template)
end

#verifyObject

Calls the SoftLayer API to verify that the template provided by this order is valid This routine will return the order template generated by the API or will throw an exception

This routine will not actually create a Bare Metal Instance and will not affect billing.

If you provide a block, it will receive the order template as a parameter and the block may make changes to the template before it is submitted.



31
32
33
34
35
36
# File 'lib/softlayer/ServerFirewallOrder.rb', line 31

def verify()
  order_template = firewall_order_template
  order_template = yield order_template if block_given?

  server.softlayer_client[:Product_Order].verifyOrder(order_template)
end