Class: EcsDeployCli::DSL::Cluster

Inherits:
Object
  • Object
show all
Includes:
AutoOptions
Defined in:
lib/ecs_deploy_cli/dsl/cluster.rb

Defined Under Namespace

Classes: VPC

Instance Method Summary collapse

Methods included from AutoOptions

#_options, #method_missing

Constructor Details

#initialize(name, config) ⇒ Cluster

Returns a new instance of Cluster.



10
11
12
13
# File 'lib/ecs_deploy_cli/dsl/cluster.rb', line 10

def initialize(name, config)
  @config = config
  _options[:name] = name.to_s
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class EcsDeployCli::DSL::AutoOptions

Instance Method Details

#as_definitionObject



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/ecs_deploy_cli/dsl/cluster.rb', line 20

def as_definition
  {
    instances_count: 1,

    device_name: '/dev/xvda',
    ebs_volume_size: 22,
    ebs_volume_type: 'gp2',

    root_device_name: '/dev/xvdcz',
    root_ebs_volume_size: 30,

    vpc: @vpc&.as_definition
  }.merge(_options)
end

#vpc(id = nil, &block) ⇒ Object



15
16
17
18
# File 'lib/ecs_deploy_cli/dsl/cluster.rb', line 15

def vpc(id = nil, &block)
  @vpc = VPC.new(id)
  @vpc.instance_exec(&block)
end