Class: Bosh::Director::Api::RuntimeConfigManager

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

Instance Method Summary collapse

Instance Method Details

#find_by_id(id) ⇒ Object



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

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

#latestObject



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

def latest
  list(1).first
end

#list(limit) ⇒ Object



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

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

#update(runtime_config_yaml) ⇒ Object



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

def update(runtime_config_yaml)
  runtime_config = Bosh::Director::Models::RuntimeConfig.new(
    properties: runtime_config_yaml
  )
  validate_manifest!(runtime_config)
  runtime_config.save
end