提问人:YueGod 提问时间:11/2/2023 最后编辑:Brian Tompsett - 汤莱恩YueGod 更新时间:11/2/2023 访问量:14
使用 google-cloud-storage 从 Google Play 管理中心检索财务报告数据时出现 Java 错误
Java error in retrieving financial report data from Google Play Console using google-cloud-storage
问:
我在 Google Cloud 中创建了一个新的服务帐户,并配置了相应的存储对象管理员权限。然后,我在Google Play管理中心内添加了此服务帐户。但是,当此帐户尝试检索财务报告数据时,它会提示我“没有对 Google Cloud Storage 存储桶的 storage.objects.list 访问权限。资源上的权限“storage.objects.list”被拒绝(或者它可能不存在)”。
@Test
public void execute() throws Exception {
Storage storage = create();
Page<Blob> list = storage.list("Bucket name");
for (Blob blob : list.iterateAll()) {
System.out.println(blob);
}
}
public Storage create() throws Exception {
String projectId = "My project id";
ClassPathResource classPathResource = new ClassPathResource("google/realtalk-c7a20-63be3ffe7b91.json");
InputStream is = classPathResource.getInputStream();
GoogleCredentials credentials = GoogleCredentials.fromStream(is);
return StorageOptions.newBuilder()
.setCredentials(credentials)
.setProjectId(projectId)
.build()
.getService();
}
为什么会这样?是因为我没有激活 Google Cloud Storage 吗?但是,我认为 Google Play 管理中心内的财务报告应该存储在 Google 自己的存储中。
答: 暂无答案
评论