VK Cloud logo

Object Lock

Methods for working with object lock:

GetObjectLegalHold

Returns the legal hold status set on an object.

Request example:

GET /{Key+}?legal-hold HTTP/1.1Host: my-test-bucket1.hb.bizmrg.com

Response example:

HTTP/1.1 200<?xml version="1.0" encoding="UTF-8"?><LegalHold>   <Status>string</Status></LegalHold>

PutObjectLegalHold

The PutObjectLegalHold method sets or removes a legal hold on an object.

Request body:

<LegalHold xmlns="http://s3.amazonaws.com/doc/2006-03-01/">   <Status>string</Status></LegalHold>

Request parameters:

Parameter

Type

Description

LegalHold

complex element

Object legal hold settings

LegalHold.Status

xs:string (enum)

Legal hold status:

  • ON — hold is set
  • OFF — hold is removed

Request example:

PUT /{Key+}?legal-hold HTTP/1.1Host: my-test-bucket1.hb.bizmrg.com<?xml version="1.0" encoding="UTF-8"?><LegalHold xmlns="http://s3.amazonaws.com/doc/2006-03-01/">   <Status>string</Status></LegalHold>

GetObjectRetention

Get the retention status set on an object.

Request example:

GET /{Key+}?retention HTTP/1.1Host: my-test-bucket1.hb.bizmrg.com

Response example:

HTTP/1.1 200<?xml version="1.0" encoding="UTF-8"?><Retention>   <Mode>string</Mode>   <RetainUntilDate>timestamp</RetainUntilDate></Retention>

PutObjectRetention

The PutObjectRetention method sets, configures, or removes retention on an object.

To bypass governance-mode retention when calling this method, include a header with the value x-amz-bypass-governance-retention in the request.

Request body:

<Retention xmlns="http://s3.amazonaws.com/doc/2006-03-01/">   <Mode>string</Mode>   <RetainUntilDate>timestamp</RetainUntilDate></Retention>

Request parameters:

Parameter

Type

Description

Retention

complex element

Object retention settings

Retention.Mode

xs:string (enum)

Lock type:

  • GOVERNANCE — governance-mode retention
  • COMPLIANCE — compliance-mode retention

Retention.RetainUntilDate

xs:dateTime

Date and time when the object's retention period expires, in ISO8601 format

Request example:

PUT /{Key+}?retention HTTP/1.1Host: my-test-bucket1.hb.bizmrg.comx-amz-bypass-governance-retention: BypassGovernanceRetention<?xml version="1.0" encoding="UTF-8"?>

GetObjectLockConfiguration

Get the default retention status.

Request example:

GET /?object-lock HTTP/1.1Host: my-test-bucket1.hb.bizmrg.com

Response example:

HTTP/1.1 200<?xml version="1.0" encoding="UTF-8"?><ObjectLockConfiguration>   <ObjectLockEnabled>string</ObjectLockEnabled>   <Rule>      <DefaultRetention>         <Days>integer</Days>         <Mode>string</Mode>         <Years>integer</Years>      </DefaultRetention>   </Rule></ObjectLockConfiguration>

PutObjectLockConfiguration

The PutObjectLockConfiguration method is used to set, configure, and remove the default retention.

Request body:

<ObjectLockConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">   <ObjectLockEnabled>string</ObjectLockEnabled>   <Rule>      <DefaultRetention>         <Days>integer</Days>         <Mode>string</Mode>         <Years>integer</Years>      </DefaultRetention>   </Rule></ObjectLockConfiguration>

Request parameters:

Parameter

Type

Description

ObjectLockConfiguration

ObjectLockEnabled

xs\:string (enum)

Lock status. Enabled — enabled

Rule

complex element

Default retention rule

Rule.DefaultRetention

complex element

Default retention parameter

Rule.DefaultRetention.Mode

xs\:string (enum)

Lock type:

  • GOVERNANCE — governance-mode retention
  • COMPLIANCE — compliance-mode retention

Rule.DefaultRetention.Days

xs\:integer

Retention period in days from the moment the object is uploaded. Cannot be specified together with Years

Rule.DefaultRetention.Years

xs\:integer

Retention period in years from the moment the object is uploaded. Cannot be specified together with Days

Request example:

PUT /?object-lock HTTP/1.1Host: my-test-bucket1.hb.bizmrg.com<?xml version="1.0" encoding="UTF-8"?><ObjectLockConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">   <ObjectLockEnabled>string</ObjectLockEnabled>   <Rule>      <DefaultRetention>         <Days>integer</Days>         <Mode>string</Mode>         <Years>integer</Years>      </DefaultRetention>   </Rule></ObjectLockConfiguration>
Was this article helpful?