Sha256: 2e3f0167af9d0251aeccb61890297c976c85c5b6507320061ea6a283efd1282e
Contents?: true
Size: 1.32 KB
Versions: 2
Compression:
Stored size: 1.32 KB
Contents
require 'aws-sdk' require 'contracts' require_relative 'service' module Cloudstrap module Amazon class Route53 < Service include ::Contracts::Core include ::Contracts::Builtin Contract None => ArrayOf[::Aws::Route53::Types::HostedZone] def zones @zones ||= zones! end Contract None => ArrayOf[::Aws::Route53::Types::HostedZone] def zones! @zones = call_api(:list_hosted_zones).hosted_zones end Contract String => Maybe[::Aws::Route53::Types::HostedZone] def zone(name) name = name.end_with?('.') ? name : name.dup.concat('.') zones.find { |zone| zone.name == name } end Contract String => ArrayOf[::Aws::Route53::Types::HostedZone] def zone_names @zone_names ||= zones.map(&:name) end Contract String => Maybe[String] def longest_matching_suffix(name) fragments = name.split '.' fragments .each_with_index .map { |_, i| fragments.drop(i).join('.') + '.' } .find { |fragment| zone_names.include? fragment } end Contract String => Maybe[String] def zone_id(name) return unless zone = zone(name) zone(name).id.split('/').last end private def client ::Aws::Route53::Client end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
cloudstrap-0.37.5.pre | lib/cloudstrap/amazon/route53.rb |
cloudstrap-0.37.4.pre | lib/cloudstrap/amazon/route53.rb |