Class: TcServer::TemplateImage

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

Overview

A template image

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) ⇒ TemplateImage

Returns a new instance of TemplateImage.



55
56
57
58
59
60
61
# File 'lib/vas/tc_server/template_images.rb', line 55

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

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

Instance Attribute Details

#nameString (readonly)

Returns the template image’s name.

Returns:

  • (String)

    the template image’s name



46
47
48
# File 'lib/vas/tc_server/template_images.rb', line 46

def name
  @name
end

#sizeString (readonly)

Returns the template image’s size.

Returns:

  • (String)

    the template image’s size



52
53
54
# File 'lib/vas/tc_server/template_images.rb', line 52

def size
  @size
end

#versionString (readonly)

Returns the template image’s version.

Returns:

  • (String)

    the template image’s version



49
50
51
# File 'lib/vas/tc_server/template_images.rb', line 49

def version
  @version
end

Instance Method Details

#reloadObject

Reloads the template image’s details from the server



64
65
66
67
# File 'lib/vas/tc_server/template_images.rb', line 64

def reload
  super
  @templates = nil
end

#templatesTemplate[]

Returns the templates that have been created from the template image.

Returns:

  • (Template[])

    the templates that have been created from the template image



70
71
72
# File 'lib/vas/tc_server/template_images.rb', line 70

def templates
  @templates ||= create_resources_from_links('template', Template)
end

#to_sString

Returns a string representation of the template image.

Returns:

  • (String)

    a string representation of the template image



75
76
77
# File 'lib/vas/tc_server/template_images.rb', line 75

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