我已经在Autodesk Forge存储中创建了两个存储桶(myprojectbucket
和myscenariobucket
),但是无论如何我可以将它们链接在一起?例如,如果我删除myprojectbucket
存储桶,我也希望它删除myscenariobucket
存储桶。程序是否有办法识别链接的存储桶?
我试图通过使project
存储桶的行为与主项目相似,而scenario
存储桶的作用类似于可以将文件上传到其中的文件夹。
项目存储区
{
"bucketKey": "myprojectbucket",
"createdDate": "1555586879197",
"policyKey": "transient"
}
场景存储区
{
"bucketKey": "myscenariobucket",
"createdDate": "1555586121454",
"policyKey": "transient"
}
方案存储桶中的文件
[
{
"bucketKey": "myscenariobucket",
"objectId": "urn:adsk.objects:os.object:myscenariobucket/MyNewFile.txt",
"objectKey": "MyNewFile.txt",
"sha1": "6ebea95f436eca94a9e541878db7b37b01cc5300",
"size": 23,
"contentType": "application/octet-stream",
"location": "https://developer.api.autodesk.com/oss/v2/buckets/myscenariobucket/objects/MyNewFile.txt",
"blockSizes": [],
"deltas": [],
"status": "OK"
}
]
如果我删除myscenariobucket
,它应该删除存储在其中的MyNewFile.txt
文件。目前,这按预期工作。但是,如果我删除myprojectbucket
,我希望它同时删除myscenariobucket
和MyNewFile.txt
。
答案 0 :(得分:1)
否,Forge存储桶的工作方式类似于AWS S3或Azure对象。因此,您不能指望在删除另一个时删除一个。我注意到您的存储桶策略是“ policyKey”:“ transient”,因此您的文件将在24小时后自动删除。这意味着,如果您同时在每个存储分区中发布文件,则它们都将在24小时后被删除。
现在,您可以执行以下操作以获得与请求相同的结果;像下面一样用前缀存储文件;所以当存储桶被删除时,一切都已完成。
只拿一个水桶
{
"bucketKey": "mybucket",
"createdDate": "1555586879197",
"policyKey": "transient"
}
将所有文件存储在其中,并带有前缀cenase /或project /
[
{
"bucketKey": "mybucket",
"objectId": "urn:adsk.objects:os.object:mybucket/project/MyNewFile.txt",
"objectKey": "project/MyNewFile.txt",
"sha1": "6ebea95f436eca94a9e541878db7b37b01cc5300",
"size": 23,
"contentType": "application/octet-stream",
"location": "https://developer.api.autodesk.com/oss/v2/buckets/mybucket/objects/project/MyNewFile.txt",
"blockSizes": [],
"deltas": [],
"status": "OK"
},
{
"bucketKey": "mybucket",
"objectId": "urn:adsk.objects:os.object:mybucket/scenario/MyNewFile.txt",
"objectKey": "scenario/MyNewFile.txt",
"sha1": "6ebea95f436eca94a9e541878db7b37b01cc5300",
"size": 23,
"contentType": "application/octet-stream",
"location": "https://developer.api.autodesk.com/oss/v2/buckets/mybucket/objects/scenario/MyNewFile.txt",
"blockSizes": [],
"deltas": [],
"status": "OK"
}
]
希望有帮助,