softlayer_api 3.0.b1 → 3.0.b2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6f8d78ff1302ba4ee3970aa9b35ae5ad58de334a
4
- data.tar.gz: 3a26cf514cefcf910e4edbadf810d63a1eea96fd
3
+ metadata.gz: cf6fc20410da311fea43f73b7e553c2f2f648ea9
4
+ data.tar.gz: 7e4100bd3eaed844094ce1eb97fd70e30549b0a2
5
5
  SHA512:
6
- metadata.gz: 8c15a6526a4447e70fcf63433c443236666bebd15dfd8f96d18ace34ae00259e55633b0c38b2938c00e066265793617b276eae6c369a36f3db1ab666e89c66d1
7
- data.tar.gz: 75f70052f5946914de71194f7db38ee2d3b6f7ee189c2b33e1bd944d5215c6ce6890e8cb6a653a2a074ef5be76528eb5c82bfe75bd57e58841b48b4076154eed
6
+ metadata.gz: 27c9f441cac5de34072dd3f2107ba6738b2b0eff561ea63e3e57d8022c0fae55eecefc0491d8251cd1b990369c15781c8e0ac60ba6f189b3e67016e3c7dcaf55
7
+ data.tar.gz: 37cc5b26fa4b62e8a8d4664e774815bdc1ea812985174c8734690f4a6aaaab5c366707bfd7308d89c3ac3a94c8a9dd6754123bda92d8edc83d57ae9c57d517c7
data/CHANGELOG.textile CHANGED
@@ -1,13 +1,18 @@
1
1
  *3.0*
2
2
  * Substantially rewrote the ObjectFilter class. ObjectFilters used to be hashes which made it easy to manipulate their content incorrectly. The new implementation has a strict interface that makes it harder to manipulate filters incorrectly.
3
- * Added a model for Virtual Server Image Templates (SoftLayer::ImageTemplate) - VirtualServerOrder now requires an instance of this class rather than allowing you to provide just the global_id of an image
3
+ * Added a model for Virtual Server Image Templates (SoftLayer::ImageTemplate) - VirtualServerOrder now requires an instance of this class rather than allowing you to provide the global_id of an image
4
4
  * Added a model for data centers (SoftLayer::Datacenter). Bare Metal, Bare Metal Package, and Virtual server orders now use an instance of Datacenter to identify where their servers will be provisioned. The routines in those classes which used to provide lists of valid data center names now return data center objects.
5
5
  * Virtual Server Upgrades are now handled by the VirtualServerUpgradeOrder class and not the VirtualServer class. This change was made for several reasons. Firt and foremost, it allows multiple aspects of a virtual server to be upgraded at once without having to wait on separate transactions to complete between upgrades. Secondly it opens the door for additional upgrades (for example, to disk configuration) to be added in the future.
6
6
  * Added a method to reboot servers.
7
7
  * The routine to retreive the open tickets on an account has been moved from the Ticket class. The set of open tickets is now a dynamic property of an account object.
8
+ * The Model Layer now includes models for Server (aka. Shared) and VLAN (aka. Dedicated) firewalls in the ServerFirewall, and VLANFireall classes respectively. There are corresponding classes for ordering firewalls (ServerFirewallOrder and VLANFirewallOrder). To facilitate the process of locating the 'id' for a firewall, the Account class includes the find_VLAN_with_number routine which lets you look up the segments of a firewall from the VLAN nubmer.
9
+
10
+ *2.2.2*
11
+ * Fixed a bug in BareMetalServerOrder_Package.rb where the order template did not use an array for the "hardware" key. This lead to an order template that would be accepted by verifyOrder, but rejected by placeOrder. An internal issue to review verifyOrder has also been generated. (reported by Rohit Singh)
8
12
 
9
13
  *2.2*
10
- * Added the ability to set a timout for network requests. The timeout is given when a client is created by passing the :timeout hash parameter when creating a client. The value of the parameter is an integer number of seconds.
14
+ * Added the ability to set a timout for network requests. The timeout is given when a client is created by passing the :timeout hash parameter when creating a client. The value of the parameter is an integer number of seconds.
15
+ * Fixed a bug in VirtualServer#capture_image
11
16
 
