Skip to content

Commit f69aa6e

Browse files
release 3.1.139 source code
1 parent 96fff18 commit f69aa6e

File tree

126 files changed

+3666
-960
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+3666
-960
lines changed

CHANGELOG.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,107 @@
1+
# 3.1.139 2025-03-27
2+
3+
### HuaweiCloud SDK Core
4+
5+
- _Features_
6+
- None
7+
- _Bug Fix_
8+
- None
9+
- _Change_
10+
- Optimize the process of automatically obtaining account IDs.
11+
12+
### HuaweiCloud SDK CBR
13+
14+
- _API Version_
15+
- V1
16+
- _Features_
17+
- Support the API `ChangeVaultChargeMode`
18+
- _Bug Fix_
19+
- None
20+
- _Change_
21+
- **ChangeOrder**
22+
- changes of response param
23+
- `* retCode: string -> number`
24+
25+
### HuaweiCloud SDK CCE
26+
27+
- _API Version_
28+
- V3
29+
- _Features_
30+
- None
31+
- _Bug Fix_
32+
- None
33+
- _Change_
34+
- **DeleteAutopilotCluster**
35+
- changes of request param
36+
- `+ lts_reclaim_policy: enum value [Delete_Log_Group,Delete_Master_Log_Stream,Retain]`
37+
- `+ lts_reclaim_policy: enum value [true,block,try,false,skip]`
38+
39+
### HuaweiCloud SDK ECS
40+
41+
- _API Version_
42+
- V2
43+
- _Features_
44+
- Support the API `ListScheduledEvents`
45+
- _Bug Fix_
46+
- None
47+
- _Change_
48+
- None
49+
50+
### HuaweiCloud SDK FunctionGraph
51+
52+
- _API Version_
53+
- V2
54+
- _Features_
55+
- None
56+
- _Bug Fix_
57+
- None
58+
- _Change_
59+
- **CreateFunction**
60+
- changes of request param
61+
- `+ enable_lts_log`
62+
- changes of response param
63+
- `+ enable_lts_log`
64+
- **ShowFunctionConfig**
65+
- changes of response param
66+
- `+ enable_lts_log`
67+
- **UpdateFunctionConfig**
68+
- changes of request param
69+
- `+ enable_lts_log`
70+
- changes of response param
71+
- `+ enable_lts_log`
72+
73+
### HuaweiCloud SDK KMS
74+
75+
- _API Version_
76+
- V2
77+
- _Features_
78+
- Support the APIs `CreateRsaDatakeyPair`, `CreateEcDatakeyPair`
79+
- _Bug Fix_
80+
- None
81+
- _Change_
82+
- None
83+
84+
### HuaweiCloud SDK VOD
85+
86+
- _API Version_
87+
- V1
88+
- _Features_
89+
- None
90+
- _Bug Fix_
91+
- None
92+
- _Change_
93+
- **UpdateStorageMode**
94+
- changes of request param
95+
- `+ X-Sdk-Date`
96+
- **ModifySubtitle**
97+
- changes of request param
98+
- `+ X-Sdk-Date`
99+
- `+ delete_subtitles.type: enum value [SRT]`
100+
- `+ add_subtitles.type: enum value [SRT]`
101+
- **DeleteTranscodeProduct**
102+
- changes of request param
103+
- `+ X-Sdk-Date`
104+
1105
# 3.1.138 2025-03-20
2106

3107
### HuaweiCloud SDK AAD

