module Aws::ClientStubs

def protocol_helper

def protocol_helper
  # Prioritize JSON over CBOR when CBOR is the configured protocol but both are supported. This is to match similar
  # prioritization in service.rb code generation.
  if @config.api.metadata['protocol'] == 'smithy-rpc-v2-cbor' && @config.api.metadata['protocols']&.include?('json')
    return Stubbing::Protocols::Json.new
  end
  case @config.api.metadata['protocol']
  when 'json'               then Stubbing::Protocols::Json
  when 'rest-json'          then Stubbing::Protocols::RestJson
  when 'rest-xml'           then Stubbing::Protocols::RestXml
  when 'query'              then Stubbing::Protocols::Query
  when 'ec2'                then Stubbing::Protocols::EC2
  when 'smithy-rpc-v2-cbor' then Stubbing::Protocols::RpcV2
  when 'api-gateway'        then Stubbing::Protocols::ApiGateway
  else raise 'unsupported protocol'
  end.new
end