使用Swift从S3存储桶访问受保护的JSON内容

时间:2018-08-28 19:34:17

标签: swift amazon-web-services amazon-s3 get access

如何使用Swift访问存储在S3存储桶中的受保护JSON?

我的凭据是AccessKey和SecurityKey。

我配置:

const request = require('request-promise');
const { writeFile } = require('fs').promises;

async function getWeeklyReport(queryString) {
  let result;
  const response = await request({..., resolveWithFullResponse: true });

  if (response.statusCode === 200) {
    result = response.body;
  } else if (response.statusCode === 409) {
    await new Promise(resolve => setTimeout(resolve, response.headers['Retry-After'] * 1000));
    result = await getWeeklyReport(queryString);
  } else {
    throw response;
  }

  await writeFile('test3.xlsm', result);
}

但是如何告诉代码“确定,我进入了。现在访问URL”?

0 个答案:

没有答案