12
17
  *2.1.1*
13
18
  * Virtual server upgrades no longer raise exceptions
@@ -129,11 +129,11 @@ begin
129
129
  # We have a configuration for the server, we also need a location for the new server.
130
130
  # The package can give us a list of locations. Let's print out that list
131
131
  puts "\nData Centers for '#{quad_intel_package.name}':"
132
- quad_intel_package.datacenter_options.each { |location| puts "\t#{location}"}
132
+ quad_intel_package.datacenter_options.each { |datacenter| puts "\t#{datacenter.name}"}
133
133
 
134
134
  # With all the config options in place we can now construct the product order.
135
135
  server_order = SoftLayer::BareMetalServerOrder_Package.new(quad_intel_package, client)
136
- server_order.datacenter = 'sng01'
136
+ server_order.datacenter = SoftLayer::Datacenter.datacenter_named 'sng01', client
137
137
  server_order.hostname = 'sample'
138
138
  server_order.domain = 'softlayerapi.org'
139
139
  server_order.configuration_options = config_options
@@ -0,0 +1,63 @@
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
+ require 'rubygems'
24
+ require 'softlayer_api'
25
+ require 'pp'
26
+
27
+ # This is the id of the server you want to protect with a firewall.
28
+ # The server can be Bare Metal or Virtual. It should have a public
29
+ # network interface, and it should not already have a firewall on it.
30
+ server_id = 257696 # 12345
31
+
32
+ # In this example, we assume this is a Bare Metal Server
33
+ is_virtual_server = false
34
+
35
+ # Work with the SoftLayer API begins with a client. By setting
36
+ # the "default" client we avoid having to specify the client repeatedly
37
+ # in calls that follow.
38
+ SoftLayer::Client.default_client = SoftLayer::Client.new(
39
+ # :username => "joecustomer" # enter your username here
40
+ # :api_key => "feeddeadbeefbadf00d..." # enter your api key here
41
+ )
42
+
43
+ # in this case we go straight to the appropriate class to find the server
44
+ # an alternative might be to create the account for this client and
45
+ # search the list of servers for the one with the appropriate ID.
46
+ if is_virtual_server
47
+ server = SoftLayer::VirtualServer.server_with_id(server_id)
48
+ else
49
+ server = SoftLayer::BareMetalServer.server_with_id(server_id)
50
+ end
51
+
52
+ # Create an instance of SoftLayer::ServerFirewallOrder
53
+ order = SoftLayer::ServerFirewallOrder.new(server)
54
+
55
+ begin
56
+ # this example calls order.verify which will build the order, submit it
57
+ # to the network API, and will throw an exception if the order is
58
+ # invalid.
59
+ order.verify()
60
+ puts "Firewall order is good for #{server.fullyQualifiedDomainName}"
61
+ rescue => exception
62
+ puts "Firewall order failed for #{server.fullyQualifiedDomainName} because #{exception}"
63
+ end
@@ -43,6 +43,13 @@ class APIParameterFilter
43
43
  @parameters = starting_parameters || {}
44
44
  end
45
45
 
46
+ ##
47
+ # API Parameter filters will call through to a particular service
48
+ # but that service is defined by their target
49
+ def service_name
50
+ return @target.service_name
51
+ end
52
+
46
53
  ##
47
54
  # Adds an API filter that narrows the scope of a call to an object with
48
55
  # a particular ID. For example, if you want to get the ticket
@@ -173,7 +180,7 @@ class APIParameterFilter
173
180
  ##
174
181
  # A utility method that returns the object filter (if any) stored with this filter.
175
182
  def server_object_filter
176
- self.parameters[:object_filter].to_h
183
+ self.parameters[:object_filter].to_h if self.parameters.has_key?(:object_filter)
177
184
  end
178
185
 
179
186
  ##
@@ -123,7 +123,25 @@ module SoftLayer
123
123
  end
124
124
 
