class OneviewSDK::API200::StoragePool
Storage pool resource implementation
Constants
- BASE_URI
Public Class Methods
Create a resource object, associate it with a client, and set its properties. @param [OneviewSDK::Client] client The client object for the OneView appliance @param [Hash] params The options for this resource (key-value pairs) @param [Integer] api_ver The api version to use when interracting with this resource.
OneviewSDK::Resource::new
# File lib/oneview-sdk/resource/api200/storage_pool.rb, line 35 def initialize(client, params = {}, api_ver = nil) super # Default values: @data['type'] ||= 'StoragePoolV2' end
Public Instance Methods
Add the resource on OneView using the current data @note Calls the refresh method to set additional data @raise [OneviewSDK::IncompleteResource] if the client is not set @raise [StandardError] if the resource creation fails @return [OneviewSDK::StoragePool] self
Method is not available @raise [OneviewSDK::MethodUnavailable] method is not available
# File lib/oneview-sdk/resource/api200/storage_pool.rb, line 43 def create(*) unavailable_method end
Method is not available @raise [OneviewSDK::MethodUnavailable] method is not available
# File lib/oneview-sdk/resource/api200/storage_pool.rb, line 49 def create!(*) unavailable_method end
Method is not available @raise [OneviewSDK::MethodUnavailable] method is not available
# File lib/oneview-sdk/resource/api200/storage_pool.rb, line 55 def delete(*) unavailable_method end
Check if a resource exists @note name or uri must be specified inside resource @return [Boolean] Whether or not resource exists
# File lib/oneview-sdk/resource/api200/storage_pool.rb, line 82 def exists? raise IncompleteResource, 'Must set resource name or uri before trying to exists?' unless @data['name'] || @data['uri'] raise IncompleteResource, 'Must set resource storageSystemUri before trying to exists?' unless @data['storageSystemUri'] return true if @data['name'] && self.class.find_by(@client, name: @data['name'], storageSystemUri: @data['storageSystemUri']).size == 1 return true if @data['uri'] && self.class.find_by(@client, uri: @data['uri'], storageSystemUri: @data['storageSystemUri']).size == 1 false end
Remove resource from OneView @return [true] if resource was removed successfully
Retrieve resource details based on this resource's name or URI. @note Name or URI must be specified inside the resource @return [Boolean] Whether or not retrieve was successful
# File lib/oneview-sdk/resource/api200/storage_pool.rb, line 68 def retrieve! raise IncompleteResource, 'Must set resource name or uri before trying to retrieve!' unless @data['name'] || @data['uri'] raise IncompleteResource, 'Must set resource storageSystemUri before trying to retrieve!' unless @data['storageSystemUri'] results = self.class.find_by(@client, name: @data['name'], storageSystemUri: @data['storageSystemUri']) if @data['name'] results = self.class.find_by(@client, uri: @data['uri'], storageSystemUri: @data['storageSystemUri']) if @data['uri'] && (!results || results.empty?) return false unless results.size == 1 set_all(results[0].data) true end
Sets the storage system @param [OneviewSDK::StorageSystem] storage_system @raise [OneviewSDK::IncompleteResource] if Storage System not found
# File lib/oneview-sdk/resource/api200/storage_pool.rb, line 93 def set_storage_system(storage_system) raise 'Storage System could not be found!' unless storage_system.retrieve! set('storageSystemUri', storage_system['uri']) end
Method is not available @raise [OneviewSDK::MethodUnavailable] method is not available
# File lib/oneview-sdk/resource/api200/storage_pool.rb, line 61 def update(*) unavailable_method end