Skip to content

Commit

Permalink
release 3.0.32-rc source code for net
Browse files Browse the repository at this point in the history
  • Loading branch information
Huaweicloud-SDK committed Jan 30, 2021
1 parent 40c2fc4 commit cbee77d
Show file tree
Hide file tree
Showing 268 changed files with 24,359 additions and 792 deletions.
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
#3.0.32-rc 2021-01-30
## HuaweiCloud SDK DNS
- ### Features
- Support `Domain Name Service`.
- ### Bug Fix
- None
- ### Change
- None

## HuaweiCloud SDK ECS
- ### Features
- None
- ### Bug Fix
- None
- ### Change
- Change interface name from `UpdateAutoTerminateTimeServer` to `UpdateServerAutoTerminateTime`.

## HuaweiCloud SDK EVS
- ### Features
- None
- ### Bug Fix
- None
- ### Change
- Interface `CinderCreateVolume` is supported to specify the id of dedicated storage pool using property `OS-SCH-HNT:scheduler_hints`.
- Modify property type of `allocated` of class `QuotaDetails` from `String` to `Integer`.

## HuaweiCloud SDK IAM
- ### Features
- None
- ### Bug Fix
- None
- ### Change
- Increases the property `access_mode` of response class of interface `ShowUser`.


## 3.0.31-rc 2021-01-25
## HuaweiCloud SDK Core
- ### Features
Expand Down
35 changes: 35 additions & 0 deletions CHANGELOG_CN.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
## 3.0.32-rc 2021-01-30
## HuaweiCloud SDK DNS
- ### 新增特性
- 支持云解析服务
- ### 解决问题
-
- ### 特性变更
-

## HuaweiCloud SDK ECS
- ### 新增特性
-
- ### 解决问题
-
- ### 特性变更
- 接口名称调整: UpdateAutoTerminateTimeServer → UpdateServerAutoTerminateTime

## HuaweiCloud SDK EVS
- ### 新增特性
-
- ### 解决问题
-
- ### 特性变更
- 创建云硬盘接口支持指定专属存储池ID
- 查询配额相关接口属性 `allocated` 类型调整: string → int

## HuaweiCloud SDK IAM
- ### 新增特性
-
- ### 解决问题
-
- ### 特性变更
- 查询IAM用户详情接口响应体增加属性`access_mode`


## 3.0.31-rc 2021-01-25
## HuaweiCloud SDK Core
- ### 新增特性
Expand Down
66 changes: 1 addition & 65 deletions Core/Auth/Credentials.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright 2020 Huawei Technologies Co.,Ltd.
*
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
Expand All @@ -19,11 +19,8 @@
* under the License.
*/

using System;
using System.Collections.Generic;
using System.Reflection;
using System.Threading.Tasks;
using static System.String;

