Reputation: 135
When I do gsutil ls -p myproject-id
I get a list of buckets (in my case 2 buckets), which I expect to be the list of all my buckets in the project:
gs://bucket-one/
gs://bucket-two/
But, if I do gsutil ls -p myproject-id gs://asixtythreecharacterlongnamebucket
I actually get the elements of that long-named bucket:
gs://asixtythreecharacterlongnamebucket/somefolder/
So my question is: why when I do a ls to the project I don't get in the results the long-named bucket?
The only explanation it made sense to me was this: https://stackoverflow.com/a/34738829/3457432 But I'm not sure. Is this the reason? Or could it be other ones?
Upvotes: 1
Views: 790
Reputation: 2593
Are you sure that asixtythreecharacterlongnamebucket
belongs to myproject-id
? It really sounds like asixtythreecharacterlongnamebucket
was created in a different project.
You can verify this by checking the bucket ACLs for asixtythreecharacterlongnamebucket
and bucket-one
and seeing if the project numbers in the listed entities match:
$ gsutil ls -Lb gs://asixtythreecharacterlongnamebucket | grep projectNumber
$ gsutil ls -Lb gs://bucket-one | grep projectNumber
Also note that the -p
argument to ls
has no effect in your second command when you're listing objects in some bucket. The -p
argument only affects which project should be used when you're listing buckets in some project, as in your first command. Think of ls
as listing the children resources belonging to some parent -- the parent of a bucket is a project, while the parent of an object is a bucket.
Upvotes: 1
Reputation: 75790
You don't perform the same request!
gsutil ls -p myproject-id
Here you ask all the bucket resources that belong to a project
gsutil ls -p myproject-id gs://asixtythreecharacterlongnamebucket
Here you ask all the objects that belong to the bucket asixtythreecharacterlongnamebucket
and you use the quota project myproject-id
In both case, you need to have permissions to access the resources
Upvotes: 0