package cn.axzo.msg.center.notices.integration.client;

import com.aliyun.dysmsapi20170525.Client;
import com.aliyun.teaopenapi.models.Config;
import lombok.SneakyThrows;
import org.springframework.stereotype.Component;

/**
 * 阿里云 SMS 客户端工厂
 *
 * @author zhaoyong_sh
 * @see AliyunSmsClientFactory
 * @since 2021-05-19 14:02
 */
@Component("aliyunSmsClientFactory")
public class AliyunSmsClientFactory {

    @SneakyThrows
    public Client getClient(String accessKeyId, String accessKeySecret)  {
        Config config = new Config()
                // 您的AccessKey ID
                .setAccessKeyId(accessKeyId)
                // 您的AccessKey Secret
                .setAccessKeySecret(accessKeySecret)
                // Endpoint
                .setEndpoint("dysmsapi.aliyuncs.com");
        Client client = new Client(config);
        return client;
    }

}
