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
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 ⇒ 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, #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.
94 95 96 97 98 99 100 101 |
# File 'lib/oneview-sdk/resource/api500/c7000/volume_template.rb', line 94 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 ⇒ true
Delete resource from OneView
23 24 25 26 27 28 |
# File 'lib/oneview-sdk/resource/api500/c7000/volume_template.rb', line 23 def delete ensure_client && ensure_uri response = @client.rest_delete(@data['uri'], { 'If-Match' => @data['eTag'] }, @api_version) @client.response_handler(response) true end |
#get_compatible_systems ⇒ Array
Retrieves a collection of all storage systems that is applicable to this storage volume template
84 85 86 87 |
# File 'lib/oneview-sdk/resource/api500/c7000/volume_template.rb', line 84 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
76 77 78 79 |
# File 'lib/oneview-sdk/resource/api500/c7000/volume_template.rb', line 76 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
41 42 43 44 |
# File 'lib/oneview-sdk/resource/api500/c7000/volume_template.rb', line 41 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
57 58 59 60 |
# File 'lib/oneview-sdk/resource/api500/c7000/volume_template.rb', line 57 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
66 67 68 69 70 |
# File 'lib/oneview-sdk/resource/api500/c7000/volume_template.rb', line 66 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
32 33 34 35 |
# File 'lib/oneview-sdk/resource/api500/c7000/volume_template.rb', line 32 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
49 50 51 |
# File 'lib/oneview-sdk/resource/api500/c7000/volume_template.rb', line 49 def unlock(property) lock(property, false) end |