Class: OneviewSDK::LogicalEnclosure

Inherits:
Resource
  • Object
show all
Defined in:
lib/oneview-sdk/resource/logical_enclosure.rb

Overview

Logical enclosure resource implementation

Constant Summary collapse

BASE_URI =
'/rest/logical-enclosures'.freeze

Instance Attribute Summary

Attributes inherited from Resource

#api_version, #client, #data, #logger

Instance Method Summary collapse

Methods inherited from Resource

#==, #[], #[]=, build_query, #create, #create!, #delete, #each, #eql?, #exists?, find_by, from_file, get_all, #like?, #refresh, #retrieve!, schema, #schema, #set, #set_all, #to_file, #update

Constructor Details

#initialize(client, params = {}, api_ver = nil) ⇒ LogicalEnclosure

Create a resource object, associate it with a client, and set its properties.

Parameters:

  • client (OneviewSDK::Client)

    The client object for the OneView appliance

  • params (Hash) (defaults to: {})

    The options for this resource (key-value pairs)

  • api_ver (Integer) (defaults to: nil)

    The api version to use when interracting with this resource.



21
22
23
24
25
# File 'lib/oneview-sdk/resource/logical_enclosure.rb', line 21

def initialize(client, params = {}, api_ver = nil)
  super
  # Default values
  @data['type'] ||= 'LogicalEnclosure'
end

Instance Method Details

#get_scriptString

Get the configuration script

Returns:

  • (String)

    script

Raises:



56
57
58
59
60
# File 'lib/oneview-sdk/resource/logical_enclosure.rb', line 56

def get_script
  ensure_client && ensure_uri
  response = @client.rest_get("#{@data['uri']}/script", @api_version)
  response.body
end

#reconfigureOneviewSDK::LogicalEnclosure

Reapplies the appliance’s configuration on the enclosures

Returns:

Raises:



32
33
34
35
36
37
# File 'lib/oneview-sdk/resource/logical_enclosure.rb', line 32

def reconfigure
  ensure_client && ensure_uri
  response = @client.rest_put("#{@data['uri']}/configuration", {}, @api_version)
  @client.response_handler(response)
  self
end

#set_script(script) ⇒ OneviewSDK::LogicalEnclosure

Updates the configuration script for the logical enclosure

Returns:

Raises:



67
68
69
70
71
72
# File 'lib/oneview-sdk/resource/logical_enclosure.rb', line 67

def set_script(script)
  ensure_client && ensure_uri
  response = @client.rest_put("#{@data['uri']}/script", { 'body' => script }, @api_version)
  @client.response_handler(response)
  self
end

#support_dump(options) ⇒ OneviewSDK::LogicalEnclosure

Generates a support dump for the logical enclosure

Returns:

Raises:



79
80
81
82
83
84
# File 'lib/oneview-sdk/resource/logical_enclosure.rb', line 79

def support_dump(options)
  ensure_client && ensure_uri
  response = @client.rest_post("#{@data['uri']}/support-dumps", { 'body' => options }, @api_version)
  @client.wait_for(response.header['location'])
  self
end

#update_from_groupOneviewSDK::LogicalEnclosure

Makes this logical enclosure consistent with the enclosure group

Returns:

Raises:



44
45
46
47
48
49
# File 'lib/oneview-sdk/resource/logical_enclosure.rb', line 44

def update_from_group
  ensure_client && ensure_uri
  response = @client.rest_put("#{@data['uri']}/updateFromGroup", {}, @api_version)
  @client.response_handler(response)
  self
end