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
@@ -21,22 +21,24 @@ module SoftLayer
|
|
21
21
|
sl_attr :name
|
22
22
|
|
23
23
|
##
|
24
|
-
# :attr_reader:
|
24
|
+
# :attr_reader: private_ip
|
25
25
|
# The backend IP address for this resource
|
26
26
|
sl_attr :private_ip, 'backendIpAddress'
|
27
27
|
|
28
28
|
##
|
29
|
-
# :attr_reader:
|
29
|
+
# :attr_reader: public_ip
|
30
30
|
# The frontend IP address for this resource
|
31
31
|
sl_attr :public_ip, 'frontendIpAddress'
|
32
32
|
|
33
33
|
##
|
34
|
-
# :attr_reader:
|
34
|
+
# :attr_reader: ssh_username
|
35
35
|
# The ssh username of for this resource
|
36
36
|
sl_attr :ssh_username, 'sshUsername'
|
37
37
|
|
38
38
|
##
|
39
|
-
#
|
39
|
+
# Retrieve the datacenter that this network service resource is available in
|
40
|
+
# :call-seq:
|
41
|
+
# datacenter(force_update=false)
|
40
42
|
sl_dynamic_attr :datacenter do |resource|
|
41
43
|
resource.should_update? do
|
42
44
|
#only retrieved once per instance
|
@@ -16,13 +16,20 @@ module SoftLayer
|
|
16
16
|
include ::SoftLayer::DynamicAttribute
|
17
17
|
|
18
18
|
##
|
19
|
-
# :attr_reader:
|
19
|
+
# :attr_reader: capacity
|
20
20
|
# A Storage account's capacity, measured in gigabytes.
|
21
21
|
sl_attr :capacity, 'capacityGb'
|
22
22
|
|
23
23
|
##
|
24
|
-
# :attr_reader:
|
24
|
+
# :attr_reader: created_at
|
25
|
+
# The date a network storage volume was created.
|
26
|
+
sl_attr :created_at, 'createDate'
|
27
|
+
|
28
|
+
##
|
29
|
+
# :attr_reader: created
|
25
30
|
# The date a network storage volume was created.
|
31
|
+
# DEPRECATION WARNING: This attribute is deprecated in favor of created_at
|
32
|
+
# and will be removed in the next major release.
|
26
33
|
sl_attr :created, 'createDate'
|
27
34
|
|
28
35
|
##
|
@@ -38,12 +45,12 @@ module SoftLayer
|
|
38
45
|
sl_attr :password
|
39
46
|
|
40
47
|
##
|
41
|
-
# :attr_reader:
|
48
|
+
# :attr_reader: type
|
42
49
|
# A Storage account's type.
|
43
50
|
sl_attr :type, 'nasType'
|
44
51
|
|
45
52
|
##
|
46
|
-
# :attr_reader:
|
53
|
+
# :attr_reader: upgradable
|
47
54
|
# This flag indicates whether this storage type is upgradable or not.
|
48
55
|
sl_attr :upgradable, 'upgradableFlag'
|
49
56
|
|
@@ -55,7 +62,9 @@ module SoftLayer
|
|
55
62
|
sl_attr :username
|
56
63
|
|
57
64
|
##
|
58
|
-
#
|
65
|
+
# Retrieve other usernames and passwords associated with a Storage volume.
|
66
|
+
# :call-seq:
|
67
|
+
# account_password(force_update=false)
|
59
68
|
sl_dynamic_attr :account_password do |resource|
|
60
69
|
resource.should_update? do
|
61
70
|
#only retrieved once per instance
|
@@ -70,6 +79,8 @@ module SoftLayer
|
|
70
79
|
|
71
80
|
##
|
72
81
|
# A Storage volume's access credentials.
|
82
|
+
# :call-seq:
|
83
|
+
# credentials(force_update=false)
|
73
84
|
sl_dynamic_attr :credentials do |resource|
|
74
85
|
resource.should_update? do
|
75
86
|
#only retrieved once per instance
|
@@ -83,6 +94,8 @@ module SoftLayer
|
|
83
94
|
|
84
95
|
##
|
85
96
|
# The network resource a Storage service is connected to.
|
97
|
+
# :call-seq:
|
98
|
+
# service_resource(force_update=false)
|
86
99
|
sl_dynamic_attr :service_resource do |resource|
|
87
100
|
resource.should_update? do
|
88
101
|
#only retrieved once per instance
|
@@ -183,13 +196,20 @@ module SoftLayer
|
|
183
196
|
# If no client can be found the routine will raise an error.
|
184
197
|
#
|
185
198
|
# You may filter the list returned by adding options:
|
186
|
-
# * <b>+:datacenter+</b> (string) - Include network storage associated with servers matching this datacenter
|
187
|
-
# * <b>+:domain+</b> (string) - Include network storage associated with servers matching this domain
|
188
|
-
# * <b>+:hostname+</b> (string) - Include network storage associated with servers matching this hostname
|
189
|
-
# * <b>+:network_storage_server_type+</b> (
|
190
|
-
# * <b>+:network_storage_type+</b> (
|
191
|
-
# * <b>+:service+</b> (string) - Include network storage from devices with this service fqdn
|
192
|
-
# * <b>+:tags+</b> (
|
199
|
+
# * <b>+:datacenter+</b> (string/array) - Include network storage associated with servers matching this datacenter
|
200
|
+
# * <b>+:domain+</b> (string/array) - Include network storage associated with servers matching this domain
|
201
|
+
# * <b>+:hostname+</b> (string/array) - Include network storage associated with servers matching this hostname
|
202
|
+
# * <b>+:network_storage_server_type+</b> (symbol) - Include network storage associated with this server type
|
203
|
+
# * <b>+:network_storage_type+</b> (symbol) - Include network storage from devices of this storage type
|
204
|
+
# * <b>+:service+</b> (string/array) - Include network storage from devices with this service fqdn
|
205
|
+
# * <b>+:tags+</b> (string/array) - Include network storage associated with servers matching these tags
|
206
|
+
#
|
207
|
+
# Additionally you may provide options related to the request itself:
|
208
|
+
# * <b>*:network_storage_object_mask*</b> (string) - The object mask of properties you wish to receive for the items returned.
|
209
|
+
# If not provided, the result will use the default object mask
|
210
|
+
# * <b>*:network_storage_object_filter*</b> (ObjectFilter) - Include network storage credentials from network storage that matches the
|
211
|
+
# criteria of this object filter
|
212
|
+
# * <b>+:result_limit+</b> (hash with :limit, and :offset keys) - Limit the scope of results returned.
|
193
213
|
#
|
194
214
|
def self.find_network_storage(options_hash = {})
|
195
215
|
softlayer_client = options_hash[:client] || Client.default_client
|
@@ -218,11 +238,11 @@ module SoftLayer
|
|
218
238
|
}
|
219
239
|
|
220
240
|
option_to_filter_path = {
|
221
|
-
:datacenter
|
222
|
-
:domain
|
223
|
-
:hostname
|
224
|
-
:service
|
225
|
-
:tags
|
241
|
+
:datacenter => lambda { |storage_type, server_type| return [ filter_label[storage_type], '.', filter_label[server_type], '.datacenter.name' ].join },
|
242
|
+
:domain => lambda { |storage_type, server_type| return [ filter_label[storage_type], '.', filter_label[server_type], '.domain' ].join },
|
243
|
+
:hostname => lambda { |storage_type, server_type| return [ filter_label[storage_type], '.', filter_label[server_type], '.hostname' ].join },
|
244
|
+
:service => lambda { |storage_type| return [ filter_label[storage_type], '.serviceResource.backendIpAddress' ].join },
|
245
|
+
:tags => lambda { |storage_type, server_type| return [ filter_label[storage_type], '.', filter_label[server_type], '.tagReferences.tag.name' ].join },
|
226
246
|
}
|
227
247
|
|
228
248
|
if options_hash[:network_storage_type]
|
@@ -240,24 +260,13 @@ module SoftLayer
|
|
240
260
|
end
|
241
261
|
|
242
262
|
if options_hash[:network_storage_server_type]
|
243
|
-
[ :datacenter, :domain, :hostname ].each do |option|
|
263
|
+
[ :datacenter, :domain, :hostname, :tags ].each do |option|
|
244
264
|
if options_hash[option]
|
245
265
|
network_storage_object_filter.modify do |filter|
|
246
266
|
filter.accept(option_to_filter_path[option].call(network_storage_type, options_hash[:network_storage_server_type])).when_it is(options_hash[option])
|
247
267
|
end
|
248
268
|
end
|
249
269
|
end
|
250
|
-
|
251
|
-
if options_hash[:tags]
|
252
|
-
network_storage_object_filter.set_criteria_for_key_path(option_to_filter_path[:tags].call(network_storage_type, options_hash[:network_storage_server_type]),
|
253
|
-
{
|
254
|
-
'operation' => 'in',
|
255
|
-
'options' => [{
|
256
|
-
'name' => 'data',
|
257
|
-
'value' => options_hash[:tags].collect{ |tag_value| tag_value.to_s }
|
258
|
-
}]
|
259
|
-
})
|
260
|
-
end
|
261
270
|
end
|
262
271
|
|
263
272
|
account_service = softlayer_client[:Account]
|
@@ -265,6 +274,10 @@ module SoftLayer
|
|
265
274
|
account_service = account_service.object_mask(NetworkStorage.default_object_mask)
|
266
275
|
account_service = account_service.object_mask(options_hash[:network_storage_object_mask]) if options_hash[:network_storage_object_mask]
|
267
276
|
|
277
|
+
if options_hash[:result_limit] && options_hash[:result_limit][:offset] && options_hash[:result_limit][:limit]
|
278
|
+
account_service = account_service.result_limit(options_hash[:result_limit][:offset], options_hash[:result_limit][:limit])
|
279
|
+
end
|
280
|
+
|
268
281
|
case options_hash[:network_storage_type]
|
269
282
|
when :evault
|
270
283
|
network_storage_data = account_service.getEvaultNetworkStorage
|
@@ -15,7 +15,9 @@ module SoftLayer
|
|
15
15
|
sl_attr :name
|
16
16
|
|
17
17
|
##
|
18
|
-
#
|
18
|
+
# Retrieve the NetworkStorageGroup instances assigned to this host
|
19
|
+
# :call-seq:
|
20
|
+
# assigned_groups(force_update=false)
|
19
21
|
sl_dynamic_attr :assigned_groups do |resource|
|
20
22
|
resource.should_update? do
|
21
23
|
#only retrieved once per instance
|
@@ -29,7 +31,9 @@ module SoftLayer
|
|
29
31
|
end
|
30
32
|
|
31
33
|
##
|
32
|
-
#
|
34
|
+
# Retrieve the NetworkStorage instances assigned to this host
|
35
|
+
# :call-seq:
|
36
|
+
# assigned_volumes(force_update=false)
|
33
37
|
sl_dynamic_attr :assigned_volumes do |resource|
|
34
38
|
resource.should_update? do
|
35
39
|
#only retrieved once per instance
|
@@ -43,7 +47,9 @@ module SoftLayer
|
|
43
47
|
end
|
44
48
|
|
45
49
|
##
|
46
|
-
#
|
50
|
+
# Retrieve the NetworkStorageCredential instance used to access NetworkStorage for this host
|
51
|
+
# :call-seq:
|
52
|
+
# credential(force_update=false)
|
47
53
|
sl_dynamic_attr :credential do |resource|
|
48
54
|
resource.should_update? do
|
49
55
|
#only retrieved once per instance
|
@@ -17,13 +17,27 @@ module SoftLayer
|
|
17
17
|
include ::SoftLayer::DynamicAttribute
|
18
18
|
|
19
19
|
##
|
20
|
-
# :attr_reader:
|
20
|
+
# :attr_reader: created_at
|
21
|
+
# This is the data that the record was created in the table.
|
22
|
+
sl_attr :created_at, 'createDate'
|
23
|
+
|
24
|
+
##
|
25
|
+
# :attr_reader: created
|
21
26
|
# This is the data that the record was created in the table.
|
27
|
+
# DEPRECATION WARNING: This attribute is deprecated in favor of created_at
|
28
|
+
# and will be removed in the next major release.
|
22
29
|
sl_attr :created, 'createDate'
|
23
30
|
|
24
31
|
##
|
25
|
-
# :attr_reader:
|
32
|
+
# :attr_reader: modified_at
|
33
|
+
# This is the date that the record was last updated in the table.
|
34
|
+
sl_attr :modified_at, 'modifyDate'
|
35
|
+
|
36
|
+
##
|
37
|
+
# :attr_reader: modified
|
26
38
|
# This is the date that the record was last updated in the table.
|
39
|
+
# DEPRECATION WARNING: This attribute is deprecated in favor of modified_at
|
40
|
+
# and will be removed in the next major release.
|
27
41
|
sl_attr :modified, 'modifyDate'
|
28
42
|
|
29
43
|
##
|
@@ -61,14 +75,22 @@ module SoftLayer
|
|
61
75
|
# If no client can be found the routine will raise an error.
|
62
76
|
#
|
63
77
|
# You may filter the list returned by adding options:
|
64
|
-
# * <b>+:datacenter+</b> (string) - Include network storage
|
65
|
-
# * <b>+:domain+</b> (string) - Include network storage
|
66
|
-
# * <b>+:hostname+</b> (string) - Include network storage
|
67
|
-
# * <b>+:network_storage_server_type+</b> (
|
68
|
-
# * <b>+:network_storage_type+</b> (
|
69
|
-
# * <b>+:service+</b> (string) - Include network storage
|
70
|
-
# * <b>+:tags+</b> (
|
71
|
-
# * <b>+:username+</b> (string) - Include network storage
|
78
|
+
# * <b>+:datacenter+</b> (string/array) - Include network storage credentials associated with servers matching this datacenter
|
79
|
+
# * <b>+:domain+</b> (string/array) - Include network storage credentials associated with servers matching this domain
|
80
|
+
# * <b>+:hostname+</b> (string/array) - Include network storage credentials associated with servers matching this hostname
|
81
|
+
# * <b>+:network_storage_server_type+</b> (symbol) - Include network storage credentials associated with services of this server type
|
82
|
+
# * <b>+:network_storage_type+</b> (symbol) - Include network storage credentials from devices of this storage type
|
83
|
+
# * <b>+:service+</b> (string/array) - Include network storage credentials from devices with this service fqdn
|
84
|
+
# * <b>+:tags+</b> (string/array) - Include network storage credentials associated with servers matching these tags
|
85
|
+
# * <b>+:username+</b> (string/array) - Include network storage credentials with this username only
|
86
|
+
#
|
87
|
+
# Additionally you may provide options related to the request itself:
|
88
|
+
# * <b>*:network_storage_credential_object_filter*</b> (ObjectFilter) - Include network storage credentials that match the
|
89
|
+
# criteria of this object filter
|
90
|
+
# * <b>*:network_storage_credential_object_mask*</b> (string) - The object mask of properties you wish to receive for the items returned.
|
91
|
+
# If not provided, the result will use the default object mask
|
92
|
+
# * <b>*:network_storage_object_filter*</b> (ObjectFilter) - Include network storage credentials from network storage that matches the
|
93
|
+
# criteria of this object filter
|
72
94
|
#
|
73
95
|
def self.find_network_storage_credentials(options_hash = {})
|
74
96
|
softlayer_client = options_hash[:client] || Client.default_client
|
@@ -104,11 +126,13 @@ module SoftLayer
|
|
104
126
|
}
|
105
127
|
|
106
128
|
option_to_filter_path = {
|
107
|
-
:
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
129
|
+
:network_storage => {
|
130
|
+
:datacenter => lambda { |storage_type, server_type| return [ filter_label[storage_type], '.', filter_label[server_type], '.datacenter.name' ].join },
|
131
|
+
:domain => lambda { |storage_type, server_type| return [ filter_label[storage_type], '.', filter_label[server_type], '.domain' ].join },
|
132
|
+
:hostname => lambda { |storage_type, server_type| return [ filter_label[storage_type], '.', filter_label[server_type], '.hostname' ].join },
|
133
|
+
:service => lambda { |storage_type| return [ filter_label[storage_type], '.serviceResource.backendIpAddress' ].join },
|
134
|
+
:tags => lambda { |storage_type, server_type| return [ filter_label[storage_type], '.', filter_label[server_type], '.tagReferences.tag.name' ].join }
|
135
|
+
},
|
112
136
|
:network_storage_credential => {
|
113
137
|
:username => "credentials.username"
|
114
138
|
}
|
@@ -124,29 +148,20 @@ module SoftLayer
|
|
124
148
|
|
125
149
|
if options_hash[:service]
|
126
150
|
network_storage_object_filter.modify do |filter|
|
127
|
-
filter.accept(option_to_filter_path[:service].call(network_storage_type)).when_it is(options_hash[:service])
|
151
|
+
filter.accept(option_to_filter_path[:network_storage][:service].call(network_storage_type)).when_it is(options_hash[:service])
|
128
152
|
end
|
129
153
|
end
|
130
154
|
|
131
155
|
if options_hash[:network_storage_server_type]
|
132
|
-
[
|
156
|
+
option_to_filter_path[:network_storage].keys.each do |option|
|
157
|
+
next if option == :service
|
158
|
+
|
133
159
|
if options_hash[option]
|
134
160
|
network_storage_object_filter.modify do |filter|
|
135
|
-
filter.accept(option_to_filter_path[option].call(network_storage_type, options_hash[:network_storage_server_type])).when_it is(options_hash[option])
|
161
|
+
filter.accept(option_to_filter_path[:network_storage][option].call(network_storage_type, options_hash[:network_storage_server_type])).when_it is(options_hash[option])
|
136
162
|
end
|
137
163
|
end
|
138
164
|
end
|
139
|
-
|
140
|
-
if options_hash[:tags]
|
141
|
-
network_storage_object_filter.set_criteria_for_key_path(option_to_filter_path[:tags].call(network_storage_type, options_hash[:network_storage_server_type]),
|
142
|
-
{
|
143
|
-
'operation' => 'in',
|
144
|
-
'options' => [{
|
145
|
-
'name' => 'data',
|
146
|
-
'value' => options_hash[:tags].collect{ |tag_value| tag_value.to_s }
|
147
|
-
}]
|
148
|
-
})
|
149
|
-
end
|
150
165
|
end
|
151
166
|
|
152
167
|
option_to_filter_path[:network_storage_credential].each do |option, filter_path|
|
@@ -15,17 +15,33 @@ module SoftLayer
|
|
15
15
|
sl_attr :alias
|
16
16
|
|
17
17
|
##
|
18
|
-
# :attr_reader:
|
18
|
+
# :attr_reader: created_at
|
19
|
+
# The date this group was created.
|
20
|
+
sl_attr :created_at, 'createDate'
|
21
|
+
|
22
|
+
##
|
23
|
+
# :attr_reader: created
|
19
24
|
# The date this group was created.
|
25
|
+
# DEPRECATION WARNING: This attribute is deprecated in favor of created_at
|
26
|
+
# and will be removed in the next major release.
|
20
27
|
sl_attr :created, 'createDate'
|
21
28
|
|
22
29
|
##
|
23
|
-
# :attr_reader:
|
30
|
+
# :attr_reader: modified_at
|
31
|
+
# The date this group was modified.
|
32
|
+
sl_attr :modified_at, 'modifyDate'
|
33
|
+
|
34
|
+
##
|
35
|
+
# :attr_reader: modified
|
24
36
|
# The date this group was modified.
|
37
|
+
# DEPRECATION WARNING: This attribute is deprecated in favor of modified_at
|
38
|
+
# and will be removed in the next major release.
|
25
39
|
sl_attr :modified, 'modifyDate'
|
26
40
|
|
27
41
|
##
|
28
|
-
#
|
42
|
+
# Retrieve the SoftLayer_Account which owns this group.
|
43
|
+
# :call-seq:
|
44
|
+
# account(force_update=false)
|
29
45
|
sl_dynamic_attr :account do |resource|
|
30
46
|
resource.should_update? do
|
31
47
|
#only retrieved once per instance
|
@@ -39,7 +55,9 @@ module SoftLayer
|
|
39
55
|
end
|
40
56
|
|
41
57
|
##
|
42
|
-
#
|
58
|
+
# Retrieve the allowed hosts list for this group.
|
59
|
+
# :call-seq:
|
60
|
+
# allowed_hosts(force_update=false)
|
43
61
|
sl_dynamic_attr :allowed_hosts do |resource|
|
44
62
|
resource.should_update? do
|
45
63
|
#only retrieved once per instance
|
@@ -53,7 +71,9 @@ module SoftLayer
|
|
53
71
|
end
|
54
72
|
|
55
73
|
##
|
56
|
-
#
|
74
|
+
# Retrieve the network storage volumes this group is attached to.
|
75
|
+
# :call-seq:
|
76
|
+
# attached_volumes(force_update=false)
|
57
77
|
sl_dynamic_attr :attached_volumes do |resource|
|
58
78
|
resource.should_update? do
|
59
79
|
#only retrieved once per instance
|
@@ -67,7 +87,9 @@ module SoftLayer
|
|
67
87
|
end
|
68
88
|
|
69
89
|
##
|
70
|
-
#
|
90
|
+
# Retrieve the IP address for for SoftLayer_Network_Storage_Allowed_Host objects within this group.
|
91
|
+
# :call-seq:
|
92
|
+
# ip_address(force_update=false)
|
71
93
|
sl_dynamic_attr :ip_address do |resource|
|
72
94
|
resource.should_update? do
|
73
95
|
#only retrieved once per instance
|
@@ -81,7 +103,10 @@ module SoftLayer
|
|
81
103
|
end
|
82
104
|
|
83
105
|
##
|
84
|
-
#
|
106
|
+
# Retrieve the description of the SoftLayer_Network_Storage_OS_Type
|
107
|
+
# Operating System designation that this group was created for.
|
108
|
+
# :call-seq:
|
109
|
+
# os_description(force_update=false)
|
85
110
|
sl_dynamic_attr :os_description do |resource|
|
86
111
|
resource.should_update? do
|
87
112
|
#only retrieved once per instance
|
@@ -95,7 +120,10 @@ module SoftLayer
|
|
95
120
|
end
|
96
121
|
|
97
122
|
##
|
98
|
-
#
|
123
|
+
# Retrieve the name of the SoftLayer_Network_Storage_OS_Type
|
124
|
+
# Operating System designation that this group was created for.
|
125
|
+
# :call-seq:
|
126
|
+
# os_name(force_update=false)
|
99
127
|
sl_dynamic_attr :os_name do |resource|
|
100
128
|
resource.should_update? do
|
101
129
|
#only retrieved once per instance
|
@@ -109,7 +137,9 @@ module SoftLayer
|
|
109
137
|
end
|
110
138
|
|
111
139
|
##
|
112
|
-
#
|
140
|
+
# Retrieve the network resource this group is created on.
|
141
|
+
# :call-seq:
|
142
|
+
# service_resource(force_update=false)
|
113
143
|
sl_dynamic_attr :service_resource do |resource|
|
114
144
|
resource.should_update? do
|
115
145
|
#only retrieved once per instance
|
@@ -123,7 +153,9 @@ module SoftLayer
|
|
123
153
|
end
|
124
154
|
|
125
155
|
##
|
126
|
-
#
|
156
|
+
# Retrieve the name of the SoftLayer_Network_Storage_Group_Type which describes this group.
|
157
|
+
# :call-seq:
|
158
|
+
# type(force_update=false)
|
127
159
|
sl_dynamic_attr :type do |resource|
|
128
160
|
resource.should_update? do
|
129
161
|
#only retrieved once per instance
|
@@ -115,7 +115,7 @@ module SoftLayer
|
|
115
115
|
# The ObjectFilterDefinitionContext defines a bunch of methods
|
116
116
|
# that allow the property conditions of an object filter to
|
117
117
|
# be defined in a "pretty" way. Each method returns a block
|
118
|
-
# (a lambda, a proc) that, when called and
|
118
|
+
# (a lambda, a proc) that, when called and passed the tail property
|
119
119
|
# of a property chain will generate a fragment of an object filter
|
120
120
|
# asking that that property match the given conditions.
|
121
121
|
#
|
@@ -125,14 +125,16 @@ module SoftLayer
|
|
125
125
|
module ObjectFilterDefinitionContext
|
126
126
|
# Matches when the value in the field is exactly equal to the
|
127
127
|
# given value. This is a case-sensitive match
|
128
|
+
# If value is Enumerable, it is equivalent to calling is_contained_by
|
128
129
|
def self.is(value)
|
129
|
-
{ 'operation' => value }
|
130
|
+
value.kind_of?(Enumerable) ? is_contained_by(value) : { 'operation' => value }
|
130
131
|
end
|
131
132
|
|
132
133
|
# Matches is the value in the field does not exactly equal
|
133
134
|
# the value passed in.
|
135
|
+
# If value is Enumerable, it is equivalent to calling is_not_contained_by
|
134
136
|
def self.is_not(value)
|
135
|
-
filter_criteria('!=', value)
|
137
|
+
value.kind_of?(Enumerable) ? is_not_contained_by(value) : filter_criteria('!=', value)
|
136
138
|
end
|
137
139
|
|
138
140
|
# Matches when the value is found within the field
|
@@ -153,11 +155,59 @@ module SoftLayer
|
|
153
155
|
filter_criteria('$=', value)
|
154
156
|
end
|
155
157
|
|
156
|
-
#
|
158
|
+
# Matches the given value in a case-insensitive way
|
157
159
|
def self.matches_ignoring_case(value)
|
158
160
|
filter_criteria('_=', value)
|
159
161
|
end
|
160
162
|
|
163
|
+
# Matches when the key path value is a date between the start and end dates provided
|
164
|
+
# Dates should be strings in '%m/%d/%Y %T' format or Date/DateTime instances
|
165
|
+
def self.is_between_dates(start_date, end_date)
|
166
|
+
{
|
167
|
+
'operation' => 'betweenDate',
|
168
|
+
'options' => [
|
169
|
+
{
|
170
|
+
'name' => 'startDate',
|
171
|
+
'value' => [ start_date.kind_of?(Date) ? start_date.strftime('%m/%d/%Y %T') : DateTime.strptime(start_date.to_s, '%m/%d/%Y %T').strftime('%m/%d/%Y %T') ]
|
172
|
+
},
|
173
|
+
{
|
174
|
+
'name' => 'endDate',
|
175
|
+
'value' => [ end_date.kind_of?(Date) ? end_date.strftime('%m/%d/%Y %T') : DateTime.strptime(end_date.to_s, '%m/%d/%Y %T').strftime('%m/%d/%Y %T') ]
|
176
|
+
}
|
177
|
+
]
|
178
|
+
}
|
179
|
+
end
|
180
|
+
|
181
|
+
# Matches when key path value is equal to one of the given values in the Enumerable
|
182
|
+
def self.is_contained_by(value)
|
183
|
+
raise "Expected an Enumerable value with a list of acceptable values that can be converted to strings" unless value.kind_of?(Enumerable)
|
184
|
+
|
185
|
+
{
|
186
|
+
'operation' => 'in',
|
187
|
+
'options' => [
|
188
|
+
{
|
189
|
+
'name' => 'data',
|
190
|
+
'value' => value.collect { |enum_val| enum_val.to_s }
|
191
|
+
}
|
192
|
+
]
|
193
|
+
}
|
194
|
+
end
|
195
|
+
|
196
|
+
# Matches when key path value is not equal to one of the given values in the Enumerable
|
197
|
+
def self.is_not_contained_by(value)
|
198
|
+
raise "Expected an Enumerable value with a list of acceptable values that can be converted to strings" unless value.kind_of?(Enumerable)
|
199
|
+
|
200
|
+
{
|
201
|
+
'operation' => 'not in',
|
202
|
+
'options' => [
|
203
|
+
{
|
204
|
+
'name' => 'data',
|
205
|
+
'value' => value.collect { |enum_val| enum_val.to_s }
|
206
|
+
}
|
207
|
+
]
|
208
|
+
}
|
209
|
+
end
|
210
|
+
|
161
211
|
# Matches when the value in the field is greater than the given value
|
162
212
|
def self.is_greater_than(value)
|
163
213
|
filter_criteria('>', value)
|