Class: SoftLayer::BareMetalServerOrder_Package
- Defined in:
- lib/softlayer/BareMetalServerOrder_Package.rb
Overview
This class is used to order a hardware server using a product package.
Ordering a server using a product package is a more complex process than ordering with simple attributes (as is done by the BareMetalServerOrder class). However with that complexity comes the the ability to specify the configuration of the server in exacting detail.
To use this class, you first select a product package. The product package defines the base configuration, the chassis, of the server as well as the set of configuration options available for that chassis. To fully configure the server you must select the value for each configuration option.
This class roughly Corresponds to the SoftLayer_Container_Product_Order_Hardware_Server data type in the SoftLayer API
sldn.softlayer.com/reference/datatypes/SoftLayer_Container_Product_Order_Hardware_Server
Instance Attribute Summary collapse
-
#configuration_options ⇒ Object
The value of this property should be a hash.
-
#datacenter ⇒ Object
An instance of SoftLayer::Datacenter.
-
#domain ⇒ Object
The domain of the server being created (i.e. ‘softlayer.com’ is the domain of sldn.softlayer.com).
-
#hostname ⇒ Object
The hostname of the server being created (i.e. ‘sldn’ is the hostname of sldn.softlayer.com).
-
#package ⇒ Object
readonly
The product package object (an instance of SoftLayer::ProductPackage) identifying the base configuration for the server.
-
#provision_script_URI ⇒ Object
The URI of a script to execute on the server after it has been provisioned.
-
#ssh_key_ids ⇒ Object
An array of the ids of SSH keys to install on the server upon provisioning To obtain a list of existing SSH keys, call getSshKeys on the SoftLayer_Account service: client.getSshKeys().
Attributes inherited from ModelBase
Instance Method Summary collapse
-
#initialize(package, client = nil) ⇒ BareMetalServerOrder_Package
constructor
You initialize a BareMetalServerOrder_Package by passing in the package that you are ordering from.
-
#place_order! ⇒ Object
Submit the order to be executed by the SoftLayer ordering system.
-
#verify ⇒ Object
Present the order for verification by the SoftLayer ordering system.
Methods inherited from Server
#change_port_speed, #firewall_port_speed, #fullyQualifiedDomainName, #notes, #notes=, #primary_private_ip, #primary_public_ip, #reboot!, #reload_os!, #set_domain!, #set_hostname!, #softlayer_properties, #to_s, #user_metadata=
Methods included from DynamicAttribute
Methods inherited from ModelBase
#[], #has_sl_property?, #refresh_details, #service, sl_attr, #to_ary
Constructor Details
#initialize(package, client = nil) ⇒ BareMetalServerOrder_Package
You initialize a BareMetalServerOrder_Package by passing in the package that you are ordering from.
71 72 73 74 75 76 77 |
# File 'lib/softlayer/BareMetalServerOrder_Package.rb', line 71 def initialize(package, client = nil) @softlayer_client = client || Client.default_client raise "#{__method__} requires a client but none was given and Client::default_client is not set" if !@softlayer_client @package = package @configuration_options = [] end |
Instance Attribute Details
#configuration_options ⇒ Object
The value of this property should be a hash. The keys of the hash are ProdcutItemCategory codes (like ‘os’ and ‘ram’) while the values may be Integers or Objects. The Integer values should be the id of a SoftLayer_Product_Item_Price representing the configuration option chosen for that category. Objects must respond to the price_id message and return an integer that is the id of a SoftLayer_Product_Item_Price. Instances of the ProductConfigurationOption class behave this way.
At a minimum, the configuation_options should include entries for each of the categories required by the package (i.e. those returned from ProductPackage#required_categories)
54 55 56 |
# File 'lib/softlayer/BareMetalServerOrder_Package.rb', line 54 def @configuration_options end |
#datacenter ⇒ Object
An instance of SoftLayer::Datacenter. The server will be provisioned in this data center. The set of datacenters available is determined by the package and may be obtained from the SoftLayer::ProductPackage object using the #datacenter_options method.
37 38 39 |
# File 'lib/softlayer/BareMetalServerOrder_Package.rb', line 37 def datacenter @datacenter end |
#domain ⇒ Object
The domain of the server being created (i.e. ‘softlayer.com’ is the domain of sldn.softlayer.com)
43 44 45 |
# File 'lib/softlayer/BareMetalServerOrder_Package.rb', line 43 def domain @domain end |
#hostname ⇒ Object
The hostname of the server being created (i.e. ‘sldn’ is the hostname of sldn.softlayer.com).
40 41 42 |
# File 'lib/softlayer/BareMetalServerOrder_Package.rb', line 40 def hostname @hostname end |
#package ⇒ Object (readonly)
The product package object (an instance of SoftLayer::ProductPackage) identifying the base configuration for the server. A list of Bare Metal Server product packages is returned by SoftLayer::ProductPackage.bare_metal_server_packages
32 33 34 |
# File 'lib/softlayer/BareMetalServerOrder_Package.rb', line 32 def package @package end |
#provision_script_URI ⇒ Object
The URI of a script to execute on the server after it has been provisioned. This may be any object which accepts the to_s message. The resulting string will be passed to SoftLayer API.
66 67 68 |
# File 'lib/softlayer/BareMetalServerOrder_Package.rb', line 66 def provision_script_URI @provision_script_URI end |
#ssh_key_ids ⇒ Object
An array of the ids of SSH keys to install on the server upon provisioning To obtain a list of existing SSH keys, call getSshKeys on the SoftLayer_Account service:
client[:Account].getSshKeys()
62 63 64 |
# File 'lib/softlayer/BareMetalServerOrder_Package.rb', line 62 def ssh_key_ids @ssh_key_ids end |
Instance Method Details
#place_order! ⇒ Object
Submit the order to be executed by the SoftLayer ordering system. If successful this will probably result in additional billing items applied to your account!
If you add a block to the method call, it will receive the product order template before it is sent to the API. You may carefully make changes to the template to provide specialized configuration.
The return value of this call is a product order receipt. After submitting the order, it will proceed to Sales for authorization.
106 107 108 109 110 |
# File 'lib/softlayer/BareMetalServerOrder_Package.rb', line 106 def place_order! product_order = hardware_order product_order = yield product_order if block_given? softlayer_client[:Product_Order].placeOrder(product_order) end |
#verify ⇒ Object
Present the order for verification by the SoftLayer ordering system. The order is verified, but not executed. This should not change the billing of your account.
If you add a block to the method call, it will receive the product order template before it is sent to the API. You may carefully make changes to the template to provide specialized configuration.
88 89 90 91 92 |
# File 'lib/softlayer/BareMetalServerOrder_Package.rb', line 88 def verify product_order = hardware_order product_order = yield product_order if block_given? softlayer_client[:Product_Order].verifyOrder(product_order) end |