Class: Roadworker::Route53Wrapper::HostedZoneWrapper

Inherits:
Object
  • Object
show all
Includes:
Log
Defined in:
lib/roadworker/route53-wrapper.rb

Overview

HostedZoneCollection

Instance Method Summary collapse

Methods included from Log

#log

Constructor Details

#initialize(hosted_zone, options) ⇒ HostedZoneWrapper

Returns a new instance of HostedZoneWrapper.



66
67
68
69
# File 'lib/roadworker/route53-wrapper.rb', line 66

def initialize(hosted_zone, options)
  @hosted_zone = hosted_zone
  @options = options
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object (private)



95
96
97
# File 'lib/roadworker/route53-wrapper.rb', line 95

def method_missing(method_name, *args)
  @hosted_zone.send(method_name, *args)
end

Instance Method Details

#deleteObject



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/roadworker/route53-wrapper.rb', line 76

def delete
  if @options.force
    log(:info, 'Delete HostedZone', :red, @hosted_zone.name)

    self.rrsets.each do |record|
      record.delete
    end

    unless @options.dry_run
      @hosted_zone.delete
      @options.updated = true
    end
  else
    log(:info, 'Undefined HostedZone (pass `--force` if you want to remove)', :yellow, @hosted_zone.name)
  end
end

#resource_record_setsObject Also known as: rrsets



71
72
73
# File 'lib/roadworker/route53-wrapper.rb', line 71

def resource_record_sets
  ResourceRecordSetCollectionWrapper.new(@hosted_zone.rrsets, @hosted_zone, @options)
end