有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java AWS API网关获取API密钥

我试图从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) 个答案

  1. # 1 楼答案

    确保将includeValues设置为true

    req.setIncludeValues(true);