List bucket IP filtering rules

This page describes how to list the bucket IP filtering rules. With the list bucket IP filtering rules operation, you can check if IP filtering is enabled or disabled on a bucket. If you need to view information about the specific network sources that are allowed, use the Get bucket IP filtering rules operation.

Required roles

To get the required permissions for listing the bucket IP filtering rules, ask your administrator to grant you the Storage Admin (roles/storage.admin) role on the bucket. This role contains the storage.buckets.list permission required to list bucket IP filtering rules.

You can also get this permission with custom roles. You might be able to get this permission with other predefined roles as well. To see which roles are associated with which permissions, refer to IAM roles for Cloud Storage.

For instructions on granting roles for projects, see Manage access to projects.

List bucket IP filtering rules

gcloud

  1. Verify that you have the Google Cloud CLI version 526.0.0 or later installed:

    gcloud version | head -n1
    
  2. If you have an earlier gcloud CLI version installed, update the version:

    gcloud components update --version=526.0.0
    
  3. To list the bucket IP filtering rules, run the command gcloud alpha storage buckets describe in your development environment:

    gcloud alpha storage buckets describe gs://BUCKET_NAME --format="default(ip_filter_config)"

    Where:

    BUCKET_NAME is the name of your bucket. For example, my-bucket.

REST APIs

JSON API

  1. Have gcloud CLI installed and initialized, which lets you generate an access token for the Authorization header.

  2. Use cURL to call the JSON API with a List bucket request:

    curl -X GET \
      -H "Authorization: Bearer $(gcloud auth print-access-token)" \
      "https://storage.s3nsapis.fr/storage/v1/b?PROJECT_ID"

    Where:

    PROJECT_ID is the ID or number of the project containing the buckets you want to list. For example, my-project.

    The response looks like the following example:

    {
      "kind": "storage#buckets",
      "items":
            {
            "kind": "storage#bucket",
            "selfLink": "https://www.googleapis.com/storage/v1/b/my-bucket1",
            "id": "my-bucket1",
            "name": "my-bucket1",
            "projectNumber": "123456789012",
            ...
             },
            "ipFilter": {
              "mode": "Disabled"
            }
            {
            "kind": "storage#bucket",
            "selfLink": "https://www.googleapis.com/storage/v1/b/my-bucket2",
            "id": "my-bucket2",
            "name": "my-bucket2",
            "projectNumber": "123456789013",
            ...
            },
            "ipFilter": {
              "mode": "Enabled"
            }
    },

What's next