module OneviewSDK::API1200
Module for API v1200
Constants
- DEFAULT_VARIANT
- SUPPORTED_VARIANTS
Public Class Methods
const_missing(const)
click to toggle source
Helps redirect resources to the correct API1200
variant
# File lib/oneview-sdk/resource/api1200.rb, line 56 def self.const_missing(const) api1200_module = OneviewSDK::API1200.const_get(@variant.to_s) api1200_module.const_get(const) rescue NameError raise NameError, "The #{const} method or resource does not exist for OneView API1200 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/api1200.rb, line 24 def self.resource_named(type, variant = @variant) raise "API1200 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::API1200.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 API1200
variant
# File lib/oneview-sdk/resource/api1200.rb, line 38 def self.variant @variant end
variant=(variant)
click to toggle source
Sets the API1200
variant
# File lib/oneview-sdk/resource/api1200.rb, line 49 def self.variant=(variant) raise "API1200 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 API1200
variant been set by the user? @return [TrueClass, FalseClass]
# File lib/oneview-sdk/resource/api1200.rb, line 44 def self.variant_updated? @variant_updated end