File size: 1,389 Bytes
c574d3a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
import com.tencentcloudapi.common.Credential;
import com.tencentcloudapi.common.exception.TencentCloudSDKException;
// 导入对应产品模块的client
import com.tencentcloudapi.cvm.v20170312.CvmClient;
// 导入要请求接口对应的request response类
import com.tencentcloudapi.cvm.v20170312.models.DescribeZonesRequest;
import com.tencentcloudapi.cvm.v20170312.models.DescribeZonesResponse;
public class DescribeZones
{
public static void main(String [] args) {
try{
// 实例化一个认证对象,入参需要传入腾讯云账户secretId,secretKey
Credential cred = new Credential("secretId", "secretKey");
// 实例化要请求产品(以cvm为例)的client对象
CvmClient client = new CvmClient(cred, "ap-guangzhou");
// 实例化一个请求对象
DescribeZonesRequest req = new DescribeZonesRequest();
// 通过client对象调用想要访问的接口,需要传入请求对象
DescribeZonesResponse resp = client.DescribeZones(req);
// 输出json格式的字符串回包
System.out.println(DescribeZonesRequest.toJsonString(resp));
} catch (TencentCloudSDKException e) {
System.out.println(e.toString());
}
}
} |