* Execute an AWS request by calling the AWS SDK * @param {string} service - Service name * @param {string} method - Method name * @param {Object} params - Parameters * @param {Object} [options] - Options to modify the request behavior * @prop [options.useCache] - Utilize cache to retr
(service, method, params, options)
| 3309 | * @prop [options.region] - Specify when to request to different region |
| 3310 | */ |
| 3311 | async request(service, method, params, options) { |
| 3312 | // TODO: Determine calling module and log that |
| 3313 | const requestOptions = _.isObject(options) ? options : {} |
| 3314 | const shouldCache = _.get(requestOptions, 'useCache', false) |
| 3315 | // Copy is required as the credentials may be modified during the request |
| 3316 | const credentials = await this.getCredentials() |
| 3317 | const serviceOptions = { |
| 3318 | name: service, |
| 3319 | params: { |
| 3320 | ...credentials, |
| 3321 | region: _.get(requestOptions, 'region', this.getRegion()), |
| 3322 | isS3TransferAccelerationEnabled: this.isS3TransferAccelerationEnabled(), |
| 3323 | }, |
| 3324 | } |
| 3325 | return (shouldCache ? awsRequest.memoized : awsRequest)( |
| 3326 | serviceOptions, |
| 3327 | method, |
| 3328 | params, |
| 3329 | ) |
| 3330 | } |
| 3331 | |
| 3332 | /** |
| 3333 | * Fetch credentials directly or using a profile from serverless yml configuration or from the |