softlayer_api 3.0.2 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.textile +3 -0
  3. data/lib/softlayer/Account.rb +85 -8
  4. data/lib/softlayer/AccountPassword.rb +49 -49
  5. data/lib/softlayer/BareMetalServer.rb +33 -43
  6. data/lib/softlayer/BareMetalServerOrder.rb +17 -8
  7. data/lib/softlayer/BareMetalServerOrder_Package.rb +25 -7
  8. data/lib/softlayer/Client.rb +7 -7
  9. data/lib/softlayer/Config.rb +105 -49
  10. data/lib/softlayer/Datacenter.rb +10 -2
  11. data/lib/softlayer/DynamicAttribute.rb +1 -1
  12. data/lib/softlayer/ImageTemplate.rb +44 -61
  13. data/lib/softlayer/ModelBase.rb +2 -2
  14. data/lib/softlayer/NetworkComponent.rb +25 -3
  15. data/lib/softlayer/NetworkMessageDelivery.rb +25 -5
  16. data/lib/softlayer/NetworkMonitor.rb +333 -0
  17. data/lib/softlayer/NetworkService.rb +6 -4
  18. data/lib/softlayer/NetworkStorage.rb +42 -29
  19. data/lib/softlayer/NetworkStorageAllowedHost.rb +9 -3
  20. data/lib/softlayer/NetworkStorageCredential.rb +44 -29
  21. data/lib/softlayer/NetworkStorageGroup.rb +42 -10
  22. data/lib/softlayer/ObjectFilter.rb +54 -4
  23. data/lib/softlayer/ObjectMaskParser.rb +1 -1
  24. data/lib/softlayer/ProductItemCategory.rb +34 -5
  25. data/lib/softlayer/ProductPackage.rb +11 -7
  26. data/lib/softlayer/Server.rb +77 -5
  27. data/lib/softlayer/ServerFirewall.rb +12 -11
  28. data/lib/softlayer/Service.rb +1 -1
  29. data/lib/softlayer/Software.rb +35 -50
  30. data/lib/softlayer/SoftwarePassword.rb +92 -107
  31. data/lib/softlayer/Ticket.rb +37 -28
  32. data/lib/softlayer/UserCustomer.rb +56 -13
  33. data/lib/softlayer/UserCustomerExternalBinding.rb +18 -5
  34. data/lib/softlayer/VLANFirewall.rb +40 -9
  35. data/lib/softlayer/VLANFirewallOrder.rb +1 -1
  36. data/lib/softlayer/VirtualDiskImage.rb +38 -10
  37. data/lib/softlayer/VirtualServer.rb +75 -48
  38. data/lib/softlayer/VirtualServerOrder.rb +15 -8
  39. data/lib/softlayer/VirtualServerOrder_Package.rb +25 -7
  40. data/lib/softlayer/VirtualServerUpgradeOrder.rb +1 -1
  41. data/lib/softlayer/base.rb +1 -1
  42. data/lib/softlayer/object_mask_helpers.rb +1 -1
  43. data/lib/softlayer_api.rb +2 -0
  44. metadata +4 -3
@@ -138,4 +138,4 @@ module SoftLayer
138
138
  end
139
139
 
140
140
  end
141
- end # Module SoftLaye
141
+ end # Module SoftLayer
@@ -10,9 +10,14 @@ module SoftLayer
10
10
  # the product order is the price_id, the rest of the information is provided
11
11
  # to make the object friendly to humans who may be searching for the
12
12
  # meaning of a given price_id.
13
- class ProductConfigurationOption < Struct.new(:capacity, :capacityRestrictionMaximum, :capacityRestrictionMinimum,
14
- :capacityRestrictionType, :description, :hourlyRecurringFee, :laborFee, :oneTimeFee, :price_id, :recurringFee,
15
- :requiredCoreCount, :setupFee, :units)
13
+ #
14
+ # DEPRECATION WARNING: The following configuration option keys have been deprecated and
15
+ # will be removed with the next major version: capacityRestrictionMaximum, capacityRestrictionMinimum,
16
+ # capacityRestrictionType, hourlyRecurringFee, laborFee, oneTimeFee, recurringFee, requiredCoreCount, setupFee
17
+ class ProductConfigurationOption < Struct.new(:capacity, :capacityRestrictionMaximum, :capicity_restriction_maximum,
18
+ :capacityRestrictionMinimum, :capacity_restriction_minimum, :capacityRestrictionType, :capacity_restriction_type,
19
+ :description, :hourlyRecurringFee, :hourly_recurring_fee, :laborFee, :labor_fee, :oneTimeFee, :one_time_fee,
20
+ :price_id, :recurringFee, :recurring_fee, :requiredCoreCount, :required_core_count, :setupFee, :setup_fee, :units)
16
21
  # Is it evil, or just incongruous to give methods to a struct?
