Class: OneviewSDK::API500::C7000::VolumeTemplate
- Inherits:
-
Resource
- Object
- Resource
- OneviewSDK::API300::C7000::Resource
- Resource
- OneviewSDK::API500::C7000::VolumeTemplate
- Defined in:
- lib/oneview-sdk/resource/api500/c7000/volume_template.rb
Overview
Volume Template resource implementation for API500 C7000
Direct Known Subclasses
Synergy::VolumeTemplate, OneviewSDK::API600::C7000::VolumeTemplate
Constant Summary collapse
- BASE_URI =
'/rest/storage-volume-templates'.freeze
Constants inherited from Resource
Resource::DEFAULT_REQUEST_HEADER, Resource::UNIQUE_IDENTIFIERS
Instance Attribute Summary
Attributes inherited from Resource
#api_version, #client, #data, #logger
Class Method Summary collapse
-
.get_reachable_volume_templates(client, networks = [], attributes = {}) ⇒ Array
Gets the storage templates that are connected on the specified networks based on the storage system port’s expected network connectivity.
Instance Method Summary collapse
-
#delete(header = {}) ⇒ true
Delete resource from OneView.
-
#get_compatible_systems ⇒ Array
Retrieves a collection of all storage systems that is applicable to this storage volume template.
-
#get_default_value(property) ⇒ Object
Gets the value of property.
-
#lock(property, locked = true) ⇒ Object
Sets the “locked” property of property passed to true or false.
-
#locked?(property) ⇒ Boolean
Verify if property is locked.
-
#set_default_value(property, value) ⇒ Object
Sets the value of property.
-
#set_root_template(root_template) ⇒ Object
Sets the root template.
-
#unlock(property) ⇒ Object
Sets the “locked” property of property passed to false.
Methods inherited from Resource
#==, #[], #[]=, build_query, #create, #create!, #deep_merge!, #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::Resource
Class Method Details
.get_reachable_volume_templates(client, networks = [], attributes = {}) ⇒ Array
Gets the storage templates that are connected on the specified networks based on the storage system port’s expected network connectivity.
92 93 94 95 96 97 98 99 |
# File 'lib/oneview-sdk/resource/api500/c7000/volume_template.rb', line 92 def self.get_reachable_volume_templates(client, networks = [], attributes = {}) uri = self::BASE_URI + '/reachable-volume-templates' unless networks.empty? network_uris = networks.map { |item| item['uri'] } uri += "?networks='#{network_uris.join(',')}'" end find_by(client, attributes, uri) end |
Instance Method Details
#delete(header = {}) ⇒ true
Delete resource from OneView
24 25 26 |
# File 'lib/oneview-sdk/resource/api500/c7000/volume_template.rb', line 24 def delete(header = {}) super(DEFAULT_REQUEST_HEADER.merge(header).merge('If-Match' => @data['eTag'])) end |
#get_compatible_systems ⇒ Array
Retrieves a collection of all storage systems that is applicable to this storage volume template
82 83 84 85 |
# File 'lib/oneview-sdk/resource/api500/c7000/volume_template.rb', line 82 def get_compatible_systems ensure_client && ensure_uri self.class.find_with_pagination(@client, self['compatibleStorageSystemsUri']) end |
#get_default_value(property) ⇒ Object
Gets the value of property
74 75 76 77 |
# File 'lib/oneview-sdk/resource/api500/c7000/volume_template.rb', line 74 def get_default_value(property) verify_if_root_template_is_set! self['properties'][property.to_s]['default'] end |
#lock(property, locked = true) ⇒ Object
Sets the “locked” property of property passed to true or false
39 40 41 42 |
# File 'lib/oneview-sdk/resource/api500/c7000/volume_template.rb', line 39 def lock(property, locked = true) verify_if_root_template_is_set! self['properties'][property.to_s]['meta']['locked'] = locked end |
#locked?(property) ⇒ Boolean
Verify if property is locked
55 56 57 58 |
# File 'lib/oneview-sdk/resource/api500/c7000/volume_template.rb', line 55 def locked?(property) verify_if_root_template_is_set! self['properties'][property.to_s]['meta']['locked'] end |
#set_default_value(property, value) ⇒ Object
Sets the value of property
64 65 66 67 68 |
# File 'lib/oneview-sdk/resource/api500/c7000/volume_template.rb', line 64 def set_default_value(property, value) verify_if_root_template_is_set! value = value['uri'] if value.is_a?(Resource) self['properties'][property.to_s]['default'] = value end |
#set_root_template(root_template) ⇒ Object
Sets the root template
30 31 32 33 |
# File 'lib/oneview-sdk/resource/api500/c7000/volume_template.rb', line 30 def set_root_template(root_template) self['properties'] = root_template['properties'].clone self['rootTemplateUri'] = root_template['uri'] end |
#unlock(property) ⇒ Object
Sets the “locked” property of property passed to false
47 48 49 |
# File 'lib/oneview-sdk/resource/api500/c7000/volume_template.rb', line 47 def unlock(property) lock(property, false) end |