CHANGELOG_CN.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,107 @@
1+
# 3.1.139 2025-03-27
2+
3+
### HuaweiCloud SDK Core
4+
5+
- _新增特性_
6+
- 无
7+
- _解决问题_
8+
- 无
9+
- _特性变更_
10+
- 优化自动获取账号ID流程
11+
12+
### HuaweiCloud SDK CBR
13+
14+
- _接口版本_
15+
- V1
16+
- _新增特性_
17+
- 支持接口`ChangeVaultChargeMode`
18+
- _解决问题_
19+
- 无
20+
- _特性变更_
21+
- **ChangeOrder**
22+
- 响应参数变更
23+
- `* retCode: string -> number`
24+
25+
### HuaweiCloud SDK CCE
26+
27+
- _接口版本_
28+
- V3
29+
- _新增特性_
30+
- 无
31+
- _解决问题_
32+
- 无
33+
- _特性变更_
34+
- **DeleteAutopilotCluster**
35+
- 请求参数变更
36+
- `+ lts_reclaim_policy: enum value [Delete_Log_Group,Delete_Master_Log_Stream,Retain]`
37+
- `+ lts_reclaim_policy: enum value [true,block,try,false,skip]`
38+
39+
### HuaweiCloud SDK ECS
40+
41+
- _接口版本_
42+
- V2
43+
- _新增特性_
44+
- 支持接口`ListScheduledEvents`
45+
- _解决问题_
46+
- 无
47+
- _特性变更_
48+
- 无
49+
50+
### HuaweiCloud SDK FunctionGraph
51+
52+
- _接口版本_
53+
- V2
54+
- _新增特性_
55+
- 无
56+
- _解决问题_
57+
- 无
58+
- _特性变更_
59+
- **CreateFunction**
60+
- 请求参数变更
61+
- `+ enable_lts_log`
62+
- 响应参数变更
63+
- `+ enable_lts_log`
64+
- **ShowFunctionConfig**
65+
- 响应参数变更
66+
- `+ enable_lts_log`
67+
- **UpdateFunctionConfig**
68+
- 请求参数变更
69+
- `+ enable_lts_log`
70+
- 响应参数变更
71+
- `+ enable_lts_log`
72+
73+
### HuaweiCloud SDK KMS
74+
75+
- _接口版本_
76+
- V2
77+
- _新增特性_
78+
- 支持接口`CreateRsaDatakeyPair`、`CreateEcDatakeyPair`
79+
- _解决问题_
80+
- 无
81+
- _特性变更_
82+
- 无
83+
84+
### HuaweiCloud SDK VOD
85+
86+
- _接口版本_
87+
- V1
88+
- _新增特性_
89+
- 无
90+
- _解决问题_
91+
- 无
92+
- _特性变更_
93+
- **UpdateStorageMode**
94+
- 请求参数变更
95+
- `+ X-Sdk-Date`
96+
- **ModifySubtitle**
97+
- 请求参数变更
98+
- `+ X-Sdk-Date`
99+
- `+ delete_subtitles.type: enum value [SRT]`
100+
- `+ add_subtitles.type: enum value [SRT]`
101+
- **DeleteTranscodeProduct**
102+
- 请求参数变更
103+
- `+ X-Sdk-Date`
104+
1105
# 3.1.138 2025-03-20
2106

3107
### HuaweiCloud SDK AAD

