Module: OneviewSDK::API300

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

Overview

Module for API v300

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


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

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

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

Get resource class that matches the type given


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

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


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

def self.variant
  @variant
end

.variant=(variant) ⇒ Object

Sets the API300 variant


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

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


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

def self.variant_updated?
  @variant_updated
end