doc-exports/docs/swr/api-ref/swr_02_0046.html
Dong, Qiu Jian f5c28c856a SWR API update 20241012
Reviewed-by: Eotvos, Oliver <oliver.eotvos@t-systems.com>
Co-authored-by: Dong, Qiu Jian <qiujiandong1@huawei.com>
Co-committed-by: Dong, Qiu Jian <qiujiandong1@huawei.com>
2024-10-18 07:19:46 +00:00

198 lines
14 KiB
HTML

<a name="swr_02_0046"></a><a name="swr_02_0046"></a>
<h1 class="topictitle1">Creating Image Permissions</h1>
<div id="body1531798197461"><div class="section" id="swr_02_0046__se03aae4436e64394a95dc13b6f233898"><h4 class="sectiontitle">Function</h4><p id="swr_02_0046__a7005bd3228d34f8ea0fb7b75b17cfbb2">Grant permissions of an image to certain users so that they can manage, edit, and read the image.</p>
</div>
<div class="section" id="swr_02_0046__s476df674307e4b04b9545f9575dde042"><h4 class="sectiontitle">URI</h4><p id="swr_02_0046__p9609115118129">POST /v2/manage/namespaces/{<em id="swr_02_0046__i14875033863">namespace</em>}/repos/{<em id="swr_02_0046__i1898838568">repository</em>}/access</p>
<p id="swr_02_0046__p824535719488">For details about parameters, see <a href="#swr_02_0046__table73271639103420">Table 1</a>.</p>
<div class="tablenoborder"><a name="swr_02_0046__table73271639103420"></a><a name="table73271639103420"></a><table cellpadding="4" cellspacing="0" summary="" id="swr_02_0046__table73271639103420" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameter description</caption><thead align="left"><tr id="swr_02_0046__row53291539153419"><th align="left" class="cellrowborder" valign="top" width="17%" id="mcps1.3.2.4.2.5.1.1"><p id="swr_02_0046__p6331539113416">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="13%" id="mcps1.3.2.4.2.5.1.2"><p id="swr_02_0046__p1546521102411">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16%" id="mcps1.3.2.4.2.5.1.3"><p id="swr_02_0046__p185461421102417">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="54%" id="mcps1.3.2.4.2.5.1.4"><p id="swr_02_0046__p43347399345">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="swr_02_0046__row7335939103416"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.2.4.2.5.1.1 "><p id="swr_02_0046__p6843228526">namespace</p>
</td>
<td class="cellrowborder" valign="top" width="13%" headers="mcps1.3.2.4.2.5.1.2 "><p id="swr_02_0046__p45474214244">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.2.4.2.5.1.3 "><p id="swr_02_0046__p4547122132412">String</p>
</td>
<td class="cellrowborder" valign="top" width="54%" headers="mcps1.3.2.4.2.5.1.4 "><p id="swr_02_0046__p776511203467">Organization name.</p>
</td>
</tr>
<tr id="swr_02_0046__row107916202715"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.2.4.2.5.1.1 "><p id="swr_02_0046__p57616102710">repository</p>
</td>
<td class="cellrowborder" valign="top" width="13%" headers="mcps1.3.2.4.2.5.1.2 "><p id="swr_02_0046__p75471621102416">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.2.4.2.5.1.3 "><p id="swr_02_0046__p125471621152412">String</p>
</td>
<td class="cellrowborder" valign="top" width="54%" headers="mcps1.3.2.4.2.5.1.4 "><p id="swr_02_0046__p187161619273">Image name.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="swr_02_0046__s8246d3afdd6f44dc817ce0c3f2ac7d53"><h4 class="sectiontitle">Request</h4><ul id="swr_02_0046__ul16281193814915"><li id="swr_02_0046__li428153874914">Request parameters
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="swr_02_0046__HeaderParameter" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request header parameters</caption><thead align="left"><tr id="swr_02_0046__row769110367216"><th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.3.2.1.1.2.5.1.1"><p id="swr_02_0046__p96924364212">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.3.2.1.1.2.5.1.2"><p id="swr_02_0046__p1369414367218">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="20%" id="mcps1.3.3.2.1.1.2.5.1.3"><p id="swr_02_0046__p11694143632110">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="40%" id="mcps1.3.3.2.1.1.2.5.1.4"><p id="swr_02_0046__p16969365215">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="swr_02_0046__row14691173619214"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="swr_02_0046__p17696736162113">Content-Type</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="swr_02_0046__p10697123602112">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="swr_02_0046__p36971136102111">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="swr_02_0046__p14697133672116">Message body type (format). The value can be <strong id="swr_02_0046__b108734721971540">application/json</strong> or <strong id="swr_02_0046__b113942124871540">charset=utf-8 application/json</strong>.</p>
<p id="swr_02_0046__p5698936112118">The default value is <strong id="swr_02_0046__b52488397372231">application/json</strong>.</p>
</td>
</tr>
<tr id="swr_02_0046__row869133617213"><td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.1 "><p id="swr_02_0046__p1969912361215">X-Auth-Token</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.2 "><p id="swr_02_0046__p12699123692118">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="20%" headers="mcps1.3.3.2.1.1.2.5.1.3 "><p id="swr_02_0046__p9699936182118">String</p>
</td>
<td class="cellrowborder" valign="top" width="40%" headers="mcps1.3.3.2.1.1.2.5.1.4 "><p id="swr_02_0046__p170073662111">User token.</p>
<p id="swr_02_0046__p12700163652111">The token can be obtained by calling an IAM API. The value of <strong id="swr_02_0046__b124699735171427">X-Subject-Token</strong> in the response header is the user token.</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="swr_02_0046__table34001413863" frame="border" border="1" rules="all"><caption><b>Table 3 </b>Request body parameter description</caption><thead align="left"><tr id="swr_02_0046__row17400171319612"><th align="left" class="cellrowborder" valign="top" width="16.65833416658334%" id="mcps1.3.3.2.1.2.2.5.1.1"><p id="swr_02_0046__p1840015139619">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="15.768423157684234%" id="mcps1.3.3.2.1.2.2.5.1.2"><p id="swr_02_0046__p1410131010424">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.12838716128387%" id="mcps1.3.3.2.1.2.2.5.1.3"><p id="swr_02_0046__p24002135620">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="51.44485551444855%" id="mcps1.3.3.2.1.2.2.5.1.4"><p id="swr_02_0046__p174008131163">Description.</p>
</th>
</tr>
</thead>
<tbody><tr id="swr_02_0046__row11400113668"><td class="cellrowborder" valign="top" width="16.65833416658334%" headers="mcps1.3.3.2.1.2.2.5.1.1 "><p id="swr_02_0046__p1482131117588"><em id="swr_02_0046__i16401119182119">[Array element]</em></p>
</td>
<td class="cellrowborder" valign="top" width="15.768423157684234%" headers="mcps1.3.3.2.1.2.2.5.1.2 "><p id="swr_02_0046__p1210181034216">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="16.12838716128387%" headers="mcps1.3.3.2.1.2.2.5.1.3 "><p id="swr_02_0046__p88201811175811">Array of <a href="#swr_02_0046__table6912142367">objects</a></p>
</td>
<td class="cellrowborder" valign="top" width="51.44485551444855%" headers="mcps1.3.3.2.1.2.2.5.1.4 "><p id="swr_02_0046__p181911115588">User list</p>
</td>
</tr>
</tbody>
</table>
</div>
<div class="tablenoborder"><a name="swr_02_0046__table6912142367"></a><a name="table6912142367"></a><table cellpadding="4" cellspacing="0" summary="" id="swr_02_0046__table6912142367" frame="border" border="1" rules="all"><caption><b>Table 4 </b><em id="swr_02_0046__i17520173014289">[Array element]</em> parameters decription</caption><thead align="left"><tr id="swr_02_0046__row494101419361"><th align="left" class="cellrowborder" valign="top" width="17%" id="mcps1.3.3.2.1.3.2.5.1.1"><p id="swr_02_0046__p495214193611">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="13%" id="mcps1.3.3.2.1.3.2.5.1.2"><p id="swr_02_0046__p763819132514">Mandatory</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16%" id="mcps1.3.3.2.1.3.2.5.1.3"><p id="swr_02_0046__p15638892255">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="54%" id="mcps1.3.3.2.1.3.2.5.1.4"><p id="swr_02_0046__p1498214113618">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="swr_02_0046__row69961413365"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.2.1.3.2.5.1.1 "><p id="swr_02_0046__p1110011416365">user_id</p>
</td>
<td class="cellrowborder" valign="top" width="13%" headers="mcps1.3.3.2.1.3.2.5.1.2 "><p id="swr_02_0046__p186387916259">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.3.2.1.3.2.5.1.3 "><p id="swr_02_0046__p1263818912520">String</p>
</td>
<td class="cellrowborder" valign="top" width="54%" headers="mcps1.3.3.2.1.3.2.5.1.4 "><p id="swr_02_0046__p46175204712">User ID.</p>
</td>
</tr>
<tr id="swr_02_0046__row3105101418360"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.2.1.3.2.5.1.1 "><p id="swr_02_0046__p3107314193615">user_name</p>
</td>
<td class="cellrowborder" valign="top" width="13%" headers="mcps1.3.3.2.1.3.2.5.1.2 "><p id="swr_02_0046__p56389912515">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.3.2.1.3.2.5.1.3 "><p id="swr_02_0046__p763816917251">String</p>
</td>
<td class="cellrowborder" valign="top" width="54%" headers="mcps1.3.3.2.1.3.2.5.1.4 "><p id="swr_02_0046__p1761185234713">Username.</p>
</td>
</tr>
<tr id="swr_02_0046__row135101232143711"><td class="cellrowborder" valign="top" width="17%" headers="mcps1.3.3.2.1.3.2.5.1.1 "><p id="swr_02_0046__p35101132143714">auth</p>
</td>
<td class="cellrowborder" valign="top" width="13%" headers="mcps1.3.3.2.1.3.2.5.1.2 "><p id="swr_02_0046__p9638791258">Yes</p>
</td>
<td class="cellrowborder" valign="top" width="16%" headers="mcps1.3.3.2.1.3.2.5.1.3 "><p id="swr_02_0046__p18638189142515">Integer</p>
</td>
<td class="cellrowborder" valign="top" width="54%" headers="mcps1.3.3.2.1.3.2.5.1.4 "><p id="swr_02_0046__p1751033214375">User permission that is configured.</p>
<ul id="swr_02_0046__ul654813144019"><li id="swr_02_0046__li115901316202">7: Manage</li><li id="swr_02_0046__li55991417708">3: Write</li><li id="swr_02_0046__li15482141406">1: Read</li></ul>
</td>
</tr>
</tbody>
</table>
</div>
</li><li id="swr_02_0046__li99231240114912">Example request<pre class="screen" id="swr_02_0046__screen971515365214">POST https://{endpoint}/v2/manage/namespaces/{namespace}/repos/{repository}/access
[ {
"user_id" : "fb3f175c1fd146ab8cdae3272be6107b",
"user_name" : "user01",
"auth" : 1
} ]</pre>
</li></ul>
</div>
<div class="section" id="swr_02_0046__sab9be5ce850743859bb238e072f8d1f2"><h4 class="sectiontitle">Response</h4><ul id="swr_02_0046__ul11656391015"><li id="swr_02_0046__li194756411106">Response parameters<p id="swr_02_0046__p370911481507"><a name="swr_02_0046__li194756411106"></a><a name="li194756411106"></a>N/A</p>
</li><li id="swr_02_0046__li129849446013">Example response<p id="swr_02_0046__p11846105832020"><a name="swr_02_0046__li129849446013"></a><a name="li129849446013"></a>None</p>
</li></ul>
</div>
<div class="section" id="swr_02_0046__s336c1dbc7af446a1b3cc077ea3f82fc9"><h4 class="sectiontitle">Status Code</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="swr_02_0046__t33d02fa79e8443868a71c99f411610a5" frame="border" border="1" rules="all"><thead align="left"><tr id="swr_02_0046__r9eb80d64e8f34d0db940daa95fc929dd"><th align="left" class="cellrowborder" valign="top" width="16.439999999999998%" id="mcps1.3.5.2.1.3.1.1"><p id="swr_02_0046__a7e51ed73a71e4dc29d0dd4aae3016632">Status Code</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="83.56%" id="mcps1.3.5.2.1.3.1.2"><p id="swr_02_0046__aa802d02e21c944f1863435a0d11c7ec1">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="swr_02_0046__r1cc0192c651444db882dde750b14be23"><td class="cellrowborder" valign="top" width="16.439999999999998%" headers="mcps1.3.5.2.1.3.1.1 "><p id="swr_02_0046__a6a3639a3cb154e17b95c5076c8036471">201</p>
</td>
<td class="cellrowborder" valign="top" width="83.56%" headers="mcps1.3.5.2.1.3.1.2 "><p id="swr_02_0046__ad54ae639e7f94380a87bfc10cc91a4f0">Creation successful.</p>
</td>
</tr>
<tr id="swr_02_0046__r0bd68000afe546dd9c7a8d3a05991a04"><td class="cellrowborder" valign="top" width="16.439999999999998%" headers="mcps1.3.5.2.1.3.1.1 "><p id="swr_02_0046__ad46ccdc6b7e04df3b6b5679f7606f434">400</p>
</td>
<td class="cellrowborder" valign="top" width="83.56%" headers="mcps1.3.5.2.1.3.1.2 "><p id="swr_02_0046__a1f2e8d58145d461781428d28f07a5351">Request error.</p>
</td>
</tr>
<tr id="swr_02_0046__row059261364320"><td class="cellrowborder" valign="top" width="16.439999999999998%" headers="mcps1.3.5.2.1.3.1.1 "><p id="swr_02_0046__p059261310438">401</p>
</td>
<td class="cellrowborder" valign="top" width="83.56%" headers="mcps1.3.5.2.1.3.1.2 "><p id="swr_02_0046__p759261314433">Authentication failed.</p>
</td>
</tr>
<tr id="swr_02_0046__row9547111612437"><td class="cellrowborder" valign="top" width="16.439999999999998%" headers="mcps1.3.5.2.1.3.1.1 "><p id="swr_02_0046__p19547131615432">404</p>
</td>
<td class="cellrowborder" valign="top" width="83.56%" headers="mcps1.3.5.2.1.3.1.2 "><p id="swr_02_0046__p16547416114315">The image does not exist.</p>
</td>
</tr>
<tr id="swr_02_0046__r19bdef782c164c93917f897241e521f8"><td class="cellrowborder" valign="top" width="16.439999999999998%" headers="mcps1.3.5.2.1.3.1.1 "><p id="swr_02_0046__a7da68e311c0f4267bacf3cbdb71d1ead">500</p>
</td>
<td class="cellrowborder" valign="top" width="83.56%" headers="mcps1.3.5.2.1.3.1.2 "><p id="swr_02_0046__aa6fd12cedd8841e29eeeca27c1bdea1a">Internal error.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="swr_02_0046__section134071631161117"><h4 class="sectiontitle">Error Codes</h4><p id="swr_02_0046__p15408431161114">For details, see <a href="swr_02_0024.html">Error Codes</a>.</p>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="en-us_topic_0000001470924909.html">Image Permission Management</a></div>
</div>
</div>