Module: OneviewSDK::API600

Defined in:
lib/oneview-sdk/resource/api600.rb,
lib/oneview-sdk/resource/api600/c7000.rb,
lib/oneview-sdk/resource/api600/synergy.rb,
lib/oneview-sdk/resource/api600/c7000/rack.rb,
lib/oneview-sdk/resource/api600/c7000/user.rb,
lib/oneview-sdk/resource/api600/c7000/event.rb,
lib/oneview-sdk/resource/api600/c7000/scope.rb,
lib/oneview-sdk/resource/api600/c7000/alerts.rb,
lib/oneview-sdk/resource/api600/c7000/fabric.rb,
lib/oneview-sdk/resource/api600/c7000/switch.rb,
lib/oneview-sdk/resource/api600/c7000/volume.rb,
lib/oneview-sdk/resource/api600/synergy/rack.rb,
lib/oneview-sdk/resource/api600/synergy/user.rb,
lib/oneview-sdk/resource/api600/c7000/id_pool.rb,
lib/oneview-sdk/resource/api600/c7000/version.rb,
lib/oneview-sdk/resource/api600/synergy/event.rb,
lib/oneview-sdk/resource/api600/synergy/scope.rb,
lib/oneview-sdk/resource/api600/c7000/resource.rb,
lib/oneview-sdk/resource/api600/synergy/alerts.rb,
lib/oneview-sdk/resource/api600/synergy/fabric.rb,
lib/oneview-sdk/resource/api600/synergy/switch.rb,
lib/oneview-sdk/resource/api600/synergy/volume.rb,
lib/oneview-sdk/resource/api600/c7000/enclosure.rb,
lib/oneview-sdk/resource/api600/synergy/id_pool.rb,
lib/oneview-sdk/resource/api600/synergy/version.rb,
lib/oneview-sdk/resource/api600/c7000/datacenter.rb,
lib/oneview-sdk/resource/api600/c7000/fc_network.rb,
lib/oneview-sdk/resource/api600/c7000/uplink_set.rb,
lib/oneview-sdk/resource/api600/synergy/resource.rb,
lib/oneview-sdk/resource/api600/c7000/managed_san.rb,
lib/oneview-sdk/resource/api600/c7000/network_set.rb,
lib/oneview-sdk/resource/api600/c7000/san_manager.rb,
lib/oneview-sdk/resource/api600/synergy/enclosure.rb,
lib/oneview-sdk/resource/api600/c7000/fcoe_network.rb,
lib/oneview-sdk/resource/api600/c7000/interconnect.rb,
lib/oneview-sdk/resource/api600/c7000/login_detail.rb,
lib/oneview-sdk/resource/api600/c7000/power_device.rb,
lib/oneview-sdk/resource/api600/c7000/storage_pool.rb,
lib/oneview-sdk/resource/api600/synergy/datacenter.rb,
lib/oneview-sdk/resource/api600/synergy/fc_network.rb,
lib/oneview-sdk/resource/api600/synergy/uplink_set.rb,
lib/oneview-sdk/resource/api600/synergy/managed_san.rb,
lib/oneview-sdk/resource/api600/synergy/network_set.rb,
lib/oneview-sdk/resource/api600/synergy/san_manager.rb,
lib/oneview-sdk/resource/api600/c7000/lig_uplink_set.rb,
lib/oneview-sdk/resource/api600/c7000/logical_switch.rb,
lib/oneview-sdk/resource/api600/c7000/server_profile.rb,
lib/oneview-sdk/resource/api600/c7000/storage_system.rb,
lib/oneview-sdk/resource/api600/synergy/fcoe_network.rb,
lib/oneview-sdk/resource/api600/synergy/interconnect.rb,
lib/oneview-sdk/resource/api600/synergy/login_detail.rb,
lib/oneview-sdk/resource/api600/synergy/power_device.rb,
lib/oneview-sdk/resource/api600/synergy/storage_pool.rb,
lib/oneview-sdk/resource/api600/c7000/enclosure_group.rb,
lib/oneview-sdk/resource/api600/c7000/firmware_bundle.rb,
lib/oneview-sdk/resource/api600/c7000/firmware_driver.rb,
lib/oneview-sdk/resource/api600/c7000/server_hardware.rb,
lib/oneview-sdk/resource/api600/c7000/volume_snapshot.rb,
lib/oneview-sdk/resource/api600/c7000/volume_template.rb,
lib/oneview-sdk/resource/api600/c7000/ethernet_network.rb,
lib/oneview-sdk/resource/api600/c7000/logical_downlink.rb,
lib/oneview-sdk/resource/api600/c7000/unmanaged_device.rb,
lib/oneview-sdk/resource/api600/synergy/lig_uplink_set.rb,
lib/oneview-sdk/resource/api600/synergy/server_profile.rb,
lib/oneview-sdk/resource/api600/synergy/storage_system.rb,
lib/oneview-sdk/resource/api600/c7000/internal_link_set.rb,
lib/oneview-sdk/resource/api600/c7000/logical_enclosure.rb,
lib/oneview-sdk/resource/api600/c7000/volume_attachment.rb,
lib/oneview-sdk/resource/api600/synergy/drive_enclosure.rb,
lib/oneview-sdk/resource/api600/synergy/enclosure_group.rb,
lib/oneview-sdk/resource/api600/synergy/firmware_bundle.rb,
lib/oneview-sdk/resource/api600/synergy/firmware_driver.rb,
lib/oneview-sdk/resource/api600/synergy/server_hardware.rb,
lib/oneview-sdk/resource/api600/synergy/volume_snapshot.rb,
lib/oneview-sdk/resource/api600/synergy/volume_template.rb,
lib/oneview-sdk/resource/api600/c7000/client_certificate.rb,
lib/oneview-sdk/resource/api600/synergy/ethernet_network.rb,
lib/oneview-sdk/resource/api600/synergy/logical_downlink.rb,
lib/oneview-sdk/resource/api600/synergy/sas_interconnect.rb,
lib/oneview-sdk/resource/api600/synergy/unmanaged_device.rb,
lib/oneview-sdk/resource/api600/c7000/connection_template.rb,
lib/oneview-sdk/resource/api600/synergy/internal_link_set.rb,
lib/oneview-sdk/resource/api600/synergy/logical_enclosure.rb,
lib/oneview-sdk/resource/api600/synergy/volume_attachment.rb,
lib/oneview-sdk/resource/api600/c7000/logical_interconnect.rb,
lib/oneview-sdk/resource/api600/c7000/logical_switch_group.rb,
lib/oneview-sdk/resource/api600/c7000/server_hardware_type.rb,
lib/oneview-sdk/resource/api600/synergy/client_certificate.rb,
lib/oneview-sdk/resource/api600/synergy/os_deployment_plan.rb,
lib/oneview-sdk/resource/api600/synergy/connection_template.rb,
lib/oneview-sdk/resource/api600/c7000/web_server_certificate.rb,
lib/oneview-sdk/resource/api600/synergy/logical_interconnect.rb,
lib/oneview-sdk/resource/api600/synergy/server_hardware_type.rb,
lib/oneview-sdk/resource/api600/c7000/server_profile_template.rb,
lib/oneview-sdk/resource/api600/synergy/web_server_certificate.rb,
lib/oneview-sdk/resource/api600/synergy/server_profile_template.rb,
lib/oneview-sdk/resource/api600/c7000/logical_interconnect_group.rb,
lib/oneview-sdk/resource/api600/synergy/sas_logical_interconnect.rb,
lib/oneview-sdk/resource/api600/synergy/logical_interconnect_group.rb,
lib/oneview-sdk/resource/api600/synergy/sas_logical_interconnect_group.rb

