Class: VagrantPlugins::Route53NG::Action::UnsetIp

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

Instance Method Summary collapse

Constructor Details

#initialize(app, environment) ⇒ UnsetIp

Returns a new instance of UnsetIp.



8
9
10
# File 'lib/vagrant-aws-route53-ng/action/unset_ip.rb', line 8

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

Instance Method Details

#call(environment) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/vagrant-aws-route53-ng/action/unset_ip.rb', line 12

def call(environment)
  access_key_id, hosted_zone_id, instance_id, record_set, ip_type, 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,
    ip:                 '0.0.0.0'
  ) do |instance_id, ip, record_set|
    environment[:ui].info("#{ip} has been assigned to #{record_set[0]}[#{record_set[1]}]")
  end

  @app.call(environment)
end