Class: Bosh::Director::Api::DeploymentManager

Inherits:
Object
  • Object
show all
Includes:
ApiHelper
Defined in:
lib/bosh/director/api/deployment_manager.rb

Constant Summary

Constants included from ApiHelper

ApiHelper::READ_CHUNK_SIZE

Instance Method Summary collapse

Methods included from ApiHelper

#check_available_disk_space, #json_decode, #json_encode, #prepare_yml_file, #send_disposable_file, #start_task, #validate_manifest_yml, #write_file

Constructor Details

#initializeDeploymentManager

Returns a new instance of DeploymentManager.



6
7
8
# File 'lib/bosh/director/api/deployment_manager.rb', line 6

def initialize
  @deployment_lookup = DeploymentLookup.new
end

Instance Method Details

#all_by_name_ascObject



14
15
16
# File 'lib/bosh/director/api/deployment_manager.rb', line 14

def all_by_name_asc
  Bosh::Director::Models::Deployment.order_by(Sequel.asc(:name)).all
end

#create_deployment(username, deployment_manifest_file_path, cloud_config, runtime_config, deployment, options = {}) ⇒ Object



18
19
20
21
22
# File 'lib/bosh/director/api/deployment_manager.rb', line 18

def create_deployment(username, deployment_manifest_file_path, cloud_config, runtime_config, deployment, options = {})
  cloud_config_id = cloud_config.nil? ? nil : cloud_config.id
  runtime_config_id = runtime_config.nil? ? nil : runtime_config.id
  JobQueue.new.enqueue(username, Jobs::UpdateDeployment, 'create deployment', [deployment_manifest_file_path, cloud_config_id, runtime_config_id, options], deployment)
end

#delete_deployment(username, deployment, options = {}) ⇒ Object



24
25
26
# File 'lib/bosh/director/api/deployment_manager.rb', line 24

def delete_deployment(username, deployment, options = {})
  JobQueue.new.enqueue(username, Jobs::DeleteDeployment, "delete deployment #{deployment.name}", [deployment.name, options], deployment)
end

#deployment_instances_with_vms(deployment) ⇒ Object



28
29
30
# File 'lib/bosh/director/api/deployment_manager.rb', line 28

def deployment_instances_with_vms(deployment)
  Models::Instance.where(deployment: deployment).exclude(vm_cid: nil)
end

#find_by_name(name) ⇒ Object



10
11
12
# File 'lib/bosh/director/api/deployment_manager.rb', line 10

def find_by_name(name)
  @deployment_lookup.by_name(name)
end