Module: OneviewSDK::API2400

Defined in:
lib/oneview-sdk/resource/api2400.rb,
lib/oneview-sdk/resource/api2400/c7000.rb,
lib/oneview-sdk/resource/api2400/synergy.rb,
lib/oneview-sdk/resource/api2400/c7000/scope.rb,
lib/oneview-sdk/resource/api2400/c7000/volume.rb,
lib/oneview-sdk/resource/api2400/synergy/scope.rb,
lib/oneview-sdk/resource/api2400/synergy/volume.rb,
lib/oneview-sdk/resource/api2400/c7000/enclosure.rb,
lib/oneview-sdk/resource/api2400/c7000/fc_network.rb,
lib/oneview-sdk/resource/api2400/c7000/uplink_set.rb,
lib/oneview-sdk/resource/api2400/c7000/network_set.rb,
lib/oneview-sdk/resource/api2400/synergy/enclosure.rb,
lib/oneview-sdk/resource/api2400/c7000/fcoe_network.rb,
lib/oneview-sdk/resource/api2400/c7000/interconnect.rb,
lib/oneview-sdk/resource/api2400/c7000/storage_pool.rb,
lib/oneview-sdk/resource/api2400/synergy/fc_network.rb,
lib/oneview-sdk/resource/api2400/synergy/uplink_set.rb,
lib/oneview-sdk/resource/api2400/synergy/network_set.rb,
lib/oneview-sdk/resource/api2400/c7000/lig_uplink_set.rb,
lib/oneview-sdk/resource/api2400/c7000/server_profile.rb,
lib/oneview-sdk/resource/api2400/c7000/storage_system.rb,
lib/oneview-sdk/resource/api2400/synergy/fcoe_network.rb,
lib/oneview-sdk/resource/api2400/synergy/interconnect.rb,
lib/oneview-sdk/resource/api2400/synergy/storage_pool.rb,
lib/oneview-sdk/resource/api2400/c7000/enclosure_group.rb,
lib/oneview-sdk/resource/api2400/c7000/firmware_driver.rb,
lib/oneview-sdk/resource/api2400/c7000/server_hardware.rb,
lib/oneview-sdk/resource/api2400/c7000/volume_template.rb,
lib/oneview-sdk/resource/api2400/c7000/ethernet_network.rb,
lib/oneview-sdk/resource/api2400/synergy/lig_uplink_set.rb,
lib/oneview-sdk/resource/api2400/synergy/server_profile.rb,
lib/oneview-sdk/resource/api2400/synergy/storage_system.rb,
lib/oneview-sdk/resource/api2400/c7000/logical_enclosure.rb,
lib/oneview-sdk/resource/api2400/c7000/volume_attachment.rb,
lib/oneview-sdk/resource/api2400/synergy/enclosure_group.rb,
lib/oneview-sdk/resource/api2400/synergy/firmware_driver.rb,
lib/oneview-sdk/resource/api2400/synergy/server_hardware.rb,
lib/oneview-sdk/resource/api2400/synergy/volume_template.rb,
lib/oneview-sdk/resource/api2400/c7000/hypervisor_manager.rb,
lib/oneview-sdk/resource/api2400/c7000/server_certificate.rb,
lib/oneview-sdk/resource/api2400/synergy/ethernet_network.rb,
lib/oneview-sdk/resource/api2400/c7000/connection_template.rb,
lib/oneview-sdk/resource/api2400/synergy/logical_enclosure.rb,
lib/oneview-sdk/resource/api2400/synergy/volume_attachment.rb,
lib/oneview-sdk/resource/api2400/c7000/logical_interconnect.rb,
lib/oneview-sdk/resource/api2400/c7000/server_hardware_type.rb,
lib/oneview-sdk/resource/api2400/synergy/hypervisor_manager.rb,
lib/oneview-sdk/resource/api2400/synergy/os_deployment_plan.rb,
lib/oneview-sdk/resource/api2400/synergy/server_certificate.rb,
lib/oneview-sdk/resource/api2400/synergy/connection_template.rb,
lib/oneview-sdk/resource/api2400/synergy/logical_interconnect.rb,
lib/oneview-sdk/resource/api2400/synergy/server_hardware_type.rb,
lib/oneview-sdk/resource/api2400/c7000/server_profile_template.rb,
lib/oneview-sdk/resource/api2400/synergy/server_profile_template.rb,
lib/oneview-sdk/resource/api2400/c7000/hypervisor_cluster_profile.rb,
lib/oneview-sdk/resource/api2400/c7000/logical_interconnect_group.rb,
lib/oneview-sdk/resource/api2400/synergy/hypervisor_cluster_profile.rb,
lib/oneview-sdk/resource/api2400/synergy/logical_interconnect_group.rb

Overview

Module for API v2400

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 API2400 variant



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

def self.const_missing(const)
  api2400_module = OneviewSDK::API2400.const_get(@variant.to_s)
  api2400_module.const_get(const)
rescue NameError
  raise NameError, "The #{const} method or resource does not exist for OneView API2400 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/api2400.rb', line 24

def self.resource_named(type, variant = @variant)
  raise "API2400 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::API2400.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 API2400 variant



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

def self.variant
  @variant
end

.variant=(variant) ⇒ Object

Sets the API2400 variant



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

def self.variant=(variant)
  raise "API2400 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 API2400 variant been set by the user?

Returns:

  • (TrueClass, FalseClass)


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

def self.variant_updated?
  @variant_updated
end