Class: Roadworker::Route53Wrapper::HostedzoneCollectionWrapper
- Inherits:
-
Object
- Object
- Roadworker::Route53Wrapper::HostedzoneCollectionWrapper
- Includes:
- Log
- Defined in:
- lib/roadworker/route53-wrapper.rb
Instance Method Summary collapse
- #create(name, opts = {}) ⇒ Object
- #each ⇒ Object
-
#initialize(hosted_zones_response, options) ⇒ HostedzoneCollectionWrapper
constructor
A new instance of HostedzoneCollectionWrapper.
Methods included from Log
Constructor Details
#initialize(hosted_zones_response, options) ⇒ HostedzoneCollectionWrapper
Returns a new instance of HostedzoneCollectionWrapper.
33 34 35 36 |
# File 'lib/roadworker/route53-wrapper.rb', line 33 def initialize(hosted_zones_response, ) @hosted_zones_response = hosted_zones_response @options = end |
Instance Method Details
#create(name, opts = {}) ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/roadworker/route53-wrapper.rb', line 45 def create(name, opts = {}) if vpc = opts[:vpc] vpcs = [vpc] else vpcs = [] opts.delete(:vpc) end logmsg = 'Create Hostedzone' logmsg << " #{vpc.inspect}" log(:info, logmsg, :cyan, name) if @options.dry_run opts.delete(:vpc) zone = OpenStruct.new({:name => name, :rrsets => [], :vpcs => vpcs}.merge(opts)) else params = { :name => name, :caller_reference => "roadworker #{Roadworker::VERSION} #{UUID.new.generate}", } if vpc params[:vpc] = vpc end zone = @options.route53.create_hosted_zone(params).hosted_zone @options.hosted_zone_name = name @options.updated = true end HostedzoneWrapper.new(zone, vpcs, @options) end |
#each ⇒ Object
38 39 40 41 42 43 |
# File 'lib/roadworker/route53-wrapper.rb', line 38 def each Collection.batch(@hosted_zones_response, :hosted_zones) do |zone| resp = @options.route53.get_hosted_zone(id: zone.id) yield(HostedzoneWrapper.new(resp.hosted_zone, resp.vp_cs, @options)) end end |