Class: Bosh::Director::Api::CloudConfigManager

Inherits:
Object
  • Object
show all
Defined in:
lib/bosh/director/api/cloud_config_manager.rb

Instance Method Summary collapse

Instance Method Details

#find_by_id(id) ⇒ Object



21
22
23
# File 'lib/bosh/director/api/cloud_config_manager.rb', line 21

def find_by_id(id)
  Bosh::Director::Models::CloudConfig.find(id: id)
end

#latestObject



17
18
19
# File 'lib/bosh/director/api/cloud_config_manager.rb', line 17

def latest
  list(1).first
end

#list(limit) ⇒ Object



13
14
15
# File 'lib/bosh/director/api/cloud_config_manager.rb', line 13

def list(limit)
  Bosh::Director::Models::CloudConfig.order(Sequel.desc(:id)).limit(limit).to_a
end

#update(cloud_config_yaml) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/bosh/director/api/cloud_config_manager.rb', line 5

def update(cloud_config_yaml)
  cloud_config = Bosh::Director::Models::CloudConfig.new(
    properties: cloud_config_yaml
  )
  validate_manifest!(cloud_config)
  cloud_config.save
end