Google Cloud Storage C++ Client 2.13.0
A C++ Client Library for Google Cloud Storage
Loading...
Searching...
No Matches
bucket_iam_configuration.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_IAM_CONFIGURATION_H
16#define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_BUCKET_IAM_CONFIGURATION_H
17
18#include "google/cloud/storage/version.h"
19#include "absl/types/optional.h"
20#include <chrono>
21#include <iosfwd>
22#include <utility>
23
24namespace google {
25namespace cloud {
26namespace storage {
27GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
28
29/**
30 * Configure if only the IAM policies are used for access control.
31 *
32 * @see Before enabling Uniform Bucket Level Access please
33 * review the [feature documentation][ubla-link], as well as
34 * ["Should you use uniform bucket-level access ?"][ubla-should-link].
35 *
36 * [ubla-link]:
37 * https://cloud.google.com/storage/docs/uniform-bucket-level-access
38 * [ubla-should-link]:
39 * https://cloud.google.com/storage/docs/uniform-bucket-level-access#should-you-use
40 */
42 bool enabled;
43 std::chrono::system_clock::time_point locked_time;
44};
45using BucketPolicyOnly = UniformBucketLevelAccess;
46
47///@{
48/// @name Comparison operators For UniformBucketLevelAccess
49inline bool operator==(UniformBucketLevelAccess const& lhs,
50 UniformBucketLevelAccess const& rhs) {
51 return std::tie(lhs.enabled, lhs.locked_time) ==
52 std::tie(rhs.enabled, rhs.locked_time);
53}
54
55inline bool operator<(UniformBucketLevelAccess const& lhs,
56 UniformBucketLevelAccess const& rhs) {
57 return std::tie(lhs.enabled, lhs.locked_time) <
58 std::tie(rhs.enabled, rhs.locked_time);
59}
60
61inline bool operator!=(UniformBucketLevelAccess const& lhs,
62 UniformBucketLevelAccess const& rhs) {
63 return std::rel_ops::operator!=(lhs, rhs);
64}
65
66inline bool operator>(UniformBucketLevelAccess const& lhs,
67 UniformBucketLevelAccess const& rhs) {
68 return std::rel_ops::operator>(lhs, rhs);
69}
70
71inline bool operator<=(UniformBucketLevelAccess const& lhs,
72 UniformBucketLevelAccess const& rhs) {
73 return std::rel_ops::operator<=(lhs, rhs);
74}
75
76inline bool operator>=(UniformBucketLevelAccess const& lhs,
77 UniformBucketLevelAccess const& rhs) {
78 return std::rel_ops::operator>=(lhs, rhs);
79}
80///@}
81
82std::ostream& operator<<(std::ostream& os, UniformBucketLevelAccess const& rhs);
83
84/**
85 * The IAM configuration for a Bucket.
86 *
87 * Currently this only holds the UniformBucketLevelAccess. In the future, we may
88 * define additional IAM which would be included in this object.
89 *
90 * @see Before enabling Uniform Bucket Level Access please review the
91 * [feature documentation][ubla-link], as well as
92 * ["Should you use uniform bucket-level access ?"][ubla-should-link].
93 *
94 * [ubla-link]:
95 * https://cloud.google.com/storage/docs/uniform-bucket-level-access
96 * [ubla-should-link]:
97 * https://cloud.google.com/storage/docs/uniform-bucket-level-access#should-you-use
98 */
101 absl::optional<std::string> public_access_prevention;
102};
103
104///@{
105/// @name Public Access Prevention helper functions
106inline std::string PublicAccessPreventionEnforced() { return "enforced"; }
107inline std::string PublicAccessPreventionInherited() { return "inherited"; }
108GOOGLE_CLOUD_CPP_DEPRECATED("Use PublicAccessPreventionInherited()")
109inline std::string PublicAccessPreventionUnspecified() { return "unspecified"; }
110///@}
111
112///@{
113/// @name Comparison operators for BucketIamConfiguration.
114inline bool operator==(BucketIamConfiguration const& lhs,
115 BucketIamConfiguration const& rhs) {
116 return std::tie(lhs.uniform_bucket_level_access,
120}
121
122inline bool operator<(BucketIamConfiguration const& lhs,
123 BucketIamConfiguration const& rhs) {
124 return std::tie(lhs.uniform_bucket_level_access,
128}
129
130inline bool operator!=(BucketIamConfiguration const& lhs,
131 BucketIamConfiguration const& rhs) {
132 return std::rel_ops::operator!=(lhs, rhs);
133}
134
135inline bool operator>(BucketIamConfiguration const& lhs,
136 BucketIamConfiguration const& rhs) {
137 return std::rel_ops::operator>(lhs, rhs);
138}
139
140inline bool operator<=(BucketIamConfiguration const& lhs,
141 BucketIamConfiguration const& rhs) {
142 return std::rel_ops::operator<=(lhs, rhs);
143}
144
145inline bool operator>=(BucketIamConfiguration const& lhs,
146 BucketIamConfiguration const& rhs) {
147 return std::rel_ops::operator>=(lhs, rhs);
148}
149///@}
150
151std::ostream& operator<<(std::ostream& os, BucketIamConfiguration const& rhs);
152
153GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
154} // namespace storage
155} // namespace cloud
156} // namespace google
157
158#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_BUCKET_IAM_CONFIGURATION_H
Contains all the Google Cloud Storage C++ client APIs.
Definition: auto_finalize.h:24
bool operator!=(UniformBucketLevelAccess const &lhs, UniformBucketLevelAccess const &rhs)
Definition: bucket_iam_configuration.h:61
std::string PublicAccessPreventionUnspecified()
Definition: bucket_iam_configuration.h:109
std::string PublicAccessPreventionInherited()
Definition: bucket_iam_configuration.h:107
bool operator<(UniformBucketLevelAccess const &lhs, UniformBucketLevelAccess const &rhs)
Definition: bucket_iam_configuration.h:55
bool operator<=(BucketIamConfiguration const &lhs, BucketIamConfiguration const &rhs)
Definition: bucket_iam_configuration.h:140
std::string PublicAccessPreventionEnforced()
Definition: bucket_iam_configuration.h:106
bool operator>=(BucketIamConfiguration const &lhs, BucketIamConfiguration const &rhs)
Definition: bucket_iam_configuration.h:145
bool operator>(UniformBucketLevelAccess const &lhs, UniformBucketLevelAccess const &rhs)
Definition: bucket_iam_configuration.h:66
bool operator==(UniformBucketLevelAccess const &lhs, UniformBucketLevelAccess const &rhs)
Definition: bucket_iam_configuration.h:49
bool operator>=(UniformBucketLevelAccess const &lhs, UniformBucketLevelAccess const &rhs)
Definition: bucket_iam_configuration.h:76
bool operator<=(UniformBucketLevelAccess const &lhs, UniformBucketLevelAccess const &rhs)
Definition: bucket_iam_configuration.h:71
bool operator>(BucketIamConfiguration const &lhs, BucketIamConfiguration const &rhs)
Definition: bucket_iam_configuration.h:135
bool operator<(BucketIamConfiguration const &lhs, BucketIamConfiguration const &rhs)
Definition: bucket_iam_configuration.h:122
bool operator!=(BucketIamConfiguration const &lhs, BucketIamConfiguration const &rhs)
Definition: bucket_iam_configuration.h:130
bool operator==(BucketIamConfiguration const &lhs, BucketIamConfiguration const &rhs)
Definition: bucket_iam_configuration.h:114
The IAM configuration for a Bucket.
Definition: bucket_iam_configuration.h:99
absl::optional< std::string > public_access_prevention
Definition: bucket_iam_configuration.h:101
absl::optional< UniformBucketLevelAccess > uniform_bucket_level_access
Definition: bucket_iam_configuration.h:100
Configure if only the IAM policies are used for access control.
Definition: bucket_iam_configuration.h:41
std::chrono::system_clock::time_point locked_time
Definition: bucket_iam_configuration.h:43
bool enabled
Definition: bucket_iam_configuration.h:42