Method: OneviewSDK::API500::C7000::StorageSystem#add
- Defined in:
- lib/oneview-sdk/resource/api500/c7000/storage_system.rb
#add ⇒ OneviewSDK::StorageSystem
Note:
Calls the refresh method to set additional data
Adds the resource to OneView using the current data
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/oneview-sdk/resource/api500/c7000/storage_system.rb', line 48 def add ensure_client temp_old_data = JSON.load(@data.to_json) credentials = temp_old_data['credentials'] || {} request_body = { 'family' => @data['family'], 'hostname' => @data['hostname'], 'username' => @data.delete('username') || credentials['username'], 'password' => @data.delete('password') || credentials['password'] } response = @client.rest_post(self.class::BASE_URI, { 'body' => request_body }, @api_version) response_body = @client.response_handler(response) set_all(response_body) managed_domain = temp_old_data['deviceSpecificAttributes']['managedDomain'] rescue nil if self['family'] == 'StoreServ' && managed_domain deep_merge!(temp_old_data) update end self end |