Class: Bosh::Director::DeploymentPlan::CloudPlanner
- Defined in:
- lib/bosh/director/deployment_plan/planner.rb
Instance Attribute Summary collapse
-
#compilation ⇒ Bosh::Director::DeploymentPlan::CompilationConfig
Resource pool and other configuration for compilation workers.
Instance Method Summary collapse
-
#add_disk_pool(disk_pool) ⇒ Object
Adds a disk pool by name.
-
#add_network(network) ⇒ Object
Adds a network by name.
-
#add_resource_pool(resource_pool) ⇒ Object
Adds a resource pool by name.
- #disk_pool(name) ⇒ Object
- #disk_pools ⇒ Object
-
#initialize(cloud_config) ⇒ CloudPlanner
constructor
A new instance of CloudPlanner.
-
#network(name) ⇒ Bosh::Director::DeploymentPlan::Network
Returns a named network.
-
#networks ⇒ Array<Bosh::Director::DeploymentPlan::Network>
Returns all networks in a deployment plan.
-
#resource_pool(name) ⇒ Bosh::Director::DeploymentPlan::ResourcePool
Returns a named resource pool spec.
-
#resource_pools ⇒ Array<Bosh::Director::DeploymentPlan::ResourcePool>
Returns all resource pools in a deployment plan.
Constructor Details
#initialize(cloud_config) ⇒ CloudPlanner
Returns a new instance of CloudPlanner.
192 193 194 195 196 197 198 199 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 192 def initialize(cloud_config) @cloud_config = cloud_config @networks_canonical_name_index = Set.new @networks = {} @resource_pools = {} @disk_pools = {} end |
Instance Attribute Details
#compilation ⇒ Bosh::Director::DeploymentPlan::CompilationConfig
Returns Resource pool and other configuration for compilation workers.
190 191 192 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 190 def compilation @compilation end |
Instance Method Details
#add_disk_pool(disk_pool) ⇒ Object
Adds a disk pool by name
252 253 254 255 256 257 258 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 252 def add_disk_pool(disk_pool) if @disk_pools[disk_pool.name] raise DeploymentDuplicateDiskPoolName, "Duplicate disk pool name `#{disk_pool.name}'" end @disk_pools[disk_pool.name] = disk_pool end |
#add_network(network) ⇒ Object
Adds a network by name
226 227 228 229 230 231 232 233 234 235 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 226 def add_network(network) if @networks_canonical_name_index.include?(network.canonical_name) raise DeploymentCanonicalNetworkNameTaken, "Invalid network name `#{network.name}', " + 'canonical name already taken' end @networks[network.name] = network @networks_canonical_name_index << network.canonical_name end |
#add_resource_pool(resource_pool) ⇒ Object
Adds a resource pool by name
203 204 205 206 207 208 209 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 203 def add_resource_pool(resource_pool) if @resource_pools[resource_pool.name] raise DeploymentDuplicateResourcePoolName, "Duplicate resource pool name `#{resource_pool.name}'" end @resource_pools[resource_pool.name] = resource_pool end |
#disk_pool(name) ⇒ Object
264 265 266 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 264 def disk_pool(name) @disk_pools[name] end |
#disk_pools ⇒ Object
260 261 262 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 260 def disk_pools @disk_pools.values end |
#network(name) ⇒ Bosh::Director::DeploymentPlan::Network
Returns a named network
246 247 248 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 246 def network(name) @networks[name] end |
#networks ⇒ Array<Bosh::Director::DeploymentPlan::Network>
Returns all networks in a deployment plan
239 240 241 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 239 def networks @networks.values end |
#resource_pool(name) ⇒ Bosh::Director::DeploymentPlan::ResourcePool
Returns a named resource pool spec
220 221 222 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 220 def resource_pool(name) @resource_pools[name] end |
#resource_pools ⇒ Array<Bosh::Director::DeploymentPlan::ResourcePool>
Returns all resource pools in a deployment plan
213 214 215 |
# File 'lib/bosh/director/deployment_plan/planner.rb', line 213 def resource_pools @resource_pools.values end |