doc-exports/docs/waf/api-ref/waf_02_0037.html
Li, Qiao 914011d51b waf_api_1109
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: Li, Qiao <qiaoli@huawei.com>
Co-committed-by: Li, Qiao <qiaoli@huawei.com>
2022-11-16 15:31:27 +00:00

172 lines
14 KiB
HTML

<a name="waf_02_0037"></a><a name="waf_02_0037"></a>
<h1 class="topictitle1">Adding a Blacklist or Whitelist Rule</h1>
<div id="body26455201"><div class="section" id="waf_02_0037__section3580440"><h4 class="sectiontitle">Function Description</h4><p class="msonormal" id="waf_02_0037__p62496568">This API is used to add a blacklist or whitelist rule.</p>
</div>
<div class="section" id="waf_02_0037__section32223962"><h4 class="sectiontitle">URI</h4><ul id="waf_02_0037__ul29057210"><li id="waf_02_0037__li60188304">URI format<p id="waf_02_0037__p4823825"><a name="waf_02_0037__li60188304"></a><a name="li60188304"></a>POST /v1/{project_id}/waf/policy/{policy_id}/whiteblackip</p>
</li><li id="waf_02_0037__li43414432">Parameter description
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="waf_02_0037__table55185573" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Path parameters</caption><thead align="left"><tr id="waf_02_0037__row48252727"><th align="left" class="cellrowborder" valign="top" width="25.507449255074494%" id="mcps1.3.2.2.2.1.2.5.1.1"><p id="waf_02_0037__p16156794"><strong id="waf_02_0037__b17547122985512">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17.348265173482652%" id="mcps1.3.2.2.2.1.2.5.1.2"><p id="waf_02_0037__p33631909"><strong id="waf_02_0037__b1484893425518">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17.348265173482652%" id="mcps1.3.2.2.2.1.2.5.1.3"><p id="waf_02_0037__p39830113"><strong id="waf_02_0037__b193819366552">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="39.796020397960206%" id="mcps1.3.2.2.2.1.2.5.1.4"><p id="waf_02_0037__p5013717"><strong id="waf_02_0037__b8445153815513">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="waf_02_0037__row3457962"><td class="cellrowborder" valign="top" width="25.507449255074494%" headers="mcps1.3.2.2.2.1.2.5.1.1 "><p id="waf_02_0037__p11659528">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.2.2.2.1.2.5.1.2 "><p id="waf_02_0037__p4897686">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.2.2.2.1.2.5.1.3 "><p id="waf_02_0037__p61168252">String</p>
</td>
<td class="cellrowborder" valign="top" width="39.796020397960206%" headers="mcps1.3.2.2.2.1.2.5.1.4 "><p id="waf_02_0037__p55681379">Specifies the project ID.</p>
</td>
</tr>
<tr id="waf_02_0037__row31370366"><td class="cellrowborder" valign="top" width="25.507449255074494%" headers="mcps1.3.2.2.2.1.2.5.1.1 "><p id="waf_02_0037__p57971721">policy_id</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.2.2.2.1.2.5.1.2 "><p id="waf_02_0037__p65197800">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.2.2.2.1.2.5.1.3 "><p id="waf_02_0037__p46530436">String</p>
</td>
<td class="cellrowborder" valign="top" width="39.796020397960206%" headers="mcps1.3.2.2.2.1.2.5.1.4 "><p id="waf_02_0037__p10868932">Specifies the policy ID.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li></ul>
</div>
<div class="section" id="waf_02_0037__section21580205"><h4 class="sectiontitle">Request</h4><div class="p" id="waf_02_0037__p1925171234414">Request parameters
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="waf_02_0037__table41450321" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Parameter description</caption><thead align="left"><tr id="waf_02_0037__row48860259"><th align="left" class="cellrowborder" valign="top" width="25.507449255074494%" id="mcps1.3.3.2.1.2.5.1.1"><p id="waf_02_0037__p65366944"><strong id="waf_02_0037__b6553152317584">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17.348265173482652%" id="mcps1.3.3.2.1.2.5.1.2"><p id="waf_02_0037__p60231101"><strong id="waf_02_0037__b12916324105817">Mandatory</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17.348265173482652%" id="mcps1.3.3.2.1.2.5.1.3"><p id="waf_02_0037__p46880994"><strong id="waf_02_0037__b1867627155810">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="39.796020397960206%" id="mcps1.3.3.2.1.2.5.1.4"><p id="waf_02_0037__p39264184"><strong id="waf_02_0037__b271892815817">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="waf_02_0037__row26282342"><td class="cellrowborder" valign="top" width="25.507449255074494%" headers="mcps1.3.3.2.1.2.5.1.1 "><p id="waf_02_0037__p48494997">addr</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.3.2.1.2.5.1.2 "><p id="waf_02_0037__p35780717">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.3.2.1.2.5.1.3 "><p id="waf_02_0037__p12556949">String</p>
</td>
<td class="cellrowborder" valign="top" width="39.796020397960206%" headers="mcps1.3.3.2.1.2.5.1.4 "><p id="waf_02_0037__p10479925">Specifies the public IP address or range (IP address and subnet mask). For example, <em id="waf_02_0037__i164311921102413">X.X.</em><strong id="waf_02_0037__b10431621162410">0.125</strong> or <em id="waf_02_0037__i9431621142417">X.X.</em><strong id="waf_02_0037__b17431192142417">6.0/24</strong>.</p>
</td>
</tr>
<tr id="waf_02_0037__row27210466"><td class="cellrowborder" valign="top" width="25.507449255074494%" headers="mcps1.3.3.2.1.2.5.1.1 "><p id="waf_02_0037__p56564138">white</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.3.2.1.2.5.1.2 "><p id="waf_02_0037__p18292479">No</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.3.2.1.2.5.1.3 "><p id="waf_02_0037__p5295816">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="39.796020397960206%" headers="mcps1.3.3.2.1.2.5.1.4 "><p id="waf_02_0037__p131673177539">Specifies the IP address type.</p>
<ul id="waf_02_0037__ul3374102111535"><li id="waf_02_0037__li1039914614531"><strong id="waf_02_0037__b12249191451113">1</strong>: <strong id="waf_02_0037__b3249121421117">Whitelist</strong></li><li id="waf_02_0037__li113741219533"><strong id="waf_02_0037__b158811021111114">0</strong>: <strong id="waf_02_0037__b118815212112">Blacklist</strong></li></ul>
<p id="waf_02_0037__p26307950">If you do not configure the <strong id="waf_02_0037__b68703121776">white</strong> parameter, the value is <strong id="waf_02_0037__b162551040274">Blacklist</strong> by default.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="section" id="waf_02_0037__section60004123"><h4 class="sectiontitle">Response</h4><div class="p" id="waf_02_0037__p12451548114414">Response parameters
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="waf_02_0037__table8657213" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Parameter description</caption><thead align="left"><tr id="waf_02_0037__row15637064"><th align="left" class="cellrowborder" valign="top" width="42.85571442855714%" id="mcps1.3.4.2.1.2.4.1.1"><p id="waf_02_0037__p58642663"><strong id="waf_02_0037__b18629191812212">Parameter</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17.348265173482652%" id="mcps1.3.4.2.1.2.4.1.2"><p id="waf_02_0037__p52435287"><strong id="waf_02_0037__b163410207216">Type</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="39.796020397960206%" id="mcps1.3.4.2.1.2.4.1.3"><p id="waf_02_0037__p19399872"><strong id="waf_02_0037__b161135218210">Description</strong></p>
</th>
</tr>
</thead>
<tbody><tr id="waf_02_0037__row40381121"><td class="cellrowborder" valign="top" width="42.85571442855714%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="waf_02_0037__p49645329">id</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="waf_02_0037__p61848685">String</p>
</td>
<td class="cellrowborder" valign="top" width="39.796020397960206%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="waf_02_0037__p43687614">Specifies the ID of a blacklist or whitelist rule.</p>
</td>
</tr>
<tr id="waf_02_0037__row57644214"><td class="cellrowborder" valign="top" width="42.85571442855714%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="waf_02_0037__p38669777">policy_id</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="waf_02_0037__p45244245">String</p>
</td>
<td class="cellrowborder" valign="top" width="39.796020397960206%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="waf_02_0037__p40905192">Specifies the policy ID.</p>
</td>
</tr>
<tr id="waf_02_0037__row32602416"><td class="cellrowborder" valign="top" width="42.85571442855714%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="waf_02_0037__p23550048">addr</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="waf_02_0037__p28505716">String</p>
</td>
<td class="cellrowborder" valign="top" width="39.796020397960206%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="waf_02_0037__p27261653">Specifies the public IP address or range (IP address and subnet mask). For example, <em id="waf_02_0037__i1643143082412">X.X.</em><strong id="waf_02_0037__b04316301241">0.125</strong> or <em id="waf_02_0037__i1043153052411">X.X.</em><strong id="waf_02_0037__b104312030172418">6.0/24</strong>.</p>
</td>
</tr>
<tr id="waf_02_0037__row44028285"><td class="cellrowborder" valign="top" width="42.85571442855714%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="waf_02_0037__p9521339">white</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="waf_02_0037__p33031034">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="39.796020397960206%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="waf_02_0037__p2060412271548">Specifies the IP address type.</p>
<ul id="waf_02_0037__ul1460411278541"><li id="waf_02_0037__li1860516279540"><strong id="waf_02_0037__b240313434116">1</strong>: <strong id="waf_02_0037__b104033431117">Whitelist</strong></li><li id="waf_02_0037__li2607162716542"><strong id="waf_02_0037__b335518458113">0</strong>: <strong id="waf_02_0037__b93555455116">Blacklist</strong></li></ul>
<p id="waf_02_0037__p58268130">If you do not configure the <strong id="waf_02_0037__b5174172911915">white</strong> parameter, the value is <strong id="waf_02_0037__b14175132910914">Blacklist</strong> by default.</p>
</td>
</tr>
<tr id="waf_02_0037__row54651124"><td class="cellrowborder" valign="top" width="42.85571442855714%" headers="mcps1.3.4.2.1.2.4.1.1 "><p id="waf_02_0037__p64664939">timestamp</p>
</td>
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.4.2.1.2.4.1.2 "><p id="waf_02_0037__p3368735">Long</p>
</td>
<td class="cellrowborder" valign="top" width="39.796020397960206%" headers="mcps1.3.4.2.1.2.4.1.3 "><p id="waf_02_0037__p4432119">Specifies the time when a blacklist or whitelist rule is added.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="section" id="waf_02_0037__section13981105484415"><h4 class="sectiontitle">Examples</h4><p id="waf_02_0037__p183886403559"><em id="waf_02_0037__i8965813122515">X.X.</em><strong id="waf_02_0037__b5840717162511">0.125</strong> is used as an example.</p>
<ul id="waf_02_0037__ul9998954134411"><li id="waf_02_0037__li14998115413443">Request example<pre class="screen" id="waf_02_0037__screen17998135474418">{
"addr": "X.X.0.125",
"white": 1
}</pre>
</li></ul>
<ul id="waf_02_0037__ul189985548441"><li id="waf_02_0037__li79981454164410">Response example<pre class="screen" id="waf_02_0037__screen39981554174412">{
"id": "44d887434169475794b2717438f7fa78",
"policy_id": "ertr45c0f96784ec8abd8ba61a98064ef",
"addr": "X.X.0.125",
"white": 1,
"timestamp": 1499817600
}</pre>
</li></ul>
</div>
<div class="section" id="waf_02_0037__section3166195"><h4 class="sectiontitle">Status Code</h4><div class="p" id="waf_02_0037__waf_02_0012_a652d4922b7df48fca0a65bc1a38ea5f2"><a href="#waf_02_0037__waf_02_0012_t82c3440f3efb42a38b9d4dc4011a33d0">Table 4</a> describes the normal status code returned by the API.
<div class="tablenoborder"><a name="waf_02_0037__waf_02_0012_t82c3440f3efb42a38b9d4dc4011a33d0"></a><a name="waf_02_0012_t82c3440f3efb42a38b9d4dc4011a33d0"></a><table cellpadding="4" cellspacing="0" summary="" id="waf_02_0037__waf_02_0012_t82c3440f3efb42a38b9d4dc4011a33d0" frame="border" border="1" rules="all"><caption><b>Table 4 </b>Status code</caption><thead align="left"><tr id="waf_02_0037__waf_02_0012_r3d6e2f205c444705bdbb9daaac74e575"><th align="left" class="cellrowborder" valign="top" width="22%" id="mcps1.3.6.2.2.2.4.1.1"><p id="waf_02_0037__waf_02_0012_af3c4073076f24eca88d94e3fa1effdc6">Status Code</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="19.41%" id="mcps1.3.6.2.2.2.4.1.2"><p id="waf_02_0037__waf_02_0012_en-us_topic_0144911667_p4531342288">Description</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="58.589999999999996%" id="mcps1.3.6.2.2.2.4.1.3"><p id="waf_02_0037__waf_02_0012_ada185614bba24140995b8123b3e9faa8">Meaning</p>
</th>
</tr>
</thead>
<tbody><tr id="waf_02_0037__waf_02_0012_rc7b2adc390904a1ba79e303017797786"><td class="cellrowborder" valign="top" width="22%" headers="mcps1.3.6.2.2.2.4.1.1 "><p id="waf_02_0037__waf_02_0012_a93f3895d44bb4226934cc626ac50e37b">200</p>
</td>
<td class="cellrowborder" valign="top" width="19.41%" headers="mcps1.3.6.2.2.2.4.1.2 "><p id="waf_02_0037__waf_02_0012_en-us_topic_0144911667_p7538425819">OK</p>
</td>
<td class="cellrowborder" valign="top" width="58.589999999999996%" headers="mcps1.3.6.2.2.2.4.1.3 "><p id="waf_02_0037__waf_02_0012_en-us_topic_0144911667_p369874114414">The request has succeeded.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p id="waf_02_0037__waf_02_0012_en-us_topic_0144911667_p482819399522">For details about error status codes, see <a href="waf_02_0085.html">Status Codes</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="waf_02_0035.html">Blacklist and Whitelist Rules</a></div>
</div>
</div>