class Aws::Plugins::EndpointPattern::Handler
@api private
def apply_endpoint_trait(context, trait)
def apply_endpoint_trait(context, trait) pattern = trait['hostPrefix'] return unless pattern host_prefix = pattern.gsub(/\{.+?}/) do |label| label = label.delete('{}') replace_label_value(label, context.operation.input, context.params) end context.http_request.endpoint.host = host_prefix + context.http_request.endpoint.host end
def call(context)
def call(context) unless context.config.disable_host_prefix_injection endpoint_trait = context.operation.endpoint_pattern apply_endpoint_trait(context, endpoint_trait) if endpoint_trait && !endpoint_trait.empty? end @handler.call(context) end
def replace_label_value(label, input_ref, params)
def replace_label_value(label, input_ref, params) name = nil input_ref.shape.members.each do |m_name, ref| name = m_name if ref['hostLabel'] && ref['hostLabelName'] == label end raise Errors::MissingEndpointHostLabelValue, name if name.nil? || params[name].nil? params[name] end