17
22
 
18
23
  def initialize(package_item_data, price_item_data)
@@ -20,6 +25,7 @@ module SoftLayer
20
25
  self.description = package_item_data['description']
21
26
  self.units = package_item_data['units']
22
27
 
28
+ #DEPRECATION WARNING: All these are deprecated and will be removed with the next major version, pleace use keys below
23
29
  self.capacityRestrictionMaximum = price_item_data['capacityRestrictionMaximum'] ? price_item_data['capacityRestrictionMaximum'] : nil
24
30
  self.capacityRestrictionMinimum = price_item_data['capacityRestrictionMinimum'] ? price_item_data['capacityRestrictionMinimum'] : nil
25
31
  self.capacityRestrictionType = price_item_data['capacityRestrictionType'] ? price_item_data['capacityRestrictionType'] : nil
@@ -30,9 +36,19 @@ module SoftLayer
30
36
  self.recurringFee = price_item_data['recurringFee'] ? price_item_data['recurringFee'].to_f : 0.0
31
37
  self.requiredCoreCount = price_item_data['requiredCoreCount'] ? price_item_data['requiredCoreCount'] : nil
32
38
  self.setupFee = price_item_data['setupFee'] ? price_item_data['setupFee'].to_f : 0.0
39
+
40
+ self.capacity_restriction_maximum = price_item_data['capacityRestrictionMaximum'] ? price_item_data['capacityRestrictionMaximum'] : nil
41
+ self.capacity_restriction_minimum = price_item_data['capacityRestrictionMinimum'] ? price_item_data['capacityRestrictionMinimum'] : nil
42
+ self.capacity_restriction_type = price_item_data['capacityRestrictionType'] ? price_item_data['capacityRestrictionType'] : nil
43
+ self.hourly_recurring_fee = price_item_data['hourlyRecurringFee'] ? price_item_data['hourlyRecurringFee'].to_f : 0.0
44
+ self.labor_fee = price_item_data['laborFee'] ? price_item_data['laborFee'].to_f : 0.0
45
+ self.one_time_fee = price_item_data['oneTimeFee'] ? price_item_data['oneTimeFee'].to_f : 0.0
46
+ self.recurring_fee = price_item_data['recurringFee'] ? price_item_data['recurringFee'].to_f : 0.0
47
+ self.required_core_count = price_item_data['requiredCoreCount'] ? price_item_data['requiredCoreCount'] : nil
48
+ self.setup_fee = price_item_data['setupFee'] ? price_item_data['setupFee'].to_f : 0.0
33
49
  end
34
50
 
35
- # returns true if the configurtion option has no fees associated with it.
51
+ # returns true if the configuration option has no fees associated with it.
36
52
  def free?
37
53
  self.setupFee == 0 && self.laborFee == 0 && self.oneTimeFee == 0 && self.recurringFee == 0 && self.hourlyRecurringFee == 0
38
54
  end
@@ -46,15 +62,24 @@ module SoftLayer
46
62
  # of a ProductPackage object. There should not be a need to create instances
47
63
  # of this class directly.
48
64
  #
49
- # This class rougly represents entities in the +SoftLayer_Product_Item_Category+
65
+ # This class roughly represents entities in the +SoftLayer_Product_Item_Category+
50
66
  # service.
51
67
  class ProductItemCategory < ModelBase
52
68
  include ::SoftLayer::DynamicAttribute
53
69
 
70
+ ##
71
+ # :attr_reader: category_code
72
+ # The categoryCode is a primary identifier for a particular
73
+ # category. It is a string like 'os' or 'ram'
74
+ sl_attr :category_code, 'categoryCode'
75
+
54
76
  ##
55
77
  # :attr_reader:
56
78
  # The categoryCode is a primary identifier for a particular
