module OneviewSDK::API2600

Module for API v2600

Constants

DEFAULT_VARIANT
SUPPORTED_VARIANTS

Public Class Methods

const_missing(const) click to toggle source

Helps redirect resources to the correct API2600 variant

# File lib/oneview-sdk/resource/api2600.rb, line 56
def self.const_missing(const)
  api2600_module = OneviewSDK::API2600.const_get(@variant.to_s)
  api2600_module.const_get(const)
rescue NameError
  raise NameError, "The #{const} method or resource does not exist for OneView API2600 variant #{@variant}."
end
resource_named(type, variant = @variant) click to toggle source

Get resource class that matches the type given @param [String] type Name of the desired class type @param [String] variant Variant (C7000 or Synergy) @return [Class] Resource class or nil if not found

# File lib/oneview-sdk/resource/api2600.rb, line 24
def self.resource_named(type, variant = @variant)
  raise "API2600 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::API2600.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
variant() click to toggle source

Get the current API2600 variant

# File lib/oneview-sdk/resource/api2600.rb, line 38
def self.variant
  @variant
end
variant=(variant) click to toggle source

Sets the API2600 variant

# File lib/oneview-sdk/resource/api2600.rb, line 49
def self.variant=(variant)
  raise "API2600 variant '#{variant}' is not supported! Try one of #{SUPPORTED_VARIANTS}" unless SUPPORTED_VARIANTS.include?(variant)
  @variant_updated = true
  @variant = variant
end
variant_updated?() click to toggle source

Has the API2600 variant been set by the user? @return [TrueClass, FalseClass]

# File lib/oneview-sdk/resource/api2600.rb, line 44
def self.variant_updated?
  @variant_updated
end