RELAX NG Compact Syntax Format Schema

The following describes the formatting requirements of the lifecyle configuration XML.

## An ISO date string without a time zone, e.g. "2013-01-15".
DateString = xsd:date { pattern = "[^:Z]+" }

start |= LifecycleConfiguration

LifecycleConfiguration =
  ## Defines the lifecycle management policies for a bucket, which contains 0 or
  ## more (up to 100) rules.
  element LifecycleConfiguration {
    ## Defines a lifecycle managment rule, which is made of an action and the
    ## condition under which the action will be taken.
    element Rule {
      ## Defines the action to be taken, which must contain one and only one
      ## specific action element.
      element Action {
        Delete
      } &
      ## Defines the condition under which the action will be taken, which
      ## must contain at least one specific condition element.
      element Condition {
        (Age | CreatedBefore | NumberOfNewerVersions | IsLive)+
      }
    }*
  }

## Action element to delete objects in the bucket.
Delete = element Delete { (empty) }

## Condition element that matches objects over the specified age (in days).
Age = element Age { xsd:integer }

## Condition element that matches objects created before midnight of the
## specified date in UTC.
CreatedBefore = element CreatedBefore { DateString }

## Condition element relevant only for versioned objects. If the value is N, the
## condition is satisfied when there are at least N versions (including the live
## version) newer than this version of the object.
NumberOfNewerVersions = element NumberOfNewerVersions { xsd:integer }

## Condition element relevant only for versioned objects. Matches live objects
## if the value is "true", or archived objects if the value is "false".
IsLive = element IsLive { xsd:boolean }

Monitor your resources on the go

Get the Google Cloud Console app to help you manage your projects.

Send feedback about...

Cloud Storage Documentation