【问题标题】:Unable to delete AppEngine Service instance using App Engine Admin API无法使用 App Engine Admin API 删除 AppEngine 服务实例
【发布时间】:2018-04-19 11:46:49
【问题描述】:

我正在尝试以编程方式删除 App Engine(标准)后端实例。删除它的代码在同一项目的另一个模块/服务上作为 Servlet 运行。

我能够列出实例和所有详细信息,但尝试删除它会引发 403 错误。

{
  "code" : 403,
  "errors" : [ {
    "domain" : "global",
    "message" : "Request had insufficient authentication scopes.",
    "reason" : "forbidden"
  } ],
  "message" : "Request had insufficient authentication scopes.",
  "status" : "PERMISSION_DENIED"
}

我正在使用 App 引擎默认服务帐号:

AppIdentityCredential credential = new AppIdentityCredential(Arrays.asList(AppengineScopes.APPENGINE_ADMIN));

Appengine engine = new Appengine.Builder(new UrlFetchTransport(), new JacksonFactory(), credential).setApplicationName("AppEngineManager").build();
//list all instances - this works fine

//now delete an instance
engine.apps().services().versions().instances().delete(appId, serviceId, version, <instanceid>).execute()

默认的 App Engine 服务帐户具有 Editor 角色(我也尝试手动添加 App Engine Admin 角色,但无济于事)

在运行代码之前打印的服务帐户名称也是正确的。有什么问题?

【问题讨论】:

  • 我尝试通过 REST api explorer 删除,它可以工作(但它使用我的个人帐户,它是项目的管理员)cloud.google.com/appengine/docs/admin-api/reference/rest/v1/…
  • 昨天的一项调查显示,Editor 角色意外缺少appengine.services.list 权限(使用gcloud 在服务版本之间切换流量时),可能与您的问题有关。这个问题今天消失了。再试一次,以防万一。
  • 谢谢丹,但我今天一整天都在尝试这个(甚至在你发表评论之后),但同样的问题。此外,我什至明确尝试添加具有这些角色的“App Engine Admin”和“App Engine Service Admin”,但仍然没有工作

标签: google-app-engine


【解决方案1】:

这就解决了!

AppIdentityCredential credential = new AppIdentityCredential(Arrays.asList(AppengineScopes.**CLOUD_PLATFORM**));

我使用的是外观更明显的 AppengineScopes.APPENGINE_ADMIN,但这不起作用。希望谷歌能改进他们的文档。由于生产问题需要我们以编程方式删除实例来解决它,因此彻夜难眠。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-02-02
相关资源
最近更新 更多