GET Bucket Lifecycle

You can perform this operation to get the bucket lifecycle configuration.

Only users granted the s3:GetLifecycleConfiguration permission can view the bucket lifecycle configuration. By default, only the bucket owner can get the bucket lifecycle configuration. The bucket owner can allow other users to get the bucket lifecycle configuration by granting them the permission.

Request Syntax

GET /?lifecycle HTTP/1.1
Host: bucketname.obs.cn-north-1.myhwclouds.com
Date: date
Authorization: authorization

Request Parameters

This request contains no parameter.

Request Headers

This request uses common headers. For details, see Common Request Headers.

Request Elements

This request contains no element.

Response Syntax

HTTP/1.1 status_code
Date: date
Content-Type: application/xml
Date: date
Content-Length: length

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<LifecycleConfiguration xmlns="http://obs.cn-north-1.myhwclouds.com/doc/2015-06-30/">
    <Rule>
        <ID>id</ID>
        <Prefix>prefix</Prefix>
        <Status>status</Status>
        <Expiration>
            <Date>date</Date>
        </Expiration>
        <NoncurrentVersionExpiration>
            <NoncurrentDays>days</NoncurrentDays>
        </NoncurrentVersionExpiration>
    </Rule>
</LifecycleConfiguration>

Response Headers

This response uses common headers. For details, see Common Response Headers.

Response Elements

This response contains elements to detail bucket lifecycle configuration. Table 1 describes the elements.

Table 1 Response elements for lifecycle configuration

Element

Description

Date

Indicates when the specified rule takes effect.

The date value must conform to the ISO 8601 format. The time is always midnight UTC.

Type: string

Ancestor: Expiration

Days

Indicates the number of days after object creation when the specified rule takes effect.

Type: positive integer

Ancestor: Expiration

Expiration

Indicates the container for the object expiration rule.

Type: XML

Children: Date or Days

Ancestor: Rule

ID

Indicates the unique identifier of a rule. The value can contain a maximum of 255 characters.

Type: string

Ancestor: Rule

LifecycleConfiguration

Indicates the container for lifecycle rules. You can add multiple rules. The total size of the configuration message body cannot exceed 20 KB.

Type: XML

Children: Rule

Ancestor: none

NoncurrentDays

Indicates the number of days an object is noncurrent before the specified rule takes effect.

Type: positive integer

Ancestor: NoncurrentVersionExpiration

NoncurrentVersionExpiration

Indicates the container for the noncurrent object expiration rule. You set this lifecycle configuration action on a bucket that has versioning enabled (or suspended) to request that OBS delete noncurrent object versions which meet the expiration rule.

Type: XML

Children: NoncurrentDays

Ancestor: Rule

Prefix

Indicates the object key prefix identifying one or more objects to which the rule applies.

Type: string

Ancestor: Rule

Rule

Indicates the container for a lifecycle rule.

Type: container

Ancestor: LifecycleConfiguration

Status

Indicates whether the rule is enabled.

Type: string

Ancestor: Rule

Valid values: Enabled, Disabled

Error Responses

This response may contain one special error, as described in Table 2.

Table 2 Special error

Error Code

Description

HTTP Status Code

NoSuchLifecycleConfiguration

Indicates that the bucket lifecycle configuration does not exist.

404 Not Found

For other errors, see Table 1.

Registration