Class: Roadworker::Route53Wrapper::HostedZoneCollectionWrapper

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

Instance Method Summary collapse

Methods included from Log

#log

Constructor Details

#initialize(hosted_zones, options) ⇒ HostedZoneCollectionWrapper

Returns a new instance of HostedZoneCollectionWrapper.



37
38
39
40
# File 'lib/roadworker/route53-wrapper.rb', line 37

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

Instance Method Details

#create(name, opts = {}) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/roadworker/route53-wrapper.rb', line 48

def create(name, opts = {})
  log(:info, 'Create HostedZone', :cyan, name)

  if @options.dry_run
    zone = OpenStruct.new({:name => name, :rrsets => []}.merge(opts))
  else
    zone = @hosted_zones.create(name, opts)
    @options.hosted_zone_name = name
    @options.updated = true
  end

  HostedZoneWrapper.new(zone, @options)
end

#eachObject



42
43
44
45
46
# File 'lib/roadworker/route53-wrapper.rb', line 42

def each
  Collection.batch(@hosted_zones) do |zone|
    yield(HostedZoneWrapper.new(zone, @options))
  end
end