我在 Autodesk Platform Services(以前称为 Forge)中运行一个应用程序。某些文件需要超过 60 分钟才能获取结果,因此上传 URL 在上传之前就已经过期,最终导致上传失败。我将 S3UploadURL 的分钟数过期时间 (minutesExpiration) 更改为 60,但我需要更多时间。我需要将输出 URL 提供给工作项 (workItem),因此我认为以后无法获取它以避免过期。
找到下面的代码片段,我获取了临时 URL,并将 expirationMinutes 选项设置为 60,然后创建了 workItem 并将其提供给 outputURL。希望有好心人能帮忙延长这个 60 分钟的限制,或者知道解决方法。
//POST Get temporary Upload URL
var objectsApiInstance3 = new ObjectsApi();
Dictionary<string, object> opts = new Dictionary<string, object>();
opts.Add("minutesExpiration", 60);
var uploadCsvResponse = objectsApiInstance3.getS3UploadURLAsync(urnOutputBucket, urnOutputObjectKey, opts);
dynamic uploadCsv = JsonConvert.DeserializeObject<Dictionary<string, object>>(uploadCsvResponse.Result.ToString());
string uploadUrl = "";
string outputUploadKey = "";
foreach (var e in uploadCsv)
{
if (e.Key == "urls")
{
uploadUrl = e.Value[0];
}
if (e.Key == "uploadKey")
{
outputUploadKey = e.Value;
}
}
//POST Create workItem
var service = new ForgeService(new HttpClient(new ForgeHandler(Microsoft.Extensions.Options.Options.Create(new ForgeConfiguration()
{ ClientId = clientID, ClientSecret = clientSecret }))
{ InnerHandler = new HttpClientHandler() }));
var workItemsApiInstance = new WorkItemsApi(service);
var workItem = new WorkItem()
{
ActivityId = clientID + "." + activity + "+" + alias,
Arguments = new Dictionary<string, IArgument>()
{
{
"rvtFile",
new XrefTreeArgument()
{
PathInZip = fileNames[n],
Url = downloadUrl
}
}, {
"exportChangesSettings",
new XrefTreeArgument()
{
Url = urlDownloadExportChangesSettings
}
}, {
"Result",
new XrefTreeArgument()
{
LocalName = outputFileName,
Verb = Verb.Put,
Url = uploadUrl
}
}
}
};
var workItemResult = await workItemsApiInstance.CreateWorkItemAsync(workItem);
var workItemStatus = await api.GetWorkitemStatusAsync(workItemResult.Content.Id);
听起来你用的是OSS。如果是这样,这里描述了一种更好的方法:https://aps.autodesk.com/blog/new-feature-support-direct-s3-migration-inputoutput-files-design-automation