forked from docs/doc-exports
Reviewed-by: Sabelnikov, Dmitriy <dmitriy.sabelnikov@t-systems.com> Co-authored-by: zhangyue <zhangyue164@huawei.com> Co-committed-by: zhangyue <zhangyue164@huawei.com>
79 lines
6.1 KiB
HTML
79 lines
6.1 KiB
HTML
<a name="obs_03_0141"></a><a name="obs_03_0141"></a>
|
|
|
|
<h1 class="topictitle1">Configuring a Custom Bucket Policy (Coding Mode)</h1>
|
|
<div id="body1559010359272"><p id="obs_03_0141__p574083285011">You can configure a custom bucket policy by coding. The size of a custom bucket policy cannot exceed 20 KB.</p>
|
|
<div class="section" id="obs_03_0141__section19588639165015"><h4 class="sectiontitle">Procedure</h4><ol id="obs_03_0141__ol6696653205012"><li id="obs_03_0141__li99821455306"><span>In the bucket list, click the bucket you want to operate. The <strong id="obs_03_0141__obs_03_0307_b144421021120">Overview</strong> page is displayed.</span></li><li id="obs_03_0141__li03051828155213"><span>In the navigation pane, choose <strong id="obs_03_0141__b134401325487">Permissions</strong>.</span></li><li id="obs_03_0141__li1568715376490"><span>On the <strong id="obs_03_0141__b15334140141518">Bucket Policies</strong> tab page, configure a custom bucket policy according to your needs.</span><p><p id="obs_03_0141__p173901896189">On the right of <strong id="obs_03_0141__b76881441131518">Custom Bucket Policies</strong>, select <strong id="obs_03_0141__b10689134111159">Coding mode</strong> to configure the policy in the coding mode.</p>
|
|
</p></li><li id="obs_03_0141__li75805462519"><span>Edit the bucket policy. Below gives a bucket policy example in JSON:</span><p><pre class="screen" id="obs_03_0141__screen866121133215">{
|
|
"Statement":[
|
|
{
|
|
"Action":[
|
|
"CreateBucket",
|
|
"DeleteBucket"
|
|
],
|
|
"Effect":"Allow",
|
|
"Principal":{
|
|
"ID":[
|
|
"domain/<em id="obs_03_0141__i1129343493419">account ID</em>",
|
|
"domain/<em id="obs_03_0141__i12293143410341">account ID</em>:user/<em id="obs_03_0141__i629313453411">User ID</em>"
|
|
]
|
|
},
|
|
"Condition":{
|
|
"NumericNotEquals":{
|
|
"Referer":"sdf"
|
|
},
|
|
"StringNotLike":{
|
|
"Delimiter":"ouio"
|
|
}
|
|
},
|
|
"Resource":"000-02/key01"
|
|
}
|
|
]
|
|
}</pre>
|
|
|
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="obs_03_0141__table788413983114" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Parameters for creating a bucket policy in JSON</caption><thead align="left"><tr id="obs_03_0141__row3884698312"><th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.2.2.4.2.2.2.3.1.1"><p id="obs_03_0141__p1888415933115">Parameter</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="50%" id="mcps1.3.2.2.4.2.2.2.3.1.2"><p id="obs_03_0141__p4884189113116">Description</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="obs_03_0141__row118844913113"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.2.4.2.2.2.3.1.1 "><p id="obs_03_0141__p988416916313">Action</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.2.4.2.2.2.3.1.2 "><p id="obs_03_0141__p13885179143120">Actions the bucket policy applies to. For details, see <a href="obs_03_0051.html">Actions</a>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_03_0141__row48856913118"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.2.4.2.2.2.3.1.1 "><p id="obs_03_0141__p68858920313">Effect</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.2.4.2.2.2.3.1.2 "><p id="obs_03_0141__p15885109173115">Effect of the bucket policy. For details, see <a href="obs_03_0115.html">Effect</a>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_03_0141__row288519173115"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.2.4.2.2.2.3.1.1 "><p id="obs_03_0141__p11885594314">Principal</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.2.4.2.2.2.3.1.2 "><p id="obs_03_0141__p10473324123114">Users the bucket policy is applied to. You can obtain the user ID on the <strong id="obs_03_0141__b367616232377">My Credentials</strong> page by logging in to the console as the user to be authorized. Principals should be configured as follows:</p>
|
|
<ul id="obs_03_0141__ul747322483120"><li id="obs_03_0141__li647313241315"><strong id="obs_03_0141__b5650145962716">domain/</strong><em id="obs_03_0141__i437117258387">Account ID</em> (indicating that the principal is an account)</li><li id="obs_03_0141__li2473172419318"><strong id="obs_03_0141__b15584734182817">domain/</strong><em id="obs_03_0141__i1227313238390">Account ID</em><strong id="obs_03_0141__b1734328283">:user/</strong><em id="obs_03_0141__i173421318163919">User ID</em> (indicating that the principal is a user under an account)</li></ul>
|
|
<div class="note" id="obs_03_0141__note169801412124317"><span class="notetitle"> NOTE: </span><div class="notebody"><p id="obs_03_0141__p109801412154311"><em id="obs_03_0141__i790515346482">Account ID</em> is the <strong id="obs_03_0141__b137894355618">Domain ID</strong> that you can find on the <strong id="obs_03_0141__b1278918312564">My Credentials</strong> page.</p>
|
|
</div></div>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_03_0141__row10885189133118"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.2.4.2.2.2.3.1.1 "><p id="obs_03_0141__p48851198314">Condition</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.2.4.2.2.2.3.1.2 "><p id="obs_03_0141__p1088519943110">Conditions under which the bucket policy takes effect. For details, see <a href="obs_03_0120.html">Conditions</a>.</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_03_0141__row17885692319"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.2.4.2.2.2.3.1.1 "><p id="obs_03_0141__p488511933113">Resource</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="50%" headers="mcps1.3.2.2.4.2.2.2.3.1.2 "><p id="obs_03_0141__p588515943114">Resources the bucket policy is applied to. For details, see <a href="obs_03_0118.html">Resources</a>.</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</p></li><li id="obs_03_0141__li54216815211"><span>Click <strong id="obs_03_0141__b1097022121712">Save</strong>.</span></li></ol>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="en-us_topic_0045853584.html">Configuring a Bucket Policy</a></div>
|
|
</div>
|
|
</div>
|
|
|