Reputation: 93
Here is the code segment:
Bucket newBucket = storage.buckets().insert("MyProject", new Bucket().setName("MyBucket").setLocation("US").setStorageClass("DURABLE_REDUCED_AVAILABILITY")).execute();
} catch (GoogleJsonResponseException e) {
System.out.println("Exception in tryCreateBucket: "+e);
throw e;
}
It throws: Exception in tryCreateBucket:
com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
{
"code" : 400,
"errors" : [ {
"domain" : "global",
"message" : "Invalid Value",
"reason" : "invalid"
} ],
"message" : "Invalid Value"
}
Any thoughts on how to fix this problem?
Thanks /VK
Upvotes: 9
Views: 7639
Reputation: 7290
Your project name is wrong, you need the one of the form foo-barbar-12345 that Google assigned, not the plain name that you gave it (CloudStorage)
Upvotes: 2
Reputation: 12145
bucket names must be lowercase. There are a number of other restrictions as well - please see https://developers.google.com/storage/docs/bucketnaming#requirements
Upvotes: 9