【发布时间】:2017-10-09 01:17:03
【问题描述】:
我创建了一个谷歌云项目并启用了 谷歌云密钥管理服务 (KMS) API。我创建了两个钥匙圈。 keyring1 位于 us-east1 和 keyring2 位于 global。我创建了以下 java 程序来列出该区域中的密钥环:
GoogleCredential credential = GoogleCredential.getApplicationDefault();
credential = credential.createScoped(CloudKMSScopes.all());
String keyRingPath = "projects/<<projectId>>/locations/global";
CloudKMS kms = new CloudKMS.Builder(httpTransport, jsonFactory, credential).setApplicationName("CloudKMS snippets").build();
ListKeyRingsResponse response = kms.projects().locations().keyRings().list(keyRingPath).execute();
System.out.println(response.getKeyRings());
我收到以下禁止错误:
Exception in thread "main" com.google.api.client.googleapis.json.GoogleJsonResponseException: 403 Forbidden
{
"code" : 403,
"errors" : [ {
"domain" : "global",
"message" : "This API is not acessible from your region.",
"reason" : "forbidden"
} ],
"message" : "This API is not acessible from your region.",
"status" : "PERMISSION_DENIED"
}
【问题讨论】:
标签: google-cloud-kms