You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
parttimejob/node_modules/ali-oss/lib/common/bucket/getBucketPolicy.js

29 lines
677 B

1 month ago
const { checkBucketName: _checkBucketName } = require('../utils/checkBucketName');
const proto = exports;
/**
* getBucketPolicy
* @param {String} bucketName - bucket name
* @param {Object} options
*/
proto.getBucketPolicy = async function getBucketPolicy(bucketName, options = {}) {
_checkBucketName(bucketName);
const params = this._bucketRequestParams('GET', bucketName, 'policy', options);
const result = await this.request(params);
params.successStatuses = [200];
let policy = null;
if (result.res.status === 200) {
policy = JSON.parse(result.res.data.toString());
}
return {
policy,
status: result.status,
res: result.res
};
};