Class: Bosh::Director::Models::Template

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/models/template.rb

Instance Method Summary collapse

Instance Method Details

#logsObject



25
26
27
28
# File 'lib/bosh/director/models/template.rb', line 25

def logs
  result = self.logs_json
  result ? Yajl::Parser.parse(result) : nil
end

#logs=(logs_spec) ⇒ Object



21
22
23
# File 'lib/bosh/director/models/template.rb', line 21

def logs=(logs_spec)
  self.logs_json = Yajl::Encoder.encode(logs_spec)
end

#package_namesObject



12
13
14
15
# File 'lib/bosh/director/models/template.rb', line 12

def package_names
  result = self.package_names_json
  result ? Yajl::Parser.parse(result) : nil
end

#package_names=(packages) ⇒ Object



17
18
19
# File 'lib/bosh/director/models/template.rb', line 17

def package_names=(packages)
  self.package_names_json = Yajl::Encoder.encode(packages)
end

#propertiesHash?

Returns:

  • (Hash)

    Template properties (as provided in job spec)

  • (nil)

    if no properties have been defined in job spec



37
38
39
40
# File 'lib/bosh/director/models/template.rb', line 37

def properties
  result = self.properties_json
  result ? Yajl::Parser.parse(result) : nil
end

#properties=(property_spec) ⇒ Object

Parameters:

  • property_spec (Object)

    Property spec from job spec



31
32
33
# File 'lib/bosh/director/models/template.rb', line 31

def properties=(property_spec)
  self.properties_json = Yajl::Encoder.encode(property_spec)
end

#validateObject



6
7
8
9
10
# File 'lib/bosh/director/models/template.rb', line 6

def validate
  validates_presence [:release_id, :name, :version, :blobstore_id, :sha1]
  validates_unique [:release_id, :name, :version]
  validates_format VALID_ID, [:name, :version]
end