Class LifecycleRule (2.18.0)

Defines objects to read, create, and modify Object Lifecycle Rules.

Object Lifecycle Rules allow to configure a Bucket to automatically delete or change the storage class of objects as they go through lifecycle events.

See Also

https://cloud.google.com/storage/docs/lifecycle for general information on Object Lifecycle Management in Google Cloud Storage.

Constructors

LifecycleRule(LifecycleRuleCondition, LifecycleRuleAction)

Parameters
Name Description
condition LifecycleRuleCondition
action LifecycleRuleAction

Functions

static Delete()

Creates different types of LifecycleRule actions.

Returns
Type Description
LifecycleRuleAction

static AbortIncompleteMultipartUpload()

Creates different types of LifecycleRule actions.

Returns
Type Description
LifecycleRuleAction

static SetStorageClassStandard()

Creates different types of LifecycleRule actions.

Returns
Type Description
LifecycleRuleAction

static SetStorageClassMultiRegional()

Creates different types of LifecycleRule actions.

Returns
Type Description
LifecycleRuleAction

static SetStorageClassRegional()

Creates different types of LifecycleRule actions.

Returns
Type Description
LifecycleRuleAction

static SetStorageClassNearline()

Creates different types of LifecycleRule actions.

Returns
Type Description
LifecycleRuleAction

static SetStorageClassColdline()

Creates different types of LifecycleRule actions.

Returns
Type Description
LifecycleRuleAction

static SetStorageClassDurableReducedAvailability()

Creates different types of LifecycleRule actions.

Returns
Type Description
LifecycleRuleAction

static SetStorageClassArchive()

Creates different types of LifecycleRule actions.

Returns
Type Description
LifecycleRuleAction

static SetStorageClass(std::string)

Creates different types of LifecycleRule actions.

Parameter
Name Description
storage_class std::string
Returns
Type Description
LifecycleRuleAction

static MaxAge(std::int32_t)

Creates different types of LifecycleRule rules.

Parameter
Name Description
days std::int32_t
Returns
Type Description
LifecycleRuleCondition

static CreatedBefore(absl::CivilDay)

Creates different types of LifecycleRule rules.

Parameter
Name Description
date absl::CivilDay
Returns
Type Description
LifecycleRuleCondition

static IsLive(bool)

Creates different types of LifecycleRule rules.

Parameter
Name Description
value bool
Returns
Type Description
LifecycleRuleCondition

static MatchesStorageClass(std::string)

Creates different types of LifecycleRule rules.

Parameter
Name Description
storage_class std::string
Returns
Type Description
LifecycleRuleCondition

static MatchesStorageClasses(std::initializer_list< std::string >)

Creates different types of LifecycleRule rules.

Parameter
Name Description
list std::initializer_list< std::string >
Returns
Type Description
LifecycleRuleCondition

static MatchesStorageClasses(Iterator, Iterator)

Creates different types of LifecycleRule rules.

Parameters
Name Description
begin Iterator
end Iterator
typename Iterator
Returns
Type Description
LifecycleRuleCondition

static MatchesStorageClassStandard()

Creates different types of LifecycleRule rules.

Returns
Type Description
LifecycleRuleCondition

static MatchesStorageClassMultiRegional()

Creates different types of LifecycleRule rules.

Returns
Type Description
LifecycleRuleCondition

static MatchesStorageClassRegional()

Creates different types of LifecycleRule rules.

Returns
Type Description
LifecycleRuleCondition

static MatchesStorageClassNearline()

Creates different types of LifecycleRule rules.

Returns
Type Description
LifecycleRuleCondition

static MatchesStorageClassColdline()

Creates different types of LifecycleRule rules.

Returns
Type Description
LifecycleRuleCondition

static MatchesStorageClassDurableReducedAvailability()

Creates different types of LifecycleRule rules.

Returns
Type Description
LifecycleRuleCondition

static MatchesStorageClassArchive()

Creates different types of LifecycleRule rules.

Returns
Type Description
LifecycleRuleCondition

static NumNewerVersions(std::int32_t)

Creates different types of LifecycleRule rules.

Parameter
Name Description
days std::int32_t
Returns
Type Description
LifecycleRuleCondition

static DaysSinceNoncurrentTime(std::int32_t)

Creates different types of LifecycleRule rules.

Parameter
Name Description
days std::int32_t
Returns
Type Description
LifecycleRuleCondition

static NoncurrentTimeBefore(absl::CivilDay)

Creates different types of LifecycleRule rules.

Parameter
Name Description
date absl::CivilDay
Returns
Type Description
LifecycleRuleCondition

static DaysSinceCustomTime(std::int32_t)

Creates different types of LifecycleRule rules.

Parameter
Name Description
days std::int32_t
Returns
Type Description
LifecycleRuleCondition

static CustomTimeBefore(absl::CivilDay)

Creates different types of LifecycleRule rules.

Parameter
Name Description
date absl::CivilDay
Returns
Type Description
LifecycleRuleCondition

static MatchesPrefix(std::string)

Creates different types of LifecycleRule rules.

Parameter
Name Description
prefix std::string
Returns
Type Description
LifecycleRuleCondition

static MatchesPrefixes(std::initializer_list< std::string >)

Creates different types of LifecycleRule rules.

Parameter
Name Description
list std::initializer_list< std::string >
Returns
Type Description
LifecycleRuleCondition

static MatchesSuffix(std::string)

Creates different types of LifecycleRule rules.

Parameter
Name Description
suffix std::string
Returns
Type Description
LifecycleRuleCondition

static MatchesSuffixes(std::initializer_list< std::string >)

Creates different types of LifecycleRule rules.

Parameter
Name Description
list std::initializer_list< std::string >
Returns
Type Description
LifecycleRuleCondition

action() const

Returns
Type Description
LifecycleRuleAction const &

condition() const

Returns
Type Description
LifecycleRuleCondition const &

static ConditionConjunction(Condition &&...)

Combines multiple LifecycleRule conditions using conjunction.

Create a condition that require all the condition parameters to be met to take effect.

Example
// Affect objects that are in the STANDARD storage class, have at
// least 2 new versions, are at least 7 days old, and are alive.
LifecycleRuleCondition condition = LifecycleRule::ConditionConjunction(
    LifecycleRule::NumNewerVersions(2),
    LifecycleRule::MatchesStorageClassStandard(),
    LifecycleRule::MaxAge(7), LifecycleRule::IsLive(true));
Parameters
Name Description
condition Condition &&...
typename...
Exceptions
Type Description
std::invalid_argument if the list of parameters is contradictory, for example, `IsLive(true)` and `IsLive(false)` are in the `condition` list.
Returns
Type Description
LifecycleRuleCondition

a LifecycleRuleCondition that is satisfied when all the condition conditions are satisfied.