Google Cloud C++ Client  0.4.0
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 
20 namespace google {
21 namespace cloud {
22 inline namespace GOOGLE_CLOUD_CPP_NS {
23 /**
24  * Represent the result of a GetIamPolicy or SetIamPolicy request.
25  *
26  * This is a simple struct to hold the version, IamBindings, and ETag.
27  *
28  * @see
29  * https://cloud.google.com/resource-manager/reference/rest/Shared.Types/Policy
30  * for more information about a AIM policies.
31  *
32  * @see https://tools.ietf.org/html/rfc7232#section-2.3 for more information
33  * about ETags.
34  */
35 struct IamPolicy {
36  std::int32_t version;
38  std::string etag;
39 };
40 
41 inline bool operator==(IamPolicy const& lhs, IamPolicy const& rhs) {
42  return std::tie(lhs.version, lhs.bindings, lhs.etag) ==
43  std::tie(rhs.version, rhs.bindings, rhs.etag);
44 }
45 
46 inline bool operator<(IamPolicy const& lhs, IamPolicy const& rhs) {
47  return std::tie(lhs.version, lhs.bindings, lhs.etag) <
48  std::tie(rhs.version, rhs.bindings, rhs.etag);
49 }
50 
51 inline bool operator!=(IamPolicy const& lhs, IamPolicy const& rhs) {
52  return std::rel_ops::operator!=(lhs, rhs);
53 }
54 
55 inline bool operator>(IamPolicy const& lhs, IamPolicy const& rhs) {
56  return std::rel_ops::operator>(lhs, rhs);
57 }
58 
59 inline bool operator<=(IamPolicy const& lhs, IamPolicy const& rhs) {
60  return std::rel_ops::operator<=(lhs, rhs);
61 }
62 
63 inline bool operator>=(IamPolicy const& lhs, IamPolicy const& rhs) {
64  return std::rel_ops::operator>=(lhs, rhs);
65 }
66 
67 std::ostream& operator<<(std::ostream& os, IamPolicy const& rhs);
68 
69 } // namespace GOOGLE_CLOUD_CPP_NS
70 } // namespace cloud
71 } // namespace google
72 
73 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_IAM_POLICY_H_
#define GOOGLE_CLOUD_CPP_NS
Definition: version.h:24
Contains all the Google Cloud C++ Library APIs.
Definition: iam_bindings.cc:21
bool operator>=(IamPolicy const &lhs, IamPolicy const &rhs)
Definition: iam_policy.h:63
bool operator==(IamPolicy const &lhs, IamPolicy const &rhs)
Definition: iam_policy.h:41
bool operator<=(IamPolicy const &lhs, IamPolicy const &rhs)
Definition: iam_policy.h:59
bool operator!=(IamPolicy const &lhs, IamPolicy const &rhs)
Definition: iam_policy.h:51
bool operator<(IamPolicy const &lhs, IamPolicy const &rhs)
Definition: iam_policy.h:46
Represent the result of a GetIamPolicy or SetIamPolicy request.
Definition: iam_policy.h:35
Represents a container for providing users with a handful of operation to users which they can use to...
Definition: iam_bindings.h:35
bool operator>(IamPolicy const &lhs, IamPolicy const &rhs)
Definition: iam_policy.h:55