使用Google Cloud Storage Client Library for Java检索特定文件的ACL

时间:2022-11-21 15:49:52

I currently have the following problem:

我目前有以下问题:

I would like to check the access control list of an object in my bucket on Google Cloud Storage from my App Engine App. I know I can set the ACL with the GcsFileOptions.Builder, but I want to read it from a specific file before passing it to the user.

我想从我的App Engine应用程序检查Google云端存储中我的存储桶中对象的访问控制列表。我知道我可以使用GcsFileOptions.Builder设置ACL,但我想在将其传递给用户之前从特定文件中读取它。

I am not able to find a method with which this is possible. Am I missing something here or is the Google Cloud Storage REST API the only way to do this? (https://cloud.google.com/storage/docs/xml-api/get-object-acls). In that case: can anyone explain why this method is not available in the client library?

我无法找到一种可行的方法。我在这里遗漏了什么,或者Google Cloud Storage REST API是唯一的方法吗? (https://cloud.google.com/storage/docs/xml-api/get-object-acls)。在这种情况下:任何人都可以解释为什么这种方法在客户端库中不可用?

1 个解决方案

#1


2  

Maybe I am also missing something, but isn't it through the getAcl method of the GcsFileOptions class?

也许我也错过了一些东西,但不是通过GcsFileOptions类的getAcl方法吗?

https://cloud.google.com/appengine/docs/java/googlecloudstorageclient/javadoc/com/google/appengine/tools/cloudstorage/GcsFileOptions.html#getAcl--

You first get the file metadata through getMetadata() on the gcs service and then get the GcsFileOptions via metadata.getOptions()

首先通过gcs服务上的getMetadata()获取文件元数据,然后通过metadata.getOptions()获取GcsFileOptions

#1


2  

Maybe I am also missing something, but isn't it through the getAcl method of the GcsFileOptions class?

也许我也错过了一些东西,但不是通过GcsFileOptions类的getAcl方法吗?

https://cloud.google.com/appengine/docs/java/googlecloudstorageclient/javadoc/com/google/appengine/tools/cloudstorage/GcsFileOptions.html#getAcl--

You first get the file metadata through getMetadata() on the gcs service and then get the GcsFileOptions via metadata.getOptions()

首先通过gcs服务上的getMetadata()获取文件元数据,然后通过metadata.getOptions()获取GcsFileOptions