Skip to content

Commit

Permalink
feat(storage): support universe domains (#9344)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrennaEpp committed Feb 1, 2024
1 parent 7b32627 commit 29a7498
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
7 changes: 4 additions & 3 deletions storage/http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,10 @@ func newHTTPStorageClient(ctx context.Context, opts ...storageOption) (storageCl
// Prepend default options to avoid overriding options passed by the user.
o = append([]option.ClientOption{option.WithScopes(ScopeFullControl, "https://www.googleapis.com/auth/cloud-platform"), option.WithUserAgent(userAgent)}, o...)

o = append(o, internaloption.WithDefaultEndpoint("https://storage.googleapis.com/storage/v1/"))
o = append(o, internaloption.WithDefaultMTLSEndpoint("https://storage.mtls.googleapis.com/storage/v1/"))

o = append(o, internaloption.WithDefaultEndpointTemplate("https://storage.UNIVERSE_DOMAIN/storage/v1/"),
internaloption.WithDefaultMTLSEndpoint("https://storage.mtls.googleapis.com/storage/v1/"),
internaloption.WithDefaultUniverseDomain("googleapis.com"),
)
// Don't error out here. The user may have passed in their own HTTP
// client which does not auth with ADC or other common conventions.
c, err := transport.Creds(ctx, o...)
Expand Down
6 changes: 4 additions & 2 deletions storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,10 @@ func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error
// Prepend default options to avoid overriding options passed by the user.
opts = append([]option.ClientOption{option.WithScopes(ScopeFullControl, "https://www.googleapis.com/auth/cloud-platform"), option.WithUserAgent(userAgent)}, opts...)

opts = append(opts, internaloption.WithDefaultEndpoint("https://storage.googleapis.com/storage/v1/"))
opts = append(opts, internaloption.WithDefaultMTLSEndpoint("https://storage.mtls.googleapis.com/storage/v1/"))
opts = append(opts, internaloption.WithDefaultEndpointTemplate("https://storage.UNIVERSE_DOMAIN/storage/v1/"),
internaloption.WithDefaultMTLSEndpoint("https://storage.mtls.googleapis.com/storage/v1/"),
internaloption.WithDefaultUniverseDomain("googleapis.com"),
)

// Don't error out here. The user may have passed in their own HTTP
// client which does not auth with ADC or other common conventions.
Expand Down

0 comments on commit 29a7498

Please sign in to comment.