Class: Hpe3parSdk::FlashCacheManager
- Inherits:
-
Object
- Object
- Hpe3parSdk::FlashCacheManager
- Defined in:
- lib/Hpe3parSdk/flash_cache_manager.rb
Overview
Adaptive Flash Cache Rest API methods
Instance Method Summary collapse
- #create_flash_cache(size_in_gib, mode) ⇒ Object
- #delete_flash_cache ⇒ Object
- #flash_cache_exists? ⇒ Boolean
- #get_flash_cache ⇒ Object
-
#initialize(http) ⇒ FlashCacheManager
constructor
A new instance of FlashCacheManager.
Constructor Details
#initialize(http) ⇒ FlashCacheManager
Returns a new instance of FlashCacheManager.
18 19 20 21 |
# File 'lib/Hpe3parSdk/flash_cache_manager.rb', line 18 def initialize(http) @http = http @flash_cache_uri = '/flashcache' end |
Instance Method Details
#create_flash_cache(size_in_gib, mode) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/Hpe3parSdk/flash_cache_manager.rb', line 23 def create_flash_cache(size_in_gib, mode) flash_cache = { 'sizeGiB' => size_in_gib } unless mode.nil? mode = { 'mode' => mode } flash_cache = Util.merge_hash(flash_cache, mode) end info = { 'flashCache' => flash_cache } _response, body = @http.post('/', body: info) body end |
#delete_flash_cache ⇒ Object
50 51 52 |
# File 'lib/Hpe3parSdk/flash_cache_manager.rb', line 50 def delete_flash_cache _response, _body = @http.delete(@flash_cache_uri) end |
#flash_cache_exists? ⇒ Boolean
41 42 43 44 45 46 47 48 |
# File 'lib/Hpe3parSdk/flash_cache_manager.rb', line 41 def flash_cache_exists? begin get_flash_cache return true rescue Hpe3parSdk::HTTPNotFound => ex return false end end |
#get_flash_cache ⇒ Object
36 37 38 39 |
# File 'lib/Hpe3parSdk/flash_cache_manager.rb', line 36 def get_flash_cache _response, body = @http.get(@flash_cache_uri) FlashCache.new(body) end |