57
79
  # category. It is a string like 'os' or 'ram'
80
+ #
81
+ # DEPRECATION WARNING: This attribute is deprecated in favor of category_code
82
+ # and will be removed in the next major release.
58
83
  sl_attr :categoryCode
59
84
 
60
85
  ##
@@ -62,6 +87,10 @@ module SoftLayer
62
87
  # The name of a category is a friendly, readable string
63
88
  sl_attr :name
64
89
 
90
+ ##
91
+ # Retrieve the product item configuration information
92
+ # :call-seq:
93
+ # configuration_options(force_update=false)
65
94
  sl_dynamic_attr :configuration_options do |config_opts|
66
95
  config_opts.should_update? do
67
96
  # only retrieved once per instance
@@ -38,16 +38,19 @@ module SoftLayer
38
38
  include ::SoftLayer::DynamicAttribute
39
39
 
40
40
  ##
41
+ # :attr_reader:
41
42
  # A friendly, readable name for the package
42
43
  sl_attr :name
43
44
 
44
45
  ##
46
+ # :attr_reader: available_locations
45
47
  # The list of locations where this product package is available.
46
48
  sl_attr :available_locations, 'availableLocations'
47
49
 
48
50
  ##
49
- # The set of product categories needed to make an order for this product package.
50
- #
51
+ # Retrieve the set of product categories needed to make an order for this product package.
52
+ # :call-seq:
53
+ # configuration(force_update=false)
51
54
  sl_dynamic_attr :configuration do |resource|
52
55
  resource.should_update? do
53
56
  # only retrieved once per instance
@@ -96,8 +99,9 @@ module SoftLayer
96
99
  end # configuration
97
100
 
98
101
  ##
99
- # The full set of product categories contained in the package
100
- #
102
+ # Retrieve the full set of product categories contained in the package
103
+ # :call-seq:
104
+ # categories(force_update=false)
101
105
  sl_dynamic_attr :categories do |resource|
102
106
  resource.should_update? do
103
107
  @categories == nil
@@ -109,7 +113,7 @@ module SoftLayer
109
113
  # that are required)
110
114
  self.configuration
111
115
 
112
- # return the value constructed by the configuraiton
116
+ # return the value constructed by the configuration
113
117
  @categories
114
118
  end
115
119
  end
@@ -123,7 +127,7 @@ module SoftLayer
123
127
  ##
124
128
  # Returns the product category with the given category code (or nil if one cannot be found)
125
129
  def category(category_code)
126
- categories.find { |category| category.categoryCode == category_code }
130
+ categories.find { |category| category.category_code == category_code }
127
131
  end
128
132
 
129
133
  ##
@@ -155,7 +159,7 @@ module SoftLayer
155
159
 
156
160
  ##
157
161
  # Requests a list (array) of ProductPackages whose key names match the
158
- # one passed in.
162
+ # one passed in. key_name may be a string or array.
159
163
  #
160
164
  def self.packages_with_key_name(key_name, client = nil)
161
165
  softlayer_client = client || Client.default_client
@@ -28,9 +28,17 @@ module SoftLayer
28
28
  # The domain name SoftLayer has stored for the server
29
29
  sl_attr :domain
30
30
 
31
+ ##
32
+ # :attr_reader: fqdn
33
+ # A convenience attribute that combines the hostname and domain name
34
+ sl_attr :fqdn, 'fullyQualifiedDomainName'
35
+
31
36
  ##
32
37
  # :attr_reader:
33
38
  # A convenience attribute that combines the hostname and domain name
39
+ #
40
+ # DEPRECATION WARNING: This attribute is deprecated in favor of fqdn
41
+ # and will be removed in the next major release.
34
42
  sl_attr :fullyQualifiedDomainName
35
43
 
36
44
  ##
@@ -39,12 +47,12 @@ module SoftLayer
39
47
  sl_attr :datacenter
40
48
 
41
49
  ##
42
- # :attr_reader:
50
+ # :attr_reader: primary_public_ip
43
51
  # The IP address of the primary public interface for the server
44
52
  sl_attr :primary_public_ip, "primaryIpAddress"
45
53
 
46
54
  ##
47
- # :attr_reader:
55
+ # :attr_reader: primary_private_ip
48
56
  # The IP address of the primary private interface for the server
