forked from docs/doc-exports
Reviewed-by: Sarda, Priya <prsarda@noreply.gitea.eco.tsi-dev.otc-service.com> Co-authored-by: Qin Ying, Fan <fanqinying@huawei.com> Co-committed-by: Qin Ying, Fan <fanqinying@huawei.com>
202 lines
16 KiB
HTML
202 lines
16 KiB
HTML
<a name="vpc_sg01_0009"></a><a name="vpc_sg01_0009"></a>
|
|
|
|
<h1 class="topictitle1">Associating Multiple NIC Ports to or Disassociating Them from a Security Group at a Time</h1>
|
|
<div id="body1534421681639"><div class="section" id="vpc_sg01_0009__section19171415101615"><h4 class="sectiontitle">Function</h4><p id="vpc_sg01_0009__p177501515101611">This API is used to associate multiple NIC ports to or disassociate them from a specified security group at a time.</p>
|
|
<p id="vpc_sg01_0009__p1415012463246">Restrictions</p>
|
|
<ul id="vpc_sg01_0009__ul57503154165"><li id="vpc_sg01_0009__li1750415141612">A maximum of 20 ports can be associated to or disassociated from a security group at a time. Therefore, the <strong id="vpc_sg01_0009__b842352706142111">ports</strong> can contain a maximum of 20 values.</li><li id="vpc_sg01_0009__li1675041571613">No error message is displayed if a port is repeatedly associated with a security group.</li></ul>
|
|
</div>
|
|
<div class="section" id="vpc_sg01_0009__section1173915101614"><h4 class="sectiontitle">URI</h4><p id="vpc_sg01_0009__p1513102612248">POST /v2.0/{project_id}/security-groups/{security_group_id}/instance/action</p>
|
|
<div class="p" id="vpc_sg01_0009__p18287171515219"><a href="#vpc_sg01_0009__table7179415121614">Table 1</a> describes the parameters.
|
|
<div class="tablenoborder"><a name="vpc_sg01_0009__table7179415121614"></a><a name="table7179415121614"></a><table cellpadding="4" cellspacing="0" summary="" id="vpc_sg01_0009__table7179415121614" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter description</caption><thead align="left"><tr id="vpc_sg01_0009__row67501815151611"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.2.3.2.2.4.1.1"><p id="vpc_sg01_0009__p117501155166"><strong id="vpc_sg01_0009__b842352706195711">Name</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.2.3.2.2.4.1.2"><p id="vpc_sg01_0009__p15750121513169"><strong id="vpc_sg01_0009__b84235270615219">Mandatory</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.2.3.2.2.4.1.3"><p id="vpc_sg01_0009__p16750141512163"><strong id="vpc_sg01_0009__b8423527061645">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="vpc_sg01_0009__row57502152163"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.3.2.2.4.1.1 "><p id="vpc_sg01_0009__p12750191511167">project_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.3.2.2.4.1.2 "><p id="vpc_sg01_0009__p15750141581618">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.3.2.2.4.1.3 "><p id="vpc_sg01_0009__p10487112">Specifies the project ID. </p>
|
|
</td>
|
|
</tr>
|
|
<tr id="vpc_sg01_0009__row1475016159162"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.3.2.2.4.1.1 "><p id="vpc_sg01_0009__p1475041510165">security_group_id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.3.2.2.4.1.2 "><p id="vpc_sg01_0009__p6750315121612">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.3.2.2.4.1.3 "><p id="vpc_sg01_0009__p197508154161">Specifies the security group ID, which uniquely identifies the security group.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="vpc_sg01_0009__section720601541612"><h4 class="sectiontitle">Request Message</h4><ul id="vpc_sg01_0009__ul2751215161613"><li id="vpc_sg01_0009__li6751181518160">Request parameter
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="vpc_sg01_0009__table1022441561614" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request parameter</caption><thead align="left"><tr id="vpc_sg01_0009__row975131518166"><th align="left" class="cellrowborder" valign="top" width="15.308469153084694%" id="mcps1.3.3.2.1.1.2.5.1.1"><p id="vpc_sg01_0009__p11751131519166"><strong id="vpc_sg01_0009__b289219415">Name</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="15.308469153084694%" id="mcps1.3.3.2.1.1.2.5.1.2"><p id="vpc_sg01_0009__p197511815141617"><strong id="vpc_sg01_0009__b1280538205">Mandatory</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="17.348265173482652%" id="mcps1.3.3.2.1.1.2.5.1.3"><p id="vpc_sg01_0009__p11751171520163"><strong id="vpc_sg01_0009__b842352706145623">Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="52.03479652034796%" id="mcps1.3.3.2.1.1.2.5.1.4"><p id="vpc_sg01_0009__p1975111511162"><strong id="vpc_sg01_0009__b64400267">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="vpc_sg01_0009__row175311156169"><td class="cellrowborder" valign="top" width="15.308469153084694%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="vpc_sg01_0009__p1175310154166">ports</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.308469153084694%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="vpc_sg01_0009__p11753315161614">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="vpc_sg01_0009__p1975321591618">Array of <a href="#vpc_sg01_0009__table425751511619">Port</a> objects</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="52.03479652034796%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="vpc_sg01_0009__p177531515171617">Specifies the port list. A maximum of 20 ports are supported. For details, see <a href="#vpc_sg01_0009__table425751511619">Table 3</a>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="vpc_sg01_0009__row19753121514169"><td class="cellrowborder" valign="top" width="15.308469153084694%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="vpc_sg01_0009__p117534152161">action</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.308469153084694%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="vpc_sg01_0009__p187531415131610">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="17.348265173482652%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="vpc_sg01_0009__p475315153160">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="52.03479652034796%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="vpc_sg01_0009__p137531515151616">Specifies the operation. The value can be <strong id="vpc_sg01_0009__b842352706143633">add</strong> (associate) or <strong id="vpc_sg01_0009__b842352706143640">remove</strong> (disassociate). The values are case-insensitive.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="p" id="vpc_sg01_0009__p297817256254">
|
|
<div class="tablenoborder"><a name="vpc_sg01_0009__table425751511619"></a><a name="table425751511619"></a><table cellpadding="4" cellspacing="0" summary="" id="vpc_sg01_0009__table425751511619" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Description of field <strong>Port</strong></caption><thead align="left"><tr id="vpc_sg01_0009__row12753515131613"><th align="left" class="cellrowborder" valign="top" width="15.46154615461546%" id="mcps1.3.3.2.1.2.1.2.5.1.1"><p id="vpc_sg01_0009__p16753115161610"><strong id="vpc_sg01_0009__b607783926">Name</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="15.46154615461546%" id="mcps1.3.3.2.1.2.1.2.5.1.2"><p id="vpc_sg01_0009__p2075351510161"><strong id="vpc_sg01_0009__b557968564">Mandatory</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="22.682268226822682%" id="mcps1.3.3.2.1.2.1.2.5.1.3"><p id="vpc_sg01_0009__p13753141511167"><strong id="vpc_sg01_0009__b1388492152">Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="46.39463946394639%" id="mcps1.3.3.2.1.2.1.2.5.1.4"><p id="vpc_sg01_0009__p27534153168"><strong id="vpc_sg01_0009__b1669471479">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="vpc_sg01_0009__row9753121514167"><td class="cellrowborder" valign="top" width="15.46154615461546%" headers="mcps1.3.3.2.1.2.1.2.5.1.1 "><p id="vpc_sg01_0009__p14753141531614">id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.46154615461546%" headers="mcps1.3.3.2.1.2.1.2.5.1.2 "><p id="vpc_sg01_0009__p0753715121618">Yes</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="22.682268226822682%" headers="mcps1.3.3.2.1.2.1.2.5.1.3 "><p id="vpc_sg01_0009__p1075571551616">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="46.39463946394639%" headers="mcps1.3.3.2.1.2.1.2.5.1.4 "><p id="vpc_sg01_0009__p1175521531616">Specifies the port ID, which uniquely identifies the port.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</li></ul>
|
|
<ul id="vpc_sg01_0009__ul7755915161611"><li id="vpc_sg01_0009__li47551415181616">Example request<pre class="screen" id="vpc_sg01_0009__screen110745861912">POST https://{Endpoint}/v1/{project_id}/security-groups/0c4a2336-b036-4fa2-bc3c-1a291ed4c431/instance/action
|
|
|
|
{
|
|
"ports": [
|
|
{
|
|
"id": "b9ac5247-c4ca-4c9b-b8fa-7d19132e560a"
|
|
},
|
|
{
|
|
"id": "aa2f8625-0042-4627-a05c-61500b604cc3"
|
|
}
|
|
],
|
|
"action": "add"
|
|
}</pre>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="vpc_sg01_0009__section2265151517164"><h4 class="sectiontitle">Response Message</h4><ul id="vpc_sg01_0009__ul18755115131619"><li id="vpc_sg01_0009__li67551615121613">Response parameter
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="vpc_sg01_0009__table18277615121617" frame="border" border="1" rules="all"><caption><b>Table 4 </b>Response parameter</caption><thead align="left"><tr id="vpc_sg01_0009__row57551715151620"><th align="left" class="cellrowborder" valign="top" width="18.37%" id="mcps1.3.4.2.1.1.2.4.1.1"><p id="vpc_sg01_0009__p17551415191614"><strong id="vpc_sg01_0009__b112419001">Name</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="25.509999999999998%" id="mcps1.3.4.2.1.1.2.4.1.2"><p id="vpc_sg01_0009__p3755141514168"><strong id="vpc_sg01_0009__b1218772891">Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="56.120000000000005%" id="mcps1.3.4.2.1.1.2.4.1.3"><p id="vpc_sg01_0009__p13755121501610"><strong id="vpc_sg01_0009__b1123908808">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="vpc_sg01_0009__row14755815121614"><td class="cellrowborder" valign="top" width="18.37%" headers="mcps1.3.4.2.1.1.2.4.1.1 "><p id="vpc_sg01_0009__p137553158163">fail</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="25.509999999999998%" headers="mcps1.3.4.2.1.1.2.4.1.2 "><p id="vpc_sg01_0009__p2755121511617"><a href="#vpc_sg01_0009__table728810252119">fail</a> object</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="56.120000000000005%" headers="mcps1.3.4.2.1.1.2.4.1.3 "><p id="vpc_sg01_0009__p1222855185215">Specifies the failed ports. For details, see <a href="#vpc_sg01_0009__table728810252119">Table 5</a>.</p>
|
|
<p id="vpc_sg01_0009__p9755191514163">If all ports are associated with or disassociated from the security group successfully, the <strong id="vpc_sg01_0009__b842352706151212">fail</strong> list in the response body is blank.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<div class="p" id="vpc_sg01_0009__p15323192310268">
|
|
<div class="tablenoborder"><a name="vpc_sg01_0009__table728810252119"></a><a name="table728810252119"></a><table cellpadding="4" cellspacing="0" summary="" id="vpc_sg01_0009__table728810252119" frame="border" border="1" rules="all"><caption><b>Table 5 </b><strong id="vpc_sg01_0009__b6522821183119">fail</strong> objects</caption><thead align="left"><tr id="vpc_sg01_0009__row628819213214"><th align="left" class="cellrowborder" valign="top" width="19.39%" id="mcps1.3.4.2.1.2.1.2.4.1.1"><p id="vpc_sg01_0009__p1428715213216"><strong id="vpc_sg01_0009__b1651464126">Name</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="18.37%" id="mcps1.3.4.2.1.2.1.2.4.1.2"><p id="vpc_sg01_0009__p32878212116"><strong id="vpc_sg01_0009__b1916692622">Type</strong></p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="62.239999999999995%" id="mcps1.3.4.2.1.2.1.2.4.1.3"><p id="vpc_sg01_0009__p1828719212217"><strong id="vpc_sg01_0009__b1498323436">Description</strong></p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="vpc_sg01_0009__row328818272110"><td class="cellrowborder" valign="top" width="19.39%" headers="mcps1.3.4.2.1.2.1.2.4.1.1 "><p id="vpc_sg01_0009__p1288122152110">id</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="18.37%" headers="mcps1.3.4.2.1.2.1.2.4.1.2 "><p id="vpc_sg01_0009__p2028820216213">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="62.239999999999995%" headers="mcps1.3.4.2.1.2.1.2.4.1.3 "><p id="vpc_sg01_0009__p192887242110">Specifies the ID of the failed port, which uniquely identifies the port.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="vpc_sg01_0009__row1328816212217"><td class="cellrowborder" valign="top" width="19.39%" headers="mcps1.3.4.2.1.2.1.2.4.1.1 "><p id="vpc_sg01_0009__p1828816210216">error_code</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="18.37%" headers="mcps1.3.4.2.1.2.1.2.4.1.2 "><p id="vpc_sg01_0009__p228817212116">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="62.239999999999995%" headers="mcps1.3.4.2.1.2.1.2.4.1.3 "><p id="vpc_sg01_0009__p11288222213">Specifies the error code.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="vpc_sg01_0009__row132886218216"><td class="cellrowborder" valign="top" width="19.39%" headers="mcps1.3.4.2.1.2.1.2.4.1.1 "><p id="vpc_sg01_0009__p122889219214">error_msg</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="18.37%" headers="mcps1.3.4.2.1.2.1.2.4.1.2 "><p id="vpc_sg01_0009__p19288152122111">String</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="62.239999999999995%" headers="mcps1.3.4.2.1.2.1.2.4.1.3 "><p id="vpc_sg01_0009__p128819211218">Specifies the error message.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</li></ul>
|
|
<ul id="vpc_sg01_0009__ul197591015121613"><li id="vpc_sg01_0009__li637204015261">Example normal response 1<div class="p" id="vpc_sg01_0009__p104391241192617"><a name="vpc_sg01_0009__li637204015261"></a><a name="li637204015261"></a>Multiple NIC ports are successfully associated to or disassociated from a security group at a time.<pre class="screen" id="vpc_sg01_0009__screen9402462223">{
|
|
"fail": []
|
|
}</pre>
|
|
</div>
|
|
</li><li id="vpc_sg01_0009__li476484511264">Example normal response 2<div class="p" id="vpc_sg01_0009__p18971104612264"><a name="vpc_sg01_0009__li476484511264"></a><a name="li476484511264"></a>Some NIC ports fail to be associated to or disassociated from a security group at a time.<pre class="screen" id="vpc_sg01_0009__screen230124983711">{
|
|
"fail": [
|
|
{
|
|
"id": "99d9d709-8478-4b46-9f3f-2206b1023fd3",
|
|
"error_code": "VPC.0608",
|
|
"error_msg": "{\"NeutronError\":{\"message\":\"Port 99d9d709-8478-4b46-9f3f-2206b1023fd3 could not be found.\",\"type\":\"PortNotFound\",\"detail\":\"\"}}"
|
|
},
|
|
{
|
|
"id": "aa2f8625-0042-4627-a05c-61500b604cc3",
|
|
"error_code": "VPC.0607",
|
|
"error_msg": "An instance must belong to at least one security group"
|
|
}
|
|
]
|
|
}</pre>
|
|
</div>
|
|
</li></ul>
|
|
<ul id="vpc_sg01_0009__ul14653144014378"><li id="vpc_sg01_0009__li1065314401375">Example abnormal response<pre class="screen" id="vpc_sg01_0009__screen565324013714">{
|
|
"code": "VPC.0606",
|
|
"message": "Request is invalid"
|
|
}</pre>
|
|
<p id="vpc_sg01_0009__p1265384013719"></p>
|
|
</li></ul>
|
|
</div>
|
|
<div class="section" id="vpc_sg01_0009__section31981619"><h4 class="sectiontitle">Status Code</h4><p id="vpc_sg01_0009__p18112112662914">See <a href="vpc_api_0002.html">Status Codes</a>.</p>
|
|
</div>
|
|
<div class="section" id="vpc_sg01_0009__section1634901513167"><h4 class="sectiontitle">Error Code</h4><p id="vpc_sg01_0009__p1076171541619">See <a href="vpc_api_0003.html">Error Codes</a>.</p>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="vpc_sg01_0000.html">Security Group</a></div>
|
|
</div>
|
|
</div>
|
|
|