change Platform to a EnumType
This commit is contained in:
@@ -12,9 +12,9 @@ namespace Hua.DDNS.Common.Config.Options
|
||||
public class DomainOption
|
||||
{
|
||||
/// <summary>
|
||||
/// platform from [Ali,Tencent]
|
||||
/// platform from 1 Ali 2 Tencent
|
||||
/// </summary>
|
||||
public string Platform { get; set; }
|
||||
public PlatformEnum Platform { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Id, the id and key from AliCould or DnsPod
|
||||
|
||||
24
Hua.DDNS/Common/Config/Options/PlatformEnum.cs
Normal file
24
Hua.DDNS/Common/Config/Options/PlatformEnum.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Hua.DDNS.Common.Config.Options
|
||||
{
|
||||
/// <summary>
|
||||
/// DDNS Platform
|
||||
/// </summary>
|
||||
public enum PlatformEnum
|
||||
{
|
||||
/// <summary>
|
||||
/// Ali
|
||||
/// </summary>
|
||||
Ali = 1,
|
||||
|
||||
/// <summary>
|
||||
/// Tencent
|
||||
/// </summary>
|
||||
Tencent
|
||||
}
|
||||
}
|
||||
@@ -66,7 +66,7 @@ namespace Hua.DDNS.Jobs
|
||||
//更新Ip记录
|
||||
switch (_domainOption.Platform)
|
||||
{
|
||||
case "Tencent":
|
||||
case PlatformEnum.Tencent:
|
||||
var _dnspodClient = new DnspodClient(
|
||||
// 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey,此处还需注意密钥对的保密
|
||||
// 密钥可前往https://console.cloud.tencent.com/cam/capi网站进行获取
|
||||
@@ -97,7 +97,7 @@ namespace Hua.DDNS.Jobs
|
||||
});
|
||||
|
||||
break;
|
||||
case "Ali":
|
||||
case PlatformEnum.Ali:
|
||||
var aliClient = new AlibabaCloud.SDK.Alidns20150109.Client(new Config()
|
||||
{
|
||||
// 您的 AccessKey ID
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
},
|
||||
|
||||
"Domain": {
|
||||
"Platform": "Ali",
|
||||
"Platform": 1, //1 Ali 2 Tencent
|
||||
// Access Id/Secret Id
|
||||
"Id": "Id",
|
||||
// Access Key/Secret Key
|
||||
|
||||
Reference in New Issue
Block a user