管理数据传输基础版资源

本页面介绍了如何管理使用“数据传输基础版”创建的资源

管理配置

您可以列出项目中的 Data Transfer Essentials 配置、检查配置的状态、更新配置或删除配置。

列出项目中的配置

如需列出项目中的某个位置的所有配置,请使用以下方法之一:

gcloud

使用 gcloud network-connectivity multicloud-data-transfer-configs list 命令

gcloud network-connectivity multicloud-data-transfer-configs list \
    --location=LOCATION

LOCATION 替换为配置的区域。

API

使用 multicloudDataTransferConfigs.get 方法

GET https://networkconnectivity.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/multicloudDataTransferConfigs

替换以下内容:

  • PROJECT_ID:您的项目的 ID
  • LOCATION:配置的区域

您可以选择使用 requestID 查询参数来标识您的 API 请求。如果您重试请求,服务器可以使用该标识符来忽略已响应的请求。

查看配置的详细信息

如需查看配置的详细信息,请使用以下方法之一:

gcloud

使用 gcloud network-connectivity multicloud-data-transfer-configs describe 命令

gcloud network-connectivity multicloud-data-transfer-configs describe CONFIGURATION_NAME \
    --location=LOCATION

替换以下内容:

  • CONFIGURATION_NAME:配置的名称
  • LOCATION:配置的区域

以下输出示例表明,来自 compute-engine 的流量已准备好纳入数据传输必需项的结算范围。对于 cloud-sqlcloud-storage,更新处于待处理状态。 effectiveTime 值表示状态预计生效的时间。此示例还显示了配置中的目标总数以及处于有效状态的目标数量。

description: 'sample config'
destinationsCount: 2
destinationsActiveCount: 0
name: config1
region: https://www.googleapis.com/network-connectivity/v1/projects/my-project/locations/europe-west3
services:
- cloud-sql:
  states:
  - effectiveTime: 2024-12-12T08:00:00Z
    state: DELETING
- cloud-storage:
  states:
  - effectiveTime: 2024-12-12T08:00:00Z
    state: ADDING
- compute-engine:
  states:
  - state: ACTIVE

API

使用 multicloudDataTransferConfigs.list 方法

GET https://networkconnectivity.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/multicloudDataTransferConfigs/CONFIGURATION_NAME

替换以下内容:

  • PROJECT_ID:您的项目的 ID
  • LOCATION:配置的区域
  • CONFIGURATION_NAME:配置的名称

以下示例输出显示,来自 compute-engine 的流量已准备好纳入数据传输必需项的结算范围。 对于 cloud-storagecloud-sql,更新处于待处理状态。 effectiveTime 值表示状态预计生效的时间。该示例还显示了配置中的目标平台总数以及处于有效状态的目标平台数量。

{
  "multicloudDataTransferConfig": [
    {
      "name": "projects/test-project/locations/europe-west1/multicloudDataTransferConfigs/config1",
      "createTime": "2025-05-14T10:16:22.761275571Z",
      "updateTime": "2025-05-14T10:16:25.872465362Z",
      "etag": "l-WY4OT6hBsMT8sAwEbuSpviLsE9iC_UDJXDyfE265I",
      "description": "sample config",
      "destinationsCount": 1,
      "destinationsActiveCount": 1,
      "services": {
        "cloud-sql": {
          "states": [
            {
              "effectiveTime": "2025-05-29T07:00:00Z",
              "state": "DELETING"
            }
          ]
        },
        "cloud-storage": {
          "states": [
            {
              "effectiveTime": "2025-05-29T07:00:00Z",
              "state": "ADDING"
            }
          ]
        },
        "compute-engine": {
          "states": [
            {
              "state": "ACTIVE"
            }
          ]
        }
      }
    }
  ]
}

服务状态可以是以下任一状态:

  • ADDING:正在添加服务。
  • DELETING:正在删除服务。
  • ACTIVE:相应服务已配置为采用 Data Transfer Essentials 结算。

更新配置

如需在配置中添加或删除服务,请使用以下方法之一:

gcloud

使用 gcloud network-connectivity multicloud-data-transfer-configs update 命令

如需指定服务,请使用以下任一选项:

  • services:将配置中的服务替换为指定列表
  • update-services:将指定的服务添加到配置中
  • remove-services:从配置中移除指定的服务
  • clear-services:从配置中移除所有服务
gcloud network-connectivity multicloud-data-transfer-configs update CONFIGURATION_NAME \
    --location=LOCATION \
    --description=DESCRIPTION \
    --services=SERVICE-A,... |
        --update-services=SERVICE-A,... |
        --remove-services=SERVICE-A,... |
        --clear-services