125
125
  def service
126
- softlayer_client["Account"].object_with_id(self.id)
126
+ softlayer_client[:Account].object_with_id(self.id)
127
+ end
128
+
129
+ ##
130
+ # Searches the account's list of VLANs for the ones with the given
131
+ # vlan number. This may return multiple results because a VLAN can
132
+ # span different routers and you will get a separate segment for
133
+ # each router.
134
+ #
135
+ # The IDs of the different segments can be helpful for ordering
136
+ # firewalls.
137
+ #
138
+ def find_VLAN_with_number(vlan_number)
139
+ filter = SoftLayer::ObjectFilter.new() { |filter|
140
+ filter.accept('networkVlans.vlanNumber').when_it is vlan_number
141
+ }
142
+
143
+ vlan_data = self.service.object_mask("mask[id,vlanNumber,primaryRouter,networkSpace]").object_filter(filter).getNetworkVlans
144
+ return vlan_data
127
145
  end
128
146
 
129
147
  ##
@@ -134,7 +152,7 @@ module SoftLayer
134
152
  softlayer_client = client || Client.default_client
135
153
  raise "#{__method__} requires a client but none was given and Client::default_client is not set" if !softlayer_client
136
154
 
137
- account_service = softlayer_client['Account']
155
+ account_service = softlayer_client[:Account]
138
156
  network_hash = account_service.getObject()
139
157
  new(softlayer_client, network_hash)
140
158
  end
@@ -27,7 +27,7 @@ module SoftLayer
27
27
  #
28
28
  def bare_metal_instance?
29
29
  if has_sl_property?(:bareMetalInstanceFlag)
30
- self["bareMetalInstanceFlag"] != 0
30
+ self['bareMetalInstanceFlag'] != 0
31
31
  else
32
32
  false
33
33
  end
@@ -47,19 +47,20 @@ module SoftLayer
47
47
  if !bare_metal_instance? then
48
48
  cancellation_reasons = self.class.cancellation_reasons()
49
49
  cancel_reason = cancellation_reasons[reason] || cancellation_reasons[:unneeded]
50
- softlayer_client["Ticket"].createCancelServerTicket(self.id, cancel_reason, comment, true, 'HARDWARE')
50
+ softlayer_client[:Ticket].createCancelServerTicket(self.id, cancel_reason, comment, true, 'HARDWARE')
51
51
  else
52
52
  # Note that reason and comment are ignored in this case, unfortunately
53
- softlayer_client['Billing_Item'].object_with_id(self.billingItem['id'].to_i).cancelService()
53
+ softlayer_client[:Billing_Item].object_with_id(self.billingItem['id'].to_i).cancelService()
54
54
  end
55
55
  end
56
56
 
57
57
  ##
58
- # Returns the SoftLayer Service used to work with this Server
58
+ # Returns the typical Service used to work with this Server
59
59
  # For Bare Metal Servers that is +SoftLayer_Hardware+ though in some special cases
60
- # you may have to use +SoftLayer_Hardware_Server+ as a type or service.
60
+ # you may have to use +SoftLayer_Hardware_Server+ as a type or service. That
61
+ # service object is available thorugh the hardware_server_service method
61
62
  def service
62
- return softlayer_client["Hardware"].object_with_id(self.id)
63
+ return softlayer_client[:Hardware_Server].object_with_id(self.id)
63
64
  end
64
65
 
65
66
  ##
@@ -106,6 +107,36 @@ module SoftLayer
106
107
  }
107
108
  end
108
109
 
