[英]How to permanently delete latest version of S3 Object using Nodejs
I have an S3 bucket with versioning enabled.我有一个启用了版本控制的 S3 存储桶。 Whenever i make a deleteObject call using the aws sdk for javascript it will mark the object with a delete marker .
每当我使用 aws sdk for javascript 进行deleteObject调用时,它都会用删除标记标记object。 As specified in the documentation , for deleting s3 object permanently, the "VersionId" should be specified.
如文档中所述,要永久删除 s3 object,应指定“VersionId”。
From S3 documentation for making the delete call:从 S3 文档中进行删除调用:
var params = {
Bucket: 'STRING_VALUE', /* required */
Key: 'STRING_VALUE', /* required */
BypassGovernanceRetention: true || false,
MFA: 'STRING_VALUE',
RequestPayer: requester,
VersionId: 'STRING_VALUE'
};
s3.deleteObject(params, function(err, data) {
i.f (err) console.log(err, err.stack); // an error occurred
else console.log(data); // successful response
});
I want to (permanently)delete the latest version of the object.我想(永久)删除最新版本的 object。 I know that, in order to do so:
我知道,为了这样做:
The above approach requires 2 API calls (first for fetching the versions and second for deleting the object version) I have gone through several solutions and they had the same approach as specified above.上述方法需要 2 个 API 调用(第一个用于获取版本,第二个用于删除 object 版本)我已经经历了几种解决方案,它们具有与上述相同的方法。
I'm trying to reduce the API calls to one.我正在尝试将 API 调用减少到一个。
Nope.没有。 You'll need to make the two calls.
您需要拨打这两个电话。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.