forked from docs/doc-exports
Reviewed-by: Sarda, Priya <prsarda@noreply.gitea.eco.tsi-dev.otc-service.com> Co-authored-by: Hongwei, King Wang <king.wanghongwei@huawei.com> Co-committed-by: Hongwei, King Wang <king.wanghongwei@huawei.com>
7.7 KiB
7.7 KiB
Example 4: Creating a VPN Connection Monitor
Scenario
This section describes how to create a VPN connection monitor by calling APIs.
Prerequisites
- You have created a VPN connection. For details, see Creating a VPN Connection.
- You have obtained a user token if you need to use token authentication. In addition, you need to add X-Auth-Token to the request header when calling an API. For details about token authentication, see "Authentication" in the Virtual Private Cloud API Reference.
Data Preparation
Parameter |
Description |
Example Value |
---|---|---|
vpn_connection_id |
Specifies the ID of the VPN connection to be monitored. |
cae286f2-demo-a8df-va86-e22416ca1220 |
Procedure
- Create a VPN connection monitor.
- Send POST https://{endpoint}/v5/{project_id}/connection-monitors.
- Add X-Auth-Token to the request header.
- Specify the following parameters in the request body:
{ "connection_monitor": { "vpn_connection_id": "cae286f2-demo-a8df-va86-e22416ca1220" } }
- Check the response.
- The request is successful if the following response is displayed. In the response, id indicates the ID of a VPN connection monitor.
{ "connection_monitor": { "id": "76f64229-demo-a8df-va86-3907e2815b6d", "vpn_connection_id": "cae286f2-demo-a8df-va86-e22416ca1220", "type": "gateway", "source_ip": "88.***.***.60", "destination_ip": "192.***.***.0", "proto_type": "icmp" }, "request_id": "54af23d8-989e-445d-bb48-0a9da33d7f0f" }
- The request is successful if the following response is displayed. In the response, id indicates the ID of a VPN connection monitor.
- Query details about the VPN connection monitor.
- Send GET https://{endpoint}/v5/{project_id}/connection-monitors/{connection_monitor_id}.
- Add X-Auth-Token to the request header.
- Check the response.
- The request is successful if the following response is displayed. In the response, id indicates the ID of a VPN connection monitor.
{ "connection_monitor": { "id": "76f64229-demo-a8df-va86-3907e2815b6d", "status": "ACTIVE", "vpn_connection_id": "cae286f2-demo-a8df-va86-e22416ca1220", "type": "gateway", "source_ip": "88.***.***.60", "destination_ip": "192.***.***.0", "proto_type": "icmp" }, "request_id": "72d05395-0637-4f93-9844-b4979e9d7bdc" }
- The request is successful if the following response is displayed. In the response, id indicates the ID of a VPN connection monitor.
Parent topic: Application Examples