管理 Fabric 云路由器
先决条件
身份验证 - 请提交您的用户凭据、客户端 ID 和客户端密钥以进行 OAuth2 身份验证。有关如何调用 OAuth API 来验证和确认您的凭据的说明,请参阅API 身份验证。
搜索和检索 Fabric 云路由器
此 API 请求用于检索符合指定搜索条件的 Fabric Cloud Router 实例。向 /fabric/v4/routers/search 端点发送 POST 请求,并在请求正文中指定您的搜索条件。
| POST /fabric/v4/routers/search | |
|---|---|
| Method | POST |
| URL or Endpoint | /fabric/v4/routers/search |
| Headers | Authorization, Content-Type |
| Path Parameters | Not applicable |
| Query Parameters | Not applicable |
| Body Parameters | filter, pagination, sort |
示例 curl 请求:
curl -X POST 'http: //api.equinix.com/fabric/v4/routers/search'
-H 'content-type: application/json'
-H 'authorization: Bearer <token>'
-d '{
"filter": {
"and": [
{
"property": "/name",
"operator": "LIKE",
"values": [
"%Test%"
]
},
{
"property": "/state",
"operator": "=",
"values": [
"PROVISIONED"
]
},
{
"property": "/project/projectId",
"operator": "=",
"values": [
"995072000433550"
]
},
{
"property": "/location/metroCode",
"operator": "=",
"values": [
"SV"
]
}
]
},
"pagination": {
"offset": 0,
"limit": 20
},
"sort": [
{
"direction": "DESC",
"property": "/changeLog/createdDateTime"
}
]
}'
值得注意的身体参数:
-
filter(必填)object - 定义搜索条件的对象。 -
and(必填)array[object] - 一个数组对象,用作应用于数组中搜索对象的逻辑运算符。您可以搜索:property(必填)string - 搜索字段参数。请注意,属性值决定了适用的运算符和值列表。适用值:"/name"、"/uuid"、"/state"、"/location/metroCode"、"/location/metroName"、"/package/code"和全类别搜索"\*"。operator(必填)string - 搜索字段参数运算符。适用值:"="、"!="、">"、">="、"<"、"<="、BETWEEN、LIKE、IN、"NOT BETWEEN"、"NOT LIKE"、"NOT IN"。value(必填)array[string] - 搜索字段参数值。
-
paginationobject - 可选对象,包含搜索结果分页设置,带有offsetinteger 和limitinteger 字段。 -
sortobject - 可选对象,用于定义搜索结果排序设置,包含directionstring 和propertystring 字段。
有关可搜索属性、分页限制和可排序属性的完整列表,请参阅API 参考。
示例响应:
{
"pagination": {
"offset": 0,
"limit": 20,
"total": 1,
"next": "/search?offset=4&limit=2",
"previous": "/search?offset=0&limit=2"
},
"data": [
{
"href": "https://api.equinix.com/fabric/v4/routers/201b7346-a9eb-42fe-ae7a-08148c71928d",
"uuid": "201b7346-a9eb-42fe-ae7a-08148c71928d",
"state": "PROVISIONED",
"type": "XF_ROUTER",
"name": "My-Fabric-Cloud-Router",
"location": {
"metroCode": "HH"
},
"package": {
"code": "LAB"
},
"order": {
"purchaseOrderNumber": "1-129105284100"
},
"project": {
"projectId": "12345"
},
"notifications": [
{
"type": "ALL",
"emails": [
"abc@abc.com"
]
}
],
"account": {
"accountNumber": 123
},
"bgpIpv4RoutesCount": 0,
"bgpIpv6RoutesCount": 0,
"connectionsCount": 0,
"changeLog": {
"createdBy": "abc@xyz.com",
"createdByFullName": "abc",
"createdByEmail": "abc@xyz.com",
"createdDateTime": "2021-09-24T06:59:46Z"
}
}
]
}
获取指定Fabric Cloud Router
此 API 请求检索指定 Fabric 云路由器的详细信息,向 /fabric/v4/routers/{uuid} 端点发送 GET 请求,并在请求路径中使用 uuid。
| GET /fabric/v4/routers/{uuid} | |
|---|---|
| Method | GET |
| URL or Endpoint | /fabric/v4/routers/{uuid} |
| Headers | Authorization, Content-Type |
| Path Parameters | uuid |
| Query Parameters | Not applicable |
| Body Parameters | Not applicable |
示例 curl 请求:
curl -X
GET 'https://api.equinix.com/fabric/v4/routers/{router_uuid}'
-H 'content-type: application/json'
-H 'authorization: Bearer <token>'
示例响应:
{
"href": "https://api.equinix.com/fabric/v4/routers/201b7346-a9eb-42fe-ae7a-08148c71928d",
"uuid": "201b7346-a9eb-42fe-ae7a-08148c71928d",
"state": "PROVISIONED",
"type": "XF_ROUTER",
"name": "My-Fabric-Cloud-Router",
"location": {
"metroCode": "HH"
},
"package": {
"code": "LAB"
},
"order": {
"purchaseOrderNumber": "1-129105284100"
},
"project": {
"projectId": "12345"
},
"notifications": [
{
"type": "ALL",
"emails": [
"abc@abc.com"
]
}
],
"account": {
"accountNumber": 123
},
"bgpIpv4RoutesCount": 0,
"bgpIpv6RoutesCount": 0,
"distinctIpv4PrefixesCount": 4,
"distinctIpv6PrefixesCount": 4,
"connectionsCount": 0,
"changeLog": {
"createdBy": "abc@xyz.com",
"createdByFullName": "abc",
"createdByEmail": "abc@xyz.com",
"createdDateTime": "2021-09-24T06:59:46Z"
}
}
更新 Fabric Cloud 路由器
要更新 Fabric 云路由器,请向 /fabric/v4/routers/{routerId} 端点发送 PATCH 请求,并在请求正文中附上要更新的参数。您可以更新名称或更改包名。
| PATCH /fabric/v4/routers/{uuid} | |
|---|---|
| Method | PATCH |
| URL or Endpoint | /fabric/v4/routers/{uuid} |
| Headers | Authorization, Content-Type |
| Path Parameters | uuid |
| Query Parameters | Not applicable |
| Body Parameters | op, path, value |
示例 curl 请求:
curl -X
PATCH 'https: //api.equinix.com/fabric/v4/routers/{router_uuid}'
-H 'content-type: application/json'
-H 'authorization: Bearer <token>'
-d '[
{
"op": "replace",
"path": "/name",
"value": "Cloud-Router-2"
}
]'
值得注意的身体参数:
op(必填)string - 更新请求类型。适用值:replace、add或remove。path(必填)string - 要更新的值的参数路径。适用值:"/name"或"/package/code"。value(必填)string - 新的参数值。
有关可更新字段及其值的完整列表,请参阅API 参考。
删除 Fabric 云路由器
要删除 Fabric 云路由器,请向 /fabric/v4/routers/{uuid} 端点发送 DELETE 请求。在路径中通过 uuid 指定要删除的路由器。
| DELETE /fabric/v4/routers/{uuid} | |
|---|---|
| Method | DELETE |
| URL or Endpoint | /fabric/v4/routers/{uuid} |
| Headers | Authorization, Content-Type |
| Path Parameters | uuid |
| Query Parameters | Not applicable |
| Body Parameters | Not applicable |
示例 curl 请求:
curl -X
DELETE 'https://api.equinix.com/fabric/v4/routers/{router_uuid}'
-H 'content-type: application/json'
-H 'authorization: Bearer <token>'