class Aws::Plugins::EndpointPattern::Handler
@api private
Public Instance Methods
Source
# File lib/aws-sdk-core/plugins/endpoint_pattern.rb, line 40 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
Private Instance Methods
Source
# File lib/aws-sdk-core/plugins/endpoint_pattern.rb, line 50 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
Source
# File lib/aws-sdk-core/plugins/endpoint_pattern.rb, line 61 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