# API - 连接到 Google Cloud Platform 使用 Fabric 端口、Fabric Cloud Router 或服务令牌与 Google Cloud Partner Interconnect 建立直接的第 2 层连接。 ![](https://docs.equinix.com/zh-Hans/assets/images/connectToGoogle-73a150d957737a8b28aab08b1ac4127d.png) 注意 有关从Network Edge虚拟设备连接的说明, 请参阅[Network Edge至Google云平台](https://docs.equinix.com/zh-Hans/fabric-marketplace/connecting-to-service-provider/gcp/fabric-gcp-googleqc.md)。 ## 先决条件 1. 身份验证 - 提交您的 OAuth2 用户凭据、客户端 ID 和客户端密钥 验证。有关如何致电OAuth API以验证和验证您的凭据的说明,请参阅[API验证](https://docs.equinix.com/zh-Hans/equinix-api/api-authentication.md)。 2. 确定A侧信息。以下任一项: * 使用[获取所有端口](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4.md#tag/Ports/operation/getPorts)API请求检索您的Equinix Fabric端口信息。 或 * 确定您的Fabric Cloud Router信息。向端点发送请求[`/fabric/v4/routers/search`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4.md#tag/Cloud-Routers/operation/searchCloudRouters),以检查可用的云路由器`POST`。您需要路由器的UUID。 或 * 通过向端点发送请求[`/fabric/v4/serviceTokens`](https://docs.equinix.com/api-catalog/fabricv4/#tag/Service-Tokens/operation/getServiceTokens)来检索A端服务令牌`GET`。您需要令牌的UUID。A端令牌提供配置连接A端的相关信息。 3. 选择Z侧都会区位置。使用[获取所有都会区](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4.md#tag/Metros/operation/getMetros)API请求查找Equinix Fabric可用的所有都会区并确定目标位置。 4. 确定Google Cloud合作伙伴互连服务配置文件信息。有关您应选择的服务配置文件的更多信息,请参见“[概述](https://docs.equinix.com/zh-Hans/fabric-marketplace/connecting-to-service-provider/gcp/gcp-interconnect-overview.md#redundancy-and-service-profiles)”页面。 * 区域1 -`bd4570e2-d792-4a00-87f5-3bde040cdcd7` * 区域2 -`b97dacca-abe6-4e8c-8be1-fcdd1be1defe` 5. 验证您的授权密钥。向端点发送`POST`请求[`/fabric/v4/connections/validate`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4.md#tag/Connections/operation/validateConnections),以验证您的配对密钥是否可用于在给定都会区创建与所选服务配置文件的连接。 ## 从 DOT1Q 端口连接 要创建从您的Dot1q端口到Google Cloud Partner互连的连接,请向端点发送`POST`请求[`/fabric/v4/connections`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4.md#tag/Connections/operation/createConnection)。连接`type`为`EVPL_VC`。 在对象中提供您的端口信息`aSide`,包括: * `accessPoint.type`AS`COLO` * 将您的端口UUID提供给`port.uuid` * 设置`linkProtocol.type`为`DOT1Q` * 将VLAN ID提供给`linkProtocol.vlanTag` 在对象中提供您的GCP详细信息和位置详细信息`zSide`,包括: * 设置`accessPoint.type`为`SP`。 * 设置`profile.type`为`L2_PROFILE`。 * 在中指定您要连接的服务配置文件`profile.uuid`。 * 在中指定您要连接的Equinix都会区位置`location.metroCode`。 * 设置`authenticationKey`为Google Cloud颁发的配对密钥。 确保: * 如果您正在创建连接,其中`redundancy`配对密钥以结尾`/1`,且您使用的是`PRIMARY`Google云合作伙伴互连区域1服务配置文件UUID`bd4570e2-d792-4a00-87f5-3bde040cdcd7`。 * 如果您正在创建连接,其中`redundancy`配对密钥以结尾`/2`,且您使用的是`SECONDARY`Google Cloud合作伙伴互连区域2服务配置文件UUID`b97dacca-abe6-4e8c-8be1-fcdd1be1defe`。 * 如果您要创建冗余连接,请发送两个 API 请求,每个冗余优先级一个请求。 在请求正文中指定任何其他连接配置详情。参数及其说明的完整列表,请参见[API参考手册](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4.md#tag/Connections/operation/createConnection)。 cURL 请求示例: ``` POST 'https://api.equinix.com/fabric/v4/connections' -H 'content-type: application/json' -H 'authorization: Bearer ' -d '{ "type": "EVPL_VC", "name": "", "bandwidth": , "redundancy": { "priority": "" }, "aSide": { "accessPoint": { "type": "COLO", "port": { "uuid": "" }, "linkProtocol": { "type": "DOT1Q", "vlanTag": } } }, "zSide": { "accessPoint": { "type": "SP", "profile": { "uuid": "" }, "location": { "metroCode": "" }, "authenticationKey": "", "sellerRegion": "" } }, "order": { "purchaseOrderNumber": "" }, "notifications": [ { "type": "ALL", "emails": [ "", "" ] } ] }' ``` ## 从 QINQ端口连接 要创建从QinQ端口到Google Cloud Partner互连的连接,请向端点发送`POST`请求[`/fabric/v4/connections`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4.md#tag/Connections/operation/createConnection)。连接`type`为`EVPL_VC`。 在对象中提供您的端口信息`aSide`,包括: * `accessPoint.type`AS`COLO` * 将您的端口UUID提供给`port.uuid` * 设置`linkProtocol.type`为`QINQ` * 向提供内部标记ID`linkProtocol.vlanCTag` * 向提供外部标记ID`linkProtocol.vlanSTag` 在对象中提供您的GCP详细信息和位置详细信息`zSide`,包括: * 设置`accessPoint.type`为`SP`。 * 设置`profile.type`为`L2_PROFILE`。 * 在中指定您要连接的服务配置文件`profile.uuid`。 * 在中指定您要连接的Equinix都会区位置`location.metroCode`。 * 设置`authenticationKey`为Google Cloud颁发的配对密钥。 确保: * 如果您正在创建连接,其中`redundancy`配对密钥以结尾`/1`,且您使用的是`PRIMARY`Google云合作伙伴互连区域1服务配置文件UUID`bd4570e2-d792-4a00-87f5-3bde040cdcd7`。 * 如果您正在创建连接,其中`redundancy`配对密钥以结尾`/2`,且您使用的是`SECONDARY`Google Cloud合作伙伴互连区域2服务配置文件UUID`b97dacca-abe6-4e8c-8be1-fcdd1be1defe`。 * 如果您要创建冗余连接,请发送两个 API 请求,每个冗余优先级一个请求。 在请求正文中指定任何其他连接配置详情。参数及其说明的完整列表,请参见[API参考手册](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4.md#tag/Connections/operation/createConnection)。 cURL 请求示例: ``` POST 'https://api.equinix.com/fabric/v4/connections' -H 'content-type: application/json' -H 'authorization: Bearer ' -d '{ "type": "EVPL_VC", "name": "", "bandwidth": "redundancy": { "priority: "" }, "aSide": { "accessPoint": { "type": "COLO", "port": { "uuid": "" }, "linkProtocol": { "type": "QINQ", "vlanCTag": , "vlanSTag": } } }, "zSide": { "accessPoint": { "type": "SP", "profile": { "uuid": "" }, "location": { "metroCode": "" }, "authenticationKey": "", "sellerRegion": "" } }, "order": { "purchaseOrderNumber": "" }, "notifications": [ { "type": "ALL", "emails": [ "", "" ] } ] }' ``` ## 从Fabric Cloud Router连接 要创建从Fabric Cloud Router到AWS的连接,请向端点发送`POST`请求[`/fabric/v4/connections`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4.md#tag/Connections/operation/createConnection)。连接`type`为`IP_VC`。 在对象中定义Fabric Cloud Router`aSide`,包括: * 设置`accessPoint.type`为`CLOUD_ROUTER`。 * 设置`router.uuid`为路由器的UUID。 在对象中提供您的GCP详细信息和位置详细信息`zSide`,包括: * 设置`accessPoint.type`为`SP`。 * 设置`profile.type`为`L2_PROFILE`。 * 在中指定您要连接的服务配置文件`profile.uuid`。 * 在中指定您要连接的Equinix都会区位置`location.metroCode`。 * 设置`authenticationKey`为Google Cloud颁发的配对密钥。 确保: * 如果您正在创建连接,其中`redundancy`配对密钥以结尾`/1`,且您使用的是`PRIMARY`Google云合作伙伴互连区域1服务配置文件UUID`bd4570e2-d792-4a00-87f5-3bde040cdcd7`。 * 如果您正在创建连接,其中`redundancy`配对密钥以结尾`/2`,且您使用的是`SECONDARY`Google Cloud合作伙伴互连区域2服务配置文件UUID`b97dacca-abe6-4e8c-8be1-fcdd1be1defe`。 * 如果您要创建冗余连接,请发送两个 API 请求,每个冗余优先级一个请求。 在请求正文中指定任何其他连接配置详情。参数及其说明的完整列表,请参见[API参考手册](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4.md#tag/Connections/operation/createConnection)。 cURL 请求示例: ``` POST 'https://api.equinix.com/fabric/v4/connections' -H 'content-type: application/json' -H 'authorization: Bearer ' -d '{ "type": "IP_VC", "name": "", "bandwidth": "redundancy": { "priority: "" }, "aSide": { "accessPoint": { "type": "CLOUD_ROUTER", "router": { "uuid": "" } } }, "zSide": { "accessPoint": { "type": "SP", "profile": { "uuid": "" }, "location": { "metroCode": "" }, "authenticationKey": "", "sellerRegion": "" } }, "order": { "purchaseOrderNumber": "" }, "notifications": [ { "type": "ALL", "emails": [ "", "" ] } ] }' ``` ## 使用服务令牌进行连接 要使用A侧服务令牌建立连接至AWS,请向端点发送`POST`请求[`/fabric/v4/connections`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4.md#tag/Connections/operation/createConnection)。连接`type`为`EVPL_VC`。 在对象中提供服务令牌UUID`aSide`。服务令牌提供建立连接所需的所有其他必要信息。 在对象中提供您的GCP详细信息和位置详细信息`zSide`,包括: * 设置`accessPoint.type`为`SP`。 * 设置`profile.type`为`L2_PROFILE`。 * 在中指定您要连接的服务配置文件`profile.uuid`。 * 在中指定您要连接的Equinix都会区位置`location.metroCode`。 * 设置`authenticationKey`为Google Cloud颁发的配对密钥。 确保: * 如果您正在创建连接,其中`redundancy`配对密钥以结尾`/1`,且您使用的是`PRIMARY`Google云合作伙伴互连区域1服务配置文件UUID`bd4570e2-d792-4a00-87f5-3bde040cdcd7`。 * 如果您正在创建连接,其中`redundancy`配对密钥以结尾`/2`,且您使用的是`SECONDARY`Google Cloud合作伙伴互连区域2服务配置文件UUID`b97dacca-abe6-4e8c-8be1-fcdd1be1defe`。 * 如果您要创建冗余连接,请发送两个 API 请求,每个冗余优先级一个请求。 在请求正文中指定任何其他连接配置详情。参数及其说明的完整列表,请参见[API参考手册](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4.md#tag/Connections/operation/createConnection)。 cURL 请求示例: ``` POST 'https://api.equinix.com/fabric/v4/connections' -H 'content-type: application/json' -H 'authorization: Bearer ' -d '{ "type": "EVPL_VC", "name": "", "bandwidth": "redundancy": { "priority: "" }, "aSide": { "serviceToken": { "uuid": "20d32a80-0d61-4333-bc03-707b591ae2f4" } }, "zSide": { "accessPoint": { "type": "SP", "profile": { "uuid": "" }, "location": { "metroCode": "" }, "authenticationKey": "", "sellerRegion": "" } }, "order": { "purchaseOrderNumber": "" }, "notifications": [ { "type": "ALL", "emails": [ "", "" ] } ] }' ``` ## 监控连接状态 向端点发送`GET`监控连接状态的请求[`fabric/v4/connections/{connectionId}`](https://docs.equinix.com/zh-Hans/api-catalog/fabricv4.md#tag/Connections/operation/getConnectionByUuid)。 | `equinixStatus`参数值 | `providerStatus`属性值 | **Google状态** | **描述** | | --------------------- | ---------------------- | ---------------------------------------- | --------------------------- | | `PROVISIONING` | `PROVISIONING` | | 连接请求尚未发送给 Google。 | | `PROVISIONED` | `PENDING_APPROVAL` | 正在等待服务提供商。 | 连接正在等待确认。 | | `PROVISIONED` | `PROVISIONING` | 需要激活 -> 需要配置边界网关协议 (BGP)。 | 连接正在建立中。 | | `PROVISIONED` | `PROVISIONED` | 待定 -> 可用 | 客户端已接受连接。 | ## 激活连接 使用Google云平台激活虚拟连接。有关如何使用Google云平台控制台激活连接的说明,请参阅[Google云文档](https://console.cloud.google.com/)。