【问题标题】:Update autoscaler api call returns 404更新自动缩放器 api 调用返回 404
【发布时间】:2017-11-01 10:25:00
【问题描述】:

我正在尝试使用 API Explorer 更新我的 Google Compute Engine 实例组:https://cloud.google.com/compute/docs/reference/latest/autoscalers/update?authuser=2

我想使用此 API 更新最小和最大副本数。身体部分有

{
  "autoscalingPolicy": {
    "minNumReplicas": 2,
    "maxNumReplicas": 5,
    "coolDownPeriodSec": 60,
    "cpuUtilization": {
    "utilizationTarget": 1.5
    }
  }
}

这会产生以下错误:

{
 "error": {
  "errors": [
   {
    "domain": "global",
    "reason": "notFound",
    "message": "The resource 'projects/<my-proj-name>/zones/us-central1-a/autoscalers' was not found"
   }
  ],
  "code": 404,
  "message": "The resource 'projects/<my-proj-name>/zones/us-central1-a/autoscalers' was not found"
 }
}

我通过单击实例组登录页面底部的微小“等效 REST”链接确认了托管实例组的自动缩放器配置。

我是否缺少让它在 API 资源管理器上运行?

【问题讨论】:

  • 这应该是关于 APIs Explorer 需要做的所有事情。 404 表示您的路径变量之一(项目名称或区域)错误,但如果没有详细信息,很难确定。如果您添加标签“google-compute-engine”,您可能会在此特定 API 上获得更好的帮助。

标签: google-compute-engine google-apis-explorer


【解决方案1】:

通过在正文部分尝试不同的参数来排序。

看起来“名称”和“目标”是根据自动缩放政策提供的必填字段。没有这些,api无法处理请求并返回错误。

为我工作的身体形成:

{
  "autoscalingPolicy": {
    "coolDownPeriodSec": 60,
    "maxNumReplicas": 2,
    "minNumReplicas": 1
  },
  "name": "<my-autoscaler-name>",
  "target": "https://www.googleapis.com/compute/v1/projects/<my-project-name>/zones/us-central1-a/instanceGroupManagers/<my-instancegroup-name>"
}

注意:目标和名称值是通过单击实例组登录页面底部的微小“等效 REST”链接从显示的页面中选择的。作为观察,在我的例子中,新实例组的两个字符串都是相同的。

【讨论】:

    猜你喜欢
    • 2018-08-22
    • 2021-05-23
    • 1970-01-01
    • 1970-01-01
    • 2023-01-27
    • 1970-01-01
    • 1970-01-01
    • 2017-11-15
    • 1970-01-01
    相关资源
    最近更新 更多