Class: TcServer::Template

Inherits:
Shared::Resource show all
Includes:
Shared::Deletable
Defined in:
lib/vas/tc_server/templates.rb

Overview

A tc Server template

Instance Attribute Summary collapse

Attributes included from Shared::Deletable

#collection

Attributes inherited from Shared::Resource

#location, #security

Instance Method Summary collapse

Methods included from Shared::Deletable

#delete

Constructor Details

#initialize(location, client) ⇒ Template

Returns a new instance of Template.



50
51
52
53
54
55
56
57
58
# File 'lib/vas/tc_server/templates.rb', line 50

def initialize(location, client)
  super(location, client)

  @version = details['version']
  @name = details['name']

  @installation_location = Util::LinkUtils.get_link_href(details, 'installation')
  @template_image_location = Util::LinkUtils.get_link_href(details, 'template-image')
end

Instance Attribute Details

#nameString (readonly)

Returns the template’s name.

Returns:

  • (String)

    the template’s name



47
48
49
# File 'lib/vas/tc_server/templates.rb', line 47

def name
  @name
end

#versionString (readonly)

Returns the template’s version.

Returns:

  • (String)

    the template’s version



44
45
46
# File 'lib/vas/tc_server/templates.rb', line 44

def version
  @version
end

Instance Method Details

#installationInstallation

Returns the template’s installation.

Returns:



61
62
63
# File 'lib/vas/tc_server/templates.rb', line 61

def installation
  @installation ||= Installation.new(@installation_location, client)
end

#template_imageTemplateImage

Returns the template image, if any, that this template was created from.

Returns:

  • (TemplateImage)

    the template image, if any, that this template was created from



66
67
68
69
70
71
# File 'lib/vas/tc_server/templates.rb', line 66

def template_image
  if @template_image.nil?
    @template_image = TemplateImage.new(@template_image_location, client) unless @template_image_location.nil?
  end
  @template_image
end

#to_sString

Returns a string representation of the template.

Returns:

  • (String)

    a string representation of the template



74
75
76
# File 'lib/vas/tc_server/templates.rb', line 74

def to_s
  "#<#{self.class} name='#@name' version='#@version'>"
end