Class: OneviewSDK::API300::Synergy::Enclosure
- Inherits:
-
C7000::Enclosure
- Object
- Resource
- OneviewSDK::API200::Resource
- OneviewSDK::API200::Enclosure
- C7000::Enclosure
- OneviewSDK::API300::Synergy::Enclosure
- Defined in:
- lib/oneview-sdk/resource/api300/synergy/enclosure.rb
Overview
Enclosure resource implementation for API300 Synergy
Direct Known Subclasses
Constant Summary
Constants inherited from OneviewSDK::API200::Enclosure
OneviewSDK::API200::Enclosure::BASE_URI, OneviewSDK::API200::Enclosure::UNIQUE_IDENTIFIERS
Constants inherited from Resource
Resource::BASE_URI, Resource::DEFAULT_REQUEST_HEADER, Resource::UNIQUE_IDENTIFIERS
Instance Attribute Summary
Attributes inherited from Resource
#api_version, #client, #data, #logger
Class Method Summary collapse
-
.update_enclosure_names(client, hostname, name = '') ⇒ Array<OneviewSDK:API300:Synergy::Enclosure>
Method for renaming all enclosures that share the same frameLinkModuleDomain.
Instance Method Summary collapse
-
#add ⇒ Array<OneviewSDK:API300:Synergy::Enclosure>
Claim/configure the enclosure and its components to the appliance.
-
#set_enclosure_group ⇒ Object
Method is not available.
-
#set_environmental_configuration ⇒ Object
Method is not available.
Methods inherited from C7000::Enclosure
Methods included from C7000::Scope::ScopeHelperMethods
#add_scope, #patch, #remove_scope, #replace_scopes
Methods inherited from OneviewSDK::API200::Enclosure
#create, #delete, #environmental_configuration, #initialize, #patch, #remove, #script, #set_refresh_state, #update, #utilization
Methods included from ResourceHelper::ConfigurationOperation
Methods inherited from Resource
#==, #[], #[]=, build_query, #create, #create!, #deep_merge!, #delete, #each, #eql?, #exists?, find_by, find_with_pagination, from_file, get_all, get_all_with_query, #initialize, #like?, #refresh, #retrieve!, schema, #schema, #set, #set_all, #to_file, #update
Constructor Details
This class inherits a constructor from OneviewSDK::API300::C7000::Enclosure
Class Method Details
.update_enclosure_names(client, hostname, name = '') ⇒ Array<OneviewSDK:API300:Synergy::Enclosure>
Method for renaming all enclosures that share the same frameLinkModuleDomain. The naming pattern for the enclosures is <name><1..number of enclosures>.
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# 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 |
Instance Method Details
#add ⇒ Array<OneviewSDK:API300:Synergy::Enclosure>
Calls the update_enclosure_names method to set the enclosure names
Claim/configure the enclosure and its components to the appliance
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# 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 |
#set_enclosure_group ⇒ Object
Method is not available
45 46 47 |
# File 'lib/oneview-sdk/resource/api300/synergy/enclosure.rb', line 45 def set_enclosure_group(*) unavailable_method end |
#set_environmental_configuration ⇒ Object
Method is not available
39 40 41 |
# File 'lib/oneview-sdk/resource/api300/synergy/enclosure.rb', line 39 def set_environmental_configuration(*) unavailable_method end |