Stay organized with collections Save and categorize content based on your preferences.
Preview
This product or feature is subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the Service Specific Terms. Pre-GA products and features are available "as is" and might have limited support. For more information, see the launch stage descriptions.
This page describes how to determine the storage layout of your bucket. Storage layout refers to how objects are organized within a bucket, either in a flat namespace or a hierarchical namespace. The layout is important for applications that interact with the bucket, as object access and manipulation methods vary depending on the layout. Storage layout also includes information about the bucket's location.
By using the getStorageLayout
API, your application can adapt its behavior based on whether a bucket uses hierarchical namespace or not, ensuring optimal compatibility and leveraging the appropriate features based on the bucket configuration.
In order to get the required permissions for getting the storage layout of a Cloud Storage bucket , ask your administrator to grant you the Storage Object User (roles/storage.objectUser
) role on the bucket.
The role contains the storage.objects.list
permission, which is required to get the storage layout of the bucket.
You might also be able to get this permission with other custom roles or predefined roles. To see which roles are associated with which permissions, refer to IAM roles for Cloud Storage.
For instructions on granting roles on buckets, see Use IAM with buckets.
Get a bucket's storage layout Command lineUse the gcloud alpha storage buckets describe
command with the --format
flag:
gcloud alpha storage buckets describe gs://BUCKET_NAME --raw --format="default(hierarchicalNamespace)"
Where:
BUCKET_NAME
is the name of the relevant bucket. For example, my-bucket
.If successful and hierarchical namespace is enabled, the response looks similar to the following example:
hierarchicalNamespace: enabled: trueJSON API
Have gcloud CLI installed and initialized, which lets you generate an access token for the Authorization
header.
Use cURL
to call the JSON API with a getStorageLayout
request:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ "https://storage.googleapis.com/storage/v1/b/BUCKET_NAME/storageLayout"
Where BUCKET_NAME
is the name of the relevant bucket. For example, my-bucket
.
If successful, the response looks like the following example:
{ "kind": "storage#storageLayout", "bucket": "my-bucket", "location": "us-central1", "locationType": "region", "hierarchicalNamespace":{enabled: true}, }
If you're new to Google Cloud, create an account to evaluate how Cloud Storage performs in real-world scenarios. New customers also get $300 in free credits to run, test, and deploy workloads.
Try Cloud Storage freeExcept as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-10-02 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-10-02 UTC."],[],[]]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.5