softlayer_api 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.textile +36 -0
- data/README.textile +17 -7
- data/examples/account_info.rb +6 -3
- data/examples/account_servers.rb +48 -0
- data/examples/create_ticket.rb +33 -22
- data/examples/open_tickets.rb +14 -19
- data/examples/order_bare_metal_package.rb +154 -0
- data/examples/order_virtual_server.rb +85 -0
- data/examples/ticket_info.rb +13 -14
- data/lib/softlayer/APIParameterFilter.rb +100 -23
- data/lib/softlayer/Account.rb +140 -0
- data/lib/softlayer/BareMetalServer.rb +233 -0
- data/lib/softlayer/BareMetalServerOrder.rb +227 -0
- data/lib/softlayer/BareMetalServerOrder_Package.rb +162 -0
- data/lib/softlayer/Client.rb +54 -9
- data/lib/softlayer/Config.rb +2 -3
- data/lib/softlayer/DynamicAttribute.rb +170 -0
- data/lib/softlayer/ModelBase.rb +141 -0
- data/lib/softlayer/ObjectFilter.rb +61 -21
- data/lib/softlayer/ObjectMaskParser.rb +157 -0
- data/lib/softlayer/ObjectMaskProperty.rb +83 -0
- data/lib/softlayer/ObjectMaskToken.rb +107 -0
- data/lib/softlayer/ObjectMaskTokenizer.rb +88 -0
- data/lib/softlayer/ProductItemCategory.rb +137 -0
- data/lib/softlayer/ProductPackage.rb +196 -0
- data/lib/softlayer/Server.rb +245 -0
- data/lib/softlayer/Service.rb +12 -9
- data/lib/softlayer/Ticket.rb +210 -0
- data/lib/softlayer/VirtualServer.rb +388 -0
- data/lib/softlayer/VirtualServerOrder.rb +263 -0
- data/lib/softlayer/base.rb +9 -9
- data/lib/softlayer/object_mask_helpers.rb +46 -18
- data/lib/softlayer_api.rb +15 -0
- metadata +49 -15
@@ -0,0 +1,263 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2014 SoftLayer Technologies, Inc. All rights reserved.
|
3
|
+
#
|
4
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
|
+
# of this software and associated documentation files (the "Software"), to deal
|
6
|
+
# in the Software without restriction, including without limitation the rights
|
7
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
8
|
+
# copies of the Software, and to permit persons to whom the Software is
|
9
|
+
# furnished to do so, subject to the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be included in
|
12
|
+
# all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
15
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
16
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
17
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
18
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
19
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
20
|
+
# THE SOFTWARE.
|
21
|
+
#
|
22
|
+
|
23
|
+
module SoftLayer
|
24
|
+
#
|
25
|
+
# VirtualServerOrder orders virtual servers using SoftLayer_Virtual_Guest::createObject.
|
26
|
+
#
|
27
|
+
# http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/createObject
|
28
|
+
#
|
29
|
+
# +createObject+ allows you to order a virtual server by providing
|
30
|
+
# a simple set of attributes and allows you to avoid much of the
|
31
|
+
# complexity of the SoftLayer ordering system (see ProductPackage)
|
32
|
+
#
|
33
|
+
class VirtualServerOrder
|
34
|
+
#--
|
35
|
+
# Required Attributes
|
36
|
+
# -------------------
|
37
|
+
# The following attributes are required in order to successfully order
|
38
|
+
# a virtual server
|
39
|
+
#++
|
40
|
+
|
41
|
+
# String, short name of the data center that will house the new virtual server (e.g. "dal05" or "sea01")
|
42
|
+
# Corresponds to +datacenter.name+ in the documentation for createObject. If not provided, the server will
|
43
|
+
# be provisioned in the first available data center.
|
44
|
+
attr_accessor :datacenter
|
45
|
+
|
46
|
+
# String, The hostname to assign to the new server
|
47
|
+
attr_accessor :hostname
|
48
|
+
|
49
|
+
# String, The domain (i.e. softlayer.com) for the new server
|
50
|
+
attr_accessor :domain
|
51
|
+
|
52
|
+
# Integer, The number of virtual CPU cores to include in the instance
|
53
|
+
# Corresponds to +startCpus+ in the documentation for +createObject+
|
54
|
+
attr_accessor :cores
|
55
|
+
|
56
|
+
# Integer, The amount of RAM for the new server (specified in Gigabytes so a value of 4 is 4GB)
|
57
|
+
# Corresponds to +maxMemory+ in the documentation for +createObject+
|
58
|
+
attr_accessor :memory
|
59
|
+
|
60
|
+
#--
|
61
|
+
# These two options are mutually exclusive, but one or the other must be provided.
|
62
|
+
# If you provide both, the image_global_id will be added to the order and the os_reference_code will be ignored
|
63
|
+
#++
|
64
|
+
|
65
|
+
# String, An OS reference code for the operating system to install on the virtual server
|
66
|
+
# Corresponds to +operatingSystemReferenceCode+ in the +createObject+ documentation
|
67
|
+
attr_accessor :os_reference_code
|
68
|
+
|
69
|
+
# String, The globalIdentifier of a disk image to put on the newly created server
|
70
|
+
# Corresponds to +blockDeviceTemplateGroup.globalIdentifier+ in the +createObject+ documentation
|
71
|
+
attr_accessor :image_global_id
|
72
|
+
|
73
|
+
#--
|
74
|
+
# Optional attributes
|
75
|
+
#++
|
76
|
+
|
77
|
+
# Boolean, If true, the virtual server will reside only on hosts with instances from this same account
|
78
|
+
# Corresponds to +dedicatedAccountHostOnlyFlag+ in the +createObject+ documentation
|
79
|
+
attr_accessor :dedicated_host_only
|
80
|
+
|
81
|
+
# Array of Integer, Sizes (in gigabytes... so use 25 to get a 25GB disk) of disks to attach to this server
|
82
|
+
# This roughly Corresponds to +blockDevices+ field in the +createObject+ documentation.
|
83
|
+
# This attribute only allows you to configure the size of disks while +blockDevices+ allows
|
84
|
+
# more configuration options
|
85
|
+
attr_accessor :disks
|
86
|
+
|
87
|
+
# Boolean, If true, an hourly server will be ordered, otherwise a monthly server will be ordered
|
88
|
+
# Corresponds to +hourlyBillingFlag+ in the +createObject+ documentation
|
89
|
+
attr_accessor :hourly
|
90
|
+
|
91
|
+
# Integer, The maximum network interface card speed (in Mbps) for the new instance
|
92
|
+
# Corresponds to +networkComponents.maxSpeed+ in the +createObject+ documentation
|
93
|
+
attr_accessor :max_port_speed
|
94
|
+
|
95
|
+
# Boolean, If true then the virtual server will only have a private network interface (and no public network interface)
|
96
|
+
# Corresponds to +userData.value+ in the +createObject+ documentation
|
97
|
+
attr_accessor :private_network_only
|
98
|
+
|
99
|
+
# Integer, The id of the private VLAN this server should join
|
100
|
+
# Corresponds to +primaryBackendNetworkComponent.networkVlan.id+ in the +createObject+ documentation
|
101
|
+
attr_accessor :private_vlan_id
|
102
|
+
|
103
|
+
# String, The URI of a post provisioning script to run on this server once it is created
|
104
|
+
attr_accessor :provision_script_URI
|
105
|
+
|
106
|
+
# Integer, The id of the public VLAN this server should join
|
107
|
+
# Corresponds to +primaryNetworkComponent.networkVlan.id+ in the +createObject+ documentation
|
108
|
+
attr_accessor :public_vlan_id
|
109
|
+
|
110
|
+
# Array of Strings, SSH keys to add to the root user's account.
|
111
|
+
# Corresponds to +sshKeys+ in the +createObject+ documentation
|
112
|
+
attr_accessor :ssh_key_ids
|
113
|
+
|
114
|
+
# Boolean, If true the server will use a virtual hard drive, if false, data will be stored on a SAN disk
|
115
|
+
# Corresponds to +localDiskFlag+ in the +createObject+ documentation
|
116
|
+
attr_accessor :use_local_disk
|
117
|
+
|
118
|
+
# String, User metadata associated with the instance
|
119
|
+
# Corresponds to +primaryBackendNetworkComponent.networkVlan.id+ in the +createObject+ documentation
|
120
|
+
attr_accessor :user_metadata
|
121
|
+
|
122
|
+
# Create a new order that works thorugh the given client connection
|
123
|
+
def initialize (client = nil)
|
124
|
+
@softlayer_client = client || Client.default_client
|
125
|
+
raise "#{__method__} requires a client but none was given and Client::default_client is not set" if !@softlayer_client
|
126
|
+
end
|
127
|
+
|
128
|
+
# Calls the SoftLayer API to verify that the template provided by this order is valid
|
129
|
+
# This routine will return the order template generated by the API or will throw an exception
|
130
|
+
#
|
131
|
+
# This routine will not actually create a Virtual Server and will not affect billing.
|
132
|
+
#
|
133
|
+
# If you provide a block, it will receive the order template as a parameter and it
|
134
|
+
# should return the order template you wish to forward to the server.
|
135
|
+
def verify()
|
136
|
+
order_template = virtual_guest_template
|
137
|
+
order_template = yield order_template if block_given?
|
138
|
+
|
139
|
+
@softlayer_client["Virtual_Guest"].generateOrderTemplate(order_template)
|
140
|
+
end
|
141
|
+
|
142
|
+
# Calls the SoftLayer API to place an order for a new virtual server based on the template in this
|
143
|
+
# order. If this succeeds then you will be billed for the new Virtual Server.
|
144
|
+
#
|
145
|
+
# If you provide a block, it will receive the order template as a parameter and
|
146
|
+
# should return an order template, **carefully** modified, that will be
|
147
|
+
# sent to create the server
|
148
|
+
def place_order!()
|
149
|
+
order_template = virtual_guest_template
|
150
|
+
order_template = yield order_template if block_given?
|
151
|
+
|
152
|
+
virtual_server_hash = @softlayer_client["Virtual_Guest"].createObject(order_template)
|
153
|
+
SoftLayer::VirtualServer.server_with_id(virtual_server_hash["id"], :client => @softlayer_client) if virtual_server_hash
|
154
|
+
end
|
155
|
+
|
156
|
+
protected
|
157
|
+
|
158
|
+
# Returns a hash of the creation options formatted to be sent to
|
159
|
+
# the SoftLayer API for either verification or completion
|
160
|
+
def virtual_guest_template
|
161
|
+
template = {
|
162
|
+
"startCpus" => @cores.to_i,
|
163
|
+
"maxMemory" => @memory.to_i * 1024, # we let the user specify memory in GB, but the API expects maxMemory in MB.
|
164
|
+
"hostname" => @hostname,
|
165
|
+
"domain" => @domain,
|
166
|
+
|
167
|
+
# Note : for the values below, we want to use the constants "true" and "false" not nil
|
168
|
+
# the nil value (while false to Ruby) will not translate to XML properly
|
169
|
+
"localDiskFlag" => !!@use_local_disk,
|
170
|
+
"hourlyBillingFlag" => !!@hourly
|
171
|
+
}
|
172
|
+
|
173
|
+
template["dedicatedAccountHostOnlyFlag"] = true if @dedicated_host_only
|
174
|
+
template["privateNetworkOnlyFlag"] = true if @private_network_only
|
175
|
+
|
176
|
+
template["datacenter"] = {"name" => @datacenter} if @datacenter
|
177
|
+
template['userData'] = [{'value' => @user_metadata}] if @user_metadata
|
178
|
+
template['networkComponents'] = [{'maxSpeed'=> @max_port_speed}] if @max_port_speed
|
179
|
+
template['postInstallScriptUri'] = @provision_script_URI.to_s if @provision_script_URI
|
180
|
+
template['sshKeys'] = @ssh_key_ids.collect { |ssh_key_id| {'id'=> ssh_key_id.to_i } } if @ssh_key_ids
|
181
|
+
template['primaryNetworkComponent'] = { "networkVlan" => { "id" => @public_vlan_id.to_i } } if @public_vlan_id
|
182
|
+
template["primaryBackendNetworkComponent"] = { "networkVlan" => {"id" => @private_vlan_id.to_i } } if @private_vlan_id
|
183
|
+
|
184
|
+
if @image_global_id
|
185
|
+
template["blockDeviceTemplateGroup"] = {"globalIdentifier" => @image_global_id}
|
186
|
+
elsif @os_reference_code
|
187
|
+
template["operatingSystemReferenceCode"] = @os_reference_code
|
188
|
+
end
|
189
|
+
|
190
|
+
if @disks && !@disks.empty?
|
191
|
+
template['blockDevices'] = []
|
192
|
+
|
193
|
+
# According to the documentation for +createObject+,
|
194
|
+
# device number 1 is reserved for the SWAP disk of the computing instance.
|
195
|
+
# So we assign device 0 and then assign the rest starting at index 2.
|
196
|
+
@disks.each_with_index do |disk, index|
|
197
|
+
device_id = (index >= 1) ? index + 1 : index
|
198
|
+
template['blockDevices'].push({"device" => "#{device_id}", "diskImage" => {"capacity" => disk}})
|
199
|
+
end
|
200
|
+
end
|
201
|
+
|
202
|
+
template
|
203
|
+
end
|
204
|
+
|
205
|
+
##
|
206
|
+
# The first time this is called it requests SoftLayer_Virtual_Guest::getCreateObjectOptions:
|
207
|
+
# from the API and remembers the result. On subsequent calls it returns the remembered result.
|
208
|
+
#
|
209
|
+
# http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/getCreateObjectOptions
|
210
|
+
#
|
211
|
+
def self.create_object_options(client = nil)
|
212
|
+
softlayer_client = client || Client.default_client
|
213
|
+
raise "#{__method__} requires a client but none was given and Client::default_client is not set" if !softlayer_client
|
214
|
+
|
215
|
+
@@create_object_options ||= nil
|
216
|
+
@@create_object_options = softlayer_client["Virtual_Guest"].getCreateObjectOptions() if !@@create_object_options
|
217
|
+
@@create_object_options
|
218
|
+
end
|
219
|
+
|
220
|
+
#--
|
221
|
+
# The following routines offer a way to query the SoftLayer API for values that are
|
222
|
+
# valid in some of the fields of a Virtual Server order. While the individual values
|
223
|
+
# returned are all valid, it is still possible to create combinations of values which
|
224
|
+
# the ordering system cannot accept.
|
225
|
+
#++
|
226
|
+
|
227
|
+
##
|
228
|
+
# Return a list of values that are valid for the :datacenter attribute
|
229
|
+
def self.datacenter_options(client = nil)
|
230
|
+
create_object_options(client)["datacenters"].collect { |datacenter_spec| datacenter_spec['template']['datacenter']["name"] }.uniq.sort!
|
231
|
+
end
|
232
|
+
|
233
|
+
##
|
234
|
+
# Return a list of values that are valid for the :cores attribute
|
235
|
+
def self.core_options(client = nil)
|
236
|
+
create_object_options(client)["processors"].collect { |processor_spec| processor_spec['template']['startCpus'] }.uniq.sort!
|
237
|
+
end
|
238
|
+
|
239
|
+
##
|
240
|
+
# Return a list of values that are valid for the :memory attribute
|
241
|
+
def self.memory_options(client = nil)
|
242
|
+
create_object_options(client)["memory"].collect { |memory_spec| memory_spec['template']['maxMemory'].to_i / 1024}.uniq.sort!
|
243
|
+
end
|
244
|
+
|
245
|
+
##
|
246
|
+
# Return a list of values that are valid the array given to the :disks
|
247
|
+
def self.disk_options(client = nil)
|
248
|
+
create_object_options(client)["blockDevices"].collect { |block_device_spec| block_device_spec['template']['blockDevices'][0]['diskImage']['capacity']}.uniq.sort!
|
249
|
+
end
|
250
|
+
|
251
|
+
##
|
252
|
+
# Returns a list of the valid :os_refrence_codes
|
253
|
+
def self.os_reference_code_options(client = nil)
|
254
|
+
create_object_options(client)["operatingSystems"].collect { |os_spec| os_spec['template']['operatingSystemReferenceCode'] }.uniq.sort!
|
255
|
+
end
|
256
|
+
|
257
|
+
##
|
258
|
+
# Returns a list of the :max_port_speeds
|
259
|
+
def self.max_port_speed_options(client = nil)
|
260
|
+
create_object_options(client)["networkComponents"].collect { |component_spec| component_spec['template']['networkComponents'][0]['maxSpeed'] }
|
261
|
+
end
|
262
|
+
end # class VirtualServerOrder
|
263
|
+
end # module SoftLayer
|
data/lib/softlayer/base.rb
CHANGED
@@ -22,16 +22,16 @@
|
|
22
22
|
|
23
23
|
require 'rubygems'
|
24
24
|
|
25
|
-
# This module is used to provide a namespace for SoftLayer code.
|
25
|
+
# This module is used to provide a namespace for SoftLayer code. It also declares a number of
|
26
26
|
# global variables:
|
27
|
-
# -
|
27
|
+
# - +$SL_API_USERNAME+ - The default username passed by clients to the server for authentication.
|
28
28
|
# Set this if you want to use the same username for all clients and don't want to have to specify it when the client is created
|
29
|
-
# -
|
29
|
+
# - +$SL_API_KEY+ - The default API key passed by clients to the server for authentication.
|
30
30
|
# Set this if you want to use the same api for all clients and don't want to have to specify it when the client is created
|
31
|
-
# -
|
31
|
+
# - +$SL_API_BASE_URL+- The default URL used to access the SoftLayer API. This defaults to the value of +SoftLayer::API_PUBLIC_ENDPOINT+
|
32
32
|
#
|
33
33
|
module SoftLayer
|
34
|
-
VERSION = "2.0
|
34
|
+
VERSION = "2.1.0" # version history in the CHANGELOG.textile file at the root of the source
|
35
35
|
|
36
36
|
# The base URL of the SoftLayer API's REST-like endpoints available to the public internet.
|
37
37
|
API_PUBLIC_ENDPOINT = 'https://api.softlayer.com/xmlrpc/v3/'
|
@@ -43,12 +43,12 @@ module SoftLayer
|
|
43
43
|
# These globals can be used to simplify client creation
|
44
44
|
#
|
45
45
|
|
46
|
-
# Set this if you want to provide a default username for each
|
47
|
-
# usernames provided to the
|
46
|
+
# Set this if you want to provide a default username for each client as it is created.
|
47
|
+
# usernames provided to the client initializer will override the global
|
48
48
|
$SL_API_USERNAME = nil
|
49
49
|
|
50
|
-
# Set this if you want to provide a default api_key for each
|
51
|
-
# created. API keys provided in the constructor when a
|
50
|
+
# Set this if you want to provide a default api_key for each client as it is
|
51
|
+
# created. API keys provided in the constructor when a client is created will
|
52
52
|
# override the values in this global
|
53
53
|
$SL_API_KEY = nil
|
54
54
|
|
@@ -20,12 +20,17 @@
|
|
20
20
|
# THE SOFTWARE.
|
21
21
|
#
|
22
22
|
|
23
|
-
|
23
|
+
##
|
24
|
+
# This extension to the Hash class to allows object masks to be constructed
|
25
|
+
# from built-in Ruby types and converted to object masks strings for presentation
|
26
|
+
# to the SoftLayer API
|
24
27
|
class Hash
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
28
|
+
# Given a hash, generate an Object Mask string from the structure
|
29
|
+
# found within the hash. This allows object masks to be constructed
|
30
|
+
# as hashes, then converted to strings when they must be passed
|
31
|
+
# to the API. The routine does some very rudimentary validation to
|
32
|
+
# ensure that the hash represents a valid object mask, but care must
|
33
|
+
# still be taken when constructing the hash.
|
29
34
|
def to_sl_object_mask()
|
30
35
|
raise RuntimeError, "An object mask must contain properties" if empty?
|
31
36
|
raise RuntimeError, "An object mask must start with root properties" if keys().find { |key| !__valid_root_property_key?(key) }
|
@@ -34,25 +39,34 @@ class Hash
|
|
34
39
|
key_strings.count > 1 ? "[#{key_strings.join(',')}]" : "#{key_strings[0]}"
|
35
40
|
end
|
36
41
|
|
37
|
-
|
42
|
+
# Returns a string representing the hash as a property within a larger
|
43
|
+
# object mask. This routine is an implementation detail used in the conversion
|
44
|
+
# of hashes to object mask strings. You should not have to call this method directly.
|
45
|
+
def _to_sl_object_mask_property()
|
38
46
|
key_strings = __sl_object_mask_properties_for_keys();
|
39
47
|
"#{key_strings.join(',')}"
|
40
48
|
end
|
41
49
|
|
50
|
+
private
|
51
|
+
|
52
|
+
def __valid_root_property_key?(key_string)
|
53
|
+
return key_string == "mask" || (0 == (key_string =~ /\Amask\([a-z][a-z0-9_]*\)\z/i))
|
54
|
+
end
|
55
|
+
|
42
56
|
def __sl_object_mask_properties_for_keys
|
43
57
|
key_strings = [];
|
44
58
|
|
45
59
|
each do |key, value|
|
46
60
|
return "" if !value
|
47
61
|
|
48
|
-
string_for_key = key.
|
62
|
+
string_for_key = key._to_sl_object_mask_property
|
49
63
|
|
50
64
|
if value.kind_of?(String) || value.kind_of?(Symbol) then
|
51
|
-
string_for_key = "#{string_for_key}.#{value.
|
65
|
+
string_for_key = "#{string_for_key}.#{value._to_sl_object_mask_property}"
|
52
66
|
end
|
53
67
|
|
54
68
|
if value.kind_of?(Array) || value.kind_of?(Hash) then
|
55
|
-
value_string = value.
|
69
|
+
value_string = value._to_sl_object_mask_property
|
56
70
|
if value_string && !value_string.empty?
|
57
71
|
string_for_key = "#{string_for_key}[#{value_string}]"
|
58
72
|
end
|
@@ -65,30 +79,44 @@ class Hash
|
|
65
79
|
end
|
66
80
|
end
|
67
81
|
|
68
|
-
|
82
|
+
##
|
83
|
+
# SoftLayer Extensions to the Array class to support using arrays to create
|
84
|
+
# object masks
|
69
85
|
class Array
|
70
86
|
# Returns a string representing the object mask content represented by the
|
71
87
|
# Array. Each value in the array is converted to its object mask eqivalent
|
72
|
-
|
88
|
+
# This routine is an implementation detail used in the conversion of hashes
|
89
|
+
# to object mask strings. You should not have to call this method directly.
|
90
|
+
def _to_sl_object_mask_property()
|
73
91
|
return "" if self.empty?
|
74
|
-
property_content = map { |item| item.
|
92
|
+
property_content = map { |item| item ? item._to_sl_object_mask_property() : nil }.compact.flatten.join(",")
|
75
93
|
"#{property_content}"
|
76
94
|
end
|
77
95
|
end
|
78
96
|
|
79
|
-
|
97
|
+
##
|
98
|
+
# SoftLayer Extensions to the String class to support using strings to create
|
99
|
+
# object masks
|
80
100
|
class String
|
81
101
|
# Returns a string representing the object mask content represented by the
|
82
|
-
# String. Strings are simply represented as copies of themselves.
|
102
|
+
# String. Strings are simply represented as copies of themselves. We make
|
83
103
|
# a copy in case the original String is modified somewhere along the way
|
84
|
-
|
104
|
+
# This routine is an implementation detail used in the conversion of hashes
|
105
|
+
# to object mask strings. You should not have to call this method directly.
|
106
|
+
def _to_sl_object_mask_property()
|
85
107
|
return self.strip
|
86
108
|
end
|
87
109
|
end
|
88
110
|
|
89
|
-
|
111
|
+
##
|
112
|
+
# SoftLayer Extensions to the Symbol class to support using symbols to create
|
113
|
+
# object masks
|
90
114
|
class Symbol
|
91
|
-
|
92
|
-
|
115
|
+
# Converts the Symbol to a string, then converts the string to an
|
116
|
+
# object mask property. This routine is an implementation detail used in
|
117
|
+
# the conversion of hashes to object mask strings. You should not have to
|
118
|
+
# call this method directly.
|
119
|
+
def _to_sl_object_mask_property()
|
120
|
+
self.to_s._to_sl_object_mask_property()
|
93
121
|
end
|
94
122
|
end
|
data/lib/softlayer_api.rb
CHANGED
@@ -24,7 +24,22 @@ require 'softlayer/base'
|
|
24
24
|
require 'softlayer/object_mask_helpers'
|
25
25
|
require 'softlayer/APIParameterFilter'
|
26
26
|
require 'softlayer/ObjectFilter'
|
27
|
+
require 'softlayer/ObjectMaskParser'
|
27
28
|
require 'softlayer/Config'
|
28
29
|
|
29
30
|
require 'softlayer/Client'
|
30
31
|
require 'softlayer/Service'
|
32
|
+
|
33
|
+
# model classes
|
34
|
+
require 'softlayer/ModelBase'
|
35
|
+
require 'softlayer/DynamicAttribute'
|
36
|
+
require 'softlayer/Account'
|
37
|
+
require 'softlayer/Ticket'
|
38
|
+
require 'softlayer/Server'
|
39
|
+
require 'softlayer/BareMetalServer'
|
40
|
+
require 'softlayer/BareMetalServerOrder'
|
41
|
+
require 'softlayer/BareMetalServerOrder_Package'
|
42
|
+
require 'softlayer/ProductPackage'
|
43
|
+
require 'softlayer/ProductItemCategory'
|
44
|
+
require 'softlayer/VirtualServer'
|
45
|
+
require 'softlayer/VirtualServerOrder'
|
metadata
CHANGED
@@ -1,75 +1,89 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: softlayer_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SoftLayer Development Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: configparser
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: 0.1.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: 0.1.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rspec
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rdoc
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.4.2
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.4.2
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: json
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- - ~>
|
73
|
+
- - "~>"
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: '1.8'
|
62
|
-
- -
|
76
|
+
- - ">="
|
63
77
|
- !ruby/object:Gem::Version
|
64
78
|
version: 1.8.1
|
65
79
|
type: :development
|
66
80
|
prerelease: false
|
67
81
|
version_requirements: !ruby/object:Gem::Requirement
|
68
82
|
requirements:
|
69
|
-
- - ~>
|
83
|
+
- - "~>"
|
70
84
|
- !ruby/object:Gem::Version
|
71
85
|
version: '1.8'
|
72
|
-
- -
|
86
|
+
- - ">="
|
73
87
|
- !ruby/object:Gem::Version
|
74
88
|
version: 1.8.1
|
75
89
|
description: The softlayer_api gem offers a convenient mechanism for invoking the
|
@@ -79,17 +93,37 @@ executables: []
|
|
79
93
|
extensions: []
|
80
94
|
extra_rdoc_files: []
|
81
95
|
files:
|
96
|
+
- CHANGELOG.textile
|
82
97
|
- LICENSE.textile
|
83
98
|
- README.textile
|
84
99
|
- examples/account_info.rb
|
100
|
+
- examples/account_servers.rb
|
85
101
|
- examples/create_ticket.rb
|
86
102
|
- examples/open_tickets.rb
|
103
|
+
- examples/order_bare_metal_package.rb
|
104
|
+
- examples/order_virtual_server.rb
|
87
105
|
- examples/ticket_info.rb
|
88
106
|
- lib/softlayer/APIParameterFilter.rb
|
107
|
+
- lib/softlayer/Account.rb
|
108
|
+
- lib/softlayer/BareMetalServer.rb
|
109
|
+
- lib/softlayer/BareMetalServerOrder.rb
|
110
|
+
- lib/softlayer/BareMetalServerOrder_Package.rb
|
89
111
|
- lib/softlayer/Client.rb
|
90
112
|
- lib/softlayer/Config.rb
|
113
|
+
- lib/softlayer/DynamicAttribute.rb
|
114
|
+
- lib/softlayer/ModelBase.rb
|
91
115
|
- lib/softlayer/ObjectFilter.rb
|
116
|
+
- lib/softlayer/ObjectMaskParser.rb
|
117
|
+
- lib/softlayer/ObjectMaskProperty.rb
|
118
|
+
- lib/softlayer/ObjectMaskToken.rb
|
119
|
+
- lib/softlayer/ObjectMaskTokenizer.rb
|
120
|
+
- lib/softlayer/ProductItemCategory.rb
|
121
|
+
- lib/softlayer/ProductPackage.rb
|
122
|
+
- lib/softlayer/Server.rb
|
92
123
|
- lib/softlayer/Service.rb
|
124
|
+
- lib/softlayer/Ticket.rb
|
125
|
+
- lib/softlayer/VirtualServer.rb
|
126
|
+
- lib/softlayer/VirtualServerOrder.rb
|
93
127
|
- lib/softlayer/base.rb
|
94
128
|
- lib/softlayer/object_mask_helpers.rb
|
95
129
|
- lib/softlayer_api.rb
|
@@ -103,12 +137,12 @@ require_paths:
|
|
103
137
|
- lib
|
104
138
|
required_ruby_version: !ruby/object:Gem::Requirement
|
105
139
|
requirements:
|
106
|
-
- -
|
140
|
+
- - ">="
|
107
141
|
- !ruby/object:Gem::Version
|
108
|
-
version:
|
142
|
+
version: 1.9.2
|
109
143
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
144
|
requirements:
|
111
|
-
- -
|
145
|
+
- - ">="
|
112
146
|
- !ruby/object:Gem::Version
|
113
147
|
version: '0'
|
114
148
|
requirements: []
|