有没有办法在模拟服务帐户时使用 gsutil?

Is there a way to use gsutil while impersonating a service account?

我正在尝试调整 Google Cloud 中的用户权限,并创建了一个其他用户可以模拟访问各种项目的服务帐户。 gcloud 命令具有 --impersonate-service-account 选项,可以通过正确的身份验证进行 API 调用,但我想知道是否有人知道如何使用 gsutil.[=15 进行此类调用=]

下面是使用 gcloud:

成功调用的示例
gcloud --impersonate-service-account=superuser@PROJECT1.iam.gserviceaccount.com iam service-accounts list --project PROJECT2

top-level gsutil command-line options 中没有这样的选项(至少没有记录)。

相比之下,gcloud --impersonate-service-account 已记录。

要尝试的事情:

-e Prompt for service account credentials. This option requires that -a is not set.

是的,这是选项:

$ gsutil -i [SERVICE-ACCOUNT]@[PROJECT] [GSUTIL-COMMAND]

示例:

$ gsutil -i myserviceaccount@iam.gserviceaccount.com ls