Class: Bosh::Director::Models::Vm
- Defined in:
- lib/bosh/director/models/vm.rb
Instance Method Summary collapse
- #apply_spec ⇒ Object
- #apply_spec=(spec) ⇒ Object
- #credentials ⇒ Object
- #credentials=(spec) ⇒ Object
-
#env ⇒ Hash
VM environment hash.
- #env=(env_hash) ⇒ Object
- #validate ⇒ Object
Instance Method Details
#apply_spec ⇒ Object
12 13 14 15 |
# File 'lib/bosh/director/models/vm.rb', line 12 def apply_spec return nil if apply_spec_json.nil? Yajl::Parser.parse(apply_spec_json) end |
#apply_spec=(spec) ⇒ Object
17 18 19 |
# File 'lib/bosh/director/models/vm.rb', line 17 def apply_spec=(spec) self.apply_spec_json = Yajl::Encoder.encode(spec) end |
#credentials ⇒ Object
32 33 34 35 |
# File 'lib/bosh/director/models/vm.rb', line 32 def credentials return nil if credentials_json.nil? Yajl::Parser.parse(credentials_json) end |
#credentials=(spec) ⇒ Object
37 38 39 |
# File 'lib/bosh/director/models/vm.rb', line 37 def credentials=(spec) self.credentials_json = Yajl::Encoder.encode(spec) end |
#env ⇒ Hash
Returns VM environment hash.
27 28 29 30 |
# File 'lib/bosh/director/models/vm.rb', line 27 def env return nil if env_json.nil? Yajl::Parser.parse(env_json) end |
#env=(env_hash) ⇒ Object
22 23 24 |
# File 'lib/bosh/director/models/vm.rb', line 22 def env=(env_hash) self.env_json = Yajl::Encoder.encode(env_hash) end |
#validate ⇒ Object
6 7 8 9 10 |
# File 'lib/bosh/director/models/vm.rb', line 6 def validate validates_presence [:deployment_id, :agent_id] validates_unique :agent_id end |