Class: Bosh::Director::Models::OrphanDisk

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

Instance Method Summary collapse

Instance Method Details

#before_createObject



10
11
12
# File 'lib/bosh/director/models/orphan_disk.rb', line 10

def before_create
  self.created_at ||= Time.now
end

#cloud_propertiesObject



14
15
16
17
# File 'lib/bosh/director/models/orphan_disk.rb', line 14

def cloud_properties
  result = self.cloud_properties_json
  result ? JSON.parse(result) : {}
end

#cloud_properties=(cloud_properties) ⇒ Object



19
20
21
# File 'lib/bosh/director/models/orphan_disk.rb', line 19

def cloud_properties=(cloud_properties)
  self.cloud_properties_json = JSON.generate(cloud_properties)
end

#validateObject



5
6
7
8
# File 'lib/bosh/director/models/orphan_disk.rb', line 5

def validate
  validates_presence [:disk_cid, :deployment_name, :instance_name]
  validates_unique [:disk_cid]
end