查看未来预留请求


本文档介绍了如何查看未来预留请求。

如需查看其他预留(包括为未来预留自动创建的用于预配预留资源的预留),请参阅查看预留

准备工作

  • 设置身份验证(如果尚未设置)。身份验证是通过其进行身份验证以访问 Google Cloud 服务和 API 的过程。如需从本地开发环境运行代码或示例,您可以按如下方式向 Compute Engine 进行身份验证。

    Select the tab for how you plan to use the samples on this page:

    Console

    When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.

    gcloud

    1. 安装 Google Cloud CLI,然后通过运行以下命令初始化 Google Cloud CLI:

      gcloud init
    2. Set a default region and zone.
    3. REST

      如需在本地开发环境中使用本页面上的 REST API 示例,请使用您提供给 gcloud CLI 的凭据。

        安装 Google Cloud CLI,然后通过运行以下命令初始化 Google Cloud CLI:

        gcloud init

      如需了解详情,请参阅 Google Cloud 身份验证文档中的使用 REST 时进行身份验证

所需的角色

如需获得查看未来预留请求所需的权限,请让您的管理员为您授予项目的 Compute Future Reservation Viewer (roles/compute.futureReservationViewer) IAM 角色。如需详细了解如何授予角色,请参阅管理访问权限

此预定义角色包含查看未来预留请求所需的权限。如需查看所需的确切权限,请展开所需权限部分:

所需权限

必须拥有以下权限才能查看未来预留请求:

  • 项目的 compute.futureReservations.list 权限(查看未来预留的列表)
  • 项目的 compute.futureReservations.get 权限(查看未来预留的详细信息)

您也可以使用自定义角色或其他预定义角色来获取这些权限。

查看未来预留请求

如需查看指定项目中的未来预留请求,请选择以下方法之一:

  • 查看未来预留请求列表

    本部分介绍如何查看指定项目中所有草稿或已提交的未来预留请求的列表。您还可以使用过滤条件根据一个或多个属性缩小结果范围。

  • 查看未来预留请求的详细信息

    本部分介绍如何查看未来预留请求的详细信息,例如共享共享未来预留的项目或其预留时间段的开始时间。

查看未来预留请求列表

您可以使用 Google Cloud 控制台、gcloud CLI 和 REST 查看指定项目中的未来预留请求列表。

控制台

如需查看未来预留请求列表,请按以下步骤操作:

  1. 在 Google Cloud 控制台中,转到预留页面。

    转到“预留”

  2. 点击未来预留标签页。

    在该表中,每行描述一个未来预留请求,每列描述一个属性。例如,总计数列描述了每个未来预留请求的预留容量。

  3. 可选:如需过滤表中显示的未来预留请求,请执行以下一项或两项操作:

    • 过滤条件字段中,输入过滤条件表达式

      例如,如需仅查看在可用区 us-central1-a 中创建或预留了 10 多个资源的未来预留请求,请指定以下表达式:

      Zone:us-central1-a OR Total Count>10
      
    • 点击 列显示选项,然后选择要用于过滤表的值。

gcloud

如需查看未来预留请求列表,请使用 gcloud beta compute future-reservations list 命令

gcloud beta compute future-reservations list \
    --project=PROJECT_ID

PROJECT_ID 替换为一个或多个未来预留请求所在项目的 ID。如果省略 --project 标志,则使用当前项目的 ID。

输出类似于以下内容:

NAME          TOTAL_COUNT    START_TIME             END_TIME               PROCUREMENT_STATUS   ZONE
fr-04         100            2025-07-20T07:00:00Z   2025-08-05T07:00:00Z   FULFILLED            us-east1-a
fr-05         10             2025-11-15T00:00:00Z   2025-12-01T00:00:00Z   PENDING_APPROVAL     us-west1-c

(可选)您可以指定 --filter 标志,以查看根据过滤条件表达式过滤后的未来预留列表。

gcloud beta compute future-reservations list \
    --filter="FILTER_EXPRESSION" \
    --project=PROJECT_ID

请替换以下内容:

  • FILTER_EXPRESSION 替换为过滤条件表达式

    例如,如需仅查看在可用区 us-central1-a 中创建的未来预留、指定 n2-standard-4 机器类型且总计数大于 10,请指定以下过滤条件表达式:

    specificSkuProperties.instanceProperties.machineType=n2-standard-4 AND specificSkuProperties.totalCount>10 AND zone=us-central1-a
    
  • PROJECT_ID:可选。一个或多个未来预留请求所在项目的 ID。如果省略 --project 标志,则使用当前项目的 ID。

REST

如需查看未来预留请求列表,请向 beta.futureResevations.list 方法发出 GET 请求。

GET https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/futureReservations

请替换以下内容:

  • PROJECT_ID:一个或多个未来预留请求所在项目的 ID。

  • ZONE:一个或多个未来预留请求所在的可用区。

输出类似于以下内容:

