Skip to content

Commit a72e2ce

Browse files
committed
rebase
1 parent 96c10c1 commit a72e2ce

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

gax-java/gax/src/main/java/com/google/api/gax/rpc/ClientContext.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,10 @@ public static ClientContext create(StubSettings settings) throws IOException {
238238
if (credentials != null) {
239239
defaultCallContext = defaultCallContext.withCredentials(credentials);
240240
}
241+
//TODO: if we decided to add setApiKey method need to check and throw exception if apikey and credentials are provided
242+
if (settings.getApiKey() != null) {
243+
defaultCallContext = defaultCallContext.withCredentials(ApiKeyCredentials.create(settings.getApiKey()));
244+
}
241245
defaultCallContext = defaultCallContext.withEndpointContext(endpointContext);
242246

243247
WatchdogProvider watchdogProvider = settings.getStreamWatchdogProvider();

gax-java/gax/src/main/java/com/google/api/gax/rpc/ClientSettings.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ public final String getQuotaProjectId() {
109109
return stubSettings.getQuotaProjectId();
110110
}
111111

112+
public final String getApiKey() {return stubSettings.getApiKey();}
113+
112114
@Nullable
113115
public final WatchdogProvider getWatchdogProvider() {
114116
return stubSettings.getStreamWatchdogProvider();

0 commit comments

Comments
 (0)