Google Cloud Storage C++ Client 2.13.0
A C++ Client Library for Google Cloud Storage
Loading...
Searching...
No Matches
bucket_retention_policy.h
1// Copyright 2022 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15#ifndef GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_BUCKET_RETENTION_POLICY_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_BUCKET_RETENTION_POLICY_H
17
18#include "google/cloud/storage/version.h"
19#include <chrono>
20#include <iosfwd>
21#include <tuple>
22#include <utility>
23
24namespace google {
25namespace cloud {
26namespace storage {
27GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
28
29/**
30 * The retention policy for a bucket.
31 *
32 * The Bucket Lock feature of Google Cloud Storage allows you to configure a
33 * data retention policy for a Cloud Storage bucket. This policy governs how
34 * long objects in the bucket must be retained. The feature also allows you to
35 * lock the data retention policy, permanently preventing the policy from from
36 * being reduced or removed.
37 *
38 * @see https://cloud.google.com/storage/docs/bucket-lock for a general
39 * overview
40 */
42 std::chrono::seconds retention_period;
43 std::chrono::system_clock::time_point effective_time;
44 bool is_locked;
45};
46
47inline bool operator==(BucketRetentionPolicy const& lhs,
48 BucketRetentionPolicy const& rhs) {
49 return std::tie(lhs.retention_period, lhs.effective_time, lhs.is_locked) ==
50 std::tie(rhs.retention_period, rhs.effective_time, rhs.is_locked);
51}
52
53inline bool operator<(BucketRetentionPolicy const& lhs,
54 BucketRetentionPolicy const& rhs) {
55 return std::tie(lhs.retention_period, lhs.effective_time, lhs.is_locked) <
56 std::tie(rhs.retention_period, rhs.effective_time, rhs.is_locked);
57}
58
59inline bool operator!=(BucketRetentionPolicy const& lhs,
60 BucketRetentionPolicy const& rhs) {
61 return std::rel_ops::operator!=(lhs, rhs);
62}
63
64inline bool operator>(BucketRetentionPolicy const& lhs,
65 BucketRetentionPolicy const& rhs) {
66 return std::rel_ops::operator>(lhs, rhs);
67}
68
69inline bool operator<=(BucketRetentionPolicy const& lhs,
70 BucketRetentionPolicy const& rhs) {
71 return std::rel_ops::operator<=(lhs, rhs);
72}
73
74inline bool operator>=(BucketRetentionPolicy const& lhs,
75 BucketRetentionPolicy const& rhs) {
76 return std::rel_ops::operator>=(lhs, rhs);
77}
78
79std::ostream& operator<<(std::ostream& os, BucketRetentionPolicy const& rhs);
80
81GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
82} // namespace storage
83} // namespace cloud
84} // namespace google
85
86#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_BUCKET_RETENTION_POLICY_H
Contains all the Google Cloud Storage C++ client APIs.
Definition: auto_finalize.h:24
bool operator>(BucketRetentionPolicy const &lhs, BucketRetentionPolicy const &rhs)
Definition: bucket_retention_policy.h:64
bool operator<=(BucketRetentionPolicy const &lhs, BucketRetentionPolicy const &rhs)
Definition: bucket_retention_policy.h:69
bool operator>=(BucketRetentionPolicy const &lhs, BucketRetentionPolicy const &rhs)
Definition: bucket_retention_policy.h:74
bool operator<(BucketRetentionPolicy const &lhs, BucketRetentionPolicy const &rhs)
Definition: bucket_retention_policy.h:53
bool operator==(BucketRetentionPolicy const &lhs, BucketRetentionPolicy const &rhs)
Definition: bucket_retention_policy.h:47
bool operator!=(BucketRetentionPolicy const &lhs, BucketRetentionPolicy const &rhs)
Definition: bucket_retention_policy.h:59
The retention policy for a bucket.
Definition: bucket_retention_policy.h:41
std::chrono::system_clock::time_point effective_time
Definition: bucket_retention_policy.h:43
std::chrono::seconds retention_period
Definition: bucket_retention_policy.h:42
bool is_locked
Definition: bucket_retention_policy.h:44