Class: OneviewSDK::StoragePool

Inherits:
Resource
  • Object
show all
Defined in:
lib/oneview-sdk/resource/storage_pool.rb

Overview

Storage pool resource implementation

Validates collapse

VALID_REFRESH_STATES =
%w(NotRefreshing RefreshFailed RefreshPending Refreshing).freeze
VALID_STATUSES =
%w(OK Disabled Warning Critical Unknown).freeze

Constant Summary collapse

BASE_URI =
'/rest/storage-pools'.freeze

Instance Attribute Summary

Attributes inherited from Resource

#api_version, #client, #data, #logger

Validates collapse

Instance Method Summary collapse

Methods inherited from Resource

#==, #[], #[]=, #create, #create!, #delete, #each, #eql?, #exists?, find_by, from_file, get_all, #like?, #refresh, #retrieve!, #schema, schema, #set, #set_all, #to_file

Constructor Details

#initialize(client, params = {}, api_ver = nil) ⇒ StoragePool

Returns a new instance of StoragePool.



6
7
8
9
10
# File 'lib/oneview-sdk/resource/storage_pool.rb', line 6

def initialize(client, params = {}, api_ver = nil)
  super
  # Default values:
  @data['type'] ||= 'StoragePoolV2'
end

Instance Method Details

#set_storage_system(storage_system) ⇒ Object

Set storage system

Parameters:



32
33
34
# File 'lib/oneview-sdk/resource/storage_pool.rb', line 32

def set_storage_system(storage_system)
  set('storageSystemUri', storage_system['uri'])
end

#updateObject



36
37
38
# File 'lib/oneview-sdk/resource/storage_pool.rb', line 36

def update
  unavailable_method
end

#validate_refreshState(value) ⇒ Object

Validate refreshState

Parameters:

  • value (String)

    NotRefreshing, RefreshFailed, RefreshPending, Refreshing



17
18
19
# File 'lib/oneview-sdk/resource/storage_pool.rb', line 17

def validate_refreshState(value)
  fail 'Invalid refresh state' unless VALID_REFRESH_STATES.include?(value)
end

#validate_status(value) ⇒ Object

Validate status

Parameters:

  • value (String)

    OK, Disabled, Warning, Critical, Unknown



24
25
26
# File 'lib/oneview-sdk/resource/storage_pool.rb', line 24

def validate_status(value)
  fail 'Invalid status' unless VALID_STATUSES.include?(value)
end