Files
doc-exports/docs/ims/dev/en-us_topic_0110300592.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

34 lines
4.5 KiB
HTML

<a name="EN-US_TOPIC_0110300592"></a><a name="EN-US_TOPIC_0110300592"></a>
<h1 class="topictitle1">Adding an Image Member</h1>
<div id="body8662426"><div class="section" id="EN-US_TOPIC_0110300592__en-us_topic_0110299938_section30752875"><h4 class="sectiontitle">Scenario</h4><p class="MsoNormal" id="EN-US_TOPIC_0110300592__en-us_topic_0110299938_p37736673">A private image can be shared with other tenants. When sharing an image, you need add a project ID of the tenant with whom you are going to share the image.</p>
<div class="note" id="EN-US_TOPIC_0110300592__en-us_topic_0110299938_note4085744"><img src="public_sys-resources/note_3.0-en-us.png"><span class="notetitle"> </span><div class="notebody"><ul id="EN-US_TOPIC_0110300592__en-us_topic_0110299938_ul36771698"><li id="EN-US_TOPIC_0110300592__en-us_topic_0110299938_li62509834">Currently, images can be shared only within the same region.</li><li id="EN-US_TOPIC_0110300592__li9147183901514">The token obtained from Identity and Access Management (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.</li></ul>
</div></div>
</div>
<div class="section" id="EN-US_TOPIC_0110300592__en-us_topic_0110299938_section8340425"><h4 class="sectiontitle">Involved APIs</h4><p class="litext" id="EN-US_TOPIC_0110300592__p23385131">If you use a token for authentication, you must obtain the token and add <strong id="EN-US_TOPIC_0110300592__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_0110300592__ul1840113419200"><li id="EN-US_TOPIC_0110300592__li6754315">IAM API used to obtain the token<p id="EN-US_TOPIC_0110300592__en-us_topic_0109822381_p1833933634"><a name="EN-US_TOPIC_0110300592__li6754315"></a><a name="li6754315"></a>URI format: POST https://<em id="EN-US_TOPIC_0110300592__en-us_topic_0109822381_i15500165112426">IAM endpoint</em>/v3/auth/tokens</p>
</li><li id="EN-US_TOPIC_0110300592__en-us_topic_0110299938_li59224828">IMS API used to add an image member (Native OpenStack API)<p id="EN-US_TOPIC_0110300592__p945919354610"><a name="EN-US_TOPIC_0110300592__en-us_topic_0110299938_li59224828"></a><a name="en-us_topic_0110299938_li59224828"></a>URI format: POST https://<em id="EN-US_TOPIC_0110300592__i1711066104918">IMS endpoint</em>/v2/images/<em id="EN-US_TOPIC_0110300592__i14110164499">Image ID</em>/members</p>
</li></ul>
</div>
<div class="section" id="EN-US_TOPIC_0110300592__en-us_topic_0110299938_section7954964"><h4 class="sectiontitle">Procedure</h4><ol id="EN-US_TOPIC_0110300592__en-us_topic_0110299938_ol32481801"><li id="EN-US_TOPIC_0110300592__li1837051910476">Obtain the token.</li><li id="EN-US_TOPIC_0110300592__en-us_topic_0110299938_li10736577">Send <strong id="EN-US_TOPIC_0110300592__b134248322501">POST https://</strong><em id="EN-US_TOPIC_0110300592__i42507312509">IMS endpoint</em><strong id="EN-US_TOPIC_0110300592__b1930002985014">/v2/images/</strong><em id="EN-US_TOPIC_0110300592__i384417201507">Image ID</em><strong id="EN-US_TOPIC_0110300592__b13410525165014">/members</strong>.</li><li id="EN-US_TOPIC_0110300592__en-us_topic_0110299938_li29520332">Add <strong id="EN-US_TOPIC_0110300592__b84235270615255">X-Auth-Token</strong> to the request header.</li><li id="EN-US_TOPIC_0110300592__en-us_topic_0110299938_li64356400">Specify the following parameters in the request body:<pre class="screen" id="EN-US_TOPIC_0110300592__screen1639164019160">{
"member": "edc89b490d7d4392898e19b2deb34797" //Member ID (that is, project ID of the image recipient)
}</pre>
</li><li id="EN-US_TOPIC_0110300592__en-us_topic_0110299938_li60482217">Check the response parameters.<pre class="screen" id="EN-US_TOPIC_0110300592__screen1282785071618">{
"status": "pending", //Image is being shared
"created_at": "2016-09-01T02:05:14Z", //Time when the image is shared
"updated_at": "2016-09-01T02:05:14Z", //Time when the image status is updated
"image_id": "d164b5df-1bc3-4c3f-893e-3e471fd16e64", //Image ID
"member_id": "edc89b490d7d4392898e19b2deb34797" //Member ID (that is, project ID of the image recipient)
"schema": "/v2/schemas/member" //Image sharing schema
}</pre>
<p id="EN-US_TOPIC_0110300592__p17617162163611">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>