Skip to content

Commit 74a1558

Browse files
authored
docs(option): update WithDefaultEndpointTemplate docs (#2356)
1 parent 135da01 commit 74a1558

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

option/internaloption/internaloption.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,10 @@ func (o defaultEndpointTemplateOption) Apply(settings *internal.DialSettings) {
3838

3939
// WithDefaultEndpointTemplate provides a template for creating the endpoint
4040
// using a universe domain. See also WithDefaultUniverseDomain and
41-
// option.WithUniverseDomain.
41+
// option.WithUniverseDomain. The placeholder UNIVERSE_DOMAIN should be used
42+
// instead of a concrete universe domain such as "googleapis.com".
43+
//
44+
// Example: WithDefaultEndpointTemplate("https://logging.UNIVERSE_DOMAIN/")
4245
//
4346
// It should only be used internally by generated clients.
4447
func WithDefaultEndpointTemplate(url string) option.ClientOption {
@@ -163,6 +166,11 @@ func (w withDefaultUniverseDomain) Apply(o *internal.DialSettings) {
163166

164167
// EnableJwtWithScope returns a ClientOption that specifies if scope can be used
165168
// with self-signed JWT.
169+
//
170+
// EnableJwtWithScope is ignored when option.WithUniverseDomain is set
171+
// to a value other than the Google Default Universe (GDU) of "googleapis.com".
172+
// For non-GDU domains, token exchange is impossible and services must
173+
// support self-signed JWTs with scopes.
166174
func EnableJwtWithScope() option.ClientOption {
167175
return enableJwtWithScope(true)
168176
}

option/internaloption/internaloption_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func TestWithCredentials(t *testing.T) {
3535
func TestDefaultApply(t *testing.T) {
3636
opts := []option.ClientOption{
3737
WithDefaultEndpoint("https://example.com:443"),
38-
WithDefaultEndpointTemplate("https://foo.%s/"),
38+
WithDefaultEndpointTemplate("https://foo.UNIVERSE_DOMAIN/"),
3939
WithDefaultMTLSEndpoint("http://mtls.example.com:445"),
4040
WithDefaultScopes("a"),
4141
WithDefaultUniverseDomain("foo.com"),
@@ -48,7 +48,7 @@ func TestDefaultApply(t *testing.T) {
4848
want := internal.DialSettings{
4949
DefaultScopes: []string{"a"},
5050
DefaultEndpoint: "https://example.com:443",
51-
DefaultEndpointTemplate: "https://foo.%s/",
51+
DefaultEndpointTemplate: "https://foo.UNIVERSE_DOMAIN/",
5252
DefaultUniverseDomain: "foo.com",
5353
DefaultAudience: "audience",
5454
DefaultMTLSEndpoint: "http://mtls.example.com:445",

0 commit comments

Comments
 (0)