Class: OneviewSDK::API500::C7000::ServerProfileTemplate
- Inherits:
-
OneviewSDK::API300::C7000::ServerProfileTemplate
- Object
- Resource
- OneviewSDK::API200::Resource
- OneviewSDK::API200::ServerProfileTemplate
- OneviewSDK::API300::C7000::ServerProfileTemplate
- OneviewSDK::API500::C7000::ServerProfileTemplate
- Defined in:
- lib/oneview-sdk/resource/api500/c7000/server_profile_template.rb
Overview
Server Profile Template resource implementation on API500 C7000
Direct Known Subclasses
Constant Summary
Constants inherited from OneviewSDK::API200::ServerProfileTemplate
OneviewSDK::API200::ServerProfileTemplate::BASE_URI
Constants inherited from Resource
Resource::BASE_URI, Resource::DEFAULT_REQUEST_HEADER, Resource::UNIQUE_IDENTIFIERS
Instance Attribute Summary
Attributes inherited from Resource
#api_version, #client, #data, #logger
Instance Method Summary collapse
-
#add_connection(network, connection_options = {}) ⇒ Object
Adds a connection entry to server profile template.
-
#create_volume_with_attachment(storage_pool, volume_options, attachment_options = {}) ⇒ Object
Adds a volume attachment entry with new volume in Server profile template.
-
#initialize(client, params = {}, api_ver = nil) ⇒ ServerProfileTemplate
constructor
Create a resource object, associate it with a client, and set its properties.
-
#remove_connection(connection_name) ⇒ Object
Removes a connection entry in server profile template.
Methods inherited from OneviewSDK::API300::C7000::ServerProfileTemplate
Methods inherited from OneviewSDK::API200::ServerProfileTemplate
#add_volume_attachment, #get_available_hardware, #new_profile, #remove_volume_attachment, #set_enclosure_group, #set_firmware_driver, #set_server_hardware_type
Methods inherited from Resource
#==, #[], #[]=, build_query, #create, #create!, #deep_merge!, #delete, #each, #eql?, #exists?, find_by, find_with_pagination, from_file, get_all, #like?, #refresh, #retrieve!, schema, #schema, #set, #set_all, #to_file, #update
Constructor Details
#initialize(client, params = {}, api_ver = nil) ⇒ ServerProfileTemplate
Create a resource object, associate it with a client, and set its properties.
24 25 26 27 28 29 |
# File 'lib/oneview-sdk/resource/api500/c7000/server_profile_template.rb', line 24 def initialize(client, params = {}, api_ver = nil) @data ||= {} # Default values @data['type'] ||= 'ServerProfileTemplateV3' super end |
Instance Method Details
#add_connection(network, connection_options = {}) ⇒ Object
Adds a connection entry to server profile template
42 43 44 45 46 47 48 49 50 |
# File 'lib/oneview-sdk/resource/api500/c7000/server_profile_template.rb', line 42 def add_connection(network, = {}) = Hash[.map { |k, v| [k.to_s, v] }] self['connectionSettings'] = {} unless self['connectionSettings'] self['connectionSettings']['connections'] = [] unless self['connectionSettings']['connections'] self['connectionSettings']['manageConnections'] = true ['id'] ||= 0 ['networkUri'] = network['uri'] if network['uri'] || network.retrieve! self['connectionSettings']['connections'] << end |
#create_volume_with_attachment(storage_pool, volume_options, attachment_options = {}) ⇒ Object
Adds a volume attachment entry with new volume in Server profile template
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/oneview-sdk/resource/api500/c7000/server_profile_template.rb', line 80 def (storage_pool, , = {}) raise IncompleteResource, 'Storage Pool not found!' unless storage_pool.retrieve! # Convert symbols keys to string in volume_options and attachment_options = Hash[.map { |k, v| [k.to_s, v] }] = Hash[.map { |k, v| [k.to_s, v] }] self['sanStorage'] ||= {} self['sanStorage']['volumeAttachments'] ||= [] ['id'] ||= 0 ['volumeStoragePoolUri'] = storage_pool['uri'] ['volumeStorageSystemUri'] = storage_pool['storageSystemUri'] ['volumeName'] = ['name'] ['volumeDescription'] = ['description'] ['volumeProvisionType'] = ['provisioningType'] ['volumeProvisionedCapacityBytes'] = ['size'] # Defaults ['volumeUri'] = nil ['permanent'] ||= true ['volumeShareable'] = false self['sanStorage']['manageSanStorage'] ||= true self['sanStorage']['volumeAttachments'] << end |
#remove_connection(connection_name) ⇒ Object
Removes a connection entry in server profile template
55 56 57 58 59 60 61 62 |
# File 'lib/oneview-sdk/resource/api500/c7000/server_profile_template.rb', line 55 def remove_connection(connection_name) desired_connection = nil return desired_connection unless self['connectionSettings']['connections'] self['connectionSettings']['connections'].each do |con| desired_connection = self['connectionSettings']['connections'].delete(con) if con['name'] == connection_name end desired_connection end |