Google App Engine - GoogleCredential.getApplicationDefault(transport, jsonFactory) 未找到
Google App Engine - GoogleCredential.getApplicationDefault(transport, jsonFactory) Not Found
我需要使用 Google App Engine 中的 Google 云存储。因此,为此,我正在尝试使用应用程序默认凭据来获取授权凭据以连接到云存储 API。我使用添加 Google Api 选项在 Eclipse 中添加了 Google Cloud Storage JSON API。它添加了 google-api-client-1.18.0-rc.jar。这个罐子没有下面的方法。
GoogleCredential credential = GoogleCredential.getApplicationDefault(transport, jsonFactory);
当我看到样本时,我看到下面的依赖项
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-storagetransfer</artifactId>
<version>v1-rev1-1.20.0</version>
</dependency>
但是在 Eclipse 中,当使用添加 Google API window 时,我没有找到找到这个 "v1-rev1-1.20.0" 版本的 Google Cloud 的方法存储 API。如何下载与版本 v1-rev1-1.20.0 兼容的 Google Cloud Storage API jar?
由于您是从 App Engine 访问 Cloud Storage,因此您可以使用为 App Engine 构建的 GCS 客户端:
GcsService gcsService = GcsServiceFactory.createGcsService();
// ...
ListResult objects = fileService.list(MY_BUCKET_NAME, ListOptions.DEFAULT);
// ... and so on
我需要使用 Google App Engine 中的 Google 云存储。因此,为此,我正在尝试使用应用程序默认凭据来获取授权凭据以连接到云存储 API。我使用添加 Google Api 选项在 Eclipse 中添加了 Google Cloud Storage JSON API。它添加了 google-api-client-1.18.0-rc.jar。这个罐子没有下面的方法。
GoogleCredential credential = GoogleCredential.getApplicationDefault(transport, jsonFactory);
当我看到样本时,我看到下面的依赖项
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-storagetransfer</artifactId>
<version>v1-rev1-1.20.0</version>
</dependency>
但是在 Eclipse 中,当使用添加 Google API window 时,我没有找到找到这个 "v1-rev1-1.20.0" 版本的 Google Cloud 的方法存储 API。如何下载与版本 v1-rev1-1.20.0 兼容的 Google Cloud Storage API jar?
由于您是从 App Engine 访问 Cloud Storage,因此您可以使用为 App Engine 构建的 GCS 客户端:
GcsService gcsService = GcsServiceFactory.createGcsService();
// ...
ListResult objects = fileService.list(MY_BUCKET_NAME, ListOptions.DEFAULT);
// ... and so on