class OneviewSDK::API300::Synergy::Enclosure
Public Class Methods
Method for renaming all enclosures that share the same frameLinkModuleDomain. The naming pattern for the enclosures is <name><1..number of enclosures>. @param [OneviewSDK::Client] client The client object for the OneView appliance @param [String] hostname The ipv6 of the enclosure to be added @param [String] name The name to be used for renaming the enclosures @return [Array<OneviewSDK:API300:Synergy::Enclosure>] which had their name changed @raise [OneviewSDK::IncompleteResource] if a client and hostname are nil
# File lib/oneview-sdk/resource/api300/synergy/enclosure.rb, line 56 def self.update_enclosure_names(client, hostname, name = '') raise IncompleteResource, 'Missing parameters for update_enclosure_names' unless client && hostname frame_link = '' # Retrieve the frameLinkModuleDomain of the specified enclosure, then use it to find all enclosures # that share that frameLinkModuleDomain. all_enclosures = find_by(client, {}) all_enclosures.each do |encl| frame_link = encl['frameLinkModuleDomain'] if encl['managerBays'].first['ipAddress'] == hostname end enclosures = all_enclosures.select { |encl| encl['frameLinkModuleDomain'] == frame_link } # Return enclosures without modifying them if a name has not been specified return enclosures if name == '' # Updates the enclosure names and return the array containing the enclosures number_of_enclosures = enclosures.count enclosures.each do |encl| encl['name'] = "#{name}#{number_of_enclosures}" encl.update number_of_enclosures -= 1 end enclosures end
Public Instance Methods
Claim/configure the enclosure and its components to the appliance @note Calls the update_enclosure_names
method to set the enclosure names @return [Array<OneviewSDK:API300:Synergy::Enclosure>] containing the added enclosures
# File lib/oneview-sdk/resource/api300/synergy/enclosure.rb, line 23 def add ensure_client required_attributes = %w[hostname] required_attributes.each { |k| raise IncompleteResource, "Missing required attribute: '#{k}'" unless @data.key?(k) } temp_data = @data.select { |k, _v| required_attributes.include?(k) } response = @client.rest_post(self.class::BASE_URI, { 'body' => temp_data }, @api_version) @client.response_handler(response) # Renames the enclosures if the @data['name'] is not nil, otherwise only returns the enclosures @data['name'] ||= '' self.class.update_enclosure_names(@client, @data['hostname'], @data['name']) end
Method is not available @raise [OneviewSDK::MethodUnavailable] method is not available
# File lib/oneview-sdk/resource/api300/synergy/enclosure.rb, line 45 def set_enclosure_group(*) unavailable_method end
Method is not available @raise [OneviewSDK::MethodUnavailable] method is not available
# File lib/oneview-sdk/resource/api300/synergy/enclosure.rb, line 39 def set_environmental_configuration(*) unavailable_method end