110
+ ##
111
+ # Returns the max port speed of the public network interfaces of the server taking into account
112
+ # bound interface pairs (redundant network cards).
113
+ def firewall_port_speed
114
+ network_components = self.service.object_mask("mask[id,maxSpeed,networkComponentGroup.networkComponents]").getFrontendNetworkComponents()
115
+
116
+ # Split the interfaces into grouped and ungrouped interfaces. The max speed of a group will be the sum
117
+ # of the individual speeds in that group. The max speed of ungrouped interfaces is simply the max speed
118
+ # of that interface.
119
+ grouped_interfaces, ungrouped_interfaces = network_components.partition{ |interface| interface.has_key?("networkComponentGroup") }
120
+
121
+ if !grouped_interfaces.empty?
122
+ group_speeds = grouped_interfaces.collect do |interface|
123
+ interface['networkComponentGroup']['networkComponents'].inject(0) {|total_speed, component| total_speed += component['maxSpeed']}
124
+ end
125
+
126
+ max_group_speed = group_speeds.max
127
+ else
128
+ max_group_speed = 0
129
+ end
130
+
131
+ if !ungrouped_interfaces.empty?
132
+ max_ungrouped_speed = ungrouped_interfaces.collect { |interface| interface['maxSpeed']}.max
133
+ else
134
+ max_ungrouped_speed = 0
135
+ end
136
+
137
+ return [max_group_speed, max_ungrouped_speed].max
138
+ end
139
+
109
140
  ##
110
141
  # Retrive the bare metal server with the given server ID from the
111
142
  # SoftLayer API
@@ -120,7 +151,7 @@ module SoftLayer
120
151
  softlayer_client = options[:client] || Client.default_client
121
152
  raise "#{__method__} requires a client but none was given and Client::default_client is not set" if !softlayer_client
122
153
 
123
- hardware_service = softlayer_client["Hardware"]
154
+ hardware_service = softlayer_client[:Hardware_Server]
124
155
  hardware_service = hardware_service.object_mask(default_object_mask.to_sl_object_mask)
125
156
 
126
157
  if options.has_key?(:object_mask)
@@ -199,7 +230,7 @@ module SoftLayer
199
230
  } );
200
231
  end
201
232
 
202
- account_service = softlayer_client['Account']
233
+ account_service = softlayer_client[:Account]
203
234
  account_service = account_service.object_filter(object_filter) unless object_filter.empty?
204
235
  account_service = account_service.object_mask(default_object_mask.to_sl_object_mask)
205
236
 
@@ -111,7 +111,7 @@ module SoftLayer
111
111
  order_template = hardware_instance_template
112
112
  order_template = yield order_template if block_given?
113
113
 
114
- @softlayer_client["Hardware"].generateOrderTemplate(order_template)
114
+ @softlayer_client[:Hardware].generateOrderTemplate(order_template)
115
115
  end
116
116
 
117
117
  ##
@@ -124,8 +124,8 @@ module SoftLayer
124
124
  order_template = hardware_instance_template
125
125
  order_template = yield order_template if block_given?
126
126
 
127
- server_hash = @softlayer_client["Hardware"].createObject(order_template)
128
- SoftLayer::BareMetalServer.server_with_id(server_hash["id"], :client => @softlayer_client) if server_hash
127
+ server_hash = @softlayer_client[:Hardware].createObject(order_template)
128
+ SoftLayer::BareMetalServer.server_with_id(server_hash['id'], :client => @softlayer_client) if server_hash
129
129
  end
130
130
 
131
131
  protected
@@ -147,15 +147,15 @@ module SoftLayer
147
147
  "hourlyBillingFlag" => !!@hourly
148
148
  }
149
149
 
150
- template["privateNetworkOnlyFlag"] = true if @private_network_only
150
+ template['privateNetworkOnlyFlag'] = true if @private_network_only
151
151
 
152
- template["datacenter"] = {"name" => @datacenter.name} if @datacenter
152
+ template['datacenter'] = {"name" => @datacenter.name} if @datacenter
153
153
  template['userData'] = [{'value' => @user_metadata}] if @user_metadata
154
154
  template['networkComponents'] = [{'maxSpeed'=> @max_port_speed}] if @max_port_speed
155
155
  template['postInstallScriptUri'] = @provision_script_URI.to_s if @provision_script_URI
156
156
  template['sshKeys'] = @ssh_key_ids.collect { |ssh_key| {'id'=> ssh_key.to_i } } if @ssh_key_ids
