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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-28 UTC."],[[["\u003cp\u003eThe latest version available for the \u003ccode\u003eLifecycleRule\u003c/code\u003e class is 2.37.0-rc.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eLifecycleRule\u003c/code\u003e objects are designed to manage object lifecycle rules within Google Cloud Storage, allowing automatic deletion or storage class changes.\u003c/p\u003e\n"],["\u003cp\u003eYou can define \u003ccode\u003eLifecycleRule\u003c/code\u003e actions, such as \u003ccode\u003eDelete()\u003c/code\u003e and setting various storage classes, like \u003ccode\u003eSetStorageClassStandard()\u003c/code\u003e, \u003ccode\u003eSetStorageClassNearline()\u003c/code\u003e, etc.\u003c/p\u003e\n"],["\u003cp\u003eConditions for lifecycle rules can be set using various static methods, like \u003ccode\u003eMaxAge()\u003c/code\u003e, \u003ccode\u003eCreatedBefore()\u003c/code\u003e, \u003ccode\u003eMatchesStorageClass()\u003c/code\u003e, and also include the ability to combine conditions with \u003ccode\u003eConditionConjunction()\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eYou can set conditions for lifecycle rules to match a specific prefix or suffix using the \u003ccode\u003eMatchesPrefix()\u003c/code\u003e and \u003ccode\u003eMatchesSuffix()\u003c/code\u003e methods, respectively.\u003c/p\u003e\n"]]],[],null,["# Class LifecycleRule (2.42.0-rc)\n\nVersion latestkeyboard_arrow_down\n\n- [2.42.0-rc (latest)](/cpp/docs/reference/storage/latest/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.41.0](/cpp/docs/reference/storage/2.41.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.40.0](/cpp/docs/reference/storage/2.40.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.39.0](/cpp/docs/reference/storage/2.39.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.38.0](/cpp/docs/reference/storage/2.38.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.37.0](/cpp/docs/reference/storage/2.37.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.36.0](/cpp/docs/reference/storage/2.36.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.35.0](/cpp/docs/reference/storage/2.35.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.34.0](/cpp/docs/reference/storage/2.34.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.33.0](/cpp/docs/reference/storage/2.33.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.32.0](/cpp/docs/reference/storage/2.32.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.31.0](/cpp/docs/reference/storage/2.31.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.30.0](/cpp/docs/reference/storage/2.30.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.29.0](/cpp/docs/reference/storage/2.29.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.28.0](/cpp/docs/reference/storage/2.28.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.27.0](/cpp/docs/reference/storage/2.27.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.26.0](/cpp/docs/reference/storage/2.26.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.25.1](/cpp/docs/reference/storage/2.25.1/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.24.0](/cpp/docs/reference/storage/2.24.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.23.0](/cpp/docs/reference/storage/2.23.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.22.1](/cpp/docs/reference/storage/2.22.1/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.21.0](/cpp/docs/reference/storage/2.21.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.20.0](/cpp/docs/reference/storage/2.20.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.19.0](/cpp/docs/reference/storage/2.19.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.18.0](/cpp/docs/reference/storage/2.18.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.17.0](/cpp/docs/reference/storage/2.17.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.16.0](/cpp/docs/reference/storage/2.16.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.15.1](/cpp/docs/reference/storage/2.15.1/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.14.0](/cpp/docs/reference/storage/2.14.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.13.0](/cpp/docs/reference/storage/2.13.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.12.0](/cpp/docs/reference/storage/2.12.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule)\n- [2.11.0](/cpp/docs/reference/storage/2.11.0/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule) \nDefines objects to read, create, and modify Object Lifecycle Rules. \nObject Lifecycle Rules allow to configure a Bucket to automatically delete or change the storage class of objects as they go through lifecycle events.\n\n###### See Also\n\n\u003chttps://cloud.google.com/storage/docs/lifecycle\u003e for general information on Object Lifecycle Management in Google Cloud Storage.\n\nConstructors\n------------\n\n### LifecycleRule(LifecycleRuleCondition, LifecycleRuleAction)\n\nFunctions\n---------\n\n### static Delete()\n\nCreates different types of LifecycleRule actions.\n\n### static AbortIncompleteMultipartUpload()\n\nCreates different types of LifecycleRule actions.\n\n### static SetStorageClassStandard()\n\nCreates different types of LifecycleRule actions.\n\n### static SetStorageClassMultiRegional()\n\nCreates different types of LifecycleRule actions.\n\n### static SetStorageClassRegional()\n\nCreates different types of LifecycleRule actions.\n\n### static SetStorageClassNearline()\n\nCreates different types of LifecycleRule actions.\n\n### static SetStorageClassColdline()\n\nCreates different types of LifecycleRule actions.\n\n### static SetStorageClassDurableReducedAvailability()\n\nCreates different types of LifecycleRule actions.\n\n### static SetStorageClassArchive()\n\nCreates different types of LifecycleRule actions.\n\n### static SetStorageClass(std::string)\n\nCreates different types of LifecycleRule actions.\n\n### static MaxAge(std::int32_t)\n\nCreates different types of LifecycleRule rules.\n\n### static CreatedBefore(absl::CivilDay)\n\nCreates different types of LifecycleRule rules.\n\n### static IsLive(bool)\n\nCreates different types of LifecycleRule rules.\n\n### static MatchesStorageClass(std::string)\n\nCreates different types of LifecycleRule rules.\n\n### static MatchesStorageClasses(std::initializer_list\\\u003c std::string \\\u003e)\n\nCreates different types of LifecycleRule rules.\n\n### static MatchesStorageClasses(Iterator, Iterator)\n\nCreates different types of LifecycleRule rules.\n\n### static MatchesStorageClassStandard()\n\nCreates different types of LifecycleRule rules.\n\n### static MatchesStorageClassMultiRegional()\n\nCreates different types of LifecycleRule rules.\n\n### static MatchesStorageClassRegional()\n\nCreates different types of LifecycleRule rules.\n\n### static MatchesStorageClassNearline()\n\nCreates different types of LifecycleRule rules.\n\n### static MatchesStorageClassColdline()\n\nCreates different types of LifecycleRule rules.\n\n### static MatchesStorageClassDurableReducedAvailability()\n\nCreates different types of LifecycleRule rules.\n\n### static MatchesStorageClassArchive()\n\nCreates different types of LifecycleRule rules.\n\n### static NumNewerVersions(std::int32_t)\n\nCreates different types of LifecycleRule rules.\n\n### static DaysSinceNoncurrentTime(std::int32_t)\n\nCreates different types of LifecycleRule rules.\n\n### static NoncurrentTimeBefore(absl::CivilDay)\n\nCreates different types of LifecycleRule rules.\n\n### static DaysSinceCustomTime(std::int32_t)\n\nCreates different types of LifecycleRule rules.\n\n### static CustomTimeBefore(absl::CivilDay)\n\nCreates different types of LifecycleRule rules.\n\n### static MatchesPrefix(std::string)\n\nCreates different types of LifecycleRule rules.\n\n### static MatchesPrefixes(std::initializer_list\\\u003c std::string \\\u003e)\n\nCreates different types of LifecycleRule rules.\n\n### static MatchesSuffix(std::string)\n\nCreates different types of LifecycleRule rules.\n\n### static MatchesSuffixes(std::initializer_list\\\u003c std::string \\\u003e)\n\nCreates different types of LifecycleRule rules.\n\n### action() const\n\n### condition() const\n\n### static ConditionConjunction(Condition \\&\\&...)\n\nCombines multiple [LifecycleRule](/cpp/docs/reference/storage/latest/classgoogle_1_1cloud_1_1storage_1_1LifecycleRule) conditions using conjunction. \nCreate a condition that require all the `condition` parameters to be met to take effect.\n\n###### Example\n\n // Affect objects that are in the STANDARD storage class, have at\n // least 2 new versions, are at least 7 days old, and are alive.\n LifecycleRuleCondition condition = LifecycleRule::ConditionConjunction(\n LifecycleRule::NumNewerVersions(2),\n LifecycleRule::MatchesStorageClassStandard(),\n LifecycleRule::MaxAge(7), LifecycleRule::IsLive(true));"]]