Class: Roadworker::Route53Wrapper::HostedzoneWrapper
- Inherits:
-
Object
- Object
- Roadworker::Route53Wrapper::HostedzoneWrapper
show all
- Includes:
- Log
- Defined in:
- lib/roadworker/route53-wrapper.rb
Overview
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Log
#log
Constructor Details
#initialize(hosted_zone, vpcs, options) ⇒ HostedzoneWrapper
Returns a new instance of HostedzoneWrapper.
80
81
82
83
84
|
# File 'lib/roadworker/route53-wrapper.rb', line 80
def initialize(hosted_zone, vpcs, options)
@hosted_zone = hosted_zone
@vpcs = vpcs
@options = options
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
140
141
142
|
# File 'lib/roadworker/route53-wrapper.rb', line 140
def method_missing(method_name, *args)
@hosted_zone.send(method_name, *args)
end
|
Instance Attribute Details
#vpcs ⇒ Object
Returns the value of attribute vpcs.
86
87
88
|
# File 'lib/roadworker/route53-wrapper.rb', line 86
def vpcs
@vpcs
end
|
Instance Method Details
#associate_vpc(vpc) ⇒ Object
118
119
120
121
122
123
124
125
126
|
# File 'lib/roadworker/route53-wrapper.rb', line 118
def associate_vpc(vpc)
log(:info, "Associate #{vpc.inspect}", :green, @hosted_zone.name)
unless @options.dry_run
@options.route53.associate_vpc_with_hosted_zone(
hosted_zone_id: @hosted_zone.id,
vpc: vpc,
)
end
end
|
#delete ⇒ Object
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
|
# File 'lib/roadworker/route53-wrapper.rb', line 98
def delete
if @options.force
log(:info, 'Delete Hostedzone', :red, @hosted_zone.name)
change_batch = Batch.new(self, health_checks: @options.health_checks, logger: @options.logger, dry_run: @options.dry_run)
self.rrsets.each do |record|
change_batch.delete(record)
end
change_batch.request!(@options.route53)
unless @options.dry_run
@options.route53.delete_hosted_zone(id: @hosted_zone.id)
@options.updated = true
end
else
log(:info, 'Undefined Hostedzone (pass `--force` if you want to remove)', :yellow, @hosted_zone.name)
end
end
|
#disassociate_vpc(vpc) ⇒ Object
128
129
130
131
132
133
134
135
136
|
# File 'lib/roadworker/route53-wrapper.rb', line 128
def disassociate_vpc(vpc)
log(:info, "Disassociate #{vpc.inspect}", :red, @hosted_zone.name)
unless @options.dry_run
@options.route53.disassociate_vpc_from_hosted_zone(
hosted_zone_id: @hosted_zone.id,
vpc: vpc,
)
end
end
|
94
95
96
|
# File 'lib/roadworker/route53-wrapper.rb', line 94
def find_resource_record_set(name, type, set_identifier)
resource_record_sets.to_h[[name, type, set_identifier]]
end
|
#resource_record_sets ⇒ Object
Also known as:
rrsets