Class: OneviewSDK::SANManager

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

Overview

SAN manager resource implementation

Constant Summary collapse

BASE_URI =
'/rest/fc-sans/device-managers'.freeze
PROVIDERS_URI =
'/rest/fc-sans/providers'.freeze

Instance Attribute Summary

Attributes inherited from Resource

#api_version, #client, #data, #logger

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

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

Constructor Details

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

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.



26
27
28
29
30
# File 'lib/oneview-sdk/resource/san_manager.rb', line 26

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

Class Method Details

.get_default_connection_info(client, provider_name) ⇒ Hash

Retrieves the default connection information for a specific provider

Parameters:

  • client (OneviewSDK::Client)

    The client object for the OneView appliance

  • provider_name (String)

    Providers name

Returns:

  • (Hash)

    A hash with default connectionInfo information



69
70
71
72
73
74
# File 'lib/oneview-sdk/resource/san_manager.rb', line 69

def self.get_default_connection_info(client, provider_name)
  response = client.rest_get(PROVIDERS_URI)
  providers = client.response_handler(response)['members']
  desired_provider = providers.find { |provider| provider['displayName'] == provider_name || provider['name'] == provider_name }
  desired_provider['defaultConnectionInfo']
end

Instance Method Details

#addOneviewSDK::SANManager

Adds the resource on OneView using the current data

Returns:



34
35
36
37
38
39
40
41
42
# File 'lib/oneview-sdk/resource/san_manager.rb', line 34

def add
  ensure_client
  fail 'providerDisplayName' unless @data['providerDisplayName']
  @data['providerUri'] = get_provider_uri
  response = @client.rest_post(@data['providerUri'] + '/device-managers', { 'body' => @data }, @api_version)
  body = @client.response_handler(response)
  set_all(body)
  self
end

#createObject

Method is not available

Raises:



46
47
48
# File 'lib/oneview-sdk/resource/san_manager.rb', line 46

def create
  unavailable_method
end

#deleteObject

Method is not available

Raises:



52
53
54
# File 'lib/oneview-sdk/resource/san_manager.rb', line 52

def delete
  unavailable_method
end

#removetrue

Remove resource from OneView

Returns:

  • (true)

    if resource was removed successfully



20
# File 'lib/oneview-sdk/resource/san_manager.rb', line 20

alias remove delete

#update(options) ⇒ Object

Refreshes the san manager state or change connection information

Parameters:

  • options (Hash)


58
59
60
61
62
63
# File 'lib/oneview-sdk/resource/san_manager.rb', line 58

def update(options)
  ensure_client && ensure_uri
  response = @client.rest_put(@data['uri'], 'body' => options)
  new_data = @client.response_handler(response)
  set_all(new_data)
end