class Roadworker::DSL::Hostedzone::ResourceRecordSet
Attributes
Public Class Methods
Source
# File lib/roadworker/dsl.rb, line 131 def initialize(context, name, type, &block) name = DSL.normalize_dns_name(name) type = type.upcase @context = context.merge( :rrset_name => name, :rrset_type => type ) @result = OpenStruct.new({ :name => name, :type => type, }) instance_eval(&block) end
Private Instance Methods
Source
# File lib/roadworker/dsl.rb, line 167 def dns_name(value, options = {}) options = Aws::Route53.normalize_dns_name_options(options) @result.dns_name = [value, options] end
Source
# File lib/roadworker/dsl.rb, line 176 def failover(value) @result.failover = value end
Source
# File lib/roadworker/dsl.rb, line 172 def geo_location(value) @result.geo_location = value end
Source
# File lib/roadworker/dsl.rb, line 180 def health_check(url, options = {}) unless options.kind_of?(Hash) raise TypeError, "wrong argument type #{options.inspect} (expected Hash)" end if url.kind_of?(Hash) if url.include?(:calculated) config = Aws::Route53::Types::HealthCheckConfig.new config[:type] = 'CALCULATED' config[:child_health_checks] = url.delete(:calculated) options = url elsif url.include?(:cloudwatch_metric) config = Aws::Route53::Types::HealthCheckConfig.new config[:type] = 'CLOUDWATCH_METRIC' config[:alarm_identifier] = url.delete(:cloudwatch_metric) config[:child_health_checks] = [] options = url else raise ArgumentError, "wrong arguments: #{url.inspect}" end else config = HealthCheck.parse_url(url) config[:child_health_checks] = [] end { :host => :fully_qualified_domain_name, :search_string => :search_string, :request_interval => :request_interval, :health_threshold => :health_threshold, :failure_threshold => :failure_threshold, :measure_latency => :measure_latency, :inverted => :inverted, :disabled => :disabled, :enable_sni => :enable_sni, :regions => :regions, :insufficient_data_health_status => :insufficient_data_health_status, }.each do |option_key, config_key| config[config_key] = options[option_key] unless options[option_key].nil? end config[:regions] ||= [] if config.search_string config.type += '_STR_MATCH' end case config[:type] when 'CALCULATED' # nothing to do when 'CLOUDWATCH_METRIC' config[:inverted] ||= false config[:insufficient_data_health_status] ||= 'LastKnownStatus' else config[:request_interval] ||= 30 config[:failure_threshold] ||= 3 config[:measure_latency] ||= false config[:inverted] ||= false config[:disabled] ||= false config[:enable_sni] ||= false end @result.health_check = config end
Source
# File lib/roadworker/dsl.rb, line 163 def region(value) @result.region = value end
Source
# File lib/roadworker/dsl.rb, line 245 def resource_records(*values) if values.uniq.length != values.length raise "Duplicate ResourceRecords: #{values.join(', ')}" end @result.resource_records = [values].flatten.map {|i| Aws::Route53::Types::ResourceRecord.new(:value => i) } end
Source
# File lib/roadworker/dsl.rb, line 150 def set_identifier(value = nil) @result.set_identifier = value end
Also aliased as: identifier
Source
# File lib/roadworker/dsl.rb, line 155 def weight(value) @result.weight = value end