【发布时间】:2014-05-30 05:18:46
【问题描述】:
字符串 projName = settings.getProject(); String bucketName = settings.getBucket();
System.out.println("Creating bucket, projName: "+projName+", bucketName: "+bucketName) ;
try {
@SuppressWarnings("unused")
Bucket createdBucket = storage.buckets().insert(projName,
new Bucket().setName(bucketName).setLocation("US")
).execute();
} catch (GoogleJsonResponseException e) {
GoogleJsonError error = e.getDetails();
if (error.getCode() == HTTP_CONFLICT
&& error.getMessage().contains("You already own this bucket.")) {
System.out.println("already exists");
} else {
System.out.println("Exception in tryCreateBucket: "+e);
throw e;
}
}
输出:
正在创建存储桶,项目名称:round-center-551,存储桶名称:1904mybucketfoo
tryCreateBucket 中的异常:
com.google.api.client.googleapis.json.GoogleJsonResponseException: 403禁止
{ “代码”:403, “错误”:[{ “域”:“全球” “位置”:“授权”, “位置类型”:“标题”, "message" : "指定项目的帐号已被禁用。", “原因”:“accountDisabled” }], "message" : "指定项目的帐号已被禁用。" } 指定项目的帐户已被禁用。
我已确认 Google Cloud Storage 和 Google Cloud Datastore API 服务已开启。 知道应该怎么做才能启用该帐户吗?
【问题讨论】:
-
您是否为您的项目启用了计费功能?如果已为该项目设置了计费,则您只能创建存储桶。