Class: OneviewSDK::ServerProfileTemplate

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

Overview

Server profile template resource implementation

Constant Summary collapse

BASE_URI =
'/rest/server-profile-templates'.freeze

Instance Attribute Summary

Attributes inherited from Resource

#api_version, #client, #data, #logger

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, #update

Constructor Details

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

Returns a new instance of ServerProfileTemplate.



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

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

Instance Method Details

#new_profile(name = nil) ⇒ ServerProfile

Create ServerProfile using this template

Parameters:

  • name (String) (defaults to: nil)

    Name of new server profile

Returns:

  • (ServerProfile)

    New server profile from template. Temporary object only; call .create to actually create resource on OneView.



16
17
18
19
20
21
22
# File 'lib/oneview-sdk/resource/server_profile_template.rb', line 16

def new_profile(name = nil)
  ensure_client && ensure_uri
  options = @client.rest_get("#{@data['uri']}/new-profile")
  profile = OneviewSDK::ServerProfile.new(@client, options)
  profile[:name] = name if name && name.size > 0
  profile
end