class OneviewSDK::API200::Datacenter

Datacenter resource implementation

Constants

BASE_URI

Public Class Methods

new(client, params = {}, api_ver = nil) click to toggle source

Create a resource object, associate it with a client, and set its properties. @param [OneviewSDK::Client] client The client object for the OneView appliance @param [Hash] params The options for this resource (key-value pairs) @param [Integer] api_ver The api version to use when interracting with this resource.

Calls superclass method OneviewSDK::Resource::new
# File lib/oneview-sdk/resource/api200/datacenter.rb, line 35
def initialize(client, params = {}, api_ver = nil)
  super
  # Default values:
  @data['contents'] ||= []
end

Public Instance Methods

add(*)

Add the resource on OneView using the current data @note Calls the refresh method to set additional data @raise [OneviewSDK::IncompleteResource] if the client is not set @raise [StandardError] if the resource creation fails @return [OneviewSDK::Datacenter] self

Alias for: create
add_rack(rack, pos_x, pos_y, rotation = 0) click to toggle source

Adds an existing rack to the datacenter @param [OneviewSDK::Rack] rack rack @param [Decimal] pos_x x position @param [Decimal] pos_y y position @param [Decimal] rotation Rotation degrees (0-359) around the center of the resource

# 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(*) click to toggle source

Method is not available @raise [OneviewSDK::MethodUnavailable] method is not available

# File lib/oneview-sdk/resource/api200/datacenter.rb, line 43
def create(*)
  unavailable_method
end
Also aliased as: add
delete(*) click to toggle source

Method is not available @raise [OneviewSDK::MethodUnavailable] method is not available

# File lib/oneview-sdk/resource/api200/datacenter.rb, line 49
def delete(*)
  unavailable_method
end
Also aliased as: remove
get_visual_content() click to toggle source

Gets a list of the visual content objects @return [Hash]

# 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(*)

Remove resource from OneView @return [true] if resource was removed successfully

Alias for: delete
remove_rack(rack) click to toggle source

Removes a rack from the datacenter @param [OneviewSDK::Rack] rack rack

# File lib/oneview-sdk/resource/api200/datacenter.rb, line 69
def remove_rack(rack)
  @data['contents'].reject! { |resource| resource['resourceUri'] == rack['uri'] }
end