class SoftLayer::Datacenter
A Data Center in the SoftLayer network
This class corresponds to the SoftLayer_Location++ data type:
sldn.softlayer.com/reference/datatypes/SoftLayer_Location
Although in this context it is used to represent a data center and not the more general class of locations that that data type can represent.
Attributes
long_name[R]
A longer location description
name[R]
A short location description
Public Class Methods
datacenter_named(name, client = nil)
click to toggle source
Return the datacenter with the given name ('sng01' or 'dal05')
# File lib/softlayer/Datacenter.rb, line 33 def self.datacenter_named(name, client = nil) datacenters(client).find{ | datacenter | datacenter.name == name.to_s.downcase } end
datacenters(client = nil, force_reload = false)
click to toggle source
# File lib/softlayer/Datacenter.rb, line 49 def self.datacenters(client = nil, force_reload = false) softlayer_client = client || Client.default_client raise "Datacenter.datacenters requires a client to call the network API" if !softlayer_client if(!@@data_centers || force_reload) datacenters_data = softlayer_client[:Location].getDatacenters @@data_centers = datacenters_data.collect { | datacenter_data | self.new(softlayer_client, datacenter_data) } end @@data_centers end