Skip to content

Commit 249585c

Browse files
committed
Add public/private vlan id order options to VirtualServer and BareMetalServer order package wrappers
1 parent 8882c35 commit 249585c

2 files changed

Lines changed: 30 additions & 10 deletions

File tree

lib/softlayer/BareMetalServerOrder_Package.rb

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ class BareMetalServerOrder_Package < Server
6565
# be installed on the server.
6666
attr_accessor :image_template
6767

68+
# Integer, The id of the public VLAN this server should join
69+
# Corresponds to +primaryNetworkComponent.networkVlan.id+ in the +createObject+ documentation
70+
attr_accessor :public_vlan_id
71+
72+
# Integer, The id of the private VLAN this server should join
73+
# Corresponds to +primaryBackendNetworkComponent.networkVlan.id+ in the +createObject+ documentation
74+
attr_accessor :private_vlan_id
75+
6876
# The URI of a script to execute on the server after it has been provisioned. This may be
6977
# any object which accepts the to_s message. The resulting string will be passed to SoftLayer API.
7078
attr_accessor :provision_script_URI
@@ -139,11 +147,13 @@ def hardware_order
139147

140148
#Note that the use of image_template and SoftLayer::ProductPackage os/guest_diskX configuration category
141149
#item prices is mutually exclusive.
142-
product_order['hardware'][0]['userData'] = @user_metadata if @user_metadata
143-
product_order['imageTemplateGlobalIdentifier'] = @image_template.global_id if @image_template
144-
product_order['location'] = @datacenter.id if @datacenter
145-
product_order['provisionScripts'] = [@provision_script_URI.to_s] if @provision_script_URI
146-
product_order['sshKeys'] = [{ 'sshKeyIds' => @ssh_key_ids }] if @ssh_key_ids
150+
product_order['hardware'][0]['userData'] = @user_metadata if @user_metadata
151+
product_order['imageTemplateGlobalIdentifier'] = @image_template.global_id if @image_template
152+
product_order['location'] = @datacenter.id if @datacenter
153+
product_order['provisionScripts'] = [@provision_script_URI.to_s] if @provision_script_URI
154+
product_order['sshKeys'] = [{ 'sshKeyIds' => @ssh_key_ids }] if @ssh_key_ids
155+
product_order['primaryNetworkComponent'] = { "networkVlan" => { "id" => @public_vlan_id.to_i } } if @public_vlan_id
156+
product_order['primaryBackendNetworkComponent'] = { "networkVlan" => {"id" => @private_vlan_id.to_i } } if @private_vlan_id
147157

148158
product_order['prices'] = @configuration_options.collect do |key, value|
149159
if value.respond_to?(:price_id)

lib/softlayer/VirtualServerOrder_Package.rb

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,14 @@ class VirtualServerOrder_Package < Server
6565
# be installed on the server.
6666
attr_accessor :image_template
6767

68+
# Integer, The id of the public VLAN this server should join
69+
# Corresponds to +primaryNetworkComponent.networkVlan.id+ in the +createObject+ documentation
70+
attr_accessor :public_vlan_id
71+
72+
# Integer, The id of the private VLAN this server should join
73+
# Corresponds to +primaryBackendNetworkComponent.networkVlan.id+ in the +createObject+ documentation
74+
attr_accessor :private_vlan_id
75+
6876
# The URI of a script to execute on the server after it has been provisioned. This may be
6977
# any object which accepts the to_s message. The resulting string will be passed to SoftLayer API.
7078
attr_accessor :provision_script_URI
@@ -139,11 +147,13 @@ def virtual_server_order
139147

140148
#Note that the use of image_template and SoftLayer::ProductPackage os/guest_diskX configuration category
141149
#item prices is mutually exclusive.
142-
product_order['imageTemplateGlobalIdentifier'] = @image_template.global_id if @image_template
143-
product_order['location'] = @datacenter.id if @datacenter
144-
product_order['provisionScripts'] = [@provision_script_URI.to_s] if @provision_script_URI
145-
product_order['sshKeys'] = [{ 'sshKeyIds' => @ssh_key_ids }] if @ssh_key_ids
146-
product_order['virtualGuests'][0]['userData'] = @user_metadata if @user_metadata
150+
product_order['imageTemplateGlobalIdentifier'] = @image_template.global_id if @image_template
151+
product_order['location'] = @datacenter.id if @datacenter
152+
product_order['provisionScripts'] = [@provision_script_URI.to_s] if @provision_script_URI
153+
product_order['sshKeys'] = [{ 'sshKeyIds' => @ssh_key_ids }] if @ssh_key_ids
154+
product_order['virtualGuests'][0]['userData'] = @user_metadata if @user_metadata
155+
product_order['primaryNetworkComponent'] = { "networkVlan" => { "id" => @public_vlan_id.to_i } } if @public_vlan_id
156+
product_order['primaryBackendNetworkComponent'] = { "networkVlan" => {"id" => @private_vlan_id.to_i } } if @private_vlan_id
147157

148158
product_order['prices'] = @configuration_options.collect do |key, value|
149159
if value.respond_to?(:price_id)

0 commit comments

Comments
 (0)