Class: Bosh::Director::DeploymentPlan::ResourcePool

Inherits:
Object
  • Object
show all
Includes:
ValidationHelper
Defined in:
lib/bosh/director/deployment_plan/resource_pool.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ValidationHelper

#safe_property

Constructor Details

#initialize(spec) ⇒ ResourcePool

Returns a new instance of ResourcePool.

Parameters:

  • deployment_plan (DeploymentPlan)

    Deployment plan

  • spec (Hash)

    Raw resource pool spec from the deployment manifest

  • logger (Logger)

    Director logger



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/bosh/director/deployment_plan/resource_pool.rb', line 23

def initialize(spec)

  @name = safe_property(spec, "name", class: String)

  @cloud_properties =
    safe_property(spec, "cloud_properties", class: Hash, default: {})

  stemcell_spec = safe_property(spec, "stemcell", class: Hash)
  @stemcell = Stemcell.parse(stemcell_spec)

  @env = safe_property(spec, "env", class: Hash, default: {})
end

Instance Attribute Details

#cloud_propertiesHash (readonly)

Returns Cloud properties.

Returns:

  • (Hash)

    Cloud properties



15
16
17
# File 'lib/bosh/director/deployment_plan/resource_pool.rb', line 15

def cloud_properties
  @cloud_properties
end

#envHash (readonly)

Returns Resource pool environment.

Returns:

  • (Hash)

    Resource pool environment



18
19
20
# File 'lib/bosh/director/deployment_plan/resource_pool.rb', line 18

def env
  @env
end

#nameString (readonly)

Returns Resource pool name.

Returns:

  • (String)

    Resource pool name



9
10
11
# File 'lib/bosh/director/deployment_plan/resource_pool.rb', line 9

def name
  @name
end

#stemcellDeploymentPlan::Stemcell (readonly)

Returns Stemcell spec.

Returns:



12
13
14
# File 'lib/bosh/director/deployment_plan/resource_pool.rb', line 12

def stemcell
  @stemcell
end

Instance Method Details

#specHash

Returns resource pools spec as Hash (usually for agent to serialize)

Returns:

  • (Hash)

    Resource pool spec



38
39
40
41
42
43
44
# File 'lib/bosh/director/deployment_plan/resource_pool.rb', line 38

def spec
  {
    "name" => @name,
    "cloud_properties" => @cloud_properties,
    "stemcell" => @stemcell.spec
  }
end