Class: Bosh::Director::Models::Vm

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

Instance Method Summary collapse

Instance Method Details

#apply_specObject



13
14
15
16
# File 'lib/bosh/director/models/vm.rb', line 13

def apply_spec
  return nil if apply_spec_json.nil?
  Yajl::Parser.parse(apply_spec_json)
end

#apply_spec=(spec) ⇒ Object



18
19
20
# File 'lib/bosh/director/models/vm.rb', line 18

def apply_spec=(spec)
  self.apply_spec_json = Yajl::Encoder.encode(spec)
end

#credentialsObject



33
34
35
36
# File 'lib/bosh/director/models/vm.rb', line 33

def credentials
  return nil if credentials_json.nil?
  Yajl::Parser.parse(credentials_json)
end

#credentials=(spec) ⇒ Object



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

def credentials=(spec)
  self.credentials_json = Yajl::Encoder.encode(spec)
end

#envHash

Returns VM environment hash.

Returns:

  • (Hash)

    VM environment hash



28
29
30
31
# File 'lib/bosh/director/models/vm.rb', line 28

def env
  return nil if env_json.nil?
  Yajl::Parser.parse(env_json)
end

#env=(env_hash) ⇒ Object

Parameters:

  • env_hash (Hash)

    Environment hash



23
24
25
# File 'lib/bosh/director/models/vm.rb', line 23

def env=(env_hash)
  self.env_json = Yajl::Encoder.encode(env_hash)
end

#validateObject



8
9
10
11
# File 'lib/bosh/director/models/vm.rb', line 8

def validate
  validates_presence [:deployment_id, :agent_id]
  validates_unique :agent_id
end