157
157
  template['primaryNetworkComponent'] = { "networkVlan" => { "id" => @public_vlan_id.to_i } } if @public_vlan_id
158
- template["primaryBackendNetworkComponent"] = { "networkVlan" => {"id" => @private_vlan_id.to_i } } if @private_vlan_id
158
+ template['primaryBackendNetworkComponent'] = { "networkVlan" => {"id" => @private_vlan_id.to_i } } if @private_vlan_id
159
159
 
160
160
  if @disks && !@disks.empty?
161
161
  template['hardDrives'] = @disks.collect do |disk|
@@ -174,36 +174,36 @@ module SoftLayer
174
174
  raise "#{__method__} requires a client but none was given and Client::default_client is not set" if !softlayer_client
175
175
 
176
176
  @@create_object_options ||= nil
177
- @@create_object_options = softlayer_client["Hardware"].getCreateObjectOptions() if !@@create_object_options
177
+ @@create_object_options = softlayer_client[:Hardware].getCreateObjectOptions() if !@@create_object_options
178
178
  @@create_object_options
179
179
  end
180
180
 
181
181
  ##
182
182
  # Return a list of values that are valid for the :datacenter attribute
183
183
  def self.datacenter_options(client = nil)
184
- create_object_options(client)["datacenters"].collect { |datacenter_spec| Datacenter.datacenter_named(datacenter_spec['template']['datacenter']['name'], client) }.uniq
184
+ create_object_options(client)['datacenters'].collect { |datacenter_spec| Datacenter.datacenter_named(datacenter_spec['template']['datacenter']['name'], client) }.uniq
185
185
  end
186
186
 
187
187
  def self.core_options(client = nil)
188
- create_object_options(client)["processors"].collect { |processor_spec| processor_spec['template']['processorCoreAmount'] }.uniq.sort!
188
+ create_object_options(client)['processors'].collect { |processor_spec| processor_spec['template']['processorCoreAmount'] }.uniq.sort!
189
189
  end
190
190
 
191
191
  ##
192
192
  # Return a list of values that are valid the array given to the :disks
193
193
  def self.disk_options(client = nil)
194
- create_object_options(client)["hardDrives"].collect { |disk_spec| disk_spec['template']['hardDrives'][0]['capacity'].to_i}.uniq.sort!
194
+ create_object_options(client)['hardDrives'].collect { |disk_spec| disk_spec['template']['hardDrives'][0]['capacity'].to_i}.uniq.sort!
195
195
  end
196
196
 
197
197
  ##
198
198
  # Returns a list of the valid :os_refrence_codes
199
199
  def self.os_reference_code_options(client = nil)
200
- create_object_options(client)["operatingSystems"].collect { |os_spec| os_spec['template']['operatingSystemReferenceCode'] }.uniq.sort!
200
+ create_object_options(client)['operatingSystems'].collect { |os_spec| os_spec['template']['operatingSystemReferenceCode'] }.uniq.sort!
201
201
  end
202
202
 
203
203
  ##
204
204
  # Returns a list of the :max_port_speeds
205
205
  def self.max_port_speed_options(client = nil)
206
- create_object_options(client)["networkComponents"].collect { |component_spec| component_spec['template']['networkComponents'][0]['maxSpeed'] }
206
+ create_object_options(client)['networkComponents'].collect { |component_spec| component_spec['template']['networkComponents'][0]['maxSpeed'] }
207
207
  end
208
208
 
209
209
  end # class BareMetalServerOrder
@@ -58,7 +58,7 @@ module SoftLayer
58
58
 
59
59
  # An array of the ids of SSH keys to install on the server upon provisioning
60
60
  # To obtain a list of existing SSH keys, call getSshKeys on the SoftLayer_Account service:
61
- # client['Account'].getSshKeys()
61
+ # client[:Account].getSshKeys()
62
62
  attr_accessor :ssh_key_ids
63
63
 
64
64
  # The URI of a script to execute on the server after it has been provisioned. This may be
@@ -88,7 +88,7 @@ module SoftLayer
88
88
  def verify
89
89
  product_order = hardware_order
