Git Product home page Git Product logo

Comments (2)

simonw avatar simonw commented on August 19, 2024

Prototype:

@@ -730,6 +755,9 @@ def list_buckets(buckets, details, nl, csv, tsv, **boto_options):
                     ).items()
                     if key != "ResponseMetadata"
                 )
+                region = s3.get_bucket_location(Bucket=bucket["Name"])["LocationConstraint"]
                 try:
                     pab = s3.get_public_access_block(
                         Bucket=bucket["Name"],
@@ -746,6 +774,7 @@ def list_buckets(buckets, details, nl, csv, tsv, **boto_options):
                     )
                 except s3.exceptions.ClientError:
                     bucket_website = None
+                bucket["region"] = region
                 bucket["bucket_acl"] = bucket_acl
                 bucket["public_access_block"] = pab
                 bucket["bucket_website"] = bucket_website

I'm seeing null for my buckets. https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/s3.html#S3.Client.get_bucket_location explains why:

Buckets in Region us-east-1 have a LocationConstraint of null.

from s3-credentials.

simonw avatar simonw commented on August 19, 2024

Example output:

% s3-credentials list-buckets sfms-history sfms-slides --details 
[
  {
    "Name": "sfms-history",
    "CreationDate": "2022-06-28 17:55:10+00:00",
    "region": "us-east-1",
    "bucket_acl": {
      "Owner": {
        "DisplayName": "swillison",
        "ID": "36b2eeee501c5952a8ac119f9e5212277a4c01eccfa8d6a9d670bba1e2d5f441"
      },
      "Grants": [
        {
          "Grantee": {
            "DisplayName": "swillison",
            "ID": "36b2eeee501c5952a8ac119f9e5212277a4c01eccfa8d6a9d670bba1e2d5f441",
            "Type": "CanonicalUser"
          },
          "Permission": "FULL_CONTROL"
        }
      ]
    },
    "public_access_block": null,
    "bucket_website": null
  },
  {
    "Name": "sfms-slides",
    "CreationDate": "2022-08-12 15:45:24+00:00",
    "region": "us-east-1",
    "bucket_acl": {
      "Owner": {
        "DisplayName": "swillison",
        "ID": "36b2eeee501c5952a8ac119f9e5212277a4c01eccfa8d6a9d670bba1e2d5f441"
      },
      "Grants": [
        {
          "Grantee": {
            "DisplayName": "swillison",
            "ID": "36b2eeee501c5952a8ac119f9e5212277a4c01eccfa8d6a9d670bba1e2d5f441",
            "Type": "CanonicalUser"
          },
          "Permission": "FULL_CONTROL"
        }
      ]
    },
    "public_access_block": null,
    "bucket_website": {
      "IndexDocument": {
        "Suffix": "index.html"
      },
      "ErrorDocument": {
        "Key": "error.html"
      },
      "url": "http://sfms-slides.s3-website.us-east-1.amazonaws.com/"
    }
  }
]

from s3-credentials.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.