我有一个Java代码,可以使用IAM角色从AWS ssm参数存储中检索参数。这段代码抛出了一些HTTP错误。有人可以帮我吗?
package com.au.local.sit.parquet.dbload;
import com.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagement;
import com.amazonaws.services.simplesystemsmanagement.AWSSimpleSystemsManagementClientBuilder;
import com.amazonaws.services.simplesystemsmanagement.model.GetParameterRequest;
import com.amazonaws.services.simplesystemsmanagement.model.GetParameterResult;
public class GetPasswordParameter {
public static void main(String args[]) {
final AWSSimpleSystemsManagement client=AWSSimpleSystemsManagementClientBuilder.defaultClient();
GetParameterRequest request = new GetParameterRequest();
request.withName("/asset/DB").withWithDecryption(true);
GetParameterResult result = client.getParameter(request);
System.out.println(result.getParameter().getValue());
}
}