我正在尝试通过阿里云提供的API修改经典网络端点的保留时间。我下载了官方Java SDK来访问阿里云ApsaraDB Instance。我正在关注官方文档。
public static void main(String[] args) {
ModifyInstanceNetExpireTimeRequest request = new ModifyInstanceNetExpireTimeRequest();
request.setClassicExpiredDays(3);
request.setConnectionString("<link string>");
request.setInstanceId("<instance Id>");
IClientProfile profile
= DefaultProfile.getProfile("cn-hangzhou", "<Your ak>",
"<Your sk>");
IAcsClient client = new DefaultAcsClient(profile);
try {
ModifyInstanceNetExpireTimeResponse response
= client.getAcsResponse(request);
for (NetInfoItem item:response.getNetInfoItems()) {
System.out.println(item.getConnectionString());
System.out.println(item.getPort());
System.out.println(item.getDBInstanceNetType());
System.out.println(item.getIPAddress());
System.out.println(item.getExpiredTime());
}
} catch (ServerException e) {
e.printStackTrace();
}
} catch (ClientException e) {
e.printStackTrace();
}}
但这会引发您没有足够的权限来更改保留时间。是因为 RAM(资源访问管理)权限吗?