forked from docs/doc-exports
Reviewed-by: gtema <artem.goncharov@gmail.com> Co-authored-by: Jawei, Li <lijiawei5@huawei.com> Co-committed-by: Jawei, Li <lijiawei5@huawei.com>
130 lines
9.4 KiB
HTML
130 lines
9.4 KiB
HTML
<a name="obs_04_0037"></a><a name="obs_04_0037"></a>
|
|
|
|
<h1 class="topictitle1">Configuring Versioning for a Bucket</h1>
|
|
<div id="body41213725"><div class="section" id="obs_04_0037__section5584184924715"><h4 class="sectiontitle">Functions</h4><p class="msonormal" id="obs_04_0037__p14402739">This operation restores an object that is mistakenly overwritten or deleted. You can use versioning to save, query, and restore objects of different versions. Versioning allows you to easily recover lost data due to misoperations or program faults. Versioning can also be used for retaining and archiving data.</p>
|
|
<p class="msonormal" id="obs_04_0037__p62515791">By default, versioning is disabled for a bucket.</p>
|
|
<p class="msonormal" id="obs_04_0037__p25771207">You can perform this operation to enable or suspend versioning for a bucket.</p>
|
|
<p class="msonormal" id="obs_04_0037__p30614278">After versioning is enabled for a bucket:</p>
|
|
<ul id="obs_04_0037__ul7093052"><li id="obs_04_0037__li35379206">OBS creates a unique version ID for each uploaded object. Namesake objects are not overwritten and are distinguished by their own version IDs.</li><li id="obs_04_0037__li49977398">You can download objects by specifying version IDs. By default, the latest object is downloaded if the version ID is not specified.</li><li id="obs_04_0037__li47143398">Objects can be deleted by version ID. If an object is deleted with no version ID specified, the object is only attached with a deletion marker and a unique version ID but is not physically deleted.</li><li id="obs_04_0037__li21637399">The latest objects in a bucket are returned by default after a GET Object request. You can also send a request to obtain a bucket's objects with all version IDs.</li><li id="obs_04_0037__li60518866">Except deletion markers and object metadata, storage space occupied by objects with all version IDs is charged.</li></ul>
|
|
<p class="msonormal" id="obs_04_0037__p63837474">After versioning is suspended for a bucket:</p>
|
|
<ul id="obs_04_0037__ul37666362"><li id="obs_04_0037__li7798889">Existing objects with version IDs are not affected.</li><li id="obs_04_0037__li3081139">The system creates version ID <strong id="obs_04_0037__b1374318164718">null</strong> to an uploaded object and the object will be overwritten after a namesake one is uploaded.</li><li id="obs_04_0037__li27730259">You can download objects by specifying version IDs. By default, the latest object is downloaded if the version ID is not specified.</li><li id="obs_04_0037__li48245745">Objects can be deleted by version ID. If an object is deleted with no version ID specified, the object is attached with a deletion marker whose version ID is <strong id="obs_04_0037__b1669506">null</strong>. The object with version ID <strong id="obs_04_0037__b864760555163621">null</strong> is physically deleted.</li><li id="obs_04_0037__li31558526">Except deletion markers and object metadata, storage space occupied by objects with all version IDs is charged.</li></ul>
|
|
<p class="msonormal" id="obs_04_0037__p3452939">Only the bucket owner can set versioning for the bucket.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0037__section31076456"><h4 class="sectiontitle">Request Syntax</h4><div class="codecoloring" codetype="Xml" id="obs_04_0037__screen6103826"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8
|
|
9</pre></div></td><td class="code"><div class="highlight"><pre><span></span>PUT /?versioning HTTP/1.1
|
|
Host: bucketname.obs.region.example.com
|
|
Date: date
|
|
Authorization: authorization
|
|
Content-Length: length
|
|
|
|
<span class="nt"><VersioningConfiguration></span>
|
|
<span class="nt"><Status></span>status<span class="nt"></Status></span>
|
|
<span class="nt"></VersioningConfiguration></span>
|
|
</pre></div>
|
|
</td></tr></table></div>
|
|
</div>
|
|
<div class="section" id="obs_04_0037__section11252648"><h4 class="sectiontitle">Request Parameters</h4><p class="msonormal" id="obs_04_0037__p142055">This request contains no parameter.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0037__section34164974"><h4 class="sectiontitle">Request Headers</h4><p class="msonormal" id="obs_04_0037__p11506457">This request uses common headers. For details, see <a href="obs_04_0007.html#obs_04_0007__table25197309">Table 3</a>.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0037__section39049314"><h4 class="sectiontitle">Request Elements</h4><p class="msonormal" id="obs_04_0037__p66708519">This request contains elements to configure the bucket versioning in XML format. <a href="#obs_04_0037__d0e7246">Table 1</a> lists the request elements.</p>
|
|
|
|
<div class="tablenoborder"><a name="obs_04_0037__d0e7246"></a><a name="d0e7246"></a><table cellpadding="4" cellspacing="0" summary="" id="obs_04_0037__d0e7246" frame="border" border="1" rules="all"><caption><b>Table 1 </b>Elements for configuring bucket versioning</caption><thead align="left"><tr id="obs_04_0037__row52104816"><th align="left" class="cellrowborder" valign="top" width="33.67%" id="mcps1.3.5.3.2.4.1.1"><p id="obs_04_0037__p59740538">Element</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="51.019999999999996%" id="mcps1.3.5.3.2.4.1.2"><p id="obs_04_0037__p64308536">Description</p>
|
|
</th>
|
|
<th align="left" class="cellrowborder" valign="top" width="15.310000000000002%" id="mcps1.3.5.3.2.4.1.3"><p id="obs_04_0037__p38936003">Mandatory</p>
|
|
</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody><tr id="obs_04_0037__row64406127"><td class="cellrowborder" valign="top" width="33.67%" headers="mcps1.3.5.3.2.4.1.1 "><p id="obs_04_0037__p49513773">VersioningConfiguration</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="51.019999999999996%" headers="mcps1.3.5.3.2.4.1.2 "><p id="obs_04_0037__p51192643">Root node for configuring versioning</p>
|
|
<p id="obs_04_0037__p58080607">Ancestor node: none</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.310000000000002%" headers="mcps1.3.5.3.2.4.1.3 "><p id="obs_04_0037__p6908717">Yes</p>
|
|
</td>
|
|
</tr>
|
|
<tr id="obs_04_0037__row62178457"><td class="cellrowborder" valign="top" width="33.67%" headers="mcps1.3.5.3.2.4.1.1 "><p id="obs_04_0037__p3290281">Status</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="51.019999999999996%" headers="mcps1.3.5.3.2.4.1.2 "><p id="obs_04_0037__p65186226">Versioning status of the bucket</p>
|
|
<p id="obs_04_0037__p49805123">Type: enumeration</p>
|
|
<p id="obs_04_0037__p45592923">Ancestor node: VersioningConfiguration</p>
|
|
<p id="obs_04_0037__p7683123">Value options: Enabled, Suspended</p>
|
|
</td>
|
|
<td class="cellrowborder" valign="top" width="15.310000000000002%" headers="mcps1.3.5.3.2.4.1.3 "><p id="obs_04_0037__p18353199">Yes</p>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
<div class="section" id="obs_04_0037__section15899509"><h4 class="sectiontitle">Response Syntax</h4><div class="codecoloring" codetype="Xml" id="obs_04_0037__screen10214176"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
|
|
2
|
|
3
|
|
4</pre></div></td><td class="code"><div class="highlight"><pre><span></span>HTTP/1.1 status_code
|
|
Date: date
|
|
|
|
Content-Length: length
|
|
</pre></div>
|
|
</td></tr></table></div>
|
|
</div>
|
|
<div class="section" id="obs_04_0037__section8877856"><h4 class="sectiontitle">Response Headers</h4><p class="msonormal" id="obs_04_0037__p1512332591013">The response to the request uses common headers. For details, see <a href="obs_04_0013.html#obs_04_0013__d0e686">Table 1</a>.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0037__section12791844"><h4 class="sectiontitle">Response Elements</h4><p class="msonormal" id="obs_04_0037__p27783412">This response involves no elements.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0037__section48017739"><h4 class="sectiontitle">Error Responses</h4><p class="msonormal" id="obs_04_0037__p35863881">No special error responses are involved. For details about error responses, see <a href="obs_04_0115.html#obs_04_0115__d0e843">Table 2</a>.</p>
|
|
</div>
|
|
<div class="section" id="obs_04_0037__section14482163815396"><h4 class="sectiontitle">Sample Request</h4><div class="codecoloring" codetype="Xml" id="obs_04_0037__screen8484163863919"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6
|
|
7
|
|
8
|
|
9
|
|
10
|
|
11</pre></div></td><td class="code"><div class="highlight"><pre><span></span>PUT /?versioning HTTP/1.1
|
|
User-Agent: curl/7.29.0
|
|
Host: examplebucket.obs.region.example.com
|
|
Accept: */*
|
|
Date: WED, 01 Jul 2015 03:14:18 GMT
|
|
Authorization: OBS H4IPJX0TQTHTHEBQQCEC:sc2PM13Wlfcoc/YZLK0MwsI2Zpo=
|
|
Content-Length: 89
|
|
|
|
<span class="nt"><VersioningConfiguration></span>
|
|
<span class="nt"><Status></span>Enabled<span class="nt"></Status></span>
|
|
<span class="nt"></VersioningConfiguration></span>
|
|
</pre></div>
|
|
</td></tr></table></div>
|
|
</div>
|
|
<div class="section" id="obs_04_0037__section76081155815"><h4 class="sectiontitle">Sample Response</h4><div class="codecoloring" codetype="Xml" id="obs_04_0037__screen8485113814"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre>1
|
|
2
|
|
3
|
|
4
|
|
5
|
|
6</pre></div></td><td class="code"><div class="highlight"><pre><span></span>HTTP/1.1 200 OK
|
|
Server: OBS
|
|
x-obs-request-id: BF26000001643672B973EEBC5FBBF909
|
|
x-obs-id-2: 32AAAQAAEAABSAAgAAEAABAAAQAAEAABCSH6rPRHjQCa62fcNpCCPs7+1Aq/hKzE
|
|
Date: Date: WED, 01 Jul 2015 03:14:18 GMT
|
|
Content-Length: 0
|
|
</pre></div>
|
|
</td></tr></table></div>
|
|
</div>
|
|
</div>
|
|
<div>
|
|
<div class="familylinks">
|
|
<div class="parentlink"><strong>Parent topic:</strong> <a href="obs_04_0026.html">Advanced Bucket Settings</a></div>
|
|
</div>
|
|
</div>
|
|
|