Core/Auth/BasicCredentials.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public override ICredential ProcessAuthParams(SdkHttpClient client, string regio
111111
var derivedFunc = DerivedPredicate;
112112
DerivedPredicate = null;
113113

114-
IamEndpoint = string.IsNullOrEmpty(IamEndpoint) ? IamService.DefaultIamEndpoint : IamEndpoint;
114+
IamEndpoint = string.IsNullOrEmpty(IamEndpoint) ? IamService.GetEndpoint(regionId) : IamEndpoint;
115115
var logger = client.GetLogger();
116116
logger.LogInformation("Project id of region '{}' not found in BasicCredentials, trying to obtain project id from IAM service: {}",
117117
regionId, IamEndpoint);

Core/Auth/GlobalCredentials.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public override ICredential ProcessAuthParams(SdkHttpClient client, string regio
109109
var derivedFunc = DerivedPredicate;
110110
DerivedPredicate = null;
111111

112-
IamEndpoint = string.IsNullOrEmpty(IamEndpoint) ? IamService.DefaultIamEndpoint : IamEndpoint;
112+
IamEndpoint = string.IsNullOrEmpty(IamEndpoint) ? IamService.GetEndpoint(regionId) : IamEndpoint;
113113
var logger = client.GetLogger();
114114
logger.LogInformation("Domain id not found in BasicCredentials, trying to obtain domain id from IAM service: {}", IamEndpoint);
115115
var request = IamService.GetKeystoneListAuthDomainsRequest(IamEndpoint, client.GetHttpConfig());

Core/Auth/IamService.cs

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,10 @@
2121

2222
using System;
2323
using System.Collections.Generic;
24+
using System.IO;
2425
using System.Linq;
2526
using System.Net;
27+
using System.Reflection;
2628
using Newtonsoft.Json;
2729

2830
namespace HuaweiCloud.SDK.Core.Auth
@@ -78,6 +80,74 @@ 2. Use the domain account to grant IAM read permission to the current account
7880
1. Manually specify domainId when initializing the credentials, var credentials = new GlobalCredentials(ak, sk, domainId);
7981
2. Use the domain account to grant IAM read permission to the current account
8082
3. Replace the ak/sk of the IAM account with the ak/sk of the domain account";
83+
84+
private const string EndpointsResourceName = "Core.Resources.iam_endpoints.json";
85+
86+
private const string IamEndpointEnv = "HUAWEICLOUD_SDK_IAM_ENDPOINT";
87+
88+
private static readonly object Lock = new object();
89+
90+
private static Dictionary<string, string> _endpoints;
91+
92+
private static Dictionary<string, string> ProcessEndpoints()
93+
{
94+
var assembly = Assembly.GetExecutingAssembly();
95+
using (var stream = assembly.GetManifestResourceStream(EndpointsResourceName))
96+
{
97+
if (stream == null)
98+
{
99+
return new Dictionary<string, string>();
100+
}
101+
using (var reader = new StreamReader(stream))
102+
{
103+
var content = reader.ReadToEnd();
104+
try
105+
{
106+
return JsonConvert.DeserializeObject<Dictionary<string, string>>(content);
107+
}
108+
catch (JsonException)
109+
{
110+
return new Dictionary<string, string>();
111+
}
112+
}
113+
}
114+
}
115+
116+
private static Dictionary<string, string> GetEndpoints()
117+
{
118+
if (_endpoints == null)
119+
{
120+
lock (Lock)
121+
{
122+
if (_endpoints == null)
123+
{
124+
_endpoints = ProcessEndpoints();
125+
}
126+
}
127+
}
128+
return _endpoints;
129+
}
130+
131+
public static string GetEndpoint(string regionId=null)
132+
{
133+
var endpointFromEnv = Environment.GetEnvironmentVariable(IamEndpointEnv);
134+
if (endpointFromEnv != null)
135+
{
136+
if (!endpointFromEnv.StartsWith("https://"))
137+
{
138+
endpointFromEnv += "https://";
139+
}
140+
return endpointFromEnv;
141+
}
142+
143+
if (regionId == null)
144+
{
145+
return DefaultIamEndpoint;
146+
}
147+
148+
149+
return GetEndpoints().TryGetValue(regionId, out var endpoint) ? endpoint : DefaultIamEndpoint;
150+
}
81151

82152
public static HttpRequest GetKeystoneListProjectsRequest(string iamEndpoint, string regionId, HttpConfig httpConfig)
83153
{

Core/Core.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@
2929
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="3.1.5" />
3030
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
3131
<PackageReference Include="YamlDotNet" Version="13.3.1" />
32+
<EmbeddedResource Include="Resources\iam_endpoints.json" />
3233
</ItemGroup>
3334
</Project>

Core/Resources/iam_endpoints.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"cn-north-2": "https://iam.cn-north-2.myhuaweicloud.com",
3+
"cn-north-4": "https://iam.cn-north-4.myhuaweicloud.com",
4+
"cn-north-1": "https://iam.cn-north-1.myhuaweicloud.com",
5+
"cn-east-2": "https://iam.cn-east-2.myhuaweicloud.com",
6+
"cn-east-3": "https://iam.cn-east-3.myhuaweicloud.com",
7+
"cn-south-1": "https://iam.cn-south-1.myhuaweicloud.com",
8+
"cn-south-2": "https://iam.cn-south-2.myhuaweicloud.com",
9+
"cn-southwest-2": "https://iam.cn-southwest-2.myhuaweicloud.com",
10+
"ap-southeast-1": "https://iam.ap-southeast-1.myhuaweicloud.com",
11+
"ap-southeast-2": "https://iam.ap-southeast-2.myhuaweicloud.com",
12+
"ap-southeast-3": "https://iam.ap-southeast-3.myhuaweicloud.com",
13+
"af-south-1": "https://iam.af-south-1.myhuaweicloud.com",
14+
"sa-brazil-1": "https://iam.sa-brazil-1.myhuaweicloud.com",
15+
"la-south-2": "https://iam.la-south-2.myhuaweicloud.com",
16+
"na-mexico-1": "https://iam.na-mexico-1.myhuaweicloud.com",
17+
"la-north-2": "https://iam.la-north-2.myhuaweicloud.com",
18+
"cn-north-9": "https://iam.cn-north-9.myhuaweicloud.com",
19+
"eu-west-0": "https://iam.eu-west-0.myhuaweicloud.com",
20+
"my-kualalumpur-1": "https://iam.my-kualalumpur-1.myhuaweicloud.com",
21+
"ru-moscow-1": "https://iam.ru-moscow-1.myhuaweicloud.com",
22+
"me-east-1": "https://iam.me-east-1.myhuaweicloud.com",
23+
"ap-southeast-4": "https://iam.ap-southeast-4.myhuaweicloud.com",
24+
"ae-ad-1": "https://iam.ae-ad-1.myhuaweicloud.com",
25+
"cn-east-4": "https://iam.cn-east-4.myhuaweicloud.com",
26+
"cn-east-5": "https://iam.cn-east-5.myhuaweicloud.com"
27+
}

0 commit comments

Comments
 (0)