替换以下内容:

  • CONFIGURATION_NAME:您要更新的配置的名称。
  • LOCATION:配置的区域。
  • DESCRIPTION:配置及其用途的说明。
  • SERVICE-A,...:一系列字符串,表示您要向配置中添加或从配置中删除的服务。如需查看有效字符串,请参阅支持的服务和区域。 使用 clear-services 从配置中移除所有服务。

API

使用 multicloudDataTransferConfigs.update 方法

PATCH https://networkconnectivity.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/multicloudDataTransferConfigs/CONFIGURATION_NAME
{
  "description": "DESCRIPTION",
  "services": {
    "SERVICE-A",
    "SERVICE-B"
  }
}

替换以下内容:

  • PROJECT_ID:您的项目的 ID。
  • LOCATION:配置的区域。
  • CONFIGURATION_NAME:配置的名称。
  • DESCRIPTION:配置及其用途的说明。
  • SERVICE-A:一系列字符串,表示您要向配置添加或从中删除的服务。如需查看有效字符串,请参阅支持的服务和区域

此外,为了防止在更新操作期间覆盖指定的一组字段,您可以使用遵循 fieldMask 格式的 updateMask 选项。

对“数据转移基本知识”配置做出的更新会在大约 24 小时后生效。

删除配置

只有在删除与配置关联的所有目的地后,您才能删除该配置。

如需删除配置,请使用以下方法之一:

gcloud

使用 gcloud network-connectivity multicloud-data-transfer-configs delete 命令

gcloud network-connectivity multicloud-data-transfer-configs delete CONFIGURATION_NAME \
    --location=LOCATION

API

使用 multicloudDataTransferConfigs.delete 方法

DELETE https://networkconnectivity.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/multicloudDataTransferConfigs/CONFIGURATION_NAME

管理目标平台

您可以列出项目中的“数据转移必备项”目标平台、检查目标平台的状态、更新目标平台或将其删除。

列出项目中的目的地

如需列出项目中的所有目的地,请使用以下方法之一:

gcloud

使用 gcloud network-connectivity multicloud-data-transfer-configs destinations list 命令

gcloud network-connectivity multicloud-data-transfer-configs destinations list \
    --multicloud-data-transfer-config=CONFIGURATION_NAME \
    --location=LOCATION

替换以下内容:

  • CONFIGURATION_NAME:您要列出其目标配置的名称
  • LOCATION:配置的区域

API

使用 multicloudDataTransferConfigs.destinations.list 方法

GET https://networkconnectivity.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/multicloudDataTransferConfigs/CONFIGURATION_NAME

替换以下内容:

  • PROJECT_ID:您的项目的 ID
  • LOCATION:配置的区域
  • CONFIGURATION_NAME:您要列出其目标配置的名称

查看目的地的详细信息

如需查看目的地的详细信息,请使用以下方法之一:

gcloud

使用 gcloud network-connectivity multicloud-data-transfer-configs destinations describe 命令

gcloud network-connectivity multicloud-data-transfer-configs destinations describe DESTINATION_NAME \
    --multicloud-data-transfer-config=CONFIGURATION_NAME \
    --location=LOCATION

替换以下内容:

  • DESTINATION_NAME:目的地的名称
  • CONFIGURATION_NAME:您要查看其目标的配置的名称
  • LOCATION:配置的区域

以下示例显示,为 destination1 指定的端点有效,并且在 effectiveTime 指示的时间添加了目的地。

createTime: '2025-05-28T13:08:00.171978514Z'
description: 'sample destination'
endpoints:
- asn: 16509
  csp: aws
  state: VALID
etag: tag1
ipPrefix: 203.0.113.0/24
name: projects/test-project/locations/europe-west3/multicloudDataTransferConfig/config1/destinations/destination1
stateTimeline:
  states:
  - effectiveTime: '2025-05-29T07:00:00Z'
    state: ADDING
updateTime: '2025-05-28T13:08:03.431862259Z'

API

使用 multicloudDataTransferConfigs.destinations.get 方法

GET https://networkconnectivity.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/multicloudDataTransferConfigs/CONFIGURATION_NAME/destinations/DESTINATION_NAME

替换以下内容:

  • PROJECT_ID:您的项目的 ID
  • LOCATION:配置的区域
  • CONFIGURATION_NAME:配置的名称
  • DESTINATION_NAME:目的地的名称

以下示例输出显示,为 destination1 指定的端点有效,并且目的地正在 effectiveTime 指示的时间添加。

{
  "destination": [
    {
      "name": "projects/test-project/locations/europe-west3/multicloudDataTransferConfig/config1/destinations/destination1",
      "createTime": "2025-05-14T10:18:16.941520739Z",
      "updateTime": "2025-05-14T10:18:20.028116272Z",
      "etag": "tag1",
      "description": "sample destination",
      "ipPrefix": "203.0.113.0/24",
      "endpoints": [
        {
          "asn": 16509,
          "csp": "aws",
          "state": "VALID"
        }
      ],
      "stateTimeline": {
        "states": [
          {
            "state": "ADDING",
            "effectiveTime": "2025-05-29T07:00:00Z"
          }
        ]
      }
    }
  ]
}

对于目的地,状态可以是以下任一值:

  • ADDING:正在添加目的地。
  • DELETING:正在删除目的地。
  • SUSPENDING:系统正在根据审核暂停目标。
  • ACTIVE:系统会考虑将目的地纳入 Data Transfer Essentials 结算范围。
  • SUSPENDED:目标已被删除或违反了使用条款,因此不会纳入 Data Transfer Essentials 结算范围。

对于端点,状态可以是以下任一值:

  • VALID:ASN 和 CSP 值的组合有效。
  • INVALID:ASN 和 CSP 值的组合无效。

如果即使只有一个端点的状态为 VALID,则系统也会认为相应目的地符合数据传输基础服务结算条件。

如果所有端点的状态均为 INVALID,则表示相应目的地符合数据传输基础服务结算条件。在这种情况下,目标的状态会设置为 SUSPENDINGSUSPENDED,具体取决于当前状态是 ADDING 还是 ACTIVE。前往此类目的地的流量会被视为常规互联网流量。

更新目的地

目的地必须至少有一个端点,且端点数不能超过 5 个。

如需向目的地添加端点或从目的地删除端点,请使用以下方法之一:

gcloud

使用 gcloud network-connectivity multicloud-data-transfer-configs destinations update 命令

如需指定端点,请使用以下任一选项。您可以在同一命令中多次指定 add-endpointsremove-endpoints 标志。

  • endpoints:将目标中的端点替换为指定列表中的端点
  • add-endpoints:将指定端点添加到目的地
  • remove-endpoints:从目标中移除指定的端点
gcloud network-connectivity multicloud-data-transfer-configs destinations update DESTINATION_NAME \
    --multicloud-data-transfer-config=CONFIGURATION_NAME \
    --location=LOCATION \
    --description=DESCRIPTION \
    --ip-prefix=IP_PREFIX \
    --endpoints=asn=ASN,csp=CSP |
        --add-endpoints=asn=ASN,csp=CSP |
        --remove-endpoints=asn=ASN,csp=CSP

替换以下内容:

  • DESTINATION_NAME:目的地的名称。
  • CONFIGURATION_NAME:您要更新的配置的名称。
  • LOCATION:配置的区域。
  • DESCRIPTION:目标及其用途的说明。
  • IP_PREFIX:指定为范围或值的目标 IP 前缀。
  • 对于每个端点,请指定以下内容:

    • ASN:预期会公布相应前缀的 ASN。请参阅已识别的 ASN
    • CSP:一个字符串,表示公布前缀的 ASN 的 CSP。

API

使用 multicloudDataTransferConfigs.destinations.update 方法

PATCH https://networkconnectivity.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/multicloudDataTransferConfigs/CONFIGURATION_NAME/destinations/DESTINATION_NAME
{
  "description": "DESCRIPTION",
  "ip_prefix": "IP_PREFIX",
  "endpoints": [
    {
      "asn": "ASN",
      "csp": "CSP"
    }
  ]
}

替换以下内容:

  • PROJECT_ID:您的项目的 ID。
  • LOCATION:配置的区域。
  • CONFIGURATION_NAME:配置的名称。
  • DESTINATION_NAME:目的地的名称。
  • DESCRIPTION:目标及其用途的说明。
  • IP_PREFIX:指定为范围(例如 203.0.113.0/242001:db8::/32)或值(例如 203.0.113.62001:db8:2:2:2:2:2:2)的目标 IP 前缀。一个 IP 前缀只能在配置中使用一次,并且只能用于一个 ASN。

  • 指定与要添加到目标平台的端点对应的字符串,或移除您不想保留在目标平台中的端点:

    • ASN:预期会公布相应前缀的 ASN。请参阅已识别的 ASN
    • CSP:一个字符串,表示公布前缀的 ASN 的 CSP。

此外,为了防止在更新操作期间覆盖指定的一组字段,您可以使用遵循 fieldMask 格式的 updateMask 选项。

对“数据转移必备知识”目标账号和相关配置的更新大约会在 24 小时后生效。

删除目标位置

如需删除目的地,请使用以下方法之一:

gcloud

使用 gcloud network-connectivity multicloud-data-transfer-configs destinations delete 命令

gcloud network-connectivity multicloud-data-transfer-configs destinations delete DESTINATION_NAME \
    --multicloud-data-transfer-config=CONFIGURATION_NAME \
    --location=LOCATION

API

使用 multicloudDataTransferConfigs.destinations.delete 方法

DELETE https://networkconnectivity.googleapis.com/v1/projects/PROJECT_ID/locations/LOCATION/multicloudDataTransferConfigs/CONFIGURATION_NAME/destinations/DESTINATION_NAME