namespace HuaweiCloud.SDK.Core.Auth
{
Expand All @@ -34,66 +31,5 @@ public abstract class Credentials
public abstract Task<HttpRequest> SignAuthRequest(HttpRequest request);

public abstract Credentials ProcessAuthParams(SdkHttpClient client, string regionId);

public static Credentials GetCredentialFromEnvironment<T>(string defaultCredentials) where T : Client
{
var credentialsTypeDef = Environment.GetEnvironmentVariable("HUAWEICLOUD_SDK_TYPE");
if (IsNullOrEmpty(credentialsTypeDef))
{
credentialsTypeDef = defaultCredentials;
}

var credentialsType = GetCredentialsType<T>(credentialsTypeDef);
if (credentialsType == null)
{
return null;
}

var credentials = InitializeCredentials(credentialsType);
credentials = LoadOptionalParams(credentials);

return credentials;
}

private static Type GetCredentialsType<T>(string credentialType)
{
var credentialsType = Type.GetType($"HuaweiCloud.SDK.Core.Auth.{credentialType}");
if (credentialsType == null)
{
credentialsType = Type.GetType($"{typeof(T).Namespace}.{credentialType}");
}

return credentialsType;
}

private static Credentials InitializeCredentials(Type credentialsType)
{
var constructors = credentialsType.GetConstructors();
var paramInfos = constructors[0].GetParameters();
var paramList = new List<Object>();
foreach (var paramInfo in paramInfos)
{
paramList.Add(
Environment.GetEnvironmentVariable(
$"HUAWEICLOUD_SDK_{StringUtils.ToSnakeCase(paramInfo.Name).ToUpper()}"));
}

return (Credentials) Activator.CreateInstance(credentialsType, paramList.ToArray());
}

private static Credentials LoadOptionalParams(Credentials credentials)
{
const BindingFlags instanceBindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;
foreach (var property in credentials.GetType().GetProperties(instanceBindFlags))
{
if (property.GetValue(credentials) == null)
{
property.SetValue(credentials, Environment.GetEnvironmentVariable(
$"HUAWEICLOUD_SDK_{StringUtils.ToSnakeCase(property.Name).ToUpper()}"));
}
}

return credentials;
}
}
}
56 changes: 56 additions & 0 deletions Core/Auth/EnvCredentials.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/*
* Copyright 2020 Huawei Technologies Co.,Ltd.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

using System;

namespace HuaweiCloud.SDK.Core.Auth
{
public class EnvCredentials
{
private const string AkEnvName = "HUAWEICLOUD_SDK_AK";
private const string SkEnvName = "HUAWEICLOUD_SDK_SK";
private const string ProjectIdEnvName = "HUAWEICLOUD_SDK_PROJECT_ID";
private const string DomainIdEnvName = "HUAWEICLOUD_SDK_DOMAIN_ID";

private const string BasicCredentialsType = "BasicCredentials";
private const string GlobalCredentialsType = "GlobalCredentials";

public static Credentials LoadCredentialsFromEnv(string defaultType)
{
var ak = Environment.GetEnvironmentVariable(AkEnvName);
var sk = Environment.GetEnvironmentVariable(SkEnvName);

if (Equals(BasicCredentialsType, defaultType))
{
var projectId = Environment.GetEnvironmentVariable(ProjectIdEnvName);
return new BasicCredentials(ak, sk, projectId);
}

if (Equals(GlobalCredentialsType, defaultType))
{
var domainId = Environment.GetEnvironmentVariable(DomainIdEnvName);
return new GlobalCredentials(ak, sk, domainId);
}

return null;
}
}
}
2 changes: 1 addition & 1 deletion Core/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public T Build()

if (this._credentials == null)
{
this._credentials = Credentials.GetCredentialFromEnvironment<T>(CredentialType[0]);
this._credentials = EnvCredentials.LoadCredentialsFromEnv(CredentialType[0]);
}

if (!CredentialType.Contains(this._credentials.GetType().Name))
Expand Down
2 changes: 1 addition & 1 deletion Core/obj/Core.csproj.nuget.cache
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": 1,
"dgSpecHash": "XsSDQSGUZ5UdXP+qn+YRBXgC6ojwxsTeTmXubOAJ5GuvVCf1gRoccOtRGkKt9QPhkdRvWhkMTk3uxDpJlp50pw==",
"dgSpecHash": "PaeOFYLMxUpQhphBayN+38tucLc6rpB4q7KOVyGmMEyjwCF0DY6/Szm1H612awlmtSNxxPOq8yTCaZpWFzOmAA==",
"success": true
}
12 changes: 6 additions & 6 deletions Core/obj/Core.csproj.nuget.dgspec.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"format": 1,
"restore": {
"/data/fuxi_ci_workspace/600eb8de9e210a420a34d09a/Core/Core.csproj": {}
"/data/fuxi_ci_workspace/601533eb7ad9bd2bcd4370c4/Core/Core.csproj": {}
},
"projects": {
"/data/fuxi_ci_workspace/600eb8de9e210a420a34d09a/Core/Core.csproj": {
"/data/fuxi_ci_workspace/601533eb7ad9bd2bcd4370c4/Core/Core.csproj": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/data/fuxi_ci_workspace/600eb8de9e210a420a34d09a/Core/Core.csproj",
"projectUniqueName": "/data/fuxi_ci_workspace/601533eb7ad9bd2bcd4370c4/Core/Core.csproj",
"projectName": "HuaweiCloud.SDK.Core",
"projectPath": "/data/fuxi_ci_workspace/600eb8de9e210a420a34d09a/Core/Core.csproj",
"projectPath": "/data/fuxi_ci_workspace/601533eb7ad9bd2bcd4370c4/Core/Core.csproj",
"packagesPath": "/root/.nuget/packages/",
"outputPath": "/data/fuxi_ci_workspace/600eb8de9e210a420a34d09a/Core/obj/",
"outputPath": "/data/fuxi_ci_workspace/601533eb7ad9bd2bcd4370c4/Core/obj/",
"projectStyle": "PackageReference",
"fallbackFolders": [
"/usr/dotnet/sdk/NuGetFallbackFolder"
Expand All @@ -23,7 +23,7 @@
"netstandard2.0"
],
"sources": {
"/data/fuxi_ci_workspace/600eb8de9e210a420a34d09a/package": {}
"/data/fuxi_ci_workspace/601533eb7ad9bd2bcd4370c4/package": {}
},
"frameworks": {
"netstandard2.0": {
Expand Down
2 changes: 1 addition & 1 deletion Core/obj/Core.csproj.nuget.g.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">/data/fuxi_ci_workspace/600eb8de9e210a420a34d09a/Core/obj/project.assets.json</ProjectAssetsFile>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">/data/fuxi_ci_workspace/601533eb7ad9bd2bcd4370c4/Core/obj/project.assets.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/root/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/root/.nuget/packages/;/usr/dotnet/sdk/NuGetFallbackFolder</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
Expand Down
8 changes: 4 additions & 4 deletions Core/obj/project.assets.json
Original file line number Diff line number Diff line change
Expand Up @@ -3593,11 +3593,11 @@
"project": {
"version": "1.0.0",
"restore": {
"projectUniqueName": "/data/fuxi_ci_workspace/600eb8de9e210a420a34d09a/Core/Core.csproj",
"projectUniqueName": "/data/fuxi_ci_workspace/601533eb7ad9bd2bcd4370c4/Core/Core.csproj",
"projectName": "HuaweiCloud.SDK.Core",
"projectPath": "/data/fuxi_ci_workspace/600eb8de9e210a420a34d09a/Core/Core.csproj",
"projectPath": "/data/fuxi_ci_workspace/601533eb7ad9bd2bcd4370c4/Core/Core.csproj",
"packagesPath": "/root/.nuget/packages/",
"outputPath": "/data/fuxi_ci_workspace/600eb8de9e210a420a34d09a/Core/obj/",
"outputPath": "/data/fuxi_ci_workspace/601533eb7ad9bd2bcd4370c4/Core/obj/",
"projectStyle": "PackageReference",
"fallbackFolders": [
"/usr/dotnet/sdk/NuGetFallbackFolder"
Expand All @@ -3609,7 +3609,7 @@
"netstandard2.0"
],
"sources": {
"/data/fuxi_ci_workspace/600eb8de9e210a420a34d09a/package": {}
"/data/fuxi_ci_workspace/601533eb7ad9bd2bcd4370c4/package": {}
},
"frameworks": {
"netstandard2.0": {
Expand Down
12 changes: 6 additions & 6 deletions Examples/Dds/V3/DdsV3.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ public static void CreateInstance(DdsClient client)
new CreateInstanceFlavorOption
{
Type = CreateInstanceFlavorOption.TypeEnum.SINGLE,
Num = 1,
Size = 10,
Num = "1",
Size = "10",
SpecCode = "dds.mongodb.s6.medium.4.single"
},
},
Expand Down Expand Up @@ -370,7 +370,7 @@ public static void EnlargeInstanceVolume(DdsClient client)
{
Volume = new ResizeInstanceVolumeOption()
{
Size = 20
Size = "20"
}
}
};
Expand Down Expand Up @@ -408,10 +408,10 @@ public static void EnlargeShardingNode(DdsClient client)
{
Type = EnlargeInstanceRequestBody.TypeEnum.MONGOS,
SpecCode = "dds.mongodb.s6.medium.4.mongos",
Num = 2,
Num = "2",
Volume = new AddShardingNodeVolumeOption()
{
Size = 20
Size = "20"
}
}
};
Expand Down Expand Up @@ -630,7 +630,7 @@ public static void SetBackupPolicy(DdsClient client)
{
BackupPolicy = new BackupPolicy()
{
KeepDays = 7,
KeepDays = "7",
StartTime = "08:15-09:15",
Period = "1,4,5,6,7"
}
Expand Down
Loading

0 comments on commit cbee77d

Please sign in to comment.