90
90
  product_order = yield product_order if block_given?
91
- softlayer_client["Product_Order"].verifyOrder(product_order)
91
+ softlayer_client[:Product_Order].verifyOrder(product_order)
92
92
  end
93
93
 
94
94
  ##
@@ -106,7 +106,7 @@ module SoftLayer
106
106
  def place_order!
107
107
  product_order = hardware_order
108
108
  product_order = yield product_order if block_given?
109
- softlayer_client["Product_Order"].placeOrder(product_order)
109
+ softlayer_client[:Product_Order].placeOrder(product_order)
110
110
  end
111
111
 
112
112
  protected
@@ -118,10 +118,10 @@ module SoftLayer
118
118
  product_order = {
119
119
  'packageId' => @package.id,
120
120
  'useHourlyPricing' => false,
121
- 'hardware' => {
121
+ 'hardware' => [{
122
122
  'hostname' => @hostname,
123
123
  'domain' => @domain
124
- }
124
+ }]
125
125
  }
126
126
 
127
127
  product_order['location'] = @datacenter.id if @datacenter
@@ -32,7 +32,7 @@ module SoftLayer
32
32
 
33
33
  # A string passsed as the value for the User-Agent header when requests are sent to SoftLayer API.
34
34
  attr_accessor :user_agent
35
-
35
+
36
36
  # An integer value (in seconds). The number of seconds to wait for HTTP requests to the network API
37
37
  # until they timeout. This value can be nil in which case the timeout will be the default value for
38
38
  # the library handling network communication (often 30 seconds)
@@ -84,8 +84,10 @@ module SoftLayer
84
84
  # and the endpoint url
85
85
  @endpoint_url = settings[:endpoint_url] || API_PUBLIC_ENDPOINT
86
86
 
87
+ # set the user agent to the one provided, or set it to a default one
87
88
  @user_agent = settings[:user_agent] || "softlayer_api gem/#{SoftLayer::VERSION} (Ruby #{RUBY_PLATFORM}/#{RUBY_VERSION})"
88
-
89
+
90
+ # and assign a time out if the settings offer one
89
91
  @network_timeout = settings[:timeout] if settings.has_key?(:timeout)
90
92
 
91
93
  raise "A SoftLayer Client requires a username" if !@username || @username.empty?
@@ -72,8 +72,8 @@ module SoftLayer
72
72
 
73
73
  def Config.environment_settings
74
74
  result = {}
75
- result[:username] = ENV["SL_USERNAME"] if ENV["SL_USERNAME"]
76
- result[:api_key] = ENV["SL_API_KEY"] if ENV["SL_API_KEY"]
75
+ result[:username] = ENV['SL_USERNAME'] if ENV['SL_USERNAME']
76
+ result[:api_key] = ENV['SL_API_KEY'] if ENV['SL_API_KEY']
77
77
  result
78
78
  end
79
79
 
@@ -89,7 +89,7 @@ module SoftLayer
89
89
  search_path.each do |file_path|
90
90
  if File.readable? file_path
91
91
  config = ConfigParser.new file_path
92
- softlayer_section = config["softlayer"]
92
+ softlayer_section = config['softlayer']
93
93
 
94
94
  if softlayer_section
95
95
  result[:username] = softlayer_section['username'] if softlayer_section['username']
@@ -41,14 +41,14 @@ module SoftLayer
41
41
  # true if the image template is a flex image
42
42
  # Note that the publicFlag property comes back as an integer (0 or 1)
43
43
  def public?
44
- self["publicFlag"] != 0
44
+ self['publicFlag'] != 0
45
45
  end
46
46
 
47
47
  ##
48
48
  # true if the image template is a flex image
49
49
  # Note that the flexImageFlag property comes back as a boolean
50
50
  def flex_image?
51
- !!self["flexImageFlag"]
51
+ !!self['flexImageFlag']
52
52
  end
53
53
 
54
54
  ##
@@ -63,7 +63,7 @@ module SoftLayer
63
63
  ##
64
64
  # Returns an array of the tags set on the image
