doc-exports/docs/bms/api-ref/en-us_topic_0060384659.html
guoyanyan c311ecafe3 bms_api_0510
Reviewed-by: Pristromskaia, Margarita <margarita.pristromskaia@t-systems.com>
Co-authored-by: guoyanyan <guoyanyan3@huawei.com>
Co-committed-by: guoyanyan <guoyanyan3@huawei.com>
2023-10-11 08:28:11 +00:00

199 lines
18 KiB
HTML

<a name="EN-US_TOPIC_0060384659"></a><a name="EN-US_TOPIC_0060384659"></a>
<h1 class="topictitle1">Querying an SSH Key Pair (Native OpenStack API)</h1>
<div id="body1495506947151"><div class="section" id="EN-US_TOPIC_0060384659__section59539732104217"><h4 class="sectiontitle">Function</h4><p id="EN-US_TOPIC_0060384659__p57988992104217">This interface is used to query a specified SSH key pair based on the key pair name.</p>
</div>
<div class="section" id="EN-US_TOPIC_0060384659__section52138884104217"><h4 class="sectiontitle">URI</h4><p id="EN-US_TOPIC_0060384659__p29338743104217">GET /v2.1/{project_id}/os-keypairs/{keypair_name}</p>
<p id="EN-US_TOPIC_0060384659__p13579723165510"><a href="#EN-US_TOPIC_0060384659__table1179423205514">Table 1</a> lists the parameters.</p>
<div class="tablenoborder"><a name="EN-US_TOPIC_0060384659__table1179423205514"></a><a name="table1179423205514"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0060384659__table1179423205514" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter description</caption><thead align="left"><tr id="EN-US_TOPIC_0060384659__row679693215558"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.2.4.2.4.1.1"><p id="EN-US_TOPIC_0060384659__p17653616104217">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.2.4.2.4.1.2"><p id="EN-US_TOPIC_0060384659__p20656767104217">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.2.4.2.4.1.3"><p id="EN-US_TOPIC_0060384659__p62585419104217">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0060384659__row379623265513"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.4.2.4.1.1 "><p id="EN-US_TOPIC_0060384659__p50904119104217">project_id</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.4.2.4.1.2 "><p id="EN-US_TOPIC_0060384659__p29593000104217">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.4.2.4.1.3 "><p id="EN-US_TOPIC_0060384659__p48222838104217">Specifies the project ID.</p>
<p id="EN-US_TOPIC_0060384659__p9141450142010">For how to obtain the project ID, see <a href="https://docs.otc.t-systems.com/en-us/api/apiug/apig-en-api-180328009.html" target="_blank" rel="noopener noreferrer">Obtaining Required Information</a>.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0060384659__row1579623216550"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.4.2.4.1.1 "><p id="EN-US_TOPIC_0060384659__p56513487104217">keypair_name</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.4.2.4.1.2 "><p id="EN-US_TOPIC_0060384659__p14189698104217">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.2.4.2.4.1.3 "><p id="EN-US_TOPIC_0060384659__p8514927104217">Specifies the key pair name.</p>
<p id="EN-US_TOPIC_0060384659__p7466161413561">You can obtain the key pair name by calling the <a href="en-us_topic_0060384658.html">Querying SSH Key Pairs (Native OpenStack API)</a> API.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="EN-US_TOPIC_0060384659__section18620476104217"><h4 class="sectiontitle">Request</h4><ul id="EN-US_TOPIC_0060384659__ul1689081125716"><li id="EN-US_TOPIC_0060384659__li1218917171812">Request parameters<p id="EN-US_TOPIC_0060384659__p350710211486"><a name="EN-US_TOPIC_0060384659__li1218917171812"></a><a name="li1218917171812"></a>None</p>
</li><li id="EN-US_TOPIC_0060384659__li158908110578">Example request<div class="codecoloring" codetype="Java" id="EN-US_TOPIC_0060384659__screen172381314115716"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal">1</span></pre></div></td><td class="code"><div><pre><span></span><span class="n">GET</span><span class="w"> </span><span class="n">https</span><span class="p">:</span><span class="c1">//{ECS Endpoint}/v2.1/bbf1946d374b44a0a2a95533562ba954/os-keypairs/keypair-test</span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0060384659__section18336671104217"><h4 class="sectiontitle">Response</h4><ul id="EN-US_TOPIC_0060384659__ul8875348104217"><li id="EN-US_TOPIC_0060384659__li12769269104217">Response parameters
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0060384659__table47814565104217" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0060384659__row50677205104217"><th align="left" class="cellrowborder" valign="top" width="23.45765423457654%" id="mcps1.3.4.2.1.1.1.4.1.1"><p id="EN-US_TOPIC_0060384659__p19987085">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="30.376962303769623%" id="mcps1.3.4.2.1.1.1.4.1.2"><p id="EN-US_TOPIC_0060384659__p4546697">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="46.16538346165384%" id="mcps1.3.4.2.1.1.1.4.1.3"><p id="EN-US_TOPIC_0060384659__p32738149">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0060384659__row33037343104217"><td class="cellrowborder" valign="top" width="23.45765423457654%" headers="mcps1.3.4.2.1.1.1.4.1.1 "><p id="EN-US_TOPIC_0060384659__p58779125104217">keypair</p>
</td>
<td class="cellrowborder" valign="top" width="30.376962303769623%" headers="mcps1.3.4.2.1.1.1.4.1.2 "><p id="EN-US_TOPIC_0060384659__p63488655104217">Object</p>
</td>
<td class="cellrowborder" valign="top" width="46.16538346165384%" headers="mcps1.3.4.2.1.1.1.4.1.3 "><p id="EN-US_TOPIC_0060384659__p42307413104217">Specifies the SSH key pair. For details, see <a href="#EN-US_TOPIC_0060384659__table39136185104217">Table 2</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="EN-US_TOPIC_0060384659__table39136185104217"></a><a name="table39136185104217"></a><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0060384659__table39136185104217" frame="border" border="1" rules="all"><caption><b>Table 2 </b><strong id="EN-US_TOPIC_0060384659__b3832843254">keypair</strong> field data structure description</caption><thead align="left"><tr id="EN-US_TOPIC_0060384659__row60401722104217"><th align="left" class="cellrowborder" valign="top" width="23.45765423457654%" id="mcps1.3.4.2.1.2.2.4.1.1"><p id="EN-US_TOPIC_0060384659__p2384624132419">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="30.376962303769623%" id="mcps1.3.4.2.1.2.2.4.1.2"><p id="EN-US_TOPIC_0060384659__p23851124102419">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="46.16538346165384%" id="mcps1.3.4.2.1.2.2.4.1.3"><p id="EN-US_TOPIC_0060384659__p1388224162411">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0060384659__row52495862104217"><td class="cellrowborder" valign="top" width="23.45765423457654%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="EN-US_TOPIC_0060384659__p24306447104217">public_key</p>
</td>
<td class="cellrowborder" valign="top" width="30.376962303769623%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="EN-US_TOPIC_0060384659__p22665160104217">String</p>
</td>
<td class="cellrowborder" valign="top" width="46.16538346165384%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="EN-US_TOPIC_0060384659__p23938633104217">Specifies information about the public key in the key pair.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0060384659__row14121108104217"><td class="cellrowborder" valign="top" width="23.45765423457654%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="EN-US_TOPIC_0060384659__p2959125104217">name</p>
</td>
<td class="cellrowborder" valign="top" width="30.376962303769623%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="EN-US_TOPIC_0060384659__p38362611104217">String</p>
</td>
<td class="cellrowborder" valign="top" width="46.16538346165384%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="EN-US_TOPIC_0060384659__p20363797104217">Specifies the key pair name.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0060384659__row49056452104217"><td class="cellrowborder" valign="top" width="23.45765423457654%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="EN-US_TOPIC_0060384659__p14149639104217">fingerprint</p>
</td>
<td class="cellrowborder" valign="top" width="30.376962303769623%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="EN-US_TOPIC_0060384659__p5270148104217">String</p>
</td>
<td class="cellrowborder" valign="top" width="46.16538346165384%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="EN-US_TOPIC_0060384659__p24228833104217">Specifies fingerprint information about the key pair.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0060384659__row16732907104217"><td class="cellrowborder" valign="top" width="23.45765423457654%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="EN-US_TOPIC_0060384659__p13188220104217">created_at</p>
</td>
<td class="cellrowborder" valign="top" width="30.376962303769623%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="EN-US_TOPIC_0060384659__p61612865104217">String</p>
</td>
<td class="cellrowborder" valign="top" width="46.16538346165384%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="EN-US_TOPIC_0060384659__p24586146104217">Specifies the time when the key pair was created.</p>
<p id="EN-US_TOPIC_0060384659__p8768130115818">The timestamp format is ISO 8601, for example, <strong id="EN-US_TOPIC_0060384659__b127321289367">2019-05-07T12:06:13.681238</strong>.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0060384659__row19948729104217"><td class="cellrowborder" valign="top" width="23.45765423457654%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="EN-US_TOPIC_0060384659__p5234385104217">deleted</p>
</td>
<td class="cellrowborder" valign="top" width="30.376962303769623%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="EN-US_TOPIC_0060384659__p21332025104217">Boolean</p>
</td>
<td class="cellrowborder" valign="top" width="46.16538346165384%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="EN-US_TOPIC_0060384659__p50172441104217">Specifies the deleted key pair.</p>
<ul id="EN-US_TOPIC_0060384659__ul1594190135612"><li id="EN-US_TOPIC_0060384659__li1259416085613"><strong id="EN-US_TOPIC_0060384659__b968419312363">true</strong>: indicates that the key has been deleted.</li><li id="EN-US_TOPIC_0060384659__li05941019563"><strong id="EN-US_TOPIC_0060384659__b1992713710367">false</strong>: indicates that the key is not deleted.</li></ul>
</td>
</tr>
<tr id="EN-US_TOPIC_0060384659__row48898790104217"><td class="cellrowborder" valign="top" width="23.45765423457654%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="EN-US_TOPIC_0060384659__p1379054104217">deleted_at</p>
</td>
<td class="cellrowborder" valign="top" width="30.376962303769623%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="EN-US_TOPIC_0060384659__p44594563104217">String</p>
</td>
<td class="cellrowborder" valign="top" width="46.16538346165384%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="EN-US_TOPIC_0060384659__p55389836104217">Specifies the time when the key pair was deleted.</p>
<p id="EN-US_TOPIC_0060384659__p03819116010">The timestamp format is ISO 8601, for example, <strong id="EN-US_TOPIC_0060384659__b1735746163617">2019-05-07T12:06:13.681238</strong>.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0060384659__row28746480104217"><td class="cellrowborder" valign="top" width="23.45765423457654%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="EN-US_TOPIC_0060384659__p46763523104217">id</p>
</td>
<td class="cellrowborder" valign="top" width="30.376962303769623%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="EN-US_TOPIC_0060384659__p29748990104217">String</p>
</td>
<td class="cellrowborder" valign="top" width="46.16538346165384%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="EN-US_TOPIC_0060384659__p60857994104217">Specifies the key pair ID.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0060384659__row10851038104217"><td class="cellrowborder" valign="top" width="23.45765423457654%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="EN-US_TOPIC_0060384659__p6518853104217">updated_at</p>
</td>
<td class="cellrowborder" valign="top" width="30.376962303769623%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="EN-US_TOPIC_0060384659__p58265105104217">String</p>
</td>
<td class="cellrowborder" valign="top" width="46.16538346165384%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="EN-US_TOPIC_0060384659__p21853098104217">Specifies the time when the key pair was updated.</p>
<p id="EN-US_TOPIC_0060384659__p63535230013">The timestamp format is ISO 8601, for example, <strong id="EN-US_TOPIC_0060384659__b178515518369">2019-05-07T12:06:13.681238</strong>.</p>
</td>
</tr>
<tr id="EN-US_TOPIC_0060384659__row62460159104217"><td class="cellrowborder" valign="top" width="23.45765423457654%" headers="mcps1.3.4.2.1.2.2.4.1.1 "><p id="EN-US_TOPIC_0060384659__p26108085104217">user_id</p>
</td>
<td class="cellrowborder" valign="top" width="30.376962303769623%" headers="mcps1.3.4.2.1.2.2.4.1.2 "><p id="EN-US_TOPIC_0060384659__p34380140104217">String</p>
</td>
<td class="cellrowborder" valign="top" width="46.16538346165384%" headers="mcps1.3.4.2.1.2.2.4.1.3 "><p id="EN-US_TOPIC_0060384659__p33327947104217">Specifies information about the user to which the key pair belongs.</p>
</td>
</tr>
</tbody>
</table>
</div>
</li><li id="EN-US_TOPIC_0060384659__li62513644103650">Example response<div class="codecoloring" codetype="Java" id="EN-US_TOPIC_0060384659__screen4690257120289"><div class="highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span class="normal"> 1</span>
<span class="normal"> 2</span>
<span class="normal"> 3</span>
<span class="normal"> 4</span>
<span class="normal"> 5</span>
<span class="normal"> 6</span>
<span class="normal"> 7</span>
<span class="normal"> 8</span>
<span class="normal"> 9</span>
<span class="normal">10</span>
<span class="normal">11</span>
<span class="normal">12</span>
<span class="normal">13</span></pre></div></td><td class="code"><div><pre><span></span><span class="p">{</span>
<span class="w"> </span><span class="s">&quot;keypair&quot;</span><span class="p">:</span><span class="w"> </span><span class="p">{</span>
<span class="w"> </span><span class="s">&quot;created_at&quot;</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;2019-05-07T12:06:13.681238&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="s">&quot;deleted&quot;</span><span class="p">:</span><span class="w"> </span><span class="kc">false</span><span class="p">,</span>
<span class="w"> </span><span class="s">&quot;deleted_at&quot;</span><span class="p">:</span><span class="w"> </span><span class="kc">null</span><span class="p">,</span>
<span class="w"> </span><span class="s">&quot;fingerprint&quot;</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;9d:00:f4:d7:26:6e:52:06:4c:c1:d3:1d:fd:06:66:01&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="s">&quot;id&quot;</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span>
<span class="w"> </span><span class="s">&quot;name&quot;</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;keypair-3582d8b7-e588-4aad-b7f7-f4e76f0e4314&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="s">&quot;public_key&quot;</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDYJrTVpcMwFqQy/oMvtUSRofZdSRHEwrsX8AYkRvn2ZnCXM+b6+GZ2NQuuWj+ocznlnwiGFQDsL/yeE+/kurqcPJFKKp60mToXIMyzioFxW88fJtwEWawHKAclbHWpR1t4fQ4DS+/sIbX/Yd9btlVQ2tpQjodGDbM9Tr9/+/3i6rcR+EoLqmbgCgAiGiVV6VbM2Zx79yUwd+GnQejHX8BlYZoOjCnt3NREsITcmWE9FVFy6TnLmahs3FkEO/QGgWGkaohAJlsgaVvSWGgDn2AujKYwyDokK3dXyeX3m2Vmc3ejiqPa/C4nRrCOlko5nSgV/9IXRx1ERImsqZnE9usB Generated-by-Nova&quot;</span><span class="p">,</span>
<span class="w"> </span><span class="s">&quot;updated_at&quot;</span><span class="p">:</span><span class="w"> </span><span class="kc">null</span><span class="p">,</span>
<span class="w"> </span><span class="s">&quot;user_id&quot;</span><span class="p">:</span><span class="w"> </span><span class="s">&quot;fake&quot;</span>
<span class="w"> </span><span class="p">}</span>
<span class="p">}</span>
</pre></div></td></tr></table></div>
</div>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0060384659__section7610951"><h4 class="sectiontitle">Returned Values</h4><div class="p" id="EN-US_TOPIC_0060384659__en-us_topic_0106040941_p193201622141412">Normal values
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="EN-US_TOPIC_0060384659__en-us_topic_0106040941_table753804619176" frame="border" border="1" rules="all"><thead align="left"><tr id="EN-US_TOPIC_0060384659__en-us_topic_0106040941_row10735134615172"><th align="left" class="cellrowborder" valign="top" width="42.42%" id="mcps1.3.5.2.1.1.3.1.1"><p id="EN-US_TOPIC_0060384659__en-us_topic_0106040941_p19735204616177">Returned Values</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="57.58%" id="mcps1.3.5.2.1.1.3.1.2"><p id="EN-US_TOPIC_0060384659__en-us_topic_0106040941_p207355465176">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="EN-US_TOPIC_0060384659__en-us_topic_0106040941_row1473514621713"><td class="cellrowborder" valign="top" width="42.42%" headers="mcps1.3.5.2.1.1.3.1.1 "><p id="EN-US_TOPIC_0060384659__en-us_topic_0106040941_p13735144611178">200</p>
</td>
<td class="cellrowborder" valign="top" width="57.58%" headers="mcps1.3.5.2.1.1.3.1.2 "><p id="EN-US_TOPIC_0060384659__en-us_topic_0106040941_p207351246161711">The request has been successfully processed.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<p id="EN-US_TOPIC_0060384659__en-us_topic_0106040941_p47633965">For details about other returned values, see <a href="en-us_topic_0053158690.html">Status Codes</a>.</p>
</div>
<div class="section" id="EN-US_TOPIC_0060384659__section14752650154917"><h4 class="sectiontitle">Error Codes</h4><p id="EN-US_TOPIC_0060384659__en-us_topic_0106040941_p10243161417491">See <a href="en-us_topic_0107541808.html">Error Codes</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="en-us_topic_0060384657.html">BMS SSH Key Pair Management</a></div>
</div>
</div>