src/aws.js
function createSignedAWSRequest(params) {
  const { body, credentials, endpoint, headers, method = 'GET', path, region } = params

  const request = new AWS.HttpRequest(endpoint)
  Object.assign(request, {
    body,
    headers: {
      Host: endpoint.host,
      'presigned-expires': false,
    },
    method,
    path,
    region,
  })

  const signed = signAWSRequest({ credentials, request })
  return mergeAllowedClientHeaders({ headers, request: signed })
}
function createSignedAWSRequest(params) {
  const { body, credentials, endpoint, headers, method = 'GET', path, region } = params

  const request = new AWS.HttpRequest(endpoint)
  Object.assign(request, {
    body,
    headers: {
      Host: endpoint.host,
      'presigned-expires': false,
    },
    method,
    path,
    region,
  })

  const signed = signAWSRequest({ credentials, request })
  return mergeAllowedClientHeaders({ headers, request: signed })
}
function createSignedAWSRequest ( params ) { const { body , credentials , endpoint , headers , method = 'GET' , path , region } = params const request = new AWS . HttpRequest ( endpoint ) Object . assign ( request , { body , headers : { Host : endpoint . host , 'presigned-expires' : false , } , method , path , region , } ) const signed = signAWSRequest ( { credentials , request } ) return mergeAllowedClientHeaders ( { headers , request : signed } ) }
Compose the request data to be sent to the AWS Node HTTP Client
@param {String} params.body        - raw client request body
@param {Object} params.credentials - aws credentials
@param {String} params.endpoint    - aws elasticsearch endpoint
@param {Object} params.headers     - client request headers
@param {String} params.method      - client request method
@param {String} params.path        - client request path (url)
@param {String} params.region      - aws region
@return {Object}
Compose the request data to be sent to the AWS Node HTTP Client