Google Cloud C++ Client  1.42.0
C++ Client Library for Google Cloud Platform
common_options.h
Go to the documentation of this file.
1 // Copyright 2021 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_COMMON_OPTIONS_H
16 #define GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_COMMON_OPTIONS_H
17 
18 #include "google/cloud/options.h"
19 #include "google/cloud/version.h"
20 #include <set>
21 #include <string>
22 #include <vector>
23 
24 namespace google {
25 namespace cloud {
27 
28 /**
29  * Change the endpoint.
30  *
31  * In almost all cases a suitable default will be chosen automatically.
32  * Applications may need to be changed to (1) test against a fake or simulator,
33  * or (2) use a beta or EAP version of the service. When using a beta or EAP
34  * version of the service, the AuthorityOption should also be set to the usual
35  * hostname of the service.
36  */
38  using Type = std::string;
39 };
40 
41 /**
42  * User-agent products to include with each request.
43  *
44  * Libraries or services that use Cloud C++ clients may want to set their own
45  * user-agent product information. This can help them develop telemetry
46  * information about number of users running particular versions of their
47  * system or library.
48  *
49  * @see https://tools.ietf.org/html/rfc7231#section-5.5.3
50  */
52  using Type = std::vector<std::string>;
53 };
54 
55 /**
56  * Return whether tracing is enabled for the given @p component.
57  *
58  * The C++ clients can log interesting events to help library and application
59  * developers troubleshoot problems. To see log messages (maybe lots) you can
60  * enable tracing for the component that interests you. Valid components are
61  * currently:
62  *
63  * - rpc
64  * - rpc-streams
65  */
67  using Type = std::set<std::string>;
68 };
69 
70 /**
71  * Specifies a project for quota and billing purposes.
72  *
73  * The caller must have `serviceusage.services.use` permission on the project.
74  *
75  * @see https://cloud.google.com/iam/docs/permissions-reference for more
76  * information about the `seviceusage.services.use` permission, including
77  * default roles that grant it.
78  * @see https://cloud.google.com/apis/docs/system-parameters
79  */
81  using Type = std::string;
82 };
83 
84 /**
85  * Configure the "authority" attribute.
86  *
87  * For gRPC requests this is the `authority()` field in the
88  * `grpc::ClientContext`. This configures the :authority pseudo-header in the
89  * HTTP/2 request.
90  * https://datatracker.ietf.org/doc/html/rfc7540#section-8.1.2.3
91  *
92  * For REST-based services using HTTP/1.1 or HTTP/1.0 this is the `Host` header.
93  *
94  * Setting this option to the empty string has no effect, i.e., no headers are
95  * set. This can be useful if you are not using Google's production environment.
96  */
98  using Type = std::string;
99 };
100 
101 /**
102  * A list of all the common options.
103  */
104 using CommonOptionList =
107 
109 } // namespace cloud
110 } // namespace google
111 
112 #endif // GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_COMMON_OPTIONS_H