Overview

Module for API v600

Defined Under Namespace

Modules: C7000, Synergy

Constant Summary collapse

SUPPORTED_VARIANTS =
%w[C7000 Synergy].freeze
DEFAULT_VARIANT =
'C7000'.freeze

Class Method Summary collapse

Class Method Details

.const_missing(const) ⇒ Object

Helps redirect resources to the correct API600 variant


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

def self.const_missing(const)
  api600_module = OneviewSDK::API600.const_get(@variant.to_s)
  api600_module.const_get(const)
rescue NameError
  raise NameError, "The #{const} method or resource does not exist for OneView API600 variant #{@variant}."
end

.resource_named(type, variant = @variant) ⇒ Class

Get resource class that matches the type given

Parameters:

  • type (String)

    Name of the desired class type

  • variant (String) (defaults to: @variant)

    Variant (C7000 or Synergy)

Returns:

  • (Class)

    Resource class or nil if not found


24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/oneview-sdk/resource/api600.rb', line 24

def self.resource_named(type, variant = @variant)
  raise "API600 variant '#{variant}' is not supported! Try one of #{SUPPORTED_VARIANTS}" unless SUPPORTED_VARIANTS.include?(variant.to_s)
  new_type = type.to_s.downcase.gsub(/[ -_]/, '')
  api_module = OneviewSDK::API600.const_get(variant)
  api_module.constants.each do |c|
    klass = api_module.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

.variantObject

Get the current API600 variant


38
39
40
# File 'lib/oneview-sdk/resource/api600.rb', line 38

def self.variant
  @variant
end

.variant=(variant) ⇒ Object

Sets the API600 variant


49
50
51
52
53
# File 'lib/oneview-sdk/resource/api600.rb', line 49

def self.variant=(variant)
  raise "API600 variant '#{variant}' is not supported! Try one of #{SUPPORTED_VARIANTS}" unless SUPPORTED_VARIANTS.include?(variant)
  @variant_updated = true
  @variant = variant
end

.variant_updated?TrueClass, FalseClass

Has the API600 variant been set by the user?

Returns:

  • (TrueClass, FalseClass)

44
45
46
# File 'lib/oneview-sdk/resource/api600.rb', line 44

def self.variant_updated?
  @variant_updated
end