Google Cloud Storage C++ Client  1.40.2
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 // 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_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 {
26 namespace internal {
27 struct ServiceAccountParser;
28 struct GrpcServiceAccountParser;
29 } // namespace internal
30 
31 /**
32  * Represents the metadata for a Google Cloud Storage service account.
33  */
35  public:
36  ServiceAccount() = default;
37 
38  std::string const& email_address() const { return email_address_; }
39  std::string const& kind() const { return kind_; }
40 
41  private:
42  friend struct internal::ServiceAccountParser;
43  friend struct internal::GrpcServiceAccountParser;
44 
45  std::string email_address_;
46  std::string kind_;
47 };
48 
49 inline bool operator==(ServiceAccount const& lhs, ServiceAccount const& rhs) {
50  return std::tie(lhs.email_address(), lhs.kind()) ==
51  std::tie(rhs.email_address(), rhs.kind());
52 }
53 
54 inline bool operator<(ServiceAccount const& lhs, ServiceAccount const& rhs) {
55  return std::tie(lhs.email_address(), lhs.kind()) <
56  std::tie(rhs.email_address(), rhs.kind());
57 }
58 
59 inline bool operator!=(ServiceAccount const& lhs, ServiceAccount const& rhs) {
60  return std::rel_ops::operator!=(lhs, rhs);
61 }
62 
63 inline bool operator>(ServiceAccount const& lhs, ServiceAccount const& rhs) {
64  return std::rel_ops::operator>(lhs, rhs);
65 }
66 
67 inline bool operator<=(ServiceAccount const& lhs, ServiceAccount const& rhs) {
68  return std::rel_ops::operator<=(lhs, rhs);
69 }
70 
71 inline bool operator>=(ServiceAccount const& lhs, ServiceAccount const& rhs) {
72  return std::rel_ops::operator>=(lhs, rhs);
73 }
74 
75 std::ostream& operator<<(std::ostream& os, ServiceAccount const& rhs);
76 
78 } // namespace storage
79 } // namespace cloud
80 } // namespace google
81 
82 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_SERVICE_ACCOUNT_H