doc-exports/docs/obs/api-swift/obs_03_0034.html
zhangyue 894279c39a Object Storage Service API Reference Swift V1
Reviewed-by: Hasko, Vladimir <vladimir.hasko@t-systems.com>
Co-authored-by: zhangyue <zhangyue164@huawei.com>
Co-committed-by: zhangyue <zhangyue164@huawei.com>
2023-02-02 08:50:48 +00:00

129 lines
11 KiB
HTML

<a name="obs_03_0034"></a><a name="obs_03_0034"></a>
<h1 class="topictitle1">Request</h1>
<div id="body1442461140556"><div class="section" id="obs_03_0034__section39869956112928"><h4 class="sectiontitle">Method</h4>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="obs_03_0034__table36630378113016" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Method description</caption><thead align="left"><tr id="obs_03_0034__row48730343113016"><th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.1.2.2.4.1.1"><p id="obs_03_0034__p5336715811413">Method</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.1.2.2.4.1.2"><p id="obs_03_0034__p51296332113016"><strong id="obs_03_0034__b39273688114629">URI</strong></p>
</th>
<th align="left" class="cellrowborder" valign="top" width="33.33333333333333%" id="mcps1.3.1.2.2.4.1.3"><p id="obs_03_0034__p61362190113016">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_03_0034__row15388804113016"><td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.1.2.2.4.1.1 "><p id="obs_03_0034__p38533588113016">PUT</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.1.2.2.4.1.2 "><p id="obs_03_0034__p52757727113245">/v1/{account}/{container}</p>
</td>
<td class="cellrowborder" valign="top" width="33.33333333333333%" headers="mcps1.3.1.2.2.4.1.3 "><p id="obs_03_0034__p19784190113016">Creates a container in a specified account.</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="obs_03_0034__p57493782195317"><strong id="obs_03_0034__b15034397">{account}</strong> indicates the name of an account.</p>
<p id="obs_03_0034__p565312949827"><strong id="obs_03_0034__b9826612">{container}</strong> indicates the name of a container.</p>
<p id="obs_03_0034__p41688322113723">This operation does not involve a request body.</p>
</div>
<div class="section" id="obs_03_0034__section16623225"><h4 class="sectiontitle">Example Request</h4><p id="obs_03_0034__p420601294920">Create a container named <strong id="obs_03_0034__b47896825">marktwain</strong>:</p>
</div>
<pre class="screen" id="obs_03_0034__screen21590153">curl -i $publicURL/marktwain -X PUT -H "X-Auth-Token:$token"</pre>
<div class="section" id="obs_03_0034__section5103708"><h4 class="sectiontitle">Request Query Parameters</h4><p id="obs_03_0034__p57040706">This operation does not include request query parameters.</p>
</div>
<div class="section" id="obs_03_0034__section2186955"><h4 class="sectiontitle">Request Headers</h4><p id="obs_03_0034__p5151104195136">Request URI parameters</p>
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" id="obs_03_0034__table6094619095136" frame="border" border="1" rules="all"><thead align="left"><tr id="obs_03_0034__row1674751895136"><th align="left" class="cellrowborder" valign="top" width="20.66%" id="mcps1.3.5.3.1.4.1.1"><p id="obs_03_0034__p1437168995136">Parameter</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="14.399999999999999%" id="mcps1.3.5.3.1.4.1.2"><p id="obs_03_0034__p797889795136">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="64.94%" id="mcps1.3.5.3.1.4.1.3"><p id="obs_03_0034__p4525367895136">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_03_0034__row3947959795136"><td class="cellrowborder" valign="top" width="20.66%" headers="mcps1.3.5.3.1.4.1.1 "><p id="obs_03_0034__p4373079495136">{account}</p>
</td>
<td class="cellrowborder" valign="top" width="14.399999999999999%" headers="mcps1.3.5.3.1.4.1.2 "><p id="obs_03_0034__p5253344495136">String</p>
<p id="obs_03_0034__p303895195136">(Required)</p>
</td>
<td class="cellrowborder" valign="top" width="64.94%" headers="mcps1.3.5.3.1.4.1.3 "><p id="obs_03_0034__p4482847095136">A unique account name. In the current version, it indicates a unique ID for the account.</p>
</td>
</tr>
<tr id="obs_03_0034__row80305395136"><td class="cellrowborder" valign="top" width="20.66%" headers="mcps1.3.5.3.1.4.1.1 "><p id="obs_03_0034__p6504730895136">{container}</p>
</td>
<td class="cellrowborder" valign="top" width="14.399999999999999%" headers="mcps1.3.5.3.1.4.1.2 "><p id="obs_03_0034__p3434058495136">String</p>
<p id="obs_03_0034__p4062980095136">(Required)</p>
</td>
<td class="cellrowborder" valign="top" width="64.94%" headers="mcps1.3.5.3.1.4.1.3 "><p id="obs_03_0034__p267946595136">A unique container name.</p>
<p id="obs_03_0034__p2411518895136">For details about container naming rules, see <a href="obs_03_0009.html">Naming Rules</a>.</p>
</td>
</tr>
</tbody>
</table>
</div>
<p id="obs_03_0034__p5081209493436"><a href="#obs_03_0034__table2213898993436">Table 2</a> describes the request header parameters.</p>
<div class="tablenoborder"><a name="obs_03_0034__table2213898993436"></a><a name="table2213898993436"></a><table cellpadding="4" cellspacing="0" summary="" id="obs_03_0034__table2213898993436" frame="border" border="1" rules="all"><caption><b>Table 2 </b>Request header parameters</caption><thead align="left"><tr id="obs_03_0034__row2383841493436"><th align="left" class="cellrowborder" valign="top" width="36.54%" id="mcps1.3.5.5.2.4.1.1"><p id="obs_03_0034__p5186338393436">Header</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="16.939999999999998%" id="mcps1.3.5.5.2.4.1.2"><p id="obs_03_0034__p2611644893436">Type</p>
</th>
<th align="left" class="cellrowborder" valign="top" width="46.52%" id="mcps1.3.5.5.2.4.1.3"><p id="obs_03_0034__p4708242393436">Description</p>
</th>
</tr>
</thead>
<tbody><tr id="obs_03_0034__row38652360195336"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.5.5.2.4.1.1 "><p id="obs_03_0034__p65236216195345">X-Auth-Token</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.5.5.2.4.1.2 "><p id="obs_03_0034__p49642148195345">String</p>
<p id="obs_03_0034__p44126152195345">(Required)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.5.5.2.4.1.3 "><p id="obs_03_0034__p17448527195345">Authentication token.</p>
</td>
</tr>
<tr id="obs_03_0034__row5720377893436"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.5.5.2.4.1.1 "><p id="obs_03_0034__p299447193436">X-Container-Read</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.5.5.2.4.1.2 "><p id="obs_03_0034__p4122562193436">String</p>
<p id="obs_03_0034__p344567579536">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.5.5.2.4.1.3 "><p id="obs_03_0034__p5094097993436">Sets a container access control list (ACL) that grants read access.</p>
<p id="obs_03_0034__p699305295556">To set the container read ACL:</p>
<p id="obs_03_0034__p5743548095618">curl -X {PUT|POST} -i -H "X-Auth-Token: $token" -H \</p>
<p id="obs_03_0034__p4715727595618">"X-Container-Read: ACL" $publicURL/Container</p>
<p id="obs_03_0034__p2291626110164">For details about ACL format rules, see the next section.</p>
</td>
</tr>
<tr id="obs_03_0034__row2477195793436"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.5.5.2.4.1.1 "><p id="obs_03_0034__p6037149193436">X-Container-Write</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.5.5.2.4.1.2 "><p id="obs_03_0034__p5825260693436">String</p>
<p id="obs_03_0034__p5945820095322">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.5.5.2.4.1.3 "><p id="obs_03_0034__p2084062193436">Sets a container ACL that grants write access.</p>
<p id="obs_03_0034__p1703297195632">To set the container write ACL:</p>
<p id="obs_03_0034__p1907901195632">curl -X {PUT|POST} -i -H "X-Auth-Token: $token" -H \</p>
<p id="obs_03_0034__p3749337395632">"X-Container-Write: ACL" $publicURL/Container</p>
<p id="obs_03_0034__p52656914101624">For details about ACL format rules, see the next section.</p>
</td>
</tr>
<tr id="obs_03_0034__row4968641311486"><td class="cellrowborder" valign="top" width="36.54%" headers="mcps1.3.5.5.2.4.1.1 "><p id="obs_03_0034__p6517651711486">X-Container-Meta-name</p>
</td>
<td class="cellrowborder" valign="top" width="16.939999999999998%" headers="mcps1.3.5.5.2.4.1.2 "><p id="obs_03_0034__p4480653811486">String</p>
<p id="obs_03_0034__p4105006895324">(Optional)</p>
</td>
<td class="cellrowborder" valign="top" width="46.52%" headers="mcps1.3.5.5.2.4.1.3 "><p id="obs_03_0034__p545094711486">Container metadata. <strong id="obs_03_0034__b1239002741016">{name}</strong> is the name of a metadata item that you want to add, update, or delete. To delete this item, leave <strong id="obs_03_0034__b13391112715104">{name}</strong> empty in this header. You must specify an <strong id="obs_03_0034__b2119073566101717">X-Container-Meta-{name}</strong> header for each metadata item (for each <strong id="obs_03_0034__b1507413363102042">{name}</strong>) that you want to add, update, or delete.</p>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<div class="section" id="obs_03_0034__section1003248895852"><a name="obs_03_0034__section1003248895852"></a><a name="section1003248895852"></a><h4 class="sectiontitle">Container Read ACL Rules (X-Container-Read)</h4><p id="obs_03_0034__p4612165410229">Container read ACL rules are as follows:</p>
<ul id="obs_03_0034__ul160436711035"><li id="obs_03_0034__li101753131035"><strong id="obs_03_0034__b52809326">.r:*#</strong>: All referrers.</li><li id="obs_03_0034__li5075144310522"><strong id="obs_03_0034__b49697041">.r:example.com,swift.example.com#</strong>: Comma-separated list of referrers.</li><li id="obs_03_0034__li945866010820"><strong id="obs_03_0034__b66037364">.rlistings#</strong>: Container listing access, always combined with <strong id="obs_03_0034__b57986675205455">.r:</strong>.</li><li id="obs_03_0034__li56374703101412"><strong id="obs_03_0034__b47426239">.r:-example.com#</strong>: Comma-separated list of inaccessible addresses.</li><li id="obs_03_0034__li49178208142541"><strong id="obs_03_0034__b842352706163135">{account:user} #</strong>: <strong id="obs_03_0034__b842352706163145">account</strong> is <strong id="obs_03_0034__b842352706163152">projectid</strong> and <strong id="obs_03_0034__b842352706163158">user</strong> is <strong id="obs_03_0034__b84235270616327">userid</strong>.</li></ul>
</div>
<div class="section" id="obs_03_0034__section39003754101721"><a name="obs_03_0034__section39003754101721"></a><a name="section39003754101721"></a><h4 class="sectiontitle">Container Write ACL Rules (X-Container-Write)</h4><p id="obs_03_0034__p1854455102152">Container write ACL rules are as follows:</p>
<ul id="obs_03_0034__ul6854202102221"><li id="obs_03_0034__li61687818102221"><strong id="obs_03_0034__b842352706163221">{account:user} #</strong>: Only this format is supported. <strong id="obs_03_0034__b2110945091163234">account</strong> is <strong id="obs_03_0034__b1330396492163234">projectid</strong> and <strong id="obs_03_0034__b874875450163234">user</strong> is <strong id="obs_03_0034__b612566277163234">userid</strong>.</li></ul>
</div>
</div>
<div>
<div class="familylinks">
<div class="parentlink"><strong>Parent topic:</strong> <a href="obs_03_0033.html">Create Container</a></div>
</div>
</div>