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.



35
36
37
38
# File 'lib/roadworker/route53-wrapper.rb', line 35

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

Instance Method Details

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



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

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.updated = true
  end

  HostedZoneWrapper.new(zone, @options)
end

#eachObject



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

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