Module: OneviewSDK::API200

Defined in:
lib/oneview-sdk/resource/api200.rb,
lib/oneview-sdk/resource/api200/rack.rb,
lib/oneview-sdk/resource/api200/user.rb,
lib/oneview-sdk/resource/api200/fabric.rb,
lib/oneview-sdk/resource/api200/switch.rb,
lib/oneview-sdk/resource/api200/volume.rb,
lib/oneview-sdk/resource/api200/resource.rb,
lib/oneview-sdk/resource/api200/enclosure.rb,
lib/oneview-sdk/resource/api200/datacenter.rb,
lib/oneview-sdk/resource/api200/fc_network.rb,
lib/oneview-sdk/resource/api200/uplink_set.rb,
lib/oneview-sdk/resource/api200/managed_san.rb,
lib/oneview-sdk/resource/api200/network_set.rb,
lib/oneview-sdk/resource/api200/san_manager.rb,
lib/oneview-sdk/resource/api200/fcoe_network.rb,
lib/oneview-sdk/resource/api200/interconnect.rb,
lib/oneview-sdk/resource/api200/power_device.rb,
lib/oneview-sdk/resource/api200/storage_pool.rb,
lib/oneview-sdk/resource/api200/lig_uplink_set.rb,
lib/oneview-sdk/resource/api200/logical_switch.rb,
lib/oneview-sdk/resource/api200/server_profile.rb,
lib/oneview-sdk/resource/api200/storage_system.rb,
lib/oneview-sdk/resource/api200/enclosure_group.rb,
lib/oneview-sdk/resource/api200/firmware_bundle.rb,
lib/oneview-sdk/resource/api200/firmware_driver.rb,
lib/oneview-sdk/resource/api200/server_hardware.rb,
lib/oneview-sdk/resource/api200/volume_snapshot.rb,
lib/oneview-sdk/resource/api200/volume_template.rb,
lib/oneview-sdk/resource/api200/ethernet_network.rb,
lib/oneview-sdk/resource/api200/logical_downlink.rb,
lib/oneview-sdk/resource/api200/unmanaged_device.rb,
lib/oneview-sdk/resource/api200/logical_enclosure.rb,
lib/oneview-sdk/resource/api200/volume_attachment.rb,
lib/oneview-sdk/resource/api200/connection_template.rb,
lib/oneview-sdk/resource/api200/logical_interconnect.rb,
lib/oneview-sdk/resource/api200/logical_switch_group.rb,
lib/oneview-sdk/resource/api200/server_hardware_type.rb,
lib/oneview-sdk/resource/api200/server_profile_template.rb,
lib/oneview-sdk/resource/api200/logical_interconnect_group.rb

Overview

Module for API v200

Defined Under Namespace

Classes: ConnectionTemplate, Datacenter, Enclosure, EnclosureGroup, EthernetNetwork, FCNetwork, FCoENetwork, Fabric, FirmwareBundle, FirmwareDriver, Interconnect, LIGUplinkSet, LogicalDownlink, LogicalEnclosure, LogicalInterconnect, LogicalInterconnectGroup, LogicalSwitch, LogicalSwitchGroup, ManagedSAN, NetworkSet, PowerDevice, Rack, Resource, SANManager, ServerHardware, ServerHardwareType, ServerProfile, ServerProfileTemplate, StoragePool, StorageSystem, Switch, UnmanagedDevice, UplinkSet, User, Volume, VolumeAttachment, VolumeSnapshot, VolumeTemplate

Class Method Summary collapse

Class Method Details

.resource_named(type, _variant = nil) ⇒ Class

Get resource class that matches the type given

Parameters:

  • type (String)

    Name of the desired class type

  • variant (String)

    There is only 1 variant for this module, so this is not used. It exists only so that the parameters match API modules that do have multiple variants.

Returns:

  • (Class)

    Resource class or nil if not found


20
21
22
23
24
25
26
27
28
29
# File 'lib/oneview-sdk/resource/api200.rb', line 20

def self.resource_named(type, _variant = nil)
  new_type = type.to_s.downcase.gsub(/[ -_]/, '')
  constants.each do |c|
    klass = const_get(c)
    next unless klass.is_a?(Class)
    name = klass.name.split('::').last.downcase.delete('_').delete('-')
    return klass if new_type =~ /^#{name}[s]?$/
  end
  nil
end