doc-exports/docs/vpc/api-ref/vpc_privateip_0001.html
Qin Ying, Fan 310d2d9eb1 VPC API 20230106 version
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>
2024-02-06 08:38:37 +00:00

217 lines
18 KiB
HTML

<a name="vpc_privateip_0001"></a><a name="vpc_privateip_0001"></a>
<h1 class="topictitle1">Assigning a Private IP Address</h1>
<div id="body10428696"><div class="section" id="vpc_privateip_0001__section31644779"><h4 class="sectiontitle">Function</h4><p id="vpc_privateip_0001__p39418019">This API is used to assign a private IP address.</p>
</div>
<div class="section" id="vpc_privateip_0001__section16367560"><h4 class="sectiontitle">URI</h4><p id="vpc_privateip_0001__p1525182112298">POST /v1/{project_id}/privateips</p>
<div class="p" id="vpc_privateip_0001__p5931171315551"><a href="#vpc_privateip_0001__table57906226">Table 1</a> describes the parameters.
<div class="tablenoborder"><a name="vpc_privateip_0001__table57906226"></a><a name="table57906226"></a><table cellpadding="4" cellspacing="0" summary="" id="vpc_privateip_0001__table57906226" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter description</caption><thead align="left"><tr id="vpc_privateip_0001__row33939988"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.2.3.2.2.4.1.1"><p id="vpc_privateip_0001__p64784526">Name</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_privateip_0001__p13055244">Mandatory</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_privateip_0001__p50841847">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="vpc_privateip_0001__row24548918"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.3.2.2.4.1.1 "><p id="vpc_privateip_0001__p42305330">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_privateip_0001__p4179666">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.3.2.2.4.1.3 "><p id="vpc_privateip_0001__p10487112">Specifies the project ID. </p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="section" id="vpc_privateip_0001__section13090320"><h4 class="sectiontitle">Request Parameters</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="vpc_privateip_0001__table6906072155755" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request parameter</caption><thead align="left"><tr id="vpc_privateip_0001__row11778955155755"><th align="left" class="cellrowborder" valign="top" width="15.409999999999998%" id="mcps1.3.3.2.2.5.1.1"><p id="vpc_privateip_0001__p14571261155755">Name</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17.86%" id="mcps1.3.3.2.2.5.1.2"><p id="vpc_privateip_0001__p39421508155755">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="19.55%" id="mcps1.3.3.2.2.5.1.3"><p id="vpc_privateip_0001__p39025608155755">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="47.18%" id="mcps1.3.3.2.2.5.1.4"><p id="vpc_privateip_0001__p6957680155755">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="vpc_privateip_0001__row26701221155755"><td class="cellrowborder" valign="top" width="15.409999999999998%" headers="mcps1.3.3.2.2.5.1.1 "><p id="vpc_privateip_0001__p15315278155755">privateips</p>
</td>
<td class="cellrowborder" valign="top" width="17.86%" headers="mcps1.3.3.2.2.5.1.2 "><p id="vpc_privateip_0001__p32578004155755">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="19.55%" headers="mcps1.3.3.2.2.5.1.3 "><p id="vpc_privateip_0001__p21572638155755">Array of <a href="#vpc_privateip_0001__table45335391">privateip</a> objects</p>
</td>
<td class="cellrowborder" valign="top" width="47.18%" headers="mcps1.3.3.2.2.5.1.4 "><p id="vpc_privateip_0001__p22979132155755">Specifies the private IP address objects. For details, see <a href="#vpc_privateip_0001__table45335391">Table 3</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="vpc_privateip_0001__table45335391"></a><a name="table45335391"></a><table cellpadding="4" cellspacing="0" summary="" id="vpc_privateip_0001__table45335391" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Description of the <strong id="vpc_privateip_0001__b1164154510129">privateip</strong> field</caption><thead align="left"><tr id="vpc_privateip_0001__row64244561"><th align="left" class="cellrowborder" valign="top" width="16.91830816918308%" id="mcps1.3.3.3.2.5.1.1"><p id="vpc_privateip_0001__p36426933">Name</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="17.478252174782526%" id="mcps1.3.3.3.2.5.1.2"><p id="vpc_privateip_0001__p64900454">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="18.04819518048195%" id="mcps1.3.3.3.2.5.1.3"><p id="vpc_privateip_0001__p2779229717298">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="47.55524447555245%" id="mcps1.3.3.3.2.5.1.4"><p id="vpc_privateip_0001__p22445387">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="vpc_privateip_0001__row6137036"><td class="cellrowborder" valign="top" width="16.91830816918308%" headers="mcps1.3.3.3.2.5.1.1 "><p id="vpc_privateip_0001__p27337939">subnet_id</p>
</td>
<td class="cellrowborder" valign="top" width="17.478252174782526%" headers="mcps1.3.3.3.2.5.1.2 "><p id="vpc_privateip_0001__p66889413">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="18.04819518048195%" headers="mcps1.3.3.3.2.5.1.3 "><p id="vpc_privateip_0001__p3658359317298">String</p>
</td>
<td class="cellrowborder" valign="top" width="47.55524447555245%" headers="mcps1.3.3.3.2.5.1.4 "><p id="vpc_privateip_0001__p41347315">Specifies the ID of the subnet from which IP addresses are assigned.</p>
<p id="vpc_privateip_0001__p05153542421">If you use the management console, the value of this parameter is the <strong id="vpc_privateip_0001__vpc_subnet01_0002_b195522519461">Network ID</strong> value.</p>
</td>
</tr>
<tr id="vpc_privateip_0001__row36581520"><td class="cellrowborder" valign="top" width="16.91830816918308%" headers="mcps1.3.3.3.2.5.1.1 "><p id="vpc_privateip_0001__p10313144">ip_address</p>
</td>
<td class="cellrowborder" valign="top" width="17.478252174782526%" headers="mcps1.3.3.3.2.5.1.2 "><p id="vpc_privateip_0001__p30058349">No</p>
</td>
<td class="cellrowborder" valign="top" width="18.04819518048195%" headers="mcps1.3.3.3.2.5.1.3 "><p id="vpc_privateip_0001__p1048103717298">String</p>
</td>
<td class="cellrowborder" valign="top" width="47.55524447555245%" headers="mcps1.3.3.3.2.5.1.4 "><ul id="vpc_privateip_0001__ul10782731123015"><li id="vpc_privateip_0001__li10782631133015">Specifies the target IP address.</li><li id="vpc_privateip_0001__li147821531103013">The value can be an available IP address in the subnet. If it is not specified, the system automatically assigns an IP address.</li></ul>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="vpc_privateip_0001__section98741545151917"><h4 class="sectiontitle">Example Request</h4><ul id="vpc_privateip_0001__ul920455061912"><li id="vpc_privateip_0001__li620417506190">Assign two private IP addresses from the subnet whose ID is 531dec0f-3116-411b-a21b-e612e42349fd. One IP address is automatically assigned, and the other is specified to 192.168.1.17.<pre class="screen" id="vpc_privateip_0001__screen24206004144749">POST https://{Endpoint}/v1/{project_id}/privateips
{
"privateips":
[
{
"subnet_id": "531dec0f-3116-411b-a21b-e612e42349fd"
},
{
"subnet_id": "531dec0f-3116-411b-a21b-e612e42349fd",
"ip_address": "192.168.1.17"
}
]
}</pre>
</li></ul>
</div>
<div class="section" id="vpc_privateip_0001__section50704018"><h4 class="sectiontitle">Response Parameters</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="vpc_privateip_0001__table38560739155852" frame="border" border="1" rules="all"><caption><b>Table 4 </b>Response parameter</caption><thead align="left"><tr id="vpc_privateip_0001__row1158370155852"><th align="left" class="cellrowborder" valign="top" width="18.34%" id="mcps1.3.5.2.2.4.1.1"><p id="vpc_privateip_0001__p26719126155852">Name</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="25.509999999999998%" id="mcps1.3.5.2.2.4.1.2"><p id="vpc_privateip_0001__p15835596155852">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="56.15%" id="mcps1.3.5.2.2.4.1.3"><p id="vpc_privateip_0001__p7614877155852">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="vpc_privateip_0001__row12825332155852"><td class="cellrowborder" valign="top" width="18.34%" headers="mcps1.3.5.2.2.4.1.1 "><p id="vpc_privateip_0001__p32218934155852">privateips</p>
</td>
<td class="cellrowborder" valign="top" width="25.509999999999998%" headers="mcps1.3.5.2.2.4.1.2 "><p id="vpc_privateip_0001__p26395826172022">Array of <a href="#vpc_privateip_0001__table34571880">privateip</a> objects</p>
</td>
<td class="cellrowborder" valign="top" width="56.15%" headers="mcps1.3.5.2.2.4.1.3 "><p id="vpc_privateip_0001__p14320614155852">Specifies the private IP address objects. For details, see <a href="#vpc_privateip_0001__table34571880">Table 5</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="vpc_privateip_0001__table34571880"></a><a name="table34571880"></a><table cellpadding="4" cellspacing="0" summary="" id="vpc_privateip_0001__table34571880" frame="border" border="1" rules="all"><caption><b>Table 5 </b>Description of the <strong id="vpc_privateip_0001__b1823522011417">privateip</strong> field</caption><thead align="left"><tr id="vpc_privateip_0001__row51070612"><th align="left" class="cellrowborder" valign="top" width="22.222222222222225%" id="mcps1.3.5.3.2.4.1.1"><p id="vpc_privateip_0001__p43078913">Name</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="28.132813281328133%" id="mcps1.3.5.3.2.4.1.2"><p id="vpc_privateip_0001__p42083530172955">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="49.644964496449646%" id="mcps1.3.5.3.2.4.1.3"><p id="vpc_privateip_0001__p45326617">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="vpc_privateip_0001__row47577364"><td class="cellrowborder" valign="top" width="22.222222222222225%" headers="mcps1.3.5.3.2.4.1.1 "><p id="vpc_privateip_0001__p28561251">status</p>
</td>
<td class="cellrowborder" valign="top" width="28.132813281328133%" headers="mcps1.3.5.3.2.4.1.2 "><p id="vpc_privateip_0001__p53322749172955">String</p>
</td>
<td class="cellrowborder" valign="top" width="49.644964496449646%" headers="mcps1.3.5.3.2.4.1.3 "><ul id="vpc_privateip_0001__ul13978236183119"><li id="vpc_privateip_0001__li18977036143113">Specifies the status of the private IP address.</li><li id="vpc_privateip_0001__li1464831917378">Possible values are as follows:<ul id="vpc_privateip_0001__ul948092312377"><li id="vpc_privateip_0001__li882113258373"><strong id="vpc_privateip_0001__b113207483149">ACTIVE</strong></li><li id="vpc_privateip_0001__li109781336143111"><strong id="vpc_privateip_0001__b842352706162411">DOWN</strong></li></ul>
</li></ul>
</td>
</tr>
<tr id="vpc_privateip_0001__row38031802"><td class="cellrowborder" valign="top" width="22.222222222222225%" headers="mcps1.3.5.3.2.4.1.1 "><p id="vpc_privateip_0001__p60677108">id</p>
</td>
<td class="cellrowborder" valign="top" width="28.132813281328133%" headers="mcps1.3.5.3.2.4.1.2 "><p id="vpc_privateip_0001__p24175384172955">String</p>
</td>
<td class="cellrowborder" valign="top" width="49.644964496449646%" headers="mcps1.3.5.3.2.4.1.3 "><p id="vpc_privateip_0001__p47453675">Specifies the ID of the private IP address, which uniquely identifies the private IP address.</p>
</td>
</tr>
<tr id="vpc_privateip_0001__row24429894"><td class="cellrowborder" valign="top" width="22.222222222222225%" headers="mcps1.3.5.3.2.4.1.1 "><p id="vpc_privateip_0001__p32664435">subnet_id</p>
</td>
<td class="cellrowborder" valign="top" width="28.132813281328133%" headers="mcps1.3.5.3.2.4.1.2 "><p id="vpc_privateip_0001__p12049092172955">String</p>
</td>
<td class="cellrowborder" valign="top" width="49.644964496449646%" headers="mcps1.3.5.3.2.4.1.3 "><p id="vpc_privateip_0001__p26383427">Specifies the ID of the subnet from which IP addresses are assigned.</p>
<p id="vpc_privateip_0001__p104566479452">If you use the management console, the value of this parameter is the <strong id="vpc_privateip_0001__vpc_subnet01_0002_b195522519461_1">Network ID</strong> value.</p>
</td>
</tr>
<tr id="vpc_privateip_0001__row1899134118131"><td class="cellrowborder" valign="top" width="22.222222222222225%" headers="mcps1.3.5.3.2.4.1.1 "><p id="vpc_privateip_0001__p6190364318131">tenant_id</p>
</td>
<td class="cellrowborder" valign="top" width="28.132813281328133%" headers="mcps1.3.5.3.2.4.1.2 "><p id="vpc_privateip_0001__p696029318131">String</p>
</td>
<td class="cellrowborder" valign="top" width="49.644964496449646%" headers="mcps1.3.5.3.2.4.1.3 "><p id="vpc_privateip_0001__p1071642181111">Specifies the project ID.</p>
</td>
</tr>
<tr id="vpc_privateip_0001__row36124251"><td class="cellrowborder" valign="top" width="22.222222222222225%" headers="mcps1.3.5.3.2.4.1.1 "><p id="vpc_privateip_0001__p40383225">device_owner</p>
</td>
<td class="cellrowborder" valign="top" width="28.132813281328133%" headers="mcps1.3.5.3.2.4.1.2 "><p id="vpc_privateip_0001__p36452392172955">String</p>
</td>
<td class="cellrowborder" valign="top" width="49.644964496449646%" headers="mcps1.3.5.3.2.4.1.3 "><ul id="vpc_privateip_0001__ul1878734133215"><li id="vpc_privateip_0001__vpc_privateip_0002_li17786143326">Specifies the resource using the private IP address. The parameter is left blank if it is not used.</li><li id="vpc_privateip_0001__vpc_privateip_0002_li1477918321708">The value can be:<p id="vpc_privateip_0001__vpc_privateip_0002_p10169439016"><a name="vpc_privateip_0001__vpc_privateip_0002_li1477918321708"></a><a name="vpc_privateip_0002_li1477918321708"></a><strong id="vpc_privateip_0001__vpc_privateip_0002_b14922833112817">network:dhcp</strong>: DHCP service IP address</p>
<p id="vpc_privateip_0001__vpc_privateip_0002_p9319114912010"><strong id="vpc_privateip_0001__vpc_privateip_0002_b516232719316">network:router_interface_distributed</strong>: Gateway IP address</p>
<p id="vpc_privateip_0001__vpc_privateip_0002_p13640135315014"><strong id="vpc_privateip_0001__vpc_privateip_0002_b1561710249340">compute:</strong><em id="vpc_privateip_0001__vpc_privateip_0002_i31822893419">xxx</em> (<em id="vpc_privateip_0001__vpc_privateip_0002_i8356152115410">xxx</em> indicates the AZ name. For example, <strong id="vpc_privateip_0001__vpc_privateip_0002_b15139182934119">compute:aa-bb-cc</strong> indicates that the IP address is used by an ECS in the AZ aa-bb-cc.): IP address of an ECS NIC</p>
<p id="vpc_privateip_0001__vpc_privateip_0002_p1114618386019"><strong id="vpc_privateip_0001__vpc_privateip_0002_b185025532441">neutron:VIP_PORT</strong>: Virtual IP address</p>
<p id="vpc_privateip_0001__vpc_privateip_0002_p118874561018"><strong id="vpc_privateip_0001__vpc_privateip_0002_b13903204615458">neutron:LOADBALANCERV2</strong>: IP address of a shared load balancer</p>
<p id="vpc_privateip_0001__vpc_privateip_0002_p132486301410"><strong id="vpc_privateip_0001__vpc_privateip_0002_b926314481472">neutron:LOADBALANCERV3</strong>: IP address of a dedicated load balancer</p>
<p id="vpc_privateip_0001__vpc_privateip_0002_p31101816152"><strong id="vpc_privateip_0001__vpc_privateip_0002_b11940171124817">network:endpoint_interface</strong>: IP address of a VPC endpoint</p>
<p id="vpc_privateip_0001__vpc_privateip_0002_p1686083795918"><strong id="vpc_privateip_0001__vpc_privateip_0002_b661815339816">network:nat_gateway</strong>: IP address used by a NAT gateway</p>
</li><li id="vpc_privateip_0001__vpc_privateip_0002_li1578718443216">The value range specifies only the type of private IP addresses supported by the current service.</li></ul>
</td>
</tr>
<tr id="vpc_privateip_0001__row64744584"><td class="cellrowborder" valign="top" width="22.222222222222225%" headers="mcps1.3.5.3.2.4.1.1 "><p id="vpc_privateip_0001__p9819961">ip_address</p>
</td>
<td class="cellrowborder" valign="top" width="28.132813281328133%" headers="mcps1.3.5.3.2.4.1.2 "><p id="vpc_privateip_0001__p66962669172955">String</p>
</td>
<td class="cellrowborder" valign="top" width="49.644964496449646%" headers="mcps1.3.5.3.2.4.1.3 "><p id="vpc_privateip_0001__p38322691">Specifies the assigned private IP address.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="vpc_privateip_0001__section16661572013"><h4 class="sectiontitle">Example Response</h4><pre class="screen" id="vpc_privateip_0001__screen19426862144820">{
"privateips": [
{
"status": "DOWN",
"id": "c60c2ce1-1e73-44bd-bf48-fd688448ff7b",
"subnet_id": "531dec0f-3116-411b-a21b-e612e42349fd",
"tenant_id": "8b7e35ad379141fc9df3e178bd64f55c",
"device_owner": "",
"ip_address": "192.168.1.10"
},
{
"status": "DOWN",
"id": "4b123c18-ae92-4dfa-92cd-d44002359aa1",
"subnet_id": "531dec0f-3116-411b-a21b-e612e42349fd",
"tenant_id": "8b7e35ad379141fc9df3e178bd64f55c",
"device_owner": "",
"ip_address": "192.168.1.17"
}
]
}</pre>
</div>
<div class="section" id="vpc_privateip_0001__section31981619"><h4 class="sectiontitle">Status Code</h4><p id="vpc_privateip_0001__p18112112662914">See <a href="vpc_api_0002.html">Status Codes</a>.</p>
</div>
<div class="section" id="vpc_privateip_0001__section85821649202813"><h4 class="sectiontitle">Error Code</h4><p id="vpc_privateip_0001__p7233105282813">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_privateip_0000.html">Private IP Address</a></div>
</div>
</div>