Class: VagrantPlugins::AwsAlbTargetGroup::Action::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/vagrant-aws-alb-target-group/action/base.rb

Direct Known Subclasses

AddInstance, RemoveInstance

Instance Method Summary collapse

Constructor Details

#initialize(app, env) ⇒ Base

Returns a new instance of Base.



9
10
11
12
# File 'lib/vagrant-aws-alb-target-group/action/base.rb', line 9

def initialize(app, env)
  @app = app
  @machine = env[:machine]
end

Instance Method Details

#call(env) {|@machine.id, @machine.config.aws_alb.target_group_name| ... } ⇒ Object

Yields:

  • (@machine.id, @machine.config.aws_alb.target_group_name)


14
15
16
17
18
19
20
21
22
23
# File 'lib/vagrant-aws-alb-target-group/action/base.rb', line 14

def call(env)
  return @app.call(env) if @machine.config.aws_alb.target_group_name.nil?

  @aws = AwsAlbTargetGroup::Util::AwsUtil.new(@machine.provider_config.access_key_id,
                                   @machine.provider_config.secret_access_key,
                                   @machine.provider_config.region)
  yield @machine.id, @machine.config.aws_alb.target_group_name if block_given?

  @app.call(env)
end