Module: OneviewSDK

Defined in:
lib/oneview-sdk.rb,
lib/oneview-sdk/cli.rb,
lib/oneview-sdk/rest.rb,
lib/oneview-sdk/client.rb,
lib/oneview-sdk/version.rb,
lib/oneview-sdk/resource.rb,
lib/oneview-sdk/ssl_helper.rb,
lib/oneview-sdk/config_loader.rb,
lib/oneview-sdk/resource/volume.rb,
lib/oneview-sdk/resource/enclosure.rb,
lib/oneview-sdk/resource/fc_network.rb,
lib/oneview-sdk/resource/uplink_set.rb,
lib/oneview-sdk/resource/interconnect.rb,
lib/oneview-sdk/resource/storage_pool.rb,
lib/oneview-sdk/resource/fcoe_network.rb,
lib/oneview-sdk/resource/server_profile.rb,
lib/oneview-sdk/resource/lig_uplink_set.rb,
lib/oneview-sdk/resource/storage_system.rb,
lib/oneview-sdk/resource/volume_snapshot.rb,
lib/oneview-sdk/resource/enclosure_group.rb,
lib/oneview-sdk/resource/firmware_bundle.rb,
lib/oneview-sdk/resource/volume_template.rb,
lib/oneview-sdk/resource/firmware_driver.rb,
lib/oneview-sdk/resource/server_hardware.rb,
lib/oneview-sdk/resource/ethernet_network.rb,
lib/oneview-sdk/resource/logical_enclosure.rb,
lib/oneview-sdk/resource/logical_interconnect.rb,
lib/oneview-sdk/resource/server_hardware_type.rb,
lib/oneview-sdk/resource/server_profile_template.rb,
lib/oneview-sdk/resource/logical_interconnect_group.rb

Overview

OneviewSDK Resources

Defined Under Namespace

Modules: Rest, SSLHelper Classes: Cli, Client, Config, Console, Enclosure, EnclosureGroup, EthernetNetwork, FCNetwork, FCoENetwork, FirmwareBundle, FirmwareDriver, Interconnect, LIGUplinkSet, LogicalEnclosure, LogicalInterconnect, LogicalInterconnectGroup, Resource, ServerHardware, ServerHardwareType, ServerProfile, ServerProfileTemplate, StoragePool, StorageSystem, UplinkSet, Volume, VolumeSnapshot, VolumeTemplate

Constant Summary collapse

ENV_VARS =
%w(ONEVIEWSDK_URL ONEVIEWSDK_USER ONEVIEWSDK_PASSWORD ONEVIEWSDK_TOKEN ONEVIEWSDK_SSL_ENABLED).freeze
VERSION =
'1.0.0'.freeze

Class Method Summary collapse

Class Method Details

.resource_named(type) ⇒ Class

Get resource class that matches the type given


298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/oneview-sdk/resource.rb', line 298

def self.resource_named(type)
  classes = {}
  orig_classes = []
  ObjectSpace.each_object(Class).select { |klass| klass < OneviewSDK::Resource }.each do |c|
    name = c.name.split('::').last
    orig_classes.push(name)
    classes[name.downcase.delete('_').delete('-')] = c
    classes["#{name.downcase.delete('_').delete('-')}s"] = c
  end
  new_type = type.to_s.downcase.gsub(/[ -_]/, '')
  return classes[new_type] if classes.keys.include?(new_type)
end