Browse Source

chore: translate into english

pull/4735/head
shaoxiaoxu 6 years ago
parent
commit
c9a36548fd
  1. 6
      framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobNamingNormalizer.cs
  2. 12
      framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProviderConfiguration.cs
  3. 14
      framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/DefaultOssClientFactory.cs
  4. 4
      framework/test/Volo.Abp.BlobStoring.Aliyun.Tests/Volo/Abp/BlobStoring/Aliyun/AbpBlobStoringAliyunTestModule.cs

6
framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobNamingNormalizer.cs

@ -6,11 +6,11 @@ namespace Volo.Abp.BlobStoring.Aliyun
public class AliyunBlobNamingNormalizer : IBlobNamingNormalizer, ITransientDependency
{
/// <summary>
/// 只允许小写字母、数字、短横线(-),且不能以短横线开头或结尾
/// Container names can contain only letters, numbers, and the dash (-) character
/// can't start or end with the dash (-) character
/// 3~63 个字符
/// they can't start or end with the dash (-) character
/// Container names must be from 3 through 63 characters long
/// 只允许小写字母、数字、短横线(-),且不能以短横线开头或结尾
/// 3~63 个字符
/// </summary>
public virtual string NormalizeContainerName(string containerName)
{

12
framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/AliyunBlobProviderConfiguration.cs

@ -3,7 +3,9 @@
namespace Volo.Abp.BlobStoring.Aliyun
{
/// <summary>
/// STS临时授权访问OSS:https://help.aliyun.com/document_detail/100624.html
/// Sub-account access to OSS or STS temporary authorization to access OSS
/// 子账号/STS临时授权访问OSS
/// https://help.aliyun.com/document_detail/100624.html
/// </summary>
public class AliyunBlobProviderConfiguration
{
@ -48,12 +50,20 @@ namespace Volo.Abp.BlobStoring.Aliyun
set => _containerConfiguration.SetConfiguration(AliyunBlobProviderConfigurationNames.RoleArn, value);
}
/// <summary>
/// The name used to identify the temporary access credentials, it is recommended to use different application users to distinguish.
/// 用来标识临时访问凭证的名称,建议使用不同的应用程序用户来区分。
/// </summary>
public string RoleSessionName
{
get => _containerConfiguration.GetConfiguration<string>(AliyunBlobProviderConfigurationNames.RoleSessionName);
set => _containerConfiguration.SetConfiguration(AliyunBlobProviderConfigurationNames.RoleSessionName, value);
}
/// <summary>
/// Set the validity period of the temporary access credential, the unit is s, the minimum is 900, and the maximum is 3600.
/// 设置临时访问凭证的有效期,单位是s,最小为900,最大为3600。
/// </summary>
public int DurationSeconds
{
get => _containerConfiguration.GetConfigurationOrDefault(AliyunBlobProviderConfigurationNames.DurationSeconds, 0);

14
framework/src/Volo.Abp.BlobStoring.Aliyun/Volo/Abp/BlobStoring/Aliyun/DefaultOssClientFactory.cs

@ -11,8 +11,9 @@ using Volo.Abp.DependencyInjection;
namespace Volo.Abp.BlobStoring.Aliyun
{
/// <summary>
/// Sub-account access to OSS or STS temporary authorization to access OSS
/// 子账号/STS临时授权访问OSS
/// STS:https://help.aliyun.com/document_detail/28756.html
/// STS or sub account number
/// </summary>
public class DefaultOssClientFactory : IOssClientFactory, ITransientDependency
{
@ -28,7 +29,7 @@ namespace Volo.Abp.BlobStoring.Aliyun
public virtual IOss Create(AliyunBlobProviderConfiguration aliyunConfig)
{
//使用账号 sub account number
//Sub-account
if (aliyunConfig.DurationSeconds <= 0)
{
var key = aliyunConfig.ToOssKeyString();
@ -43,7 +44,7 @@ namespace Volo.Abp.BlobStoring.Aliyun
}
else
{
//使用STS
//STS temporary authorization to access OSS
var key = aliyunConfig.ToOssWithStsKeyString();
var iOssClient = _cache.Get<IOss>(key);
if (iOssClient != null)
@ -55,16 +56,15 @@ namespace Volo.Abp.BlobStoring.Aliyun
aliyunConfig.AccessKeyId,
aliyunConfig.AccessKeySecret);
DefaultAcsClient client = new DefaultAcsClient(profile);
//构建AssumeRole请求
AssumeRoleRequest request = new AssumeRoleRequest
{
AcceptFormat = FormatType.JSON,
//指定角色ARN
//eg:acs:ram::$accountID:role/$roleName
RoleArn = aliyunConfig.RoleArn,
RoleSessionName = aliyunConfig.RoleSessionName,
//设置Token有效期,可选参数,默认3600秒
//Set the validity period of the temporary access credential, the unit is s, the minimum is 900, and the maximum is 3600. default 3600
DurationSeconds = aliyunConfig.DurationSeconds,
//设置Token的附加权限策略;在获取Token时,通过额外设置一个权限策略进一步减小Token的权限
//Set additional permission policy of Token; when acquiring Token, further reduce the permission of Token by setting an additional permission policy
Policy = aliyunConfig.Policy.IsNullOrEmpty() ? null : aliyunConfig.Policy,
};
var response = client.GetAcsResponse(request);

4
framework/test/Volo.Abp.BlobStoring.Aliyun.Tests/Volo/Abp/BlobStoring/Aliyun/AbpBlobStoringAliyunTestModule.cs

@ -5,10 +5,6 @@ using Volo.Abp.Modularity;
namespace Volo.Abp.BlobStoring.Aliyun
{
/// <summary>
/// This module will not try to connect to azure.
/// </summary>
[DependsOn(
typeof(AbpBlobStoringAliyunModule),
typeof(AbpBlobStoringTestModule)

Loading…
Cancel
Save