Class: VagrantPlugins::AwsRoute53Advoc8::Action::SetIp

Inherits:
IpOperations
  • Object
show all
Defined in:
lib/vagrant-aws-route53-advoc8/action/set_ip.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, environment) ⇒ SetIp

Returns a new instance of SetIp.



7
8
9
# File 'lib/vagrant-aws-route53-advoc8/action/set_ip.rb', line 7

def initialize(app, environment)
  @app = app
end

Instance Method Details

#call(environment) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/vagrant-aws-route53-advoc8/action/set_ip.rb', line 11

def call(environment)
  access_key_id, hosted_zone_id, instance_id, record_set, region, secret_access_key = config(environment)

  return @app.call(environment) if hosted_zone_id.eql?(::Vagrant::Plugin::V2::Config::UNSET_VALUE) || record_set.eql?(::Vagrant::Plugin::V2::Config::UNSET_VALUE)

  set(
    access_key_id:     access_key_id,
    secret_access_key: secret_access_key,
    region:            region,
    instance_id:       instance_id,
    hosted_zone_id:    hosted_zone_id,
    record_set:        record_set,
  ) do |instance_id, pubilic_ip, record_set|
    environment[:ui].info("#{instance_id}'s #{pubilic_ip} has been assigned to #{record_set[0]}[#{record_set[1]}]")
  end

  @app.call(environment)
end