65
65
  def tags
66
- return self["tagReferences"].collect{ |tag_reference| tag_reference["tag"]["name"] }
66
+ return self['tagReferences'].collect{ |tag_reference| tag_reference['tag']['name'] }
67
67
  end
68
68
 
69
69
  ##
@@ -78,7 +78,7 @@ module SoftLayer
78
78
  ##
79
79
  # Returns the an array containing the datacenters where this image is available.
80
80
  def datacenters
81
- self["datacenters"].collect{ |datacenter_data| SoftLayer::Datacenter.datacenter_named(datacenter_data["name"])}
81
+ self['datacenters'].collect{ |datacenter_data| SoftLayer::Datacenter.datacenter_named(datacenter_data['name'])}
82
82
  end
83
83
 
84
84
  ##
@@ -107,7 +107,7 @@ module SoftLayer
107
107
  #
108
108
  def available_datacenters
109
109
  datacenters_data = self.service.getStorageLocations()
110
- datacenters_data.collect { |datacenter_data| SoftLayer::Datacenter.datacenter_named(datacenter_data["name"]) }
110
+ datacenters_data.collect { |datacenter_data| SoftLayer::Datacenter.datacenter_named(datacenter_data['name']) }
111
111
  end
112
112
 
113
113
 
@@ -116,7 +116,7 @@ module SoftLayer
116
116
  # that this image is shared with
117
117
  def shared_with_accounts
118
118
  accounts_data = self.service.getAccountReferences
119
- accounts_data.collect { |account_data| account_data["accountId"] }
119
+ accounts_data.collect { |account_data| account_data['accountId'] }
120
120
  end
121
121
 
122
122
  ##
@@ -177,7 +177,7 @@ module SoftLayer
177
177
  self.refresh_details()
178
178
 
179
179
  parent_ready = !(has_sl_property? :transactionId) || (self[:transactionId] == "")
180
- children_ready = (nil == self["children"].find { |child| child["transactionId"] != "" })
180
+ children_ready = (nil == self['children'].find { |child| child['transactionId'] != "" })
181
181
 
182
182
  ready = parent_ready && children_ready
183
183
  yield ready if block_given?
@@ -191,7 +191,7 @@ module SoftLayer
191
191
 
192
192
  # ModelBase protocol methods
193
193
  def service
194
- softlayer_client['Virtual_Guest_Block_Device_Template_Group'].object_with_id(self.id)
194
+ softlayer_client[:Virtual_Guest_Block_Device_Template_Group].object_with_id(self.id)
195
195
  end
196
196
 
197
197
  def softlayer_properties(object_mask = nil)
@@ -245,7 +245,7 @@ module SoftLayer
245
245
  } );
246
246
  end
247
247
 
248
- account_service = softlayer_client['Account']
248
+ account_service = softlayer_client[:Account]
249
249
  account_service = account_service.object_filter(object_filter) unless object_filter.empty?
250
250
  account_service = account_service.object_mask(default_object_mask)
251
251
 
@@ -311,7 +311,7 @@ module SoftLayer
311
311
  } );
312
312
  end
313
313
 
314
- template_service = softlayer_client['Virtual_Guest_Block_Device_Template_Group']
314
+ template_service = softlayer_client[:Virtual_Guest_Block_Device_Template_Group]
315
315
  template_service = template_service.object_filter(object_filter) unless object_filter.empty?
316
316
  template_service = template_service.object_mask(default_object_mask)
317
317
 
@@ -347,7 +347,7 @@ module SoftLayer
347
347
  softlayer_client = options_hash[:client] || Client.default_client
348
348
  raise "#{__method__} requires a client but none was given and Client::default_client is not set" if !softlayer_client
349
349
 
350
- service = softlayer_client['Virtual_Guest_Block_Device_Template_Group'].object_with_id(id)
350
+ service = softlayer_client[:Virtual_Guest_Block_Device_Template_Group].object_with_id(id)
351
351
  service.object_mask(default_object_mask)
352
352
 
353
353
  if options_hash.has_key? :object_mask