49
57
  sl_attr :primary_private_ip, "primaryBackendIpAddress"
50
58
 
@@ -53,6 +61,69 @@ module SoftLayer
53
61
  # Notes about these server (for use by the customer)
54
62
  sl_attr :notes
55
63
 
64
+ ##
65
+ # The maximum network monitor query/response levels currently supported by the server
66
+ # :call-seq:
67
+ # network_monitor_levels(force_update=false)
68
+ sl_dynamic_attr :network_monitor_levels do |resource|
69
+ resource.should_update? do
70
+ @network_monitor_levels == nil
71
+ end
72
+
73
+ resource.to_update do
74
+ NetworkMonitorLevels.new(self.service.getAvailableMonitoring)
75
+ end
76
+ end
77
+
78
+ ##
79
+ # A lsst of configured network monitors.
80
+ # :call-seq:
81
+ # network_monitors(force_update=false)
82
+ sl_dynamic_attr :network_monitors do |resource|
83
+ resource.should_update? do
84
+ @network_monitors == nil
85
+ end
86
+
87
+ resource.to_update do
88
+ network_monitors_data = self.service.object_mask(NetworkMonitor.default_object_mask).getNetworkMonitors
89
+
90
+ network_monitors_data.map! do |network_monitor|
91
+ NetworkMonitor.new(softlayer_client, network_monitor) unless network_monitor.empty?
92
+ end
93
+
94
+ network_monitors_data.compact
95
+ end
96
+ end
97
+
98
+ ##
99
+ # :attr_reader:
100
+ # The list of user customers notified on monitoring failures
101
+ # :call-seq:
102
+ # notified_network_monitor_users(force_update=false)
103
+ sl_dynamic_attr :notified_network_monitor_users do |resource|
104
+ resource.should_update? do
105
+ #only retrieved once per instance
106
+ @notified_network_monitor_users == nil
107
+ end
108
+
109
+ resource.to_update do
110
+ notified_network_monitor_users_data = self.service.object_mask("mask[userId]").getMonitoringUserNotification
111
+
112
+ notified_network_monitor_users = notified_network_monitor_users_data.collect do |notified_network_monitor_user|
113
+ user_customer_service = softlayer_client[:User_Customer].object_with_id(notified_network_monitor_user['userId'])
114
+ user_customer_data = user_customer_service.object_mask(UserCustomer.default_object_mask).getObject
115
+
116
+ UserCustomer.new(softlayer_client, user_customer_data) unless user_customer_data.empty?
117
+ end
118
+
119
+ notified_network_monitor_users.compact
120
+ end
121
+ end
122
+
123
+ ##
124
+ # Retrieve the primary network component
125
+ # :call-seq:
126
+ # primary_network_component(force_update=false)
56
127
  sl_dynamic_attr :primary_network_component do |primary_component|
57
128
  primary_component.should_update? do
58
129
  return @primary_network_component == nil
@@ -65,8 +136,9 @@ module SoftLayer
65
136
  end
66
137
 
67
138
  ##
68
- # :attr_reader:
69
- # All software installed on current server
139
+ # Retrieve all software installed on current server
140
+ # :call-seq:
141
+ # software(force_update=false)
70
142
  sl_dynamic_attr :software do |software|
71
143
  software.should_update? do
72
144
  @software == nil
@@ -97,7 +169,7 @@ module SoftLayer
97
169
  # Reboot the server. This action is taken immediately.
98
170
  # Servers can be rebooted in three different ways:
99
171
  # :default_reboot - (Try soft, then hard) Attempts to reboot a server using the :os_reboot technique then, if that is not successful, tries the :power_cycle method
100
- # :os_reboot - (aka. soft rebot) instructs the server's host operating system to reboot
172
+ # :os_reboot - (aka. soft reboot) instructs the server's host operating system to reboot
101
173
  # :power_cycle - (aka. hard reboot) The actual (for hardware) or metaphorical (for virtual servers) equivalent to pulling the plug on the server then plugging it back in.
102
174
  def reboot!(reboot_technique = :default_reboot)
103
175
  case reboot_technique
@@ -12,10 +12,10 @@ module SoftLayer
12
12
  #
13
13
  # This is also called a "Shared Firewall" in some documentation.
14
14
  #
