...
1
2
3
4
5
6 package internaloption
7
8 import (
9 "golang.org/x/oauth2/google"
10 "google.golang.org/api/internal"
11 "google.golang.org/api/option"
12 )
13
14 type defaultEndpointOption string
15
16 func (o defaultEndpointOption) Apply(settings *internal.DialSettings) {
17 settings.DefaultEndpoint = string(o)
18 }
19
20
21
22
23
24
25
26
27
28
29 func WithDefaultEndpoint(url string) option.ClientOption {
30 return defaultEndpointOption(url)
31 }
32
33 type defaultEndpointTemplateOption string
34
35 func (o defaultEndpointTemplateOption) Apply(settings *internal.DialSettings) {
36 settings.DefaultEndpointTemplate = string(o)
37 }
38
39
40
41
42
43
44
45
46
47 func WithDefaultEndpointTemplate(url string) option.ClientOption {
48 return defaultEndpointTemplateOption(url)
49 }
50
51 type defaultMTLSEndpointOption string
52
53 func (o defaultMTLSEndpointOption) Apply(settings *internal.DialSettings) {
54 settings.DefaultMTLSEndpoint = string(o)
55 }
56
57
58
59
60 func WithDefaultMTLSEndpoint(url string) option.ClientOption {
61 return defaultMTLSEndpointOption(url)
62 }
63
64
65
66
67 func SkipDialSettingsValidation() option.ClientOption {
68 return skipDialSettingsValidation{}
69 }
70
71 type skipDialSettingsValidation struct{}
72
73 func (s skipDialSettingsValidation) Apply(settings *internal.DialSettings) {
74 settings.SkipValidation = true
75 }
76
77
78
79
80
81
82 func EnableDirectPath(dp bool) option.ClientOption {
83 return enableDirectPath(dp)
84 }
85
86 type enableDirectPath bool
87
88 func (e enableDirectPath) Apply(o *internal.DialSettings) {
89 o.EnableDirectPath = bool(e)
90 }
91
92
93
94
95
96
97 func EnableDirectPathXds() option.ClientOption {
98 return enableDirectPathXds(true)
99 }
100
101 type enableDirectPathXds bool
102
103 func (x enableDirectPathXds) Apply(o *internal.DialSettings) {
104 o.EnableDirectPathXds = bool(x)
105 }
106
107
108
109
110
111
112 func AllowNonDefaultServiceAccount(nd bool) option.ClientOption {
113 return allowNonDefaultServiceAccount(nd)
114 }
115
116 type allowNonDefaultServiceAccount bool
117
118 func (a allowNonDefaultServiceAccount) Apply(o *internal.DialSettings) {
119 o.AllowNonDefaultServiceAccount = bool(a)
120 }
121
122
123
124
125
126 func WithDefaultAudience(audience string) option.ClientOption {
127 return withDefaultAudience(audience)
128 }
129
130 type withDefaultAudience string
131
132 func (w withDefaultAudience) Apply(o *internal.DialSettings) {
133 o.DefaultAudience = string(w)
134 }
135
136
137
138
139
140 func WithDefaultScopes(scope ...string) option.ClientOption {
141 return withDefaultScopes(scope)
142 }
143
144 type withDefaultScopes []string
145
146 func (w withDefaultScopes) Apply(o *internal.DialSettings) {
147 o.DefaultScopes = make([]string, len(w))
148 copy(o.DefaultScopes, w)
149 }
150
151
152
153
154
155
156
157 func WithDefaultUniverseDomain(ud string) option.ClientOption {
158 return withDefaultUniverseDomain(ud)
159 }
160
161 type withDefaultUniverseDomain string
162
163 func (w withDefaultUniverseDomain) Apply(o *internal.DialSettings) {
164 o.DefaultUniverseDomain = string(w)
165 }
166
167
168
169
170
171
172
173
174 func EnableJwtWithScope() option.ClientOption {
175 return enableJwtWithScope(true)
176 }
177
178 type enableJwtWithScope bool
179
180 func (w enableJwtWithScope) Apply(o *internal.DialSettings) {
181 o.EnableJwtWithScope = bool(w)
182 }
183
184
185
186 func WithCredentials(creds *google.Credentials) option.ClientOption {
187 return (*withCreds)(creds)
188 }
189
190 type withCreds google.Credentials
191
192 func (w *withCreds) Apply(o *internal.DialSettings) {
193 o.InternalCredentials = (*google.Credentials)(w)
194 }
195
196
197
198
199 func EnableNewAuthLibrary() option.ClientOption {
200 return enableNewAuthLibrary(true)
201 }
202
203 type enableNewAuthLibrary bool
204
205 func (w enableNewAuthLibrary) Apply(o *internal.DialSettings) {
206 o.EnableNewAuthLibrary = bool(w)
207 }
208
209
210
211
212 type EmbeddableAdapter struct{}
213
214 func (*EmbeddableAdapter) Apply(_ *internal.DialSettings) {}
215
View as plain text