Search in sources :

Example 1 with Config

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);
}
Also used : AliyunConfig(com.baiyi.opscloud.common.datasource.AliyunConfig) Config(com.aliyun.teaopenapi.models.Config) AliyunConfig(com.baiyi.opscloud.common.datasource.AliyunConfig)

Example 2 with 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失败");
    }
}
Also used : AliClientException(com.wingice.msg.ali.exception.AliClientException) Config(com.aliyun.teaopenapi.models.Config) Client(com.aliyun.dysmsapi20170525.Client) AliAccountNotFoundException(com.wingice.msg.ali.exception.AliAccountNotFoundException) MultiAliAccountException(com.wingice.msg.ali.exception.MultiAliAccountException) AliClientException(com.wingice.msg.ali.exception.AliClientException)

Example 3 with Config

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);
}
Also used : Config(com.aliyun.teaopenapi.models.Config) SmsConfig(com.tansci.config.SmsConfig) Client(com.aliyun.dysmsapi20170525.Client)

Example 4 with 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);
}
Also used : Config(com.aliyun.teaopenapi.models.Config) PostConstruct(javax.annotation.PostConstruct)

Example 5 with 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)));
    }
}
Also used : SmsConfig(tech.pdai.springboot.sms.ali.config.SmsConfig) Config(com.aliyun.teaopenapi.models.Config) SendSmsRequest(com.aliyun.dysmsapi20170525.models.SendSmsRequest)

Aggregations

Config (com.aliyun.teaopenapi.models.Config)13 Client (com.aliyun.dysmsapi20170525.Client)4 Client (com.aliyun.ons20190214.Client)2 OnsTopicListRequest (com.aliyun.ons20190214.models.OnsTopicListRequest)2 OnsTopicListResponse (com.aliyun.ons20190214.models.OnsTopicListResponse)2 AliyunConfig (com.baiyi.opscloud.common.datasource.AliyunConfig)2 ServiceException (cn.lili.common.exception.ServiceException)1 Setting (cn.lili.modules.system.entity.dos.Setting)1 SmsSetting (cn.lili.modules.system.entity.dto.SmsSetting)1 SendSmsRequest (com.aliyun.dysmsapi20170525.models.SendSmsRequest)1 OnsGroupListRequest (com.aliyun.ons20190214.models.OnsGroupListRequest)1 OnsGroupListResponse (com.aliyun.ons20190214.models.OnsGroupListResponse)1 OSSClient (com.aliyun.oss.OSSClient)1 DefaultDingTalkClient (com.dingtalk.api.DefaultDingTalkClient)1 DingTalkClient (com.dingtalk.api.DingTalkClient)1 Gson (com.google.gson.Gson)1 AliCloudConfig (com.lwohvye.config.AliCloudConfig)1 CloudSDKException (com.mizhousoft.cloudsdk.CloudSDKException)1 SmsConfig (com.tansci.config.SmsConfig)1 AliAccountNotFoundException (com.wingice.msg.ali.exception.AliAccountNotFoundException)1