15
- # Instances of this class rougly correspond to instances of the
15
+ # Instances of this class roughly correspond to instances of the
16
16
  # SoftLayer_Network_Component_Firewall service entity.
17
17
  #
18
- class ServerFirewall < SoftLayer::ModelBase
18
+ class ServerFirewall < SoftLayer::ModelBase
19
19
  include ::SoftLayer::DynamicAttribute
20
20
 
21
21
  ##
@@ -27,11 +27,12 @@ module SoftLayer
27
27
  sl_attr :status
28
28
 
29
29
  ##
30
- # :attr_reader:
31
- # The firewall rules assigned to this firewall. These rules will
30
+ # Retrieve the firewall rules assigned to this firewall. These rules will
32
31
  # be read from the network API every time you ask for the value
33
32
  # of this property. To change the rules on the server use the
34
33
  # asymmetric method change_rules!
34
+ # :call-seq:
35
+ # rules(force_update=false)
35
36
  sl_dynamic_attr :rules do |firewall_rules|
36
37
  firewall_rules.should_update? do
37
38
  # firewall rules update every time you ask for them.
@@ -56,10 +57,10 @@ module SoftLayer
56
57
  end
57
58
 
58
59
  ##
59
- # :attr_reader:
60
- # The server that this firewall is attached to. The result may be
60
+ # Retrieve the server that this firewall is attached to. The result may be
61
61
  # either a bare metal or virtual server.
62
- #
62
+ # :call-seq:
63
+ # protected_server(force_update=false)
63
64
  sl_dynamic_attr :protected_server do |protected_server|
64
65
  protected_server.should_update? do
65
66
  @protected_server == nil
@@ -129,7 +130,7 @@ module SoftLayer
129
130
  # *NOTE!* The rules themselves have an "orderValue" property.
130
131
  # It is this property, and *not* the order that the rules are
131
132
  # found in the rules_data array, which will determine in which
132
- # order the firewall applies it's rules to incomming traffic.
133
+ # order the firewall applies it's rules to incoming traffic.
133
134
  #
134
135
  # *NOTE!* Changes to the rules are not applied immediately
135
136
  # on the server side. Instead, they are enqueued by the
@@ -215,11 +216,11 @@ module SoftLayer
215
216
  end
216
217
 
217
218
  bare_metal_firewalls = bare_metal_firewalls_data.collect { |bare_metal_firewall_data|
218
- self.new(softlayer_client, bare_metal_firewall_data)
219
+ ServerFirewall.new(softlayer_client, bare_metal_firewall_data)
219
220
  }
220
221
 
221
222
  virtual_server_firewalls = virtual_firewalls_data.collect { |virtual_firewall_data|
222
- self.new(softlayer_client, virtual_firewall_data)
223
+ ServerFirewall.new(softlayer_client, virtual_firewall_data)
223
224
  }
224
225
 
225
226
  return bare_metal_firewalls + virtual_server_firewalls
@@ -260,4 +261,4 @@ module SoftLayer
260
261
  ['orderValue','action','destinationIpAddress','destinationIpSubnetMask',"protocol","destinationPortRangeStart","destinationPortRangeEnd",'sourceIpAddress',"sourceIpSubnetMask","version"]
261
262
  end
262
263
  end # ServerFirewall class
263
- end # SoftLayer module
264
+ end # SoftLayer module
@@ -70,7 +70,7 @@ module SoftLayer
70
70
  # => {... lots of information here representing the list of open tickets ...}
71
71
  #
72
72
  class Service
73
- # The name of the service that this object calls. Cannot be emtpy or nil.
73
+ # The name of the service that this object calls. Cannot be empty or nil.
74
74
  attr_reader :service_name
75
75
  attr_reader :client
76
76
 
@@ -16,17 +16,19 @@ module SoftLayer
16
16
  include ::SoftLayer::DynamicAttribute
17
17
 
18
18
  ##
19
- # :attr_reader:
19
+ # :attr_reader: manufacturer_activation_code
20
20
  # The manufacturer code that is needed to activate a license.
21
21
  sl_attr :manufacturer_activation_code, 'manufacturerActivationCode'
22
22
 
23
23
  ##
24
- # :attr_reader:
24
+ # :attr_reader: manufacturer_license_key
25
25
  # A license key for this specific installation of software, if it is needed.
26
26
  sl_attr :manufacturer_license_key, 'manufacturerLicenseInstance'
