package com.cloud.host;

import com.ecloud.sdk.config.Config;
import com.ecloud.sdk.ecs.v1.Client;
import org.springframework.context.annotation.Configuration;

@Configuration
public class CloudHostConfig {
    /**
     * 使用AK&SK初始化账号Client
     *
     * @param accessKey
     * @param secretKey
     * @param poolId
     * @return Client
     */
    public static Client createClient(String accessKey, String secretKey, String poolId) {
        Config config = new Config();
        config.setAccessKey(accessKey);
        config.setSecretKey(secretKey);
        config.setPoolId(poolId);
        // 默认连接超时时间为60秒
        config.setConnectTimeout(60);
        // 默认响应超时时间为120秒
        config.setReadTimeout(120);
        return new Client(config);
    }

}
