从 Dataflow 1.9 升级到 Beam 0.4.0。GcpOptions 上设置服务帐户名称 ( setServiceAccountName
) 和密钥文件 ( setServiceAccountKeyFile
) 的方法不再可用。最接近的替代方案是setGcpCredential
.
要手动创建 GoogleCredential,要使用哪些合适的范围?我的管道需要访问 PubSub、Datastore 和 BigQuery,可能还有 Cloud Storage。
new GoogleCredential.Builder()
.setTransport(HTTP_TRANSPORT)
.setJsonFactory(JSON_FACTORY)
.setServiceAccountId(serviceAccount)
.setServiceAccountScopes(SCOPES) // what will be the scopes?
.setServiceAccountPrivateKeyFromP12File(p12file)
.build();