doc-exports/docs/eip/api-ref/eip_apieg_0001.html
Qin Ying, Fan 65b77b76d4 EIP API 20230106 version
Reviewed-by: Hajba, László Antal <laszlo-antal.hajba@t-systems.com>
Co-authored-by: Qin Ying, Fan <fanqinying@huawei.com>
Co-committed-by: Qin Ying, Fan <fanqinying@huawei.com>
2023-08-01 06:58:15 +00:00

114 lines
8.8 KiB
HTML

<a name="eip_apieg_0001"></a><a name="eip_apieg_0001"></a>
<h1 class="topictitle1">Assigning an EIP with a Specific Shared Bandwidth</h1>
<div id="body1598357202801"><div class="section" id="eip_apieg_0001__section142267511571"><h4 class="sectiontitle">Scenarios</h4><p id="eip_apieg_0001__p8586205115715">This section describes how to assign an EIP with a specific shared bandwidth by calling APIs.</p>
</div>
<div class="section" id="eip_apieg_0001__section10234151977"><h4 class="sectiontitle">Prerequisites</h4><p id="eip_apieg_0001__p2586151076">If you use a token for authentication, you must obtain the token and add <strong id="eip_apieg_0001__b91638681817">X-Auth-Token</strong> to the request header when making an API call. </p>
<div class="note" id="eip_apieg_0001__note430375361618"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="eip_apieg_0001__p530413530166">The token obtained from IAM is valid for only 24 hours. If you want to use a token for authentication, you can cache it to avoid frequent calling.</p>
</div></div>
</div>
<div class="section" id="eip_apieg_0001__section12608714143014"><h4 class="sectiontitle">Procedure</h4><ol id="eip_apieg_0001__ol1958616511371"><li id="eip_apieg_0001__li175871451573">Assign a shared bandwidth.<ol type="a" id="eip_apieg_0001__ol75872513710"><li id="eip_apieg_0001__li258711511711">Send <strong id="eip_apieg_0001__b1978417328205">POST https://</strong><em id="eip_apieg_0001__i1678943217203">Endpoint</em><strong id="eip_apieg_0001__b1679053232019">/v2.0/</strong><em id="eip_apieg_0001__i57909324208">project_id</em><strong id="eip_apieg_0001__b328812136243">/bandwidths</strong>. Parameter <strong id="eip_apieg_0001__b18791143217208">project_id</strong> indicates the project ID.</li><li id="eip_apieg_0001__li558713511676">Add <strong id="eip_apieg_0001__b195041815172410">X-Auth-Token</strong> to the request header.</li><li id="eip_apieg_0001__li155881511773">Specify the following parameters in the request body:<pre class="screen" id="eip_apieg_0001__screen93163193812">{
"bandwidth": {
"name": "bandwidth123",
"size": 10
}
}</pre>
</li><li id="eip_apieg_0001__li12588351273">Check the response message.<ul id="eip_apieg_0001__ul458818518712"><li id="eip_apieg_0001__li658810518718">The request is successful if the following response is displayed. In the response, <strong id="eip_apieg_0001__b198508215274">id</strong> indicates the bandwidth ID.<pre class="screen" id="eip_apieg_0001__screen579111385818">{
"bandwidth": {
"id": "1bffc5f2-ff19-45a6-96d2-dfdca49cc387",
"name": "bandwidth123",
"size": 10,
"share_type": "WHOLE",
"publicip_info": [],
"tenant_id": "26ae5181a416420998eb2093aaed84d9",
"bandwidth_type": "share",
"charge_mode": "bandwidth",
"enterprise_project_id": "0",
"status": "NORMAL",
"created_at": "2020-04-21T07:58:02Z",
"updated_at": "2020-04-21T07:58:02Z"
}
}</pre>
</li><li id="eip_apieg_0001__li3588951179">For details about the error codes when the request is abnormal, see <a href="ErrorCode.html">Error Codes</a>.</li></ul>
</li></ol>
</li><li id="eip_apieg_0001__li558817518712">Query the shared bandwidth details.<ol type="a" id="eip_apieg_0001__ol1258812512072"><li id="eip_apieg_0001__li15899511476">Send <strong id="eip_apieg_0001__b126141617122917">Get https://</strong><em id="eip_apieg_0001__i7619121711294">Endpoint</em><strong id="eip_apieg_0001__b17619171716295">//v1/</strong><em id="eip_apieg_0001__i7620131712914">project_id</em><strong id="eip_apieg_0001__b662041702911">/bandwidths/</strong><em id="eip_apieg_0001__i15078916300">bandwidth_id</em>. Parameter <strong id="eip_apieg_0001__b136215170291">project_id</strong> indicates the project ID.</li><li id="eip_apieg_0001__li558914511711">Add <strong id="eip_apieg_0001__b149536123301">X-Auth-Token</strong> to the request header.</li><li id="eip_apieg_0001__li258914511673">Check the response message.<ul id="eip_apieg_0001__ul3589205110720"><li id="eip_apieg_0001__li175899511271">The request is successful if the following response is displayed. In the response, <strong id="eip_apieg_0001__b1780510250317">id</strong> indicates the bandwidth ID.<pre class="screen" id="eip_apieg_0001__screen1093511189">{
"bandwidth": {
"id": "1bffc5f2-ff19-45a6-96d2-dfdca49cc387",
"name": "bandwidth123",
"size": 10,
"share_type": "WHOLE",
"publicip_info": [
{
"publicip_id": "ff156c26-bcc9-4541-a75c-42baf8b9748f",
"publicip_address": "114.xx.xx.244",
"ip_version": 4,
"publicip_type": "5_sbgp"
}
],
"tenant_id": "b3292dde618e40408e30cd87455a0652",
"bandwidth_type": "sbgp",
"charge_mode": "bandwidth",
"enterprise_project_id": "0",
"status": "NORMAL",
"created_at": "2020-04-21T07:58:02Z",
"updated_at": "2020-04-21T07:58:02Z"
}
}</pre>
</li><li id="eip_apieg_0001__li558910516716">For details about the error codes when the request is abnormal, see <a href="ErrorCode.html">Error Codes</a>.</li></ul>
</li></ol>
</li><li id="eip_apieg_0001__li185891551376">Assign an EIP using the shared bandwidth.<ol type="a" id="eip_apieg_0001__ol1589155114714"><li id="eip_apieg_0001__li1758935119714">Send <strong id="eip_apieg_0001__b1137322183313">POST https://</strong><em id="eip_apieg_0001__i10379192113310">Endpoint</em><strong id="eip_apieg_0001__b12379112123312">/v1/</strong><em id="eip_apieg_0001__i238018223312">project_id</em><strong id="eip_apieg_0001__b33806218337">/publicips</strong>. Parameter <strong id="eip_apieg_0001__b113813219339">project_id</strong> indicates the project ID.</li><li id="eip_apieg_0001__li3589251079">Add <strong id="eip_apieg_0001__b7372513123512">X-Auth-Token</strong> to the request header.</li><li id="eip_apieg_0001__li358910518715">Specify the following parameters in the request body:<pre class="screen" id="eip_apieg_0001__screen147391216914">{
"publicip": {
"type": "5_bgp",
"ip_version": 6
},
"bandwidth": {
"name": "bandwidth123",
"size": 10,
"share_type": "WHOLE",
"id":"1bffc5f2-ff19-45a6-96d2-dfdca49cc387"
},
"enterprise_project_id":"0"
}</pre>
</li><li id="eip_apieg_0001__li14589185116718">Check the response message.<ul id="eip_apieg_0001__ul195901851575"><li id="eip_apieg_0001__li1159011511377">The request is successful if the following response is displayed.<pre class="screen" id="eip_apieg_0001__screen18526138191">{
"publicip": {
"id": "f588ccfa-8750-4d7c-bf5d-2ede24414706",
"status": "PENDING_CREATE",
"type": "5_bgp",
"public_ip_address": "161.xx.xx.7",
"tenant_id": "8b7e35ad379141fc9df3e178bd64f55c",
"ip_version": 4,
"create_time": "2015-07-16 04:10:52",
"bandwidth_size": 0,
"enterprise_project_id":"b261ac1f-2489-4bc7-b31b-c33c3346a439"
}
}</pre>
</li><li id="eip_apieg_0001__li8590165112711">For details about the error codes when the request is abnormal, see <a href="ErrorCode.html">Error Codes</a>.</li></ul>
</li></ol>
</li><li id="eip_apieg_0001__li15902511571">Query EIP details.<ol type="a" id="eip_apieg_0001__ol11590185116710"><li id="eip_apieg_0001__li0590751575">Send <strong id="eip_apieg_0001__b176811015368">GET /v1/</strong><em id="eip_apieg_0001__i197731510183615">project_id</em><strong id="eip_apieg_0001__b17737106365">/publicips/</strong><em id="eip_apieg_0001__i1077312100362">publicip_id</em>. Parameter <strong id="eip_apieg_0001__b1577481043611">project_id</strong> indicates the project ID.</li><li id="eip_apieg_0001__li759095119710">Add <strong id="eip_apieg_0001__b222517282389">X-Auth-Token</strong> to the request header.</li><li id="eip_apieg_0001__li1659075117715">Check the response message.<pre class="screen" id="eip_apieg_0001__screen456816151299">{
"publicip": {
"id": "3ec9fea0-2d4c-49e2-8aca-ce883eae547d",
"type": "5_bgp",
"public_ip_address": "10.246.164.87",
"status": "DOWN",
"tenant_id": "060576782980d5762f9ec014dd2f1148",
"create_time": "2020-08-13 12:55:27",
"bandwidth_id": "1bffc5f2-ff19-45a6-96d2-dfdca49cc387",
"bandwidth_name": "bandwidth123",
"bandwidth_share_type": "WHOLE",
"bandwidth_size": 10,
"profile": {},
"enterprise_project_id": "a380829c-db6f-4db3-b5b6-cc377f7a3ff8",
"ip_version": 4
}
}</pre>
</li></ol>
</li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="eip_apieg_0000.html">Application Examples</a></div>
</div>
</div>