Class: OneviewSDK::API200::Datacenter
- Defined in:
- lib/oneview-sdk/resource/api200/datacenter.rb
Overview
Datacenter resource implementation
Direct Known Subclasses
OneviewSDK::API300::C7000::Datacenter, OneviewSDK::API300::Synergy::Datacenter
Constant Summary collapse
- BASE_URI =
'/rest/datacenters'.freeze
Constants inherited from Resource
Resource::DEFAULT_REQUEST_HEADER, Resource::UNIQUE_IDENTIFIERS
Instance Attribute Summary
Attributes inherited from Resource
#api_version, #client, #data, #logger
Instance Method Summary collapse
-
#add ⇒ OneviewSDK::Datacenter
Add the resource on OneView using the current data.
-
#add_rack(rack, pos_x, pos_y, rotation = 0) ⇒ Object
Adds an existing rack to the datacenter.
-
#create ⇒ Object
Method is not available.
-
#delete ⇒ Object
Method is not available.
-
#get_visual_content ⇒ Hash
Gets a list of the visual content objects.
-
#initialize(client, params = {}, api_ver = nil) ⇒ Datacenter
constructor
Create a resource object, associate it with a client, and set its properties.
-
#remove ⇒ true
Remove resource from OneView.
-
#remove_rack(rack) ⇒ Object
Removes a rack from the datacenter.
Methods inherited from Resource
#==, #[], #[]=, build_query, #create!, #deep_merge!, #each, #eql?, #exists?, find_by, find_with_pagination, from_file, get_all, get_all_with_query, #like?, #refresh, #retrieve!, schema, #schema, #set, #set_all, #to_file, #update
Constructor Details
#initialize(client, params = {}, api_ver = nil) ⇒ Datacenter
Create a resource object, associate it with a client, and set its properties.
35 36 37 38 39 |
# File 'lib/oneview-sdk/resource/api200/datacenter.rb', line 35 def initialize(client, params = {}, api_ver = nil) super # Default values: @data['contents'] ||= [] end |
Instance Method Details
#add ⇒ OneviewSDK::Datacenter
Calls the refresh method to set additional data
Add the resource on OneView using the current data
25 |
# File 'lib/oneview-sdk/resource/api200/datacenter.rb', line 25 alias add create |
#add_rack(rack, pos_x, pos_y, rotation = 0) ⇒ Object
Adds an existing rack to the datacenter
58 59 60 61 62 63 64 65 |
# File 'lib/oneview-sdk/resource/api200/datacenter.rb', line 58 def add_rack(rack, pos_x, pos_y, rotation = 0) @data['contents'] << { 'resourceUri' => rack['uri'], 'x' => pos_x, 'y' => pos_y, 'rotation' => rotation } end |
#create ⇒ Object
Method is not available
43 44 45 |
# File 'lib/oneview-sdk/resource/api200/datacenter.rb', line 43 def create(*) unavailable_method end |
#delete ⇒ Object
Method is not available
49 50 51 |
# File 'lib/oneview-sdk/resource/api200/datacenter.rb', line 49 def delete(*) unavailable_method end |
#get_visual_content ⇒ Hash
Gets a list of the visual content objects
75 76 77 78 |
# File 'lib/oneview-sdk/resource/api200/datacenter.rb', line 75 def get_visual_content response = @client.rest_get(@data['uri'] + '/visualContent') @client.response_handler(response) end |
#remove ⇒ true
Remove resource from OneView
29 |
# File 'lib/oneview-sdk/resource/api200/datacenter.rb', line 29 alias remove delete |
#remove_rack(rack) ⇒ Object
Removes a rack from the datacenter
69 70 71 |
# File 'lib/oneview-sdk/resource/api200/datacenter.rb', line 69 def remove_rack(rack) @data['contents'].reject! { |resource| resource['resourceUri'] == rack['uri'] } end |