All checks were successful
Build and Deploy / deploy (push) Successful in 1m47s
51 lines
1.7 KiB
C#
51 lines
1.7 KiB
C#
namespace Oms.Application.Storage;
|
||
|
||
/// <summary>
|
||
/// 预签名 PUT 直传凭证(前端直接 PUT 到 COS,文件不经后端)。
|
||
/// </summary>
|
||
public sealed class PresignedUploadTicket
|
||
{
|
||
/// <summary>库内应保存的逻辑 key(不含 KeyPrefix)。</summary>
|
||
public string Key { get; init; } = string.Empty;
|
||
|
||
/// <summary>一次性 PUT 地址(含签名)。</summary>
|
||
public string UploadUrl { get; init; } = string.Empty;
|
||
|
||
public string Method { get; init; } = "PUT";
|
||
|
||
/// <summary>PUT 时必须带上的 Content-Type(若签发时绑定了则必填)。</summary>
|
||
public string? ContentType { get; init; }
|
||
|
||
/// <summary>PUT 时必须原样携带的请求头。</summary>
|
||
public IReadOnlyDictionary<string, string> Headers { get; init; } =
|
||
new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||
|
||
public DateTime ExpireAt { get; init; }
|
||
}
|
||
|
||
/// <summary>
|
||
/// STS 临时密钥直传凭证(前端用 cos-js-sdk 等上传)。
|
||
/// </summary>
|
||
public sealed class StsUploadTicket
|
||
{
|
||
/// <summary>库内应保存的逻辑 key。</summary>
|
||
public string Key { get; init; } = string.Empty;
|
||
|
||
/// <summary>COS 对象完整键(含 KeyPrefix),SDK putObject 用。</summary>
|
||
public string CosKey { get; init; } = string.Empty;
|
||
|
||
public string Bucket { get; init; } = string.Empty;
|
||
|
||
public string Region { get; init; } = string.Empty;
|
||
|
||
public string TmpSecretId { get; init; } = string.Empty;
|
||
|
||
public string TmpSecretKey { get; init; } = string.Empty;
|
||
|
||
public string SessionToken { get; init; } = string.Empty;
|
||
|
||
public long StartTime { get; init; }
|
||
|
||
public long ExpiredTime { get; init; }
|
||
}
|