Google Cloud C++ Client
2.7.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
{
26
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_BEGIN
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
*
37
* @ingroup options
38
*/
39
struct
EndpointOption
{
40
using
Type = std::string;
41
};
42
43
/**
44
* User-agent products to include with each request.
45
*
46
* Libraries or services that use Cloud C++ clients may want to set their own
47
* user-agent product information. This can help them develop telemetry
48
* information about number of users running particular versions of their
49
* system or library.
50
*
51
* @see https://tools.ietf.org/html/rfc7231#section-5.5.3
52
*
53
* @ingroup options
54
*/
55
struct
UserAgentProductsOption
{
56
using
Type = std::vector<std::string>;
57
};
58
59
/**
60
* Return whether tracing is enabled for the given @p component.
61
*
62
* The C++ clients can log interesting events to help library and application
63
* developers troubleshoot problems. To see log messages (maybe lots) you can
64
* enable tracing for the component that interests you. Valid components are
65
* currently:
66
*
67
* - rpc
68
* - rpc-streams
69
*/
70
struct
TracingComponentsOption
{
71
using
Type = std::set<std::string>;
72
};
73
74
/**
75
* Specifies a project for quota and billing purposes.
76
*
77
* The caller must have `serviceusage.services.use` permission on the project.
78
*
79
* @see https://cloud.google.com/iam/docs/permissions-reference for more
80
* information about the `seviceusage.services.use` permission, including
81
* default roles that grant it.
82
* @see https://cloud.google.com/apis/docs/system-parameters
83
*
84
* @ingroup options
85
*/
86
struct
UserProjectOption
{
87
using
Type = std::string;
88
};
89
90
/**
91
* Configure the "authority" attribute.
92
*
93
* For gRPC requests this is the `authority()` field in the
94
* `grpc::ClientContext`. This configures the :authority pseudo-header in the
95
* HTTP/2 request.
96
* https://datatracker.ietf.org/doc/html/rfc7540#section-8.1.2.3
97
*
98
* For REST-based services using HTTP/1.1 or HTTP/1.0 this is the `Host` header.
99
*
100
* Setting this option to the empty string has no effect, i.e., no headers are
101
* set. This can be useful if you are not using Google's production environment.
102
*
103
* @ingroup options
104
*/
105
struct
AuthorityOption
{
106
using
Type = std::string;
107
};
108
109
/**
110
* A list of all the common options.
111
*/
112
using
CommonOptionList =
113
OptionList<
EndpointOption
,
UserAgentProductsOption
,
TracingComponentsOption
,
114
UserProjectOption
,
AuthorityOption
>;
115
116
GOOGLE_CLOUD_CPP_INLINE_NAMESPACE_END
117
}
// namespace cloud
118
}
// namespace google
119
120
#
endif
// GOOGLE_CLOUD_CPP_GOOGLE_CLOUD_COMMON_OPTIONS_H
Generated on Wed Feb 1 2023 20:24:19 for Google Cloud C++ Client by
1.9.1