Class: OneviewSDK::API200::SANManager

Inherits:
Resource show all
Defined in:
lib/oneview-sdk/resource/api200/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

Constants inherited from Resource

Resource::UNIQUE_IDENTIFIERS

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.


29
30
31
32
33
# File 'lib/oneview-sdk/resource/api200/san_manager.rb', line 29

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


72
73
74
75
76
77
# File 'lib/oneview-sdk/resource/api200/san_manager.rb', line 72

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:

  • (OneviewSDK::SANManager)

    self


37
38
39
40
41
42
43
44
45
# File 'lib/oneview-sdk/resource/api200/san_manager.rb', line 37

def add
  ensure_client
  raise '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:


49
50
51
# File 'lib/oneview-sdk/resource/api200/san_manager.rb', line 49

def create(*)
  unavailable_method
end

#deleteObject

Method is not available

Raises:


55
56
57
# File 'lib/oneview-sdk/resource/api200/san_manager.rb', line 55

def delete(*)
  unavailable_method
end

#removetrue

Remove resource from OneView

Returns:

  • (true)

    if resource was removed successfully


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

alias remove delete

#update(options) ⇒ Object

Refreshes the san manager state or change connection information

Parameters:

  • options (Hash)

61
62
63
64
65
66
# File 'lib/oneview-sdk/resource/api200/san_manager.rb', line 61

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