Files
doc-exports/docs/ims/dev/en-us_topic_0110300597.html
guoyanyan b3547b53d8 ims_dev_1109
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: guoyanyan <guoyanyan3@huawei.com>
Co-committed-by: guoyanyan <guoyanyan3@huawei.com>
2022-11-16 09:00:55 +00:00

35 lines
4.1 KiB
HTML

<a name="EN-US_TOPIC_0110300597"></a><a name="EN-US_TOPIC_0110300597"></a>
<h1 class="topictitle1">Adding Image Members</h1>
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0110300597__en-us_topic_0110299944_section47188597"><h4 class="sectiontitle">Scenario</h4><p class="MsoNormal" id="EN-US_TOPIC_0110300597__en-us_topic_0110299944_p60892825">An image can be shared with multiple tenants. The API used add tenants is an extension API.</p>
<div class="note" id="EN-US_TOPIC_0110300597__note021013252910"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><p id="EN-US_TOPIC_0110300597__en-us_topic_0109822404_p88501497167">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 frequently calling the IAM API.</p>
</div></div>
</div>
<div class="section" id="EN-US_TOPIC_0110300597__en-us_topic_0110299944_section22044193"><h4 class="sectiontitle">Involved APIs</h4><p class="litext" id="EN-US_TOPIC_0110300597__p23385131">If you use a token for authentication, you must obtain the token and add <strong id="EN-US_TOPIC_0110300597__en-us_topic_0109822381_b842352706134841">X-Auth-Token</strong> to the request header of the IMS API when making an API call.</p>
<ul id="EN-US_TOPIC_0110300597__ul1840113419200"><li id="EN-US_TOPIC_0110300597__li6754315">IAM API used to obtain the token<p id="EN-US_TOPIC_0110300597__en-us_topic_0109822381_p1833933634"><a name="EN-US_TOPIC_0110300597__li6754315"></a><a name="li6754315"></a>URI format: POST https://<em id="EN-US_TOPIC_0110300597__en-us_topic_0109822381_i15500165112426">IAM endpoint</em>/v3/auth/tokens</p>
</li><li id="EN-US_TOPIC_0110300597__en-us_topic_0110299944_li4742722">IMS API used to add image members<p id="EN-US_TOPIC_0110300597__p108151126537"><a name="EN-US_TOPIC_0110300597__en-us_topic_0110299944_li4742722"></a><a name="en-us_topic_0110299944_li4742722"></a>URI format: POST https://<em id="EN-US_TOPIC_0110300597__i18339431593">IMS endpoint</em>/v1/cloudimages/members</p>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0110300597__en-us_topic_0110299944_section64180012"><h4 class="sectiontitle">Procedure</h4><ol id="EN-US_TOPIC_0110300597__en-us_topic_0110299944_ol48616240"><li id="EN-US_TOPIC_0110300597__li1837051910476">Obtain the token.</li><li id="EN-US_TOPIC_0110300597__en-us_topic_0110299944_li29687198">Send <strong id="EN-US_TOPIC_0110300597__b164763571196">POST https://</strong><em id="EN-US_TOPIC_0110300597__i14641115218915">IMS endpoint</em><strong id="EN-US_TOPIC_0110300597__b98831206104">/v1/cloudimages/members</strong>.</li><li id="EN-US_TOPIC_0110300597__en-us_topic_0110299944_li65858198">Add <strong id="EN-US_TOPIC_0110300597__b84235270615255">X-Auth-Token</strong> to the request header.</li><li id="EN-US_TOPIC_0110300597__en-us_topic_0110299944_li55852871">Configure the request parameters. (The values are examples only.)<pre class="screen" id="EN-US_TOPIC_0110300597__screen1290135316223">{
"images": [
"d164b5df-1bc3-4c3f-893e-3e471fd16e64",
"0b680482-acaa-4045-b14c-9a8c7dfe9c70"
], //Image IDs (mandatory, list&lt;string&gt;)
"projects": [
"9c61004714024f9586705d090530f9fa",
"edc89b490d7d4392898e19b2deb34797"
], //Project IDs (mandatory, list&lt;string&gt;)
}</pre>
<p id="EN-US_TOPIC_0110300597__p11433121819584">If the request is successful, a job ID is returned.</p>
</li><li id="EN-US_TOPIC_0110300597__li514842411357">Query job details using the job ID by referring to <a href="en-us_topic_0109822371.html">Querying Job Details</a>.<p id="EN-US_TOPIC_0110300597__p411722533511">If the job status is <strong id="EN-US_TOPIC_0110300597__b8423527061586">SUCCESS</strong>, the private image is successfully created.</p>
<p id="EN-US_TOPIC_0110300597__p2120102015816">For details about status codes for request errors, see <a href="en-us_topic_0124290300.html">Status Codes</a>.</p>
</li></ol>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="en-us_topic_0110300591.html">Sharing an Image</a></div>
</div>
</div>