1、阿里云DNS的SDK依赖
<dependency> |
|
<groupId>com.aliyun</groupId> |
|
<artifactId>tea-openapi</artifactId> |
|
<version>0.0.19</version> |
|
</dependency> |
|
<dependency> |
|
<groupId>com.aliyun</groupId> |
|
<artifactId>alidns20150109</artifactId> |
|
<version>2.0.1</version> |
|
</dependency> |
2、第一个方法:创建SDK客户端实例
所有解析记录的操作都要通过这个客户端实例来进行,所以要首先创建这个实例,需要阿里云的AccessKey(AppId和AppSecret)
/** |
|
* <p> |
|
* 创建客户端实例 |
|
* </p> |
|
* |
|
* @return |
|
* @throws Exception |
|
*/ |
|
private Client createClient() throws Exception{
|
|
AliConfig api = APIKit.getAliConfig(); //返回阿里云的AccessKey参数 |
|
if(api == null) throw new ErrException("未配置阿里云API参数!"); |
|
Config config = new Config(); |
|
config.accessKeyId = api.getAppId(); |
|
config.accessKeySecret = api.getAp |