27
27
 
28
28
  ##
29
- # The manufacturer, name and version of a piece of software.
29
+ # Retrieve the manufacturer, name and version of a piece of software.
30
+ # :call-seq:
31
+ # description(force_update=false)
30
32
  sl_dynamic_attr :description do |resource|
31
33
  resource.should_update? do
32
34
  #only retrieved once per instance
@@ -40,7 +42,9 @@ module SoftLayer
40
42
  end
41
43
 
42
44
  ##
43
- # The name of this specific piece of software.
45
+ # Retrieve the name of this specific piece of software.
46
+ # :call-seq:
47
+ # name(force_update=false)
44
48
  sl_dynamic_attr :name do |resource|
45
49
  resource.should_update? do
46
50
  #only retrieved once per instance
@@ -54,7 +58,9 @@ module SoftLayer
54
58
  end
55
59
 
56
60
  ##
57
- # Username/Password pairs used for access to this Software Installation.
61
+ # Retrieve the Username/Password pairs used for access to this Software Installation.
62
+ # :call-seq:
63
+ # passwords(force_update=false)
58
64
  sl_dynamic_attr :passwords do |resource|
59
65
  resource.should_update? do
60
66
  #only retrieved once per instance
@@ -110,7 +116,7 @@ module SoftLayer
110
116
  end
111
117
 
112
118
  ##
113
- # Returns whether or not one of the Software Passowrd instances pertains to the specified user
119
+ # Returns whether or not one of the Software Password instances pertains to the specified user
114
120
  #
115
121
  def has_user_password?(username)
116
122
  self.passwords.map { |sw_pw| sw_pw.username }.include?(username)
@@ -127,14 +133,14 @@ module SoftLayer
127
133
  # If no client can be found the routine will raise an error.
128
134
  #
129
135
  # You may filter the list returned by adding options:
130
- # * <b>+:datacenter+</b> (string) - Include software from hardware matching this datacenter
131
- # * <b>+:description+</b> (string) - Include software that matches this description
132
- # * <b>+:domain+</b> (string) - Include software from hardware matching this domain
133
- # * <b>+:hardware_type+</b> (string) - Include software from hardware matching this hardware type
134
- # * <b>+:hostname+</b> (string) - Include software from hardware matching this hostname
135
- # * <b>+:manufacturer+</b> (string) - Include software that matches this manufacturer
136
- # * <b>+:name+</b> (string) - Include software that matches this name
137
- # * <b>+:username+</b> (string) - Include software that has software password matching this username
136
+ # * <b>+:datacenter+</b> (string/array) - Include software from hardware matching this datacenter
137
+ # * <b>+:description+</b> (string/array) - Include software that matches this description
138
+ # * <b>+:domain+</b> (string/array) - Include software from hardware matching this domain
139
+ # * <b>+:hardware_type+</b> (symbol) - Include software from hardware matching this hardware type
140
+ # * <b>+:hostname+</b> (string/array) - Include software from hardware matching this hostname
141
+ # * <b>+:manufacturer+</b> (string/array) - Include software that matches this manufacturer
142
+ # * <b>+:name+</b> (string/array) - Include software that matches this name
143
+ # * <b>+:username+</b> (string/array) - Include software that has software password matching this username
138
144
  #
139
145
  # You may use the following properties to provide hardware or software object filter instances:
140
146
  # * <b>+:hardware_object_filter+</b> (ObjectFilter) - Include software from hardware that matches the criteria of this object filter
@@ -167,10 +173,12 @@ module SoftLayer
167
173
  }
168
174
 
