Google Cloud C++ Client  1.32.1
C++ Client Library for Google Cloud Platform
iam_policy.h
Go to the documentation of this file.
1 // Copyright 2018 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 // http://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_IAM_POLICY_H
16 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_IAM_POLICY_H
17 
18 #include "google/cloud/iam_bindings.h"
19 #include "google/cloud/version.h"
20 #include <string>
21 
22 namespace google {
23 namespace cloud {
24 inline namespace GOOGLE_CLOUD_CPP_NS {
25 /**
26  * A deprecated representation of IAM policies.
27  *
28  * @deprecated this class is deprecated. Any functions that use it have also
29  * been deprecated. The class was defined before IAM conditional bindings,
30  * and does not support them. Nor will it be able to support future IAM
31  * features. Please use the alternative functions.
32  *
33  * @see [Identity and Access Management](https://cloud.google.com/iam)
34  * @see [Overview of IAM Conditions][iam-conditions]
35  *
36  * [iam-conditions]: https://cloud.google.com/iam/docs/conditions-overview
37  */
38 struct IamPolicy {
39  std::int32_t version;
41  std::string etag;
42 };
43 
44 inline bool operator==(IamPolicy const& lhs, IamPolicy const& rhs) {
45  return std::tie(lhs.version, lhs.bindings, lhs.etag) ==
46  std::tie(rhs.version, rhs.bindings, rhs.etag);
47 }
48 
49 inline bool operator<(IamPolicy const& lhs, IamPolicy const& rhs) {
50  return std::tie(lhs.version, lhs.bindings, lhs.etag) <
51  std::tie(rhs.version, rhs.bindings, rhs.etag);
52 }
53 
54 inline bool operator!=(IamPolicy const& lhs, IamPolicy const& rhs) {
55  return std::rel_ops::operator!=(lhs, rhs);
56 }
57 
58 inline bool operator>(IamPolicy const& lhs, IamPolicy const& rhs) {
59  return std::rel_ops::operator>(lhs, rhs);
60 }
61 
62 inline bool operator<=(IamPolicy const& lhs, IamPolicy const& rhs) {
63  return std::rel_ops::operator<=(lhs, rhs);
64 }
65 
66 inline bool operator>=(IamPolicy const& lhs, IamPolicy const& rhs) {
67  return std::rel_ops::operator>=(lhs, rhs);
68 }
69 
70 std::ostream& operator<<(std::ostream& os, IamPolicy const& rhs);
71 
72 } // namespace GOOGLE_CLOUD_CPP_NS
73 } // namespace cloud
74 } // namespace google
75 
76 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_IAM_POLICY_H