초기커밋
This commit is contained in:
40
ServerCommon/Helper/BeaconHelper.cs
Normal file
40
ServerCommon/Helper/BeaconHelper.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user