首先,我想提一下,作为存储桶所有者意味着您始终可以删除存储在该存储桶中的对象,但如果默认 ACL 被覆盖,您可能没有对象所有者权限。这与存在超级用户概念的流行操作系统的工作方式不同。
您是否尝试使用开发人员控制台中 APIs & auth -> Credentials 中列出的项目中的现有服务帐户运行该命令?
如果您仍然收到该错误,则该对象可能是通过 App Engine 上传的。您可以使用以下代码在Python中创建 App Engine 应用程序,该代码使用 JSON API 列出对象 ACL,因为 App Engine 有自己的服务帐户 ( <project ID>@appspot.gserviceaccount.com
),并且与 Developers Console 中显示的不同。
#!/usr/bin/env python
import webapp2
from google.appengine.api import app_identity
from google.appengine.api import urlfetch
class MainPage(webapp2.RequestHandler):
def get(self):
scope = "https://www.googleapis.com/auth/devstorage.full_control"
authorization_token, _ = app_identity.get_access_token(scope)
acls = urlfetch.fetch(
"https://www.googleapis.com/storage/v1/b/<bucket>/o/<object/acl",
method=urlfetch.GET,
headers = {"Content-Type": "application/json", "Authorization": "OAuth " + authorization_token})
self.response.headers['Content-Type'] = 'application/json'
self.response.write(acls.content)
application = webapp2.WSGIApplication([
('/', MainPage),
], debug=True)