169
175
  option_to_filter_path = {
170
- :datacenter => lambda { |hardware_type| return [ filter_label[hardware_type], '.datacenter.name' ].join },
171
- :domain => lambda { |hardware_type| return [ filter_label[hardware_type], '.domain' ].join },
172
- :hostname => lambda { |hardware_type| return [ filter_label[hardware_type], '.hostname' ].join },
173
- :tags => lambda { |hardware_type| return [ filter_label[hardware_type], '.tagReferences.tag.name' ].join },
176
+ :hardware => {
177
+ :datacenter => lambda { |hardware_type| return [ filter_label[hardware_type], '.datacenter.name' ].join },
178
+ :domain => lambda { |hardware_type| return [ filter_label[hardware_type], '.domain' ].join },
179
+ :hostname => lambda { |hardware_type| return [ filter_label[hardware_type], '.hostname' ].join },
180
+ :tags => lambda { |hardware_type| return [ filter_label[hardware_type], '.tagReferences.tag.name' ].join }
181
+ },
174
182
  :software => {
175
183
  :description => "softwareComponents.softwareDescription.longDescription",
176
184
  :manufacturer => "softwareComponents.softwareDescription.manufacturer",
@@ -185,23 +193,12 @@ module SoftLayer
185
193
  end
186
194
  end
187
195
 
188
- [ :datacenter, :domain, :hostname ].each do |option|
196
+ option_to_filter_path[:hardware].keys.each do |option|
189
197
  if options_hash[option]
190
- hardware_object_filter.modify { |filter| filter.accept(option_to_filter_path[option].call(options_hash[:hardware_type] || :hardware)).when_it is(options_hash[option]) }
198
+ hardware_object_filter.modify { |filter| filter.accept(option_to_filter_path[:hardware][option].call(options_hash[:hardware_type] || :hardware)).when_it is(options_hash[option]) }
191
199
  end
192
200
  end
193
201
 
194
- if options_hash[:tags]
195
- hardware_object_filter.set_criteria_for_key_path(option_to_filter_path[:tags].call(options_hash[:hardware_type] || :hardware),
196
- {
197
- 'operation' => 'in',
198
- 'options' => [{
199
- 'name' => 'data',
200
- 'value' => options_hash[:tags].collect{ |tag_value| tag_value.to_s }
201
- }]
202
- })
203
- end
204
-
205
202
  option_to_filter_path[:software].each do |option, filter_path|
206
203
  software_object_filter.modify { |filter| filter.accept(filter_path).when_it is(options_hash[option]) } if options_hash[option]
207
204
  end
@@ -245,13 +242,13 @@ module SoftLayer
245
242
  # If no client can be found the routine will raise an error.
246
243
  #
247
244
  # You may filter the list returned by adding options:
248
- # * <b>+:datacenter+</b> (string) - Include software from virtual servers matching this datacenter
249
- # * <b>+:description+</b> (string) - Include software that matches this description
250
- # * <b>+:domain+</b> (string) - Include software from virtual servers matching this domain
251
- # * <b>+:hostname+</b> (string) - Include software from virtual servers matching this hostname
252
- # * <b>+:manufacturer+</b> (string) - Include software that matches this manufacturer
253
- # * <b>+:name+</b> (string) - Include software that matches this name
254
- # * <b>+:username+</b> (string) - Include software that has software password matching this username
245
+ # * <b>+:datacenter+</b> (string/array) - Include software from virtual servers matching this datacenter
246
+ # * <b>+:description+</b> (string/array) - Include software that matches this description
247
+ # * <b>+:domain+</b> (string/array) - Include software from virtual servers matching this domain
248
+ # * <b>+:hostname+</b> (string/array) - Include software from virtual servers matching this hostname
249
+ # * <b>+:manufacturer+</b> (string/array) - Include software that matches this manufacturer
250
+ # * <b>+:name+</b> (string/array) - Include software that matches this name
251
+ # * <b>+:username+</b> (string/array) - Include software that has software password matching this username
255
252
  #
256
253
  # You may use the following properties to provide virtual server or software object filter instances:
257
254
  # * <b>+:virtual_server_object_filter+</b> (ObjectFilter) - Include software from virtual servers that matches the criteria of this object filter
@@ -291,19 +288,7 @@ module SoftLayer
291
288
  }
292
289
  }
293
290
 
294
- if options_hash[:tags]
295
- virtual_server_object_filter.set_criteria_for_key_path(option_to_filter_path[:virtual_server][:tags],
296
- {
297
- 'operation' => 'in',
298
- 'options' => [{
299
- 'name' => 'data',
300
- 'value' => options_hash[:tags].collect{ |tag_value| tag_value.to_s }
301
- }]
302
- })
303
- end
304
-
305
291
  option_to_filter_path[:virtual_server].each do |option, filter_path|
306
- next if option == :tags
307
292
  virtual_server_object_filter.modify { |filter| filter.accept(filter_path).when_it is(options_hash[option]) } if options_hash[option]
308
293
  end
309
294