{
  "id": "projects/my-project/zones/us-east1-a/futureReservations",
  "items": [
    {
      "id": "743865190848184978",
      "creationTimestamp": "2025-04-11T18:16:45.274-07:00",
      "selfLink": "https://www.googleapis.com/compute/beta/projects/my-project/zones/us-east1-a/futureReservations/fr-base",
      "selfLinkWithId": "https://www.googleapis.com/compute/beta/projects/my-project/zones/us-east1-a/futureReservations/743865190848184978",
      "zone": "https://www.googleapis.com/compute/beta/projects/my-project/zones/us-east1-a",
      "name": "fr-base",
      "specificSkuProperties": {
        "instanceProperties": {
          "machineType": "n1-standard-1"
        },
        "totalCount": "100"
      },
      "planningStatus": "SUBMITTED",
      "timeWindow": {
        "startTime": "2025-07-20T07:00:00Z",
        "endTime": "2025-08-05T07:00:00Z"
      },
      "status": {
        "procurementStatus": "FULFILLED",
        "lockTime": "2025-05-04T07:00:00Z",
        "fulfilledCount": "100"
      },
      "kind": "compute#futureReservation"
    },
    ...
  ],
  "selfLink": "https://www.googleapis.com/compute/beta/projects/my-project/zones/us-east1-a/futureReservations",
  "etag": "AnzKY34l-cvvV-JnniESJ0dtQvQ=/hvc4jaHpxFAZmOt1FVtKNgzZu-M=",
  "kind": "compute#futureReservationsListResponse"
}

(可选)您可以指定 filter 查询参数,以查看根据过滤条件表达式过滤后的未来预留列表。

GET https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/aggregated/futureReservations?filter=FILTER_EXPRESSION

请替换以下内容:

  • PROJECT_ID:一个或多个未来预留请求所在项目的 ID。

  • FILTER_EXPRESSION:使用网址编码过滤条件表达式

    例如,如需仅查看在可用区 us-central1-a 中创建、预留了 n2-standard-4 机器类型且总计数大于 10 的预留,请指定以下过滤条件表达式:

    specificSkuProperties.instanceProperties.machineType=n2-standard-4%20AND%20specificSkuProperties.totalCount%3E10%20AND%20zone=us-central1-a
    

    请注意,网址编码的过滤条件表达式表示以下解码后的过滤条件表达式:

    specificSkuProperties.instanceProperties.machineType=n2-standard-4 AND specificSkuProperties.totalCount>10 AND zone=us-central1-a
    

查看未来预留请求的详细信息

您可以使用 Google Cloud 控制台、gcloud CLI 和 REST 查看未来预留请求的详细信息。

控制台

如需查看未来预留请求的详细信息,请按以下步骤操作:

  1. 在 Google Cloud 控制台中,转到预留页面。

    转到“预留”

  2. 点击未来预留标签页。

  3. 名称列中,点击要查看其详细信息的未来预留请求的名称。

    系统会打开未来预留页面,其中包含未来预留请求的详细信息。

gcloud

如需查看未来预留请求的详细信息,请使用 gcloud beta compute future-reservations describe 命令

gcloud beta compute future-reservations describe FUTURE_RESERVATION_NAME \
    --project=PROJECT_ID \
    --zone=ZONE

请替换以下内容:

  • FUTURE_RESERVATION_NAME:现有未来预留请求的名称。

  • PROJECT_ID:可选。未来预留请求所在项目的 ID。如果您省略 --project 标志,则系统会使用当前项目的 ID。

  • ZONE:未来预留请求所在的可用区。

输出类似于以下内容:

creationTimestamp: '2025-07-19T12:44:11.855-07:00'
id: '5212276518668495076'
kind: compute#futureReservation
name: fr-01
namePrefix: test-fr
selfLink: https://www.googleapis.com/compute/beta/projects/project-01/zones/us-central1-a/futureReservations/future-reservation-test-1
selfLinkWithId: https://www.googleapis.com/compute/beta/projects/project-01/zones/us-central1-a/futureReservations/5212276518668495076
shareSettings:
  projects:
  - 'project-02'
  shareType: SPECIFIC_PROJECTS
specificSkuProperties:
  instanceProperties:
    localSsds:
    - diskSizeGb: '375'
      interface: SCSI
    machineType: n1-standard-64
    minCpuPlatform: Intel Skylake
  totalCount: '800'
planningStatus: SUBMITTED
status:
  lockTime: '2025-08-25T00:00:00Z'
  procurementStatus: APPROVED
timeWindow:
  endTime: '2025-12-10T00:00:00Z'
  startTime: '2025-11-10T00:00:00Z'
zone: https://www.googleapis.com/compute/beta/projects/project-01/zones/us-central1-a

REST

如需查看未来预留请求的详细信息,请向 beta.futureReservations.get 方法发出 GET 请求。

GET https://compute.googleapis.com/compute/beta/projects/PROJECT_ID/zones/ZONE/reservations/FUTURE_RESERVATION_NAME

请替换以下内容:

  • PROJECT_ID:未来预留请求所在项目的 ID。

  • ZONE:未来预留请求所在的可用区。

  • FUTURE_RESERVATION_NAME:现有未来预留请求的名称。

输出类似于以下内容:

{
  "creationTimestamp": "2025-04-11T18:16:45.274-07:00",
  "id": "743865190848184978",
  "name": "fr-01",
  "namePrefix": "test-fr",
  "kind": "compute#futureReservation",
  "selfLink": "https://www.googleapis.com/compute/beta/projects/my-project/zones/us-east1-a/futureReservations/fr-base",
  "selfLinkWithId": "https://www.googleapis.com/compute/beta/projects/my-project/zones/us-east1-a/futureReservations/743865190848184978",
  "specificSkuProperties": {
    "instanceProperties": {
      "machineType": "n1-standard-1"
    },
    "totalCount": "100"
  },
  "planningStatus": "SUBMITTED",
  "timeWindow": {
    "endTime": "2025-08-05T07:00:00Z",
    "startTime": "2025-07-20T07:00:00Z"
  },
  "status": {
    "fulfilledCount": "100"
    "lockTime": "2025-05-04T07:00:00Z",
    "procurementStatus": "FULFILLED",
  },
  "zone": "https://www.googleapis.com/compute/beta/projects/my-project/zones/us-east1-a"
}

后续步骤