function resourceIdMiddlerware(shim, config, next) {
  return async function wrappedResourceIdMiddlerware(args) {
    let region
    try {
      region = await config.region()
      const segment = shim.getSegment()

      const accountId = shim.agent.config.cloud.aws.account_id

      if (accountId) {
        const attributes = segment.getAttributes()
        segment.addAttribute(
          'cloud.resource_id',
          `arn:aws:dynamodb:${region}:${accountId}:table/${attributes.collection}`
        )
      }
    } catch (err) {
      shim.logger.debug(err, 'Failed to add AWS cloud resource id to segment')
    }

    return next(args)
  }
}
Wraps the deserialize middleware step to add the
cloud.resource_id segment attributes for the AWS command

@param {Shim} shim
@param {Object} config AWS command configuration
@param {function} next next function in middleware chain
@returns {function}