40 lines
1.1 KiB
Java
40 lines
1.1 KiB
Java
package com.lyh.common.config;
|
|
|
|
import com.aliyun.teaopenapi.models.Config;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
/**
|
|
* @ProjectName: LoadCenter
|
|
* @Author: LiuYunHu
|
|
* @CreateTime: 2024/4/13
|
|
* @Description: 阿里云客户端配置类
|
|
*/
|
|
|
|
@Component
|
|
public class ClientService {
|
|
|
|
/*
|
|
* @Author: LiuYunHu
|
|
* @Date: 2024/4/13 9:52
|
|
* @Description: 初始化公共请求参数
|
|
* @Param:
|
|
* @Return:
|
|
**/
|
|
|
|
public static com.aliyun.ecs20140526.Client createEcsClient(String regionId) throws Exception {
|
|
Config config = new Config()
|
|
// 您的AccessKey ID
|
|
.setAccessKeyId("LTAI5tEBb3cjLf8nRBJZmfD9")
|
|
// 您的AccessKey Secret
|
|
.setAccessKeySecret("Emzjl8SlqwlHP7xeFOrhwtXiJNfbkF")
|
|
// 您的可用区ID
|
|
.setRegionId(regionId)
|
|
// 设置连接超时为5000毫秒
|
|
.setConnectTimeout(5000)
|
|
// 设置读超时为5000毫秒
|
|
.setReadTimeout(5000);
|
|
return new com.aliyun.ecs20140526.Client(config);
|
|
}
|
|
|
|
}
|