41 lines
1.4 KiB
C#
41 lines
1.4 KiB
C#
using Amazon.S3.Model;
|
|
using Google.Protobuf;
|
|
using Google.Protobuf.WellKnownTypes;
|
|
|
|
|
|
using ServerCore;
|
|
using ServerBase;
|
|
using ServerCommon;
|
|
using ServerCommon.BusinessLogDomain;
|
|
using MetaAssets;
|
|
|
|
|
|
namespace ServerCommon;
|
|
|
|
public static class BeaconHelper
|
|
{
|
|
public static async Task<(Result, string)> getBeaconAppProfileUploadPresignedUrl( this S3ConnectorBase s3connector
|
|
, string bucketName
|
|
, string beaconAppProfileS3Key )
|
|
{
|
|
var result = new Result();
|
|
var err_msg = string.Empty;
|
|
|
|
(var is_success, var presigned_url) = await s3connector.getPresignedUrl( bucketName
|
|
, beaconAppProfileS3Key
|
|
, Amazon.S3.HttpVerb.PUT
|
|
, DateTime.UtcNow.AddHours(1) );
|
|
if ( false == is_success
|
|
|| presigned_url.isNullOrWhiteSpace() )
|
|
{
|
|
err_msg = $"Failed to getPresignedUrl() !!!";
|
|
result.setFail(ServerErrorCode.S3FileGetFailed, err_msg);
|
|
Log.getLogger().error(result.toBasicString());
|
|
|
|
return (result, presigned_url);
|
|
}
|
|
|
|
return (result, presigned_url);
|
|
}
|
|
}
|