Google Cloud Storage C++ Client  1.32.1
A C++ Client Library for Google Cloud Storage
service_account.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_STORAGE_SERVICE_ACCOUNT_H
16 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_SERVICE_ACCOUNT_H
17 
18 #include "google/cloud/storage/version.h"
19 #include "google/cloud/status_or.h"
20 #include <string>
21 
22 namespace google {
23 namespace cloud {
24 namespace storage {
25 inline namespace STORAGE_CLIENT_NS {
26 namespace internal {
27 struct ServiceAccountParser;
28 } // namespace internal
29 
30 /**
31  * Represents the metadata for a Google Cloud Storage service account.
32  */
34  public:
35  ServiceAccount() = default;
36 
37  std::string const& email_address() const { return email_address_; }
38  std::string const& kind() const { return kind_; }
39 
40  private:
41  friend struct internal::ServiceAccountParser;
42 
43  std::string email_address_;
44  std::string kind_;
45 };
46 
47 inline bool operator==(ServiceAccount const& lhs, ServiceAccount const& rhs) {
48  return std::tie(lhs.email_address(), lhs.kind()) ==
49  std::tie(rhs.email_address(), rhs.kind());
50 }
51 
52 inline bool operator<(ServiceAccount const& lhs, ServiceAccount const& rhs) {
53  return std::tie(lhs.email_address(), lhs.kind()) <
54  std::tie(rhs.email_address(), rhs.kind());
55 }
56 
57 inline bool operator!=(ServiceAccount const& lhs, ServiceAccount const& rhs) {
58  return std::rel_ops::operator!=(lhs, rhs);
59 }
60 
61 inline bool operator>(ServiceAccount const& lhs, ServiceAccount const& rhs) {
62  return std::rel_ops::operator>(lhs, rhs);
63 }
64 
65 inline bool operator<=(ServiceAccount const& lhs, ServiceAccount const& rhs) {
66  return std::rel_ops::operator<=(lhs, rhs);
67 }
68 
69 inline bool operator>=(ServiceAccount const& lhs, ServiceAccount const& rhs) {
70  return std::rel_ops::operator>=(lhs, rhs);
71 }
72 
73 std::ostream& operator<<(std::ostream& os, ServiceAccount const& rhs);
74 
75 } // namespace STORAGE_CLIENT_NS
76 } // namespace storage
77 } // namespace cloud
78 } // namespace google
79 
80 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_SERVICE_ACCOUNT_H