Google Cloud Storage C++ Client 2.13.0
A C++ Client Library for Google Cloud Storage
Loading...
Searching...
No Matches
service_account.h
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
22namespace google {
23namespace cloud {
24namespace storage {
25GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
26
27/**
28 * Represents the metadata for a Google Cloud Storage service account.
29 */
30class ServiceAccount {
31 public:
32 ServiceAccount() = default;
33
34 std::string const& email_address() const { return email_address_; }
35
36 /// @note This is only intended for mocking.
37 ServiceAccount& set_email_address(std::string v) {
38 email_address_ = std::move(v);
39 return *this;
40 }
41
42 std::string const& kind() const { return kind_; }
43
44 /// @note This is only intended for mocking.
45 ServiceAccount& set_kind(std::string v) {
46 kind_ = std::move(v);
47 return *this;
48 }
49
50 private:
51 std::string email_address_;
52 std::string kind_;
53};
54
55inline bool operator==(ServiceAccount const& lhs, ServiceAccount const& rhs) {
56 return std::tie(lhs.email_address(), lhs.kind()) ==
57 std::tie(rhs.email_address(), rhs.kind());
58}
59
60inline bool operator<(ServiceAccount const& lhs, ServiceAccount const& rhs) {
61 return std::tie(lhs.email_address(), lhs.kind()) <
62 std::tie(rhs.email_address(), rhs.kind());
63}
64
65inline bool operator!=(ServiceAccount const& lhs, ServiceAccount const& rhs) {
66 return std::rel_ops::operator!=(lhs, rhs);
67}
68
69inline bool operator>(ServiceAccount const& lhs, ServiceAccount const& rhs) {
70 return std::rel_ops::operator>(lhs, rhs);
71}
72
73inline bool operator<=(ServiceAccount const& lhs, ServiceAccount const& rhs) {
74 return std::rel_ops::operator<=(lhs, rhs);
75}
76
77inline bool operator>=(ServiceAccount const& lhs, ServiceAccount const& rhs) {
78 return std::rel_ops::operator>=(lhs, rhs);
79}
80
81std::ostream& operator<<(std::ostream& os, ServiceAccount const& rhs);
82
83GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
84} // namespace storage
85} // namespace cloud
86} // namespace google
87
88#endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_STORAGE_SERVICE_ACCOUNT_H
Represents the metadata for a Google Cloud Storage service account.
Definition: service_account.h:30
ServiceAccount & set_kind(std::string v)
Definition: service_account.h:45
ServiceAccount & set_email_address(std::string v)
Definition: service_account.h:37
std::string const & email_address() const
Definition: service_account.h:34
std::string const & kind() const
Definition: service_account.h:42
Contains all the Google Cloud Storage C++ client APIs.
Definition: auto_finalize.h:24
bool operator!=(ServiceAccount const &lhs, ServiceAccount const &rhs)
Definition: service_account.h:65
bool operator<=(ServiceAccount const &lhs, ServiceAccount const &rhs)
Definition: service_account.h:73
bool operator==(ServiceAccount const &lhs, ServiceAccount const &rhs)
Definition: service_account.h:55
bool operator>=(ServiceAccount const &lhs, ServiceAccount const &rhs)
Definition: service_account.h:77
bool operator<(ServiceAccount const &lhs, ServiceAccount const &rhs)
Definition: service_account.h:60
bool operator>(ServiceAccount const &lhs, ServiceAccount const &rhs)
Definition: service_account.h:69