Class: EcsDeployCli::DSL::Cluster::VPC

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

Instance Method Summary collapse

Methods included from AutoOptions

#_options, #method_missing

Constructor Details

#initialize(id) ⇒ VPC

Returns a new instance of VPC.



39
40
41
# File 'lib/ecs_deploy_cli/dsl/cluster.rb', line 39

def initialize(id)
  _options[:id] = id
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



51
52
53
54
55
56
57
58
59
60
# File 'lib/ecs_deploy_cli/dsl/cluster.rb', line 51

def as_definition
  validate! if _options[:id]

  {
    cidr: '10.0.0.0/16',
    subnet1: '10.0.0.0/24',
    subnet2: '10.0.1.0/24',
    subnet3: '10.0.2.0/24'
  }.merge(_options)
end

#availability_zones(*values) ⇒ Object



43
44
45
# File 'lib/ecs_deploy_cli/dsl/cluster.rb', line 43

def availability_zones(*values)
  _options[:availability_zones] = values.join(',')
end

#subnet_ids(*values) ⇒ Object



47
48
49
# File 'lib/ecs_deploy_cli/dsl/cluster.rb', line 47

def subnet_ids(*values)
  _options[:subnet_ids] = values.join(',')
end

#validate!Object



62
63
64
65
66
# File 'lib/ecs_deploy_cli/dsl/cluster.rb', line 62

def validate!
  [
    :subnet1, :subnet_ids, :availability_zones
  ].each { |key| raise "Missing required parameter #{key}" unless _options[key] }
end