AWS API Gateway获取Api密钥

时间:2018-05-31 13:49:00

标签: java amazon-web-services aws-api-gateway

我试图从" API密钥"中的API密钥获取实际密钥。 API网关

AmazonApiGateway client = AmazonApiGatewayClientBuilder.standard().withRegion("my region").build();

GetApiKeysRequest req = new GetApiKeysRequest();        
GetApiKeysResult keys = client.getApiKeys(req);

ApiKey key = keys.getItems().get(0); // just get the first one.. 

System.out.println(key.getId());
System.out.println(key.getName());
System.out.println(key.getValue());

希望 getValue()会提供实际的密钥,但它是空的。

1 个答案:

答案 0 :(得分:1)

确保将includeValues设置为true

req.setIncludeValues(true);