15#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_LIFECYCLE_RULE_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_LIFECYCLE_RULE_H
18#include "google/cloud/storage/storage_class.h"
19#include "google/cloud/storage/version.h"
20#include "google/cloud/internal/parse_rfc3339.h"
21#include "google/cloud/optional.h"
22#include "google/cloud/status_or.h"
23#include "absl/time/civil_time.h"
24#include "absl/types/optional.h"
33GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
55 return std::rel_ops::operator!=(lhs, rhs);
60 return std::rel_ops::operator>(lhs, rhs);
65 return std::rel_ops::operator<=(lhs, rhs);
70 return std::rel_ops::operator>=(lhs, rhs);
98 return std::rel_ops::operator!=(lhs, rhs);
103 return std::rel_ops::operator>(lhs, rhs);
108 return std::rel_ops::operator<=(lhs, rhs);
113 return std::rel_ops::operator>=(lhs, rhs);
119
120
121
122
123
124
125
126
131 : action_(std::move(action)), condition_(std::move(condition)) {}
137
138
153
154
158 result
.age.emplace(std::move(days));
170 result
.is_live.emplace(std::move(value));
175 std::vector<std::string> value;
176 value.emplace_back(std::move(storage_class));
183 std::initializer_list<std::string> list) {
184 std::vector<std::string> classes(std::move(list));
190 template <
typename Iterator>
193 std::vector<std::string> classes(begin, end);
259 std::vector<std::string> value;
260 value.emplace_back(std::move(prefix));
267 std::initializer_list<std::string> list) {
268 std::vector<std::string> classes(std::move(list));
275 std::vector<std::string> value;
276 value.emplace_back(std::move(suffix));
283 std::initializer_list<std::string> list) {
284 std::vector<std::string> classes(std::move(list));
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316 template <
typename... Condition>
319 MergeConditions(result, std::forward<Condition>(condition)...);
324 LifecycleRule() =
default;
329 template <
typename... Condition>
332 Condition&&... tail) {
333 MergeConditions(result, head);
334 MergeConditions(result, std::forward<Condition>(tail)...);
352 return std::rel_ops::operator!=(lhs, rhs);
356 return std::rel_ops::operator>(lhs, rhs);
360 return std::rel_ops::operator<=(lhs, rhs);
364 return std::rel_ops::operator>=(lhs, rhs);
367std::ostream& operator<<(std::ostream& os,
LifecycleRule const& rhs);
368GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
Defines objects to read, create, and modify Object Lifecycle Rules.
Definition: lifecycle_rule.h:127
static LifecycleRuleCondition CustomTimeBefore(absl::CivilDay date)
Definition: lifecycle_rule.h:252
static LifecycleRuleAction AbortIncompleteMultipartUpload()
static LifecycleRuleAction SetStorageClassRegional()
static LifecycleRuleCondition MatchesStorageClassArchive()
Definition: lifecycle_rule.h:224
static LifecycleRuleCondition NoncurrentTimeBefore(absl::CivilDay date)
Definition: lifecycle_rule.h:240
static LifecycleRuleCondition MatchesPrefixes(std::initializer_list< std::string > list)
Definition: lifecycle_rule.h:266
static LifecycleRuleCondition MatchesStorageClassColdline()
Definition: lifecycle_rule.h:215
static LifecycleRuleAction Delete()
static LifecycleRuleCondition MatchesPrefix(std::string prefix)
Definition: lifecycle_rule.h:258
LifecycleRuleCondition const & condition() const
Definition: lifecycle_rule.h:134
static LifecycleRuleCondition MatchesStorageClassNearline()
Definition: lifecycle_rule.h:211
static LifecycleRuleCondition DaysSinceNoncurrentTime(std::int32_t days)
Definition: lifecycle_rule.h:234
static LifecycleRuleAction SetStorageClassNearline()
static LifecycleRuleCondition MatchesStorageClassRegional()
Definition: lifecycle_rule.h:207
static LifecycleRuleCondition ConditionConjunction(Condition &&... condition)
Combines multiple LifecycleRule conditions using conjunction.
Definition: lifecycle_rule.h:317
static LifecycleRuleCondition MatchesStorageClassStandard()
Definition: lifecycle_rule.h:199
static LifecycleRuleCondition MatchesSuffix(std::string suffix)
Definition: lifecycle_rule.h:274
static LifecycleRuleCondition NumNewerVersions(std::int32_t days)
Definition: lifecycle_rule.h:228
static LifecycleRuleCondition MatchesStorageClasses(std::initializer_list< std::string > list)
Definition: lifecycle_rule.h:182
static LifecycleRuleCondition MatchesStorageClassDurableReducedAvailability()
Definition: lifecycle_rule.h:220
LifecycleRule(LifecycleRuleCondition condition, LifecycleRuleAction action)
Definition: lifecycle_rule.h:129
static LifecycleRuleCondition MatchesStorageClasses(Iterator begin, Iterator end)
Definition: lifecycle_rule.h:191
static LifecycleRuleAction SetStorageClassMultiRegional()
static LifecycleRuleAction SetStorageClassColdline()
static LifecycleRuleCondition IsLive(bool value)
Definition: lifecycle_rule.h:168
static LifecycleRuleAction SetStorageClass(std::string storage_class)
static LifecycleRuleAction SetStorageClassStandard()
static LifecycleRuleAction SetStorageClassArchive()
static LifecycleRuleCondition MatchesStorageClassMultiRegional()
Definition: lifecycle_rule.h:203
static LifecycleRuleCondition MatchesStorageClass(std::string storage_class)
Definition: lifecycle_rule.h:174
static LifecycleRuleCondition MatchesSuffixes(std::initializer_list< std::string > list)
Definition: lifecycle_rule.h:282
static LifecycleRuleAction SetStorageClassDurableReducedAvailability()
static LifecycleRuleCondition DaysSinceCustomTime(std::int32_t days)
Definition: lifecycle_rule.h:246
static LifecycleRuleCondition CreatedBefore(absl::CivilDay date)
Definition: lifecycle_rule.h:162
LifecycleRuleAction const & action() const
Definition: lifecycle_rule.h:133
static LifecycleRuleCondition MaxAge(std::int32_t days)
Definition: lifecycle_rule.h:156
Contains functions to return well-known storage class names.
Definition: storage_class.h:25
char const * Nearline()
Definition: storage_class.h:41
char const * MultiRegional()
Definition: storage_class.h:31
char const * DurableReducedAvailability()
Definition: storage_class.h:51
char const * Archive()
Definition: storage_class.h:56
char const * Standard()
Definition: storage_class.h:26
char const * Regional()
Definition: storage_class.h:36
char const * Coldline()
Definition: storage_class.h:46
Contains all the Google Cloud Storage C++ client APIs.
Definition: auto_finalize.h:24
bool operator<(LifecycleRuleAction const &lhs, LifecycleRuleAction const &rhs)
Definition: lifecycle_rule.h:47
bool operator!=(LifecycleRule const &lhs, LifecycleRule const &rhs)
Definition: lifecycle_rule.h:351
bool operator==(LifecycleRuleAction const &lhs, LifecycleRuleAction const &rhs)
Definition: lifecycle_rule.h:41
bool operator<=(LifecycleRuleCondition const &lhs, LifecycleRuleCondition const &rhs)
Definition: lifecycle_rule.h:106
bool operator==(LifecycleRuleCondition const &lhs, LifecycleRuleCondition const &rhs)
bool operator>(LifecycleRuleCondition const &lhs, LifecycleRuleCondition const &rhs)
Definition: lifecycle_rule.h:101
bool operator!=(LifecycleRuleCondition const &lhs, LifecycleRuleCondition const &rhs)
Definition: lifecycle_rule.h:96
bool operator!=(LifecycleRuleAction const &lhs, LifecycleRuleAction const &rhs)
Definition: lifecycle_rule.h:53
bool operator>(LifecycleRule const &lhs, LifecycleRule const &rhs)
Definition: lifecycle_rule.h:355
bool operator>=(LifecycleRuleAction const &lhs, LifecycleRuleAction const &rhs)
Definition: lifecycle_rule.h:68
bool operator>=(LifecycleRuleCondition const &lhs, LifecycleRuleCondition const &rhs)
Definition: lifecycle_rule.h:111
bool operator==(LifecycleRule const &lhs, LifecycleRule const &rhs)
Definition: lifecycle_rule.h:341
bool operator>(LifecycleRuleAction const &lhs, LifecycleRuleAction const &rhs)
Definition: lifecycle_rule.h:58
bool operator<=(LifecycleRuleAction const &lhs, LifecycleRuleAction const &rhs)
Definition: lifecycle_rule.h:63
bool operator<(LifecycleRuleCondition const &lhs, LifecycleRuleCondition const &rhs)
bool operator>=(LifecycleRule const &lhs, LifecycleRule const &rhs)
Definition: lifecycle_rule.h:363
bool operator<=(LifecycleRule const &lhs, LifecycleRule const &rhs)
Definition: lifecycle_rule.h:359
bool operator<(LifecycleRule const &lhs, LifecycleRule const &rhs)
Definition: lifecycle_rule.h:346
Implement a wrapper for Lifecycle Rules actions.
Definition: lifecycle_rule.h:36
std::string storage_class
Definition: lifecycle_rule.h:38
std::string type
Definition: lifecycle_rule.h:37
Implement a wrapper for Lifecycle Conditions.
Definition: lifecycle_rule.h:76
absl::optional< absl::CivilDay > custom_time_before
Definition: lifecycle_rule.h:85
absl::optional< std::int32_t > num_newer_versions
Definition: lifecycle_rule.h:81
absl::optional< std::vector< std::string > > matches_prefix
Definition: lifecycle_rule.h:86
absl::optional< std::int32_t > age
Definition: lifecycle_rule.h:77
absl::optional< std::vector< std::string > > matches_storage_class
Definition: lifecycle_rule.h:80
absl::optional< std::vector< std::string > > matches_suffix
Definition: lifecycle_rule.h:87
absl::optional< std::int32_t > days_since_noncurrent_time
Definition: lifecycle_rule.h:82
absl::optional< absl::CivilDay > created_before
Definition: lifecycle_rule.h:78
absl::optional< absl::CivilDay > noncurrent_time_before
Definition: lifecycle_rule.h:83
absl::optional< bool > is_live
Definition: lifecycle_rule.h:79
absl::optional< std::int32_t > days_since_custom_time
Definition: lifecycle_rule.h:84