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>
70 lines
7.7 KiB
HTML
70 lines
7.7 KiB
HTML
<a name="EN-US_TOPIC_0000001807370496"></a><a name="EN-US_TOPIC_0000001807370496"></a>
|
|
|
|
<h1 class="topictitle1">Example 4: Creating a VPN Connection Monitor</h1>
|
|
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_section3366124216585"><h4 class="sectiontitle">Scenario</h4><p id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_p1525144825813">This section describes how to create a VPN connection monitor by calling APIs.</p>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_section58820918592"><h4 class="sectiontitle">Prerequisites</h4><ul id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_ul148861650152820"><li id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_li10886165012816">You have created a VPN connection. For details, see <a href="vpn_api_0027.html#EN-US_TOPIC_0000001854169149">Creating a VPN Connection</a>.</li></ul>
|
|
<ul id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_ul124612035154812"><li id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_li184618358484">You have obtained a user token if you need to use token authentication. In addition, you need to add <strong id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_b134700942803336">X-Auth-Token</strong> to the request header when calling an API. For details about token authentication, see "Authentication" in the <em id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_i1713818812418">Virtual Private Cloud API Reference</em>.</li></ul>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_section4141642175915"><h4 class="sectiontitle">Data Preparation</h4>
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_table444111294349" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Key parameters in the request for creating a VPN connection monitor</caption><thead align="left"><tr id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_row3459182917345"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.3.2.2.4.1.1"><p id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_p194595291340">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="31.783178317831783%" id="mcps1.3.3.2.2.4.1.2"><p id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_p2459112916345">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="34.88348834883489%" id="mcps1.3.3.2.2.4.1.3"><p id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_p11459102913414">Example Value</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_row7459122923420"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.3.2.2.4.1.1 "><p id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_p74596297347">vpn_connection_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="31.783178317831783%" headers="mcps1.3.3.2.2.4.1.2 "><p id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_p490732062714">Specifies the ID of the VPN connection to be monitored.</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="34.88348834883489%" headers="mcps1.3.3.2.2.4.1.3 "><p id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_p645910291347"><span id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_ph1242564692316">cae286f2-demo-a8df-va86-e22416ca1220</span></p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_section1792115611597"><h4 class="sectiontitle">Procedure</h4><ol id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_ol1033516371743"><li id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_li133351379413">Create a VPN connection monitor.<ol type="a" id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_ol7630731105015"><li id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_li18354814195019">Send <strong id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_b48168341325">POST https://{endpoint}/v5/{project_id}/connection-monitors</strong>.</li><li id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_li12354121485016">Add <strong id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_b3388755860515">X-Auth-Token</strong> to the request header.</li><li id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_li735414146508">Specify the following parameters in the request body:<pre class="screen" id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_screen1778465375316">{
|
|
"connection_monitor": {
|
|
"vpn_connection_id": "cae286f2-demo-a8df-va86-e22416ca1220"
|
|
}
|
|
}</pre>
|
|
</li><li id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_li1963133185019">Check the response.<ul id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_ul1363113195012"><li id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_li1463173112507">The request is successful if the following response is displayed. In the response, <strong id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_b961442221817">id</strong> indicates the ID of a VPN connection monitor.<pre class="screen" id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_screen678017232489">{
|
|
"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"
|
|
}</pre>
|
|
</li></ul>
|
|
</li></ol>
|
|
</li><li id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_li1355101465012">Query details about the VPN connection monitor.<ol type="a" id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_ol95722017111819"><li id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_li557281720184">Send <strong id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_b2770149327">GET https://{endpoint}/v5/{project_id}/connection-monitors/{connection_monitor_id}</strong>.</li><li id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_li1457214173183">Add <strong id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_b679343160515">X-Auth-Token</strong> to the request header.</li><li id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_li15572717141815">Check the response.<ul id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_ul1057214178189"><li id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_li155727173189">The request is successful if the following response is displayed. In the response, <strong id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_b692809169">id</strong> indicates the ID of a VPN connection monitor.<pre class="screen" id="EN-US_TOPIC_0000001807370496__en-us_topic_0000001594472941_screen17982737153017">{
|
|
"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"
|
|
}</pre>
|
|
</li></ul>
|
|
</li></ol>
|
|
</li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="vpn_api_0039.html">Application Examples</a></div>
|
|
</div>
|
|
</div>
|
|
|