数据流管道选项的服务帐户凭据



从数据流 1.9 升级到 Beam 0.4.0。GcpOptions 上设置服务帐号名称 (setServiceAccountName) 和密钥文件 (setServiceAccountKeyFile) 的方法不再可用。最接近的替代方案是setGcpCredential.

要手动创建 GoogleCredential,要使用的适当范围是什么?我的管道需要访问 PubSub、Datastore 和 BigQuery,可能是云存储。

new GoogleCredential.Builder()
.setTransport(HTTP_TRANSPORT)
.setJsonFactory(JSON_FACTORY)
.setServiceAccountId(serviceAccount)
.setServiceAccountScopes(SCOPES)  // what will be the scopes?
.setServiceAccountPrivateKeyFromP12File(p12file)
.build();

我相信基于此列表,所有这些都应该可以使用https://www.googleapis.com/auth/cloud-platform范围进行访问。

最新更新