class Aws::Plugins::EndpointPattern::Handler
Public Instance Methods
call(context)
click to toggle source
# File lib/aws-sdk-core/plugins/endpoint_pattern.rb, line 23 def call(context) if !context.config.disable_host_prefix_injection endpoint_trait = context.operation.endpoint_pattern if endpoint_trait && !endpoint_trait.empty? _apply_endpoint_trait(context, endpoint_trait) end end @handler.call(context) end
Private Instance Methods
_apply_endpoint_trait(context, trait)
click to toggle source
# File lib/aws-sdk-core/plugins/endpoint_pattern.rb, line 35 def _apply_endpoint_trait(context, trait) # currently only support host pattern ori_host = context.http_request.endpoint.host if pattern = trait['hostPrefix'] host_prefix = pattern.gsub(/\{.+?\}/) do |label| label = label.delete("{}") _replace_label_value( ori_host, label, context.operation.input, context.params) end context.http_request.endpoint.host = host_prefix + context.http_request.endpoint.host end end
_replace_label_value(ori, label, input_ref, params)
click to toggle source
# File lib/aws-sdk-core/plugins/endpoint_pattern.rb, line 48 def _replace_label_value(ori, label, input_ref, params) name = nil input_ref.shape.members.each do |m_name, ref| if ref['hostLabel'] && ref['hostLabelName'] == label name = m_name end end if name.nil? || params[name].nil? raise Errors::MissingEndpointHostLabelValue.new(name) end params[name] end