use of com.aliyun.teaopenapi.models.Config in project opscloud4 by ixrjog.
the class AliyunDmsClient method createClient.
public static com.aliyun.dms_enterprise20181101.Client createClient(AliyunConfig.Aliyun aliyun) throws Exception {
Config config = new Config().setAccessKeyId(aliyun.getAccount().getAccessKeyId()).setAccessKeySecret(aliyun.getAccount().getSecret());
// 访问的域名
config.endpoint = Optional.of(aliyun).map(AliyunConfig.Aliyun::getDms).map(AliyunConfig.Dms::getEndpoint).orElse(AliyunConfig.DMS_ENDPOINT);
return new com.aliyun.dms_enterprise20181101.Client(config);
}
use of com.aliyun.teaopenapi.models.Config in project knife-starter by 1120023921.
the class KnifeSmsAliSenderContextImpl method buildClient.
private Client buildClient(AliAccount aliAccount) throws AliClientException {
final Config config = new Config().setAccessKeyId(aliAccount.getAccessKeyId()).setAccessKeySecret(aliAccount.getAccessSecret());
// 访问的域名
config.endpoint = "dysmsapi.aliyuncs.com";
try {
return new Client(config);
} catch (Exception e) {
throw new AliClientException("构造阿里云短信Client失败");
}
}
use of com.aliyun.teaopenapi.models.Config in project tansci by typ1805.
the class AliSmsServiceImpl method createClient.
/**
* @MonthName: createClient
* @Description: SK初始化账号Client
* @Author: tanyp
* @Date: 2021/6/7 15:44
* @Param: [accessId, accessKey, endpoint]
* @return: com.aliyun.teaopenapi.Client
*/
public Client createClient() throws Exception {
Config config = new Config();
config.accessKeyId = smsConfig.getAccessId();
config.accessKeySecret = smsConfig.getAccessKey();
config.endpoint = smsConfig.getEndpoint();
return new Client(config);
}
use of com.aliyun.teaopenapi.models.Config in project java-in-depth by tenstone.
the class IoTDeviceServiceImpl method init.
@PostConstruct
public void init() throws Exception {
Config config = new Config().setAccessKeyId(accessKey).setAccessKeySecret(accessSecret);
config.endpoint = endpoint;
client = new com.aliyun.iot20180120.Client(config);
}
use of com.aliyun.teaopenapi.models.Config in project tech-pdai-spring-demos by realpdai.
the class SmsServiceImpl method sendSms.
/**
* send sms.
*
* @param pNos phone num
* @param templateCode template code
* @param signName sign name
* @param templateParam template param
* @throws Exception Exception
*/
public void sendSms(List<String> pNos, String templateCode, String signName, String templateParam) throws Exception {
Config config = new Config().setAccessKeyId(smsConfig.getAccessKeyId()).setAccessKeySecret(smsConfig.getAccessKeySecret()).setEndpoint(smsConfig.getDomain()).setConnectTimeout(10000).setReadTimeout(10000);
com.aliyun.dysmsapi20170525.Client client = new com.aliyun.dysmsapi20170525.Client(config);
for (String pNo : pNos) {
SendSmsRequest sendSmsRequest = new SendSmsRequest().setPhoneNumbers(pNo).setSignName(signName).setTemplateCode(templateCode).setTemplateParam(templateParam);
log.info(JsonUtil.toJson(client.sendSms(sendSmsRequest)));
}
}
Aggregations