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.
- checksums.yaml +4 -4
- data/CHANGELOG.textile +3 -0
- data/lib/softlayer/Account.rb +85 -8
- data/lib/softlayer/AccountPassword.rb +49 -49
- data/lib/softlayer/BareMetalServer.rb +33 -43
- data/lib/softlayer/BareMetalServerOrder.rb +17 -8
- data/lib/softlayer/BareMetalServerOrder_Package.rb +25 -7
- data/lib/softlayer/Client.rb +7 -7
- data/lib/softlayer/Config.rb +105 -49
- data/lib/softlayer/Datacenter.rb +10 -2
- data/lib/softlayer/DynamicAttribute.rb +1 -1
- data/lib/softlayer/ImageTemplate.rb +44 -61
- data/lib/softlayer/ModelBase.rb +2 -2
- data/lib/softlayer/NetworkComponent.rb +25 -3
- data/lib/softlayer/NetworkMessageDelivery.rb +25 -5
- data/lib/softlayer/NetworkMonitor.rb +333 -0
- data/lib/softlayer/NetworkService.rb +6 -4
- data/lib/softlayer/NetworkStorage.rb +42 -29
- data/lib/softlayer/NetworkStorageAllowedHost.rb +9 -3
- data/lib/softlayer/NetworkStorageCredential.rb +44 -29
- data/lib/softlayer/NetworkStorageGroup.rb +42 -10
- data/lib/softlayer/ObjectFilter.rb +54 -4
- data/lib/softlayer/ObjectMaskParser.rb +1 -1
- data/lib/softlayer/ProductItemCategory.rb +34 -5
- data/lib/softlayer/ProductPackage.rb +11 -7
- data/lib/softlayer/Server.rb +77 -5
- data/lib/softlayer/ServerFirewall.rb +12 -11
- data/lib/softlayer/Service.rb +1 -1
- data/lib/softlayer/Software.rb +35 -50
- data/lib/softlayer/SoftwarePassword.rb +92 -107
- data/lib/softlayer/Ticket.rb +37 -28
- data/lib/softlayer/UserCustomer.rb +56 -13
- data/lib/softlayer/UserCustomerExternalBinding.rb +18 -5
- data/lib/softlayer/VLANFirewall.rb +40 -9
- data/lib/softlayer/VLANFirewallOrder.rb +1 -1
- data/lib/softlayer/VirtualDiskImage.rb +38 -10
- data/lib/softlayer/VirtualServer.rb +75 -48
- data/lib/softlayer/VirtualServerOrder.rb +15 -8
- data/lib/softlayer/VirtualServerOrder_Package.rb +25 -7
- data/lib/softlayer/VirtualServerUpgradeOrder.rb +1 -1
- data/lib/softlayer/base.rb +1 -1
- data/lib/softlayer/object_mask_helpers.rb +1 -1
- data/lib/softlayer_api.rb +2 -0
- metadata +4 -3
@@ -22,8 +22,15 @@ module SoftLayer
|
|
22
22
|
sl_attr :active
|
23
23
|
|
24
24
|
##
|
25
|
-
# :attr_reader:
|
25
|
+
# :attr_reader: created_at
|
26
|
+
# The date that the external authentication binding was created.
|
27
|
+
sl_attr :created_at, 'createDate'
|
28
|
+
|
29
|
+
##
|
30
|
+
# :attr_reader: created
|
26
31
|
# The date that the external authentication binding was created.
|
32
|
+
# DEPRECATION WARNING: This attribute is deprecated in favor of created_at
|
33
|
+
# and will be removed in the next major release.
|
27
34
|
sl_attr :created, 'createDate'
|
28
35
|
|
29
36
|
##
|
@@ -33,7 +40,9 @@ module SoftLayer
|
|
33
40
|
sl_attr :password
|
34
41
|
|
35
42
|
##
|
36
|
-
#
|
43
|
+
# Retrieve an optional note for identifying the external binding.
|
44
|
+
# :call-seq:
|
45
|
+
# note(force_update=false)
|
37
46
|
sl_dynamic_attr :note do |resource|
|
38
47
|
resource.should_update? do
|
39
48
|
#only retrieved once per instance
|
@@ -46,7 +55,9 @@ module SoftLayer
|
|
46
55
|
end
|
47
56
|
|
48
57
|
##
|
49
|
-
#
|
58
|
+
# Retrieve the user friendly name of a type of external authentication binding.
|
59
|
+
# :call-seq:
|
60
|
+
# type(force_update=false)
|
50
61
|
sl_dynamic_attr :type do |resource|
|
51
62
|
resource.should_update? do
|
52
63
|
#only retrieved once per instance
|
@@ -60,7 +71,9 @@ module SoftLayer
|
|
60
71
|
end
|
61
72
|
|
62
73
|
##
|
63
|
-
#
|
74
|
+
# Retrieve the user friendly name of an external binding vendor.
|
75
|
+
# :call-seq:
|
76
|
+
# vendor(force_update=false)
|
64
77
|
sl_dynamic_attr :vendor do |resource|
|
65
78
|
resource.should_update? do
|
66
79
|
#only retrieved once per instance
|
@@ -74,7 +87,7 @@ module SoftLayer
|
|
74
87
|
end
|
75
88
|
|
76
89
|
##
|
77
|
-
# Returns the service for interacting with this user customer
|
90
|
+
# Returns the service for interacting with this user customer external binding
|
78
91
|
# through the network API
|
79
92
|
#
|
80
93
|
def service
|
@@ -17,20 +17,26 @@ module SoftLayer
|
|
17
17
|
# As a result, instances of this class correspond to certain instances
|
18
18
|
# in the SoftLayer_Network_Vlan service.
|
19
19
|
#
|
20
|
-
|
20
|
+
class VLANFirewall < SoftLayer::ModelBase
|
21
21
|
include ::SoftLayer::DynamicAttribute
|
22
22
|
|
23
23
|
##
|
24
|
-
|
24
|
+
# :attr_reader: vlan_number
|
25
|
+
#
|
26
|
+
# The number of the VLAN protected by this firewall.
|
27
|
+
sl_attr :vlan_number, 'vlanNumber'
|
28
|
+
|
29
|
+
##
|
30
|
+
# :attr_reader: VLAN_number
|
25
31
|
#
|
26
32
|
# The number of the VLAN protected by this firewall.
|
27
33
|
#
|
34
|
+
# DEPRECATION WARNING: This attribute is deprecated in favor of vlan_number
|
35
|
+
# and will be removed in the next major release.
|
28
36
|
sl_attr :VLAN_number, 'vlanNumber'
|
29
37
|
|
30
38
|
##
|
31
|
-
#
|
32
|
-
#
|
33
|
-
# The set of rules applied by this firewall to incoming traffic.
|
39
|
+
# Retrieve the set of rules applied by this firewall to incoming traffic.
|
34
40
|
# The object will retrieve the rules from the network API every
|
35
41
|
# time you ask it for the rules.
|
36
42
|
#
|
@@ -38,6 +44,8 @@ module SoftLayer
|
|
38
44
|
# order that the firewall applies the rules, however please see
|
39
45
|
# the important note in change_rules! concerning the "orderValue"
|
40
46
|
# property of the rules.
|
47
|
+
# :call-seq:
|
48
|
+
# rules(force_update=false)
|
41
49
|
sl_dynamic_attr :rules do |firewall_rules|
|
42
50
|
firewall_rules.should_update? do
|
43
51
|
# firewall rules update every time you ask for them.
|
@@ -54,6 +62,16 @@ module SoftLayer
|
|
54
62
|
##
|
55
63
|
# Returns the name of the primary router the firewall is attached to.
|
56
64
|
# This is often a "customer router" in one of the datacenters.
|
65
|
+
def primary_router
|
66
|
+
return self['primaryRouter']['hostname']
|
67
|
+
end
|
68
|
+
|
69
|
+
##
|
70
|
+
# Returns the name of the primary router the firewall is attached to.
|
71
|
+
# This is often a "customer router" in one of the datacenters.
|
72
|
+
#
|
73
|
+
# DEPRECATION WARNING: This method is deprecated in favor of primary_router
|
74
|
+
# and will be removed in the next major release.
|
57
75
|
def primaryRouter
|
58
76
|
return self['primaryRouter']['hostname']
|
59
77
|
end
|
@@ -61,6 +79,20 @@ module SoftLayer
|
|
61
79
|
##
|
62
80
|
# The fully qualified domain name of the physical device the
|
63
81
|
# firewall is implemented by.
|
82
|
+
def fqdn
|
83
|
+
if self.has_sl_property?('networkVlanFirewall')
|
84
|
+
return self['networkVlanFirewall']['fullyQualifiedDomainName']
|
85
|
+
else
|
86
|
+
return @softlayer_hash
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
##
|
91
|
+
# The fully qualified domain name of the physical device the
|
92
|
+
# firewall is implemented by.
|
93
|
+
#
|
94
|
+
# DEPRECATION WARNING: This method is deprecated in favor of fqdn
|
95
|
+
# and will be removed in the next major release.
|
64
96
|
def fullyQualifiedDomainName
|
65
97
|
if self.has_sl_property?('networkVlanFirewall')
|
66
98
|
return self['networkVlanFirewall']['fullyQualifiedDomainName']
|
@@ -120,7 +152,7 @@ module SoftLayer
|
|
120
152
|
# *NOTE!* The rules themselves have an "orderValue" property.
|
121
153
|
# It is this property, and *not* the order that the rules are
|
122
154
|
# found in the rules_data array, which will determine in which
|
123
|
-
# order the firewall applies its rules to
|
155
|
+
# order the firewall applies its rules to incoming traffic.
|
124
156
|
#
|
125
157
|
# *NOTE!* Changes to the rules are not applied immediately
|
126
158
|
# on the server side. Instead, they are enqueued by the
|
@@ -210,7 +242,7 @@ module SoftLayer
|
|
210
242
|
softlayer_client = client || Client.default_client
|
211
243
|
raise "#{__method__} requires a client but none was given and Client::default_client is not set" if !softlayer_client
|
212
244
|
|
213
|
-
# only VLAN
|
245
|
+
# only VLAN firewalls have a networkVlanFirewall component
|
214
246
|
vlan_firewall_filter = SoftLayer::ObjectFilter.new() { |filter|
|
215
247
|
filter.accept("networkVlans.networkVlanFirewall").when_it is_not_null
|
216
248
|
}
|
@@ -219,7 +251,6 @@ module SoftLayer
|
|
219
251
|
vlan_firewalls.collect { |firewall_data| SoftLayer::VLANFirewall.new(softlayer_client, firewall_data)}
|
220
252
|
end
|
221
253
|
|
222
|
-
|
223
254
|
#--
|
224
255
|
# Methods for the SoftLayer model
|
225
256
|
#++
|
@@ -277,4 +308,4 @@ module SoftLayer
|
|
277
308
|
'version']
|
278
309
|
end
|
279
310
|
end # class Firewall
|
280
|
-
end # module SoftLayer
|
311
|
+
end # module SoftLayer
|
@@ -14,7 +14,7 @@ module SoftLayer
|
|
14
14
|
attr_reader :vlan_id
|
15
15
|
|
16
16
|
##
|
17
|
-
# Set
|
17
|
+
# Set high_availability to true if you want redundant
|
18
18
|
# firewall devices (defaults to false, no high_availability)
|
19
19
|
attr_accessor :high_availability
|
20
20
|
|
@@ -26,8 +26,15 @@ module SoftLayer
|
|
26
26
|
sl_attr :checksum
|
27
27
|
|
28
28
|
##
|
29
|
-
# :attr_reader:
|
29
|
+
# :attr_reader: created_at
|
30
|
+
# The date a disk image was created.
|
31
|
+
sl_attr :created_at, 'createDate'
|
32
|
+
|
33
|
+
##
|
34
|
+
# :attr_reader: created
|
30
35
|
# The date a disk image was created.
|
36
|
+
# DEPRECATION WARNING: This attribute is deprecated in favor of created_at
|
37
|
+
# and will be removed in the next major release.
|
31
38
|
sl_attr :created, 'createDate'
|
32
39
|
|
33
40
|
##
|
@@ -36,8 +43,15 @@ module SoftLayer
|
|
36
43
|
sl_attr :description
|
37
44
|
|
38
45
|
##
|
39
|
-
# :attr_reader:
|
46
|
+
# :attr_reader: modified_at
|
47
|
+
# The date a disk image was last modified.
|
48
|
+
sl_attr :modified_at, 'modifyDate'
|
49
|
+
|
50
|
+
##
|
51
|
+
# :attr_reader: modified
|
40
52
|
# The date a disk image was last modified.
|
53
|
+
# DEPRECATION WARNING: This attribute is deprecated in favor of modified_at
|
54
|
+
# and will be removed in the next major release.
|
41
55
|
sl_attr :modified, 'modifyDate'
|
42
56
|
|
43
57
|
##
|
@@ -57,7 +71,9 @@ module SoftLayer
|
|
57
71
|
sl_attr :uuid
|
58
72
|
|
59
73
|
##
|
60
|
-
#
|
74
|
+
# Retrieve coalesced disk images associated with this virtual disk image
|
75
|
+
# :call-seq:
|
76
|
+
# coalesced_disk_images(force_update=false)
|
61
77
|
sl_dynamic_attr :coalesced_disk_images do |resource|
|
62
78
|
resource.should_update? do
|
63
79
|
#only retrieved once per instance
|
@@ -71,7 +87,9 @@ module SoftLayer
|
|
71
87
|
end
|
72
88
|
|
73
89
|
##
|
74
|
-
#
|
90
|
+
# Retrieve local disk flag associated with virtual disk image
|
91
|
+
# :call-seq:
|
92
|
+
# local_disk(force_update=false)
|
75
93
|
sl_dynamic_attr :local_disk do |resource|
|
76
94
|
resource.should_update? do
|
77
95
|
#only retrieved once per instance
|
@@ -84,8 +102,10 @@ module SoftLayer
|
|
84
102
|
end
|
85
103
|
|
86
104
|
##
|
87
|
-
#
|
88
|
-
# supplied with a Cloud Computing Instance order.
|
105
|
+
# Retrieve metadata as to whether this disk image is meant for
|
106
|
+
# storage of custom user data supplied with a Cloud Computing Instance order.
|
107
|
+
# :call-seq:
|
108
|
+
# metadata(force_update=false)
|
89
109
|
sl_dynamic_attr :metadata do |resource|
|
90
110
|
resource.should_update? do
|
91
111
|
#only retrieved once per instance
|
@@ -98,7 +118,9 @@ module SoftLayer
|
|
98
118
|
end
|
99
119
|
|
100
120
|
##
|
101
|
-
#
|
121
|
+
# Retrieve the references to the software that resides on a disk image.
|
122
|
+
# :call-seq:
|
123
|
+
# software(force_update=false)
|
102
124
|
sl_dynamic_attr :software do |resource|
|
103
125
|
resource.should_update? do
|
104
126
|
#only retrieved once per instance
|
@@ -112,7 +134,9 @@ module SoftLayer
|
|
112
134
|
end
|
113
135
|
|
114
136
|
##
|
115
|
-
#
|
137
|
+
# Retrieve the original disk image that the current disk image was cloned from.
|
138
|
+
# :call-seq:
|
139
|
+
# source_disk_image(force_update=false)
|
116
140
|
sl_dynamic_attr :source_disk_image do |resource|
|
117
141
|
resource.should_update? do
|
118
142
|
#only retrieved once per instance
|
@@ -126,7 +150,9 @@ module SoftLayer
|
|
126
150
|
end
|
127
151
|
|
128
152
|
##
|
129
|
-
#
|
153
|
+
# Retrieve a brief description of a virtual disk image type's function.
|
154
|
+
# :call-seq:
|
155
|
+
# type_description(force_update=false)
|
130
156
|
sl_dynamic_attr :type_description do |resource|
|
131
157
|
resource.should_update? do
|
132
158
|
#only retrieved once per instance
|
@@ -140,7 +166,9 @@ module SoftLayer
|
|
140
166
|
end
|
141
167
|
|
142
168
|
##
|
143
|
-
#
|
169
|
+
# Retrieve a virtual disk image type's name.
|
170
|
+
# :call-seq:
|
171
|
+
# type_name(force_update=false)
|
144
172
|
sl_dynamic_attr :type_name do |resource|
|
145
173
|
resource.should_update? do
|
146
174
|
#only retrieved once per instance
|
@@ -16,45 +16,87 @@ module SoftLayer
|
|
16
16
|
include ::SoftLayer::DynamicAttribute
|
17
17
|
|
18
18
|
##
|
19
|
-
# :attr_reader:
|
20
|
-
# A count of the
|
19
|
+
# :attr_reader: cores
|
20
|
+
# A count of the number of virtual processing cores allocated
|
21
21
|
# to the server.
|
22
22
|
sl_attr :cores, 'maxCpu'
|
23
23
|
|
24
|
+
##
|
25
|
+
# :attr_reader: provisioned_at
|
26
|
+
# The date the Virtual Server was provisioned. This attribute can be
|
27
|
+
# nil if the SoftLayer system has not yet finished provisioning the
|
28
|
+
# server (consequently this attribute is used by the #wait_until_ready
|
29
|
+
# method to determine when a server has been provisioned)
|
30
|
+
sl_attr :provisioned_at, 'provisionDate'
|
31
|
+
|
24
32
|
##
|
25
33
|
# :attr_reader:
|
26
34
|
# The date the Virtual Server was provisioned. This attribute can be
|
27
35
|
# nil if the SoftLayer system has not yet finished provisioning the
|
28
36
|
# server (consequently this attribute is used by the #wait_until_ready
|
29
37
|
# method to determine when a server has been provisioned)
|
38
|
+
#
|
39
|
+
# DEPRECATION WARNING: This attribute is deprecated in favor of provisioned_at
|
40
|
+
# and will be removed in the next major release.
|
30
41
|
sl_attr :provisionDate
|
31
42
|
|
43
|
+
##
|
44
|
+
# :attr_reader: active_transaction
|
45
|
+
# The active transaction (if any) for this virtual server. Transactions
|
46
|
+
# are used to make configuration changes to the server and only one
|
47
|
+
# transaction can be active at a time.
|
48
|
+
sl_attr :active_transaction, 'activeTransaction'
|
49
|
+
|
32
50
|
##
|
33
51
|
# :attr_reader:
|
34
52
|
# The active transaction (if any) for this virtual server. Transactions
|
35
53
|
# are used to make configuration changes to the server and only one
|
36
54
|
# transaction can be active at a time.
|
55
|
+
#
|
56
|
+
# DEPRECATION WARNING: This attribute is deprecated in favor of active_transaction
|
57
|
+
# and will be removed in the next major release.
|
37
58
|
sl_attr :activeTransaction
|
38
59
|
|
60
|
+
##
|
61
|
+
# :attr_reader: block_devices
|
62
|
+
# Storage devices attached to the server. Storage may be local
|
63
|
+
# to the host running the Virtual Server, or it may be located
|
64
|
+
# on the SAN
|
65
|
+
sl_attr :block_devices, 'blockDevices'
|
66
|
+
|
39
67
|
##
|
40
68
|
# :attr_reader:
|
41
69
|
# Storage devices attached to the server. Storage may be local
|
42
70
|
# to the host running the Virtual Server, or it may be located
|
43
71
|
# on the SAN
|
72
|
+
#
|
73
|
+
# DEPRECATION WARNING: This attribute is deprecated in favor of block_devices
|
74
|
+
# and will be removed in the next major release.
|
44
75
|
sl_attr :blockDevices
|
45
76
|
|
77
|
+
##
|
78
|
+
# :attr_reader: last_operating_system_reload
|
79
|
+
# The last operating system reload transaction that was
|
80
|
+
# run for this server. #wait_until_ready compares the
|
81
|
+
# ID of this transaction to the ID of the active transaction
|
82
|
+
# to determine if an OS reload is in progress.
|
83
|
+
sl_attr :last_operating_system_reload, 'lastOperatingSystemReload'
|
84
|
+
|
46
85
|
##
|
47
86
|
# :attr_reader:
|
48
87
|
# The last operating system reload transaction that was
|
49
88
|
# run for this server. #wait_until_ready compares the
|
50
89
|
# ID of this transaction to the ID of the active transaction
|
51
90
|
# to determine if an OS reload is in progress.
|
91
|
+
#
|
92
|
+
# DEPRECATION WARNING: This attribute is deprecated in favor of last_operating_system_reload
|
93
|
+
# and will be removed in the next major release.
|
52
94
|
sl_attr :lastOperatingSystemReload
|
53
95
|
|
54
96
|
##
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
97
|
+
# Retrieve information about items that are available for upgrades.
|
98
|
+
# :call-seq:
|
99
|
+
# upgrade_options(force_update=false)
|
58
100
|
sl_dynamic_attr :upgrade_options do |resource|
|
59
101
|
resource.should_update? do
|
60
102
|
@upgrade_options == nil
|
@@ -130,7 +172,7 @@ module SoftLayer
|
|
130
172
|
has_os_reload = has_sl_property? :lastOperatingSystemReload
|
131
173
|
has_active_transaction = has_sl_property? :activeTransaction
|
132
174
|
|
133
|
-
reloading_os = has_active_transaction && has_os_reload && (self.
|
175
|
+
reloading_os = has_active_transaction && has_os_reload && (self.last_operating_system_reload['id'] == self.active_transaction['id'])
|
134
176
|
provisioned = has_sl_property?(:provisionDate) && ! self['provisionDate'].empty?
|
135
177
|
|
136
178
|
# a server is ready when it is provisioned, not reloading the OS
|
@@ -148,7 +190,7 @@ module SoftLayer
|
|
148
190
|
end
|
149
191
|
|
150
192
|
##
|
151
|
-
#
|
193
|
+
# Retrieve the virtual server with the given server ID from the API
|
152
194
|
#
|
153
195
|
# The options parameter should contain:
|
154
196
|
#
|
@@ -187,22 +229,23 @@ module SoftLayer
|
|
187
229
|
# If no client can be found the routine will raise an error.
|
188
230
|
#
|
189
231
|
# You may filter the list returned by adding options:
|
190
|
-
# * <b>+:hourly+</b>
|
191
|
-
# * <b>+:monthly+</b>
|
192
|
-
# * <b>+:tags+</b>
|
193
|
-
# * <b>+:cpus+</b>
|
194
|
-
# * <b>+:memory+</b>
|
195
|
-
# * <b>+:hostname+</b>
|
196
|
-
# * <b>+:domain+</b>
|
197
|
-
# * <b>+:local_disk+</b> (boolean)
|
198
|
-
# * <b>+:datacenter+</b> (string) - find servers whose short data center name (e.g. dal05, sjc01) matches the query string given (see ObjectFilter::query_to_filter_operation)
|
199
|
-
# * <b>+:nic_speed+</b>
|
200
|
-
# * <b>+:public_ip+</b>
|
201
|
-
# * <b>+:private_ip+</b> (string) - same as :public_ip, but for private IP addresses
|
232
|
+
# * <b>+:hourly+</b> (boolean) - Include servers billed hourly in the list
|
233
|
+
# * <b>+:monthly+</b> (boolean) - Include servers billed monthly in the list
|
234
|
+
# * <b>+:tags+</b> (string/array) - an array of strings representing tags to search for on the instances
|
235
|
+
# * <b>+:cpus+</b> (int/array) - return virtual servers with the given number of (virtual) CPUs
|
236
|
+
# * <b>+:memory+</b> (int/array) - return servers with at least the given amount of memory (in MB. e.g. 4096 = 4GB)
|
237
|
+
# * <b>+:hostname+</b> (string/array) - return servers whose hostnames match the query string given (see ObjectFilter::query_to_filter_operation)
|
238
|
+
# * <b>+:domain+</b> (string/array) - filter servers to those whose domain matches the query string given (see ObjectFilter::query_to_filter_operation)
|
239
|
+
# * <b>+:local_disk+</b> (boolean) - include servers that do, or do not, have local disk storage
|
240
|
+
# * <b>+:datacenter+</b> (string/array) - find servers whose short data center name (e.g. dal05, sjc01) matches the query string given (see ObjectFilter::query_to_filter_operation)
|
241
|
+
# * <b>+:nic_speed+</b> (int/array) - include servers with the given nic speed (in Mbps, usually 10, 100, or 1000)
|
242
|
+
# * <b>+:public_ip+</b> (string/array) - return servers whose public IP address matches the query string given (see ObjectFilter::query_to_filter_operation)
|
243
|
+
# * <b>+:private_ip+</b> (string/array) - same as :public_ip, but for private IP addresses
|
202
244
|
#
|
203
245
|
# Additionally you may provide options related to the request itself:
|
204
|
-
# * <b
|
205
|
-
# * <b>+:
|
246
|
+
# * <b>*:object_filter*</b> (ObjectFilter) - Include servers that match the criteria of this object filter
|
247
|
+
# * <b>+:object_mask+</b> (string) - A object mask of properties, in addition to the default properties, that you wish to retrieve for the servers
|
248
|
+
# * <b>+:result_limit+</b> (hash with :limit, and :offset keys) - Limit the scope of results returned.
|
206
249
|
#
|
207
250
|
def self.find_servers(options_hash = {})
|
208
251
|
softlayer_client = options_hash[:client] || Client.default_client
|
@@ -216,15 +259,16 @@ module SoftLayer
|
|
216
259
|
end
|
217
260
|
|
218
261
|
option_to_filter_path = {
|
219
|
-
:cores
|
220
|
-
:memory
|
221
|
-
:hostname
|
222
|
-
:domain
|
262
|
+
:cores => "virtualGuests.maxCpu",
|
263
|
+
:memory => "virtualGuests.maxMemory",
|
264
|
+
:hostname => "virtualGuests.hostname",
|
265
|
+
:domain => "virtualGuests.domain",
|
223
266
|
:local_disk => "virtualGuests.localDiskFlag",
|
224
267
|
:datacenter => "virtualGuests.datacenter.name",
|
225
|
-
:nic_speed
|
226
|
-
:public_ip
|
227
|
-
:private_ip => "virtualGuests.primaryBackendIpAddress"
|
268
|
+
:nic_speed => "virtualGuests.networkComponents.maxSpeed",
|
269
|
+
:public_ip => "virtualGuests.primaryIpAddress",
|
270
|
+
:private_ip => "virtualGuests.primaryBackendIpAddress",
|
271
|
+
:tags => "virtualGuests.tagReferences.tag.name"
|
228
272
|
}
|
229
273
|
|
230
274
|
if options_hash.has_key?(:local_disk) then
|
@@ -238,32 +282,15 @@ module SoftLayer
|
|
238
282
|
object_filter.modify { |filter| filter.accept(filter_path).when_it is(options_hash[option])} if options_hash[option]
|
239
283
|
end
|
240
284
|
|
241
|
-
# Tags get a much more complex object filter operation so we handle them separately
|
242
|
-
if options_hash.has_key?(:tags)
|
243
|
-
object_filter.set_criteria_for_key_path("virtualGuests.tagReferences.tag.name", {
|
244
|
-
'operation' => 'in',
|
245
|
-
'options' => [{
|
246
|
-
'name' => 'data',
|
247
|
-
'value' => options_hash[:tags].collect{ |tag_value| tag_value.to_s }
|
248
|
-
}]
|
249
|
-
} );
|
250
|
-
end
|
251
|
-
|
252
285
|
required_properties_mask = 'mask.id'
|
253
286
|
|
254
287
|
account_service = softlayer_client[:Account]
|
255
288
|
account_service = account_service.object_filter(object_filter) unless object_filter.empty?
|
256
289
|
account_service = account_service.object_mask(default_object_mask.to_sl_object_mask)
|
290
|
+
account_service = account_service.object_mask(options_hash[:object_mask]) if options_hash[:object_mask]
|
257
291
|
|
258
|
-
if options_hash
|
259
|
-
account_service = account_service.
|
260
|
-
end
|
261
|
-
|
262
|
-
if options_hash.has_key?(:result_limit)
|
263
|
-
offset = options[:result_limit][:offset]
|
264
|
-
limit = options[:result_limit][:limit]
|
265
|
-
|
266
|
-
account_service = account_service.result_limit(offset, limit)
|
292
|
+
if options_hash[:result_limit] && options_hash[:result_limit][:offset] && options_hash[:result_limit][:limit]
|
293
|
+
account_service = account_service.result_limit(options_hash[:result_limit][:offset], options_hash[:result_limit][:limit])
|
267
294
|
end
|
268
295
|
|
269
296
|
case
|