IBM Cloud Docs
编辑连接

编辑连接

在 UI 中编辑连接

要编辑与 Transit Gateway 的连接,请执行以下步骤:

  1. 从浏览器打开 IBM Cloud 控制台并登录账户。

  2. 从左上角选择导航菜单图标 导航菜单图标,然后单击基础架构 > 网络 > Transit Gateway

  3. 单击要在其中编辑连接的 Transit Gateway 的名称。

    如果您位于展开的视图中,请单击 查看详细信息

  4. 从“连接”页面中,单击要编辑的连接旁边的“操作”菜单 "操作" 菜单,然后选择 编辑

    从此处,可以更改所选网络连接的名称。

从 CLI 编辑连接

要从 CLI 编辑连接,请执行以下命令:

ibmcloud tg connection-update|cu GATEWAY_ID CONNECTION_ID --name NAME [--output json] [-h, --help]

其中:

  • GATEWAY_ID: 正在更新连接的网关的标识。

  • CONNECTION_ID: 要更新的连接的标识。

    • -name:连接的新名称。
  • -- output json: 可选: 指定是否要以 JSON 格式显示输出。

  • --help |-h:可选:获取该命令的帮助。

示例

此示例说明如何更新与 MyConn2 的连接的名称:

ibmcloud tg cu $gateway $connection --name MyConn2

编辑与 API 的连接

您可以使用 API 更新 Transit Gateway 的连接名称。

请求示例

此示例说明如何编辑 Transit Gateway 连接的名称:

curl -H "Content-Type: application/json" -X PATCH https://$TS_ENDPOINT/v1/transit_gateways/$GATEWAY_ID/connections/$CONNECTION_ID?version=2020-03-31   -H "authorization: Bearer $IAM_TOKEN"   -d '{
  "name":  "Transit_Service_BWTN_SJ_DL",
  "prefix_filters_default":  "permit"
}'

响应示例

以下响应指示已成功更新连接:

{
  "name": "Transit_Service_BWTN_SJ_DL",
  "network_id": "crn:v1:bluemix:public:is:us-south:a/123456::vpc:4727d842-f94f-4a2d-824a-9bc9b02c523b",
  "network_type": "vpc",
  "id": "1a15dca5-7e33-45e1-b7c5-bc690e569531",
  "base_connection_id": "975f58c1-afe7-469a-9727-7f3d720f2d32",
  "created_at": "2022-02-10T14:52:54.918Z",
  "local_bgp_asn": 64490,
  "local_gateway_ip": "192.168.100.1",
  "local_tunnel_ip": "192.168.129.2",
  "mtu": 9000,
  "network_account_id": "28e4d90ac7504be694471ee66e70d0d5",
  "prefix_filters": [
    {
      "action": "permit",
      "before": "1a15dcab-7e40-45e1-b7c5-bc690eaa9782",
      "created_at": "2022-02-10T14:52:54.918Z",
      "ge": 0,
      "id": "1a15dcab-7e30-45e1-b7c5-bc690eaa9865",
      "le": 32,
      "prefix": "192.168.100.0/24",
      "updated_at": "2022-02-10T14:52:54.918Z"
    }
  ],
  "prefix_filters_default": "permit",
  "remote_bgp_asn": 65010,
  "remote_gateway_ip": "10.242.63.12",
  "remote_tunnel_ip": "192.168.129.1",
  "request_status": "pending",
  "status": "attached",
  "updated_at": "2022-02-10T14:52:54.918Z",
  "zone": {
    "name": "us-south-1"
  }
}

有关更多信息,请参阅 Transit Gateway API 参考中的 更新指定的 Transit Gateway 连接

使用 terraform 编辑连接

编辑 Transit Gateway 连接时,可以为资源指定以下参数引用:

用于编辑连接的 Terraform 参数引用
参数 详细信息
gateway
必需
字符串
输入 Transit Gateway 标识。
network_type
必需
字符串
输入网络类型。 允许的值为 classic, directlink, gre_tunnel, unbound_gre_tunnel, and vpc
name
可选
字符串
输入名称。 如果未提供名称,那么将根据网络类型提供缺省名称,例如 vpc 表示网络类型 VPC,classic 表示网络类型经典。

示例

此示例说明如何编辑 Terraform 中的 Transit Gateway 连接:

resource "ibm_tg_connection" "test_ibm_tg_connection" {
  gateway      = ibm_tg_gateway.test_tg_gateway.id
  network_type = "